Basic IO, Memory RW and Interrupt Operations
Basic IO, Memory RW and Interrupt Operations
There are three ways in which system bus can be allotted to them:
1. Separate set of address, control and data bus to I/O and memory.
2. Have common bus (data and address) for I/O and memory but separate control lines.
3. Have common bus (data, address, and control) for I/O and memory.
In first case it is simple because both have different set of address space and instruction but require more buses
It is also known as Isolated I/O mapping and the reason for the same is that here the address space of
memory and I/O are separated from each other.
I/O mapped I/O have common bus (data and address) for I/O and memory but separate read and write
control lines for I/O.
So when CPU decode instruction then if data is for I/O then it places the address on the address line and
set I/O read or write control line on due to which data transfer occurs between CPU and I/O.
As the address space of memory and I/O is isolated and the name is so.
The address for I/O here is called ports. Here we have different read-write instruction for both I/O and
memory.
Difference between Memory-Mapped I/O Interfacing and I/O Mapped I/O Interfacing:
DMA Transfer is a hardware controlled I/O Transfer technique. It is mainly used for high-speed block of
data transfer between I/O and Memory where the speed of the peripheral is generally faster than the µP.
It is a method that allows an input/output (I/O) device to send or receive data directly to or from the main
memory, bypassing the CPU to speed up memory operations.
The processor relinquishes the system bus for a few clock cycles. So, the DMA controller can
accomplish the task of data transfer via the system bus.
In Program Controlled I/O, Status or interrupt driven I/O the speed of transfer is slow mainly because
instructions need to be decoded and then executed for the transfer. DMA transfer is software independent
and hence much faster.
A device known as the DMA Controller (DMAC) is responsible for the DMA transfer
Fig: DMA
DMA is a process of communication for data transfer between memory and input/output, controlled by an external
circuit called DMA controller, without involvement of CPU.
8085 MP has two pins HOLD and HLDA which are used for DMA operation.
First, DMA controller sends a request by making Bus Request (BR) control line high. When MP receives high
signal to HOLD pin, it first completes the execution of current machine cycle, it takes few clocks and sends HLDA
signal to the DMA controller.
After receiving HLDA through Bus Grant (BG) pin of DMA controller, the DMA controller takes control over
system bus and transfers data directly between memory and I/O without involvement of CPU. During DMA
operation, the processor is free to perform next job which does not need system bus.
At the end of data transfer, the DMA controller terminates the request by sending low signal to HOLD pin and
MP regains control of system bus by making HLDA low.
Disadvantages
Cost of DMA hardware.
Data has to be stored in continuous memory locations.
DMA controller is slow in comparison to CPU.
Application of DMA
DMA has been a built-in feature of PC architecture since the introduction of the original IBM PC.
PC-based DMA was used for floppy disk I/O in the original PC and for hard disk I/O in later versions.
PC-based DMA technology, along with high speed bus technology, is driven by data storage, communications, and
graphics needs-all of which require the highest rates of data transfer between system memory and I/O devices.
Applications areas are: cinemas, theatres, hotels, railway stations, shopping centres, trade shows, museums & many
more.
Features of 8237
8237 is a programmable, high speed, Direct Memory Access (DMA) controller housed in a 40-pin package.
1. Hardware interrupts:
An external device initiates the hardware interrupts and placing an appropriate signal at the interrupt pin of the
processor.
If the interrupt is accepted, then the processor executes an interrupt service routine.
The 8085 has five hardware interrupts:
(1) TRAP (2) RST 7.5 (3) RST 6.5 (4) RST 5.5 and (5) INTR
TRAP:
This interrupt is a non-maskable interrupt. It is unaffected by any mask or interrupt enable.
TRAP has the highest priority and vectored interrupt.
TRAP interrupt is edge and level triggered. This means that the TRAP must go high and remain high until it is
acknowledged.
In sudden power failure, it executes a ISR and send the data from main memory to backup memory.
The signal, which overrides the TRAP, is HOLD signal. (i.e., If the processor receives HOLD and TRAP at the same
time then HOLD is recognized first and then TRAP is recognized).
RST 7.5:
The RST 7.5 interrupt is a maskable interrupt.
It has the second highest priority.
It is edge sensitive. i.e. Input goes to high and no need to maintain high state until it recognized.
Maskable interrupt.
It is disabled by,
o DI instruction
o System or processor reset, After reorganization of interrupt.
Enabled by EI instruction.
INTR:
INTR is a maskable interrupt. It is disabled by,
o DI, SIM instruction
o Enabled by EI instruction.
Non- vectored interrupt. After receiving INTA (active low) signal, it has to supply the address of ISR.
It has lowest priority.
It is a level sensitive interrupts. i.e. Input goes to high and it is necessary to maintain high state until it recognized.
The following sequence of events occurs when INTR signal goes high.
1. The 8085 checks the status of INTR signal during execution of each instruction.
2. If INTR signal is high, then 8085 complete its current instruction and sends active low interrupt acknowledge
signal, if the interrupt is enabled.
3. In response to the acknowledge signal, external logic places an instruction OPCODE on the data bus.
In the case of multi byte instruction, additional interrupt acknowledge machine cycles are generated by
the 8085 to transfer the additional bytes into the microprocessor.
4. On receiving the instruction, the 8085 save the address of next instruction on stack and execute received
instruction.
The hardware Interrupts can be further classified into two types:
The 8259A block diagram includes control logic, registers for interrupt requests, priority resolver, cascade logic, and
data bus. The registers manage interrupt requests; the priority resolver determines their priority. The cascade logic is
used to connect additional 8259A devices.
Priority modes
1. Fully Nested Mode(FNM)
It is the default mode of 8259.
It is a fixed priority mode.
IR0 has the highest priority and IR7 has the lowest priority.
It is preferred for “Single” 8259.
2. Special Fully Nested Mode (SFNM)
This mode can be used for the Master 8259 in a cascaded configuration.
Its priority structure is fixed and is the same as FNM (IR0 highest and IR7 lowest).
Additionally, in SFNM, the Master would recognize a higher priority interrupt from a slave, whose
another interrupt is currently being serviced. This is possible only in SFNM.
3. Rotating Priority Modes
There are two rotating priority modes: Automatic Rotation and Specific Rotation
Automatic Rotation Mode
o This is a rotating priority mode.
o It is preferred when several interrupt sources are of equal priority.
o In this mode, after a device receives service, it gets the lowest priority.
o All other priorities rotate subsequently.
o Eg: If IR2 is has just been serviced, it will get the lowest priority.
Specific Rotation Mode
o It is also a rotating priority mode, but here the user can select any IR level for lowest priority,
and thus fix all other priorities.
4. Special Mask Mode (SMM)
Usually 8259 prevents interrupt requests lower or equal to the interrupt, which is currently in service.
In SMM 8259 permits interrupts of all levels (lower or higher) except the one currently in service.
As we are specially masking the current interrupt, it is called Special Mask Mode.
This mode is preferred when we don’t want priority