Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Embedded Controller Hardware Design (Ken Arnold, 2000).pdf
Скачиваний:
219
Добавлен:
12.08.2013
Размер:
1.35 Mб
Скачать

181CHAPTER EIGHT

Basic I/O Interfaces

damaging the relay driver circuits. Solenoid valves and other devices are used to control external flow and have similar inductive characteristics. Solid-state relays are much easier to use, as they are isolated from the high voltage and provide a simple logic level interface. Optical isolation is also used to sense high voltage inputs and convert them to logic levels. There are even standardized modules (OPTO-22 and equivalents) available that can be interchanged with each other, resulting in very flexible configuration options.

Chapter Eight Problems

1.Using an 8031 Port 1 I/O bit, design an interface to an LED that requires 20 milliamperes of output current for full brightness.

2.A DMA device transfers blocks of data consisting of 256 bytes, and the bytes in the burst are spaced 10 microseconds apart. The real time clock tick interval is 1 millisecond. What kind of DMA should be used, burst mode or single cycle?

3.If an 8031 CPU executes one instruction per microsecond, estimate the maximum rate that data can be transferred to or from an I/O port, assuming that a status bit must be polled before transferring data.

4.Design a 4-row by 3-column telephone keypad matrix for connection to the 8051 Port 1 pins, to be polled using software scanning.

This is a blank page.

9

 

CHAPTER NINE

183

Other Interfaces

and Bus Cycles

There are two kinds of interrupts software and hardware. Software interrupts are just another kind of subroutine call that can be used to access subroutines with entry points at fixed memory locations. Operating system services are often accessed using software interrupts, which are simply instructions that cause an interrupt subroutine to be called at whatever point in the program they are placed. These interrupts are synchronized with the program in that they always occur at the same place in the program. They are referred to as “synchronous events because their execution is solely dependent upon the sequence of execution of the program instructions.

Some processor manufacturers refer to “traps” or “exceptions,” but these are synonymous with the term “interrupt” as used here, which may be either a hardware or software interrupt. Unless otherwise specified, however, the word “interrupt” is generally used to imply a hardware interrupt. Hardware interrupts are triggered by a physical event, such as the closure of a switch, that causes a specific subroutine to be called. They can be thought of as a sort of hardware initiated subroutine call. They can and do occur at any time in the program, depending on when the event occurs. These are referred to as “asynchronous events because they may occur during the execution of any part of the program. Interrupts allow the programs to respond to an event when it occurs. In a printing application, the printer may interrupt the processor to inform the program that it has printed all the data in its buffer and is ready for more. A serial interface might activate an interrupt to indicate that a character has been received and it is available to be processed. These kinds of applications are “event driven” because no action will take place until an event occurs. In the case of a typical embedded application, event driven programs are used when it is necessary to respond to an external event within a fixed time period. A system