CSE491 Computer Interfacing and Peripherals Lec3 Handsout
CSE491 Computer Interfacing and Peripherals Lec3 Handsout
CSE 491
Computer Interfacing and Peripherals
1 2
Definition
Typical hardware structure of a computer system
Microprocessor is like a function. Its takes an instruction then
4
process it & return the result .
Task of Microprocessor
Types of bus
Address bus
Data Bus
The block diagram of Computer system showing the address, data bus and Control
5 bus structure . 6 Control bus
Address Bus
It request a memory location from the Memory or i/o put location Typical structure of a computer system
from the i/o devices .
7
If the address bus is 16bit it can locate address of 0000H‐FFFFH
Data Bus
Data bus transfer information from microprocessor & I/O devices .
Data bus vary in size from 8 bit – 64 bit in Intel microprocessors.
Control Bus
The Control bus contains lines that select the memory or I/O devices
and causes them to perform a read or a write operation .
• MWTC
• MRDC
• IOWC
• IORC
7 8
10/5/2024
Introduction to Microcontrollers
9 10
11 12
10/5/2024
Types of Microcontrollers
13 14
DMA
15 16
10/5/2024
The control of the transfer of data from an external device to the processor
consists in the following steps:
4. I/O module achieves a unit of data such as 8 or 16 bits from the external
device.
I/O module communicates with the processor: 1. The processor has direct control over I/O.
Command decoding: The I/O module accepts commands • Sensing status
from the processor.
• Read/write commands
Data: Data are exchange between the processor and the • Transferring data
I/O module over the data bus
Status reporting: Due to peripherals are so slow , it is 2. The processor waits for I/O module to
important to know the status of the I/O module. complete operation.
2. I/O module performs operation. 1. With this interrupt , the processor issues an I/O command and
continues to execute other instructions ; but is interrupted by the
I/O module when the latter has completed its work.
3. I/O module sets status bits.
2. Overcomes the processor waiting.
4. The processor checks status bits periodically.
3. The processor does not repeat checking of device.
5. I/O module does not inform the processor directly.
4. This interrupt is used when an I/O to memory transfer occurs across
the processor.
6. I/O module does not interrupt the processor.
Used in disk controllers, video/sound cards etc, or DMA controller: dedicated hardware used for controlling
between memory locations the DMA operation
.
Typically, the CPU initiates DMA transfer, does other operations while Single‐cycle mode: DMA data transfer is done one byte at a
the transfer is in progress, and receives an interrupt from the DMA time
controller once the operation is complete.
Burst‐mode: DMA transfer is finished when all data has
been moved
29 30
8237
33 34
37 38
RESET READY
The reset pin clears the command, status, request, and A logic 0 on the ready input causes the 8237 to enter wait
temporary registers.
states for slower memory components.
It also clears the first/last flip-flop and sets
the mask register.
this input primes the 8237 so it is disabled
until programmed otherwise
HLDA
• A hold acknowledge signals 8237 that the microprocessor has
relinquished control of the address, data, and control buses.
39 40
10/5/2024
DREQ0–DREQ3 IOR
DMA request inputs are used to request a transfer for I/O read is a bidirectional pin used during programming
each of the four DMA channels.
and during a DMA write cycle.
the polarity of these inputs is programmable, so
they are either active-high or active-low inputs
DB0–DB7 IOW
• Data bus pins are connected to the processor data • I/O write is a bidirectional pin used during
bus connections and used during the programming programming and during a DMA read cycle.
of the DMA controller.
41 42
A0–A3
EOP
These address pins select an internal
End-of-process is a bidirectional signal register during programming and provide
used as an input to terminate a DMA part of the DMA transfer address during a DMA action.
process or as an output to signal the
end of the DMA transfer. address pins are outputs that provide part of
often used to interrupt a DMA transfer at the DMA transfer address during a DMA action
the end of a DMA cycle
HRQ
Hold request is an output that connects to the HOLD
input of the microprocessor in order to request a DMA
43 44
transfer.
10/5/2024
DACK0–DACK3 AEN
Address enable signal enables the DMA address latch
DMA channel acknowledge outputs acknowledge a channel connected to the DB7–DB0 pins on the 8237.
DMA request. also used to disable any buffers in the system connected to
These outputs are programmable as either active-high or active- the microprocessor
low signals.
DACK outputs are often used to
DMA- controlled I/O device during the DMA transfer.
select the ADSTB
Address strobe functions as ALE, except
it is used by the DMA controller to latch
address bits A15–A8 during the DMA transfer.
45 46
MEMR
• Memory read is an output that causes
memory to read data during a DMA read
cycle.
MEMW
Memory write is an output that causes memory to
write data during a DMA write cycle.
47 48
10/5/2024
Description
DATA BUS BUFFER:
Five main Blocks It contain tristate ,8 bit bi‐directional buffer.
BA and BWC CR
The base address (BA) and base word count (BWC) The command register programs the operation of the
registers are used when auto-initialization is selected 8237 DMA controller.
for a channel. The register uses bit position 0 to select the memory-to-
In auto-initialization mode, these registers memory DMA transfer mode.
are used to reload the CAR and CWCR memory-to-memory DMA transfers use DMA channel 0 to
after the DMA action is completed. hold the source address
allows the same count and address to be used DMA channel 1 holds the destination address
to transfer data from the same memory area Similar to operation of a MOVSB instruction.
53 54
MR
The mode register programs the mode of operation
for a channel.
Each channel has its own mode register as selected
by bit positions 1 and 0.
remaining bits of the mode register select operation,
auto-initialization, increment/decrement, and mode for
the channel
55 56
10/5/2024
BR
The bus request register is used to request
a DMA transfer via software.
very useful in memory-to-memory transfers,
where an external signal is not available to
begin the DMA transfer
57 58
MRSR
The mask register set/reset sets or clears the
channel mask.
if the mask is set, the channel is disabled
the RESET signal sets all channel masks
to disable them
59 60
10/5/2024
MSR
61 62
SR
The status register shows status of each DMA
channel. The TC bits indicate if the channel has
reached its terminal count (transferred all its bytes).
When the terminal count is reached, the DMA
transfer is terminated for most modes of operation.
the request bits indicate whether the DREQ input for a
given channel is active
63 64
10/5/2024
65 66
Master clear
Acts exactly the same as the RESET signal to the 8237.
as with the RESET signal, this command disables all channels
67 68
10/5/2024
Clear the first/last flip-flop Figure shows I/O port locations for programming the
Clears the first/last (F/L) flip-flop within 8237.
count and address registers for each channel.
The F/L flip-flop selects which byte (low or high order) is read/written in The state of the F/L flip-flop determines whether the
the current address and current count registers.
if F/L = 0, the low-order byte is selected LSB or MSB is programmed.
if F/L = 1, the high-order byte is selected
if the state is unknown, count and address could be
Any read or write to the address or count register automatically toggles the
F/L flip-flop. programmed incorrectly
It is important to disable the DMA channel before
address and count are programmed.
69 70
The 8237 Connected to the 80X86 Complete 8088 minimum mode DMA system.
73 74
75 76
10/5/2024
Types:
Sequential DMA
77 78
Simultaneous DMA