24-12-2012, 03:07 PM
Introduction to Input-Output
1Introduction to Input-.pdf (Size: 678.19 KB / Downloads: 28)
I/O interface
Input-output involves the transfer to (or from) peripheral devices
from (or to) the data bus of the cpu eg. data transfer to the CRT
display, from the keyboard, to/from a hard disk drive, to/from a
modem to another computer system.
Input-output operations fall into one of the following types:
• Programmed I/O - cpu polls peripherals to check if I/O is needed
• Interrupt I/O - peripheral sends an interrupt request to cpu for I/O
• Direct memory access (DMA) - peripheral writes directly to memory
8088 uses Isolated I/O (I/O addresses are not part of memory
address) as distinct from Memory mapped I/O (peripherals are
mapped to locations in the memory address space).
Q: pros and cons of isolated I/O and memory mapped I/O?
I/O interface functions can include
• data storage buffer for sending and receiving data
• low-level communications protocol (handshaking)
• data format conversion (eg. parallel/serial)
• error detection
• addressing of different peripherals
I/O interface are typically implemented by LSI (large scale
integration) - many different types are available from different
manufacturers.
Data can be transferred through I/O interface by either
programmed I/O or interrupt I/O. DMA typically needs a separate
controller.
Parallel and Serial Data Transfer
Data Transfer between the I/O interface and the peripheral can
involve either parallel or serial data transmission, depending on the
peripheral and the actual implementation of the I/O interface.
Parallel data transfer involves using at least 8 separate lines for the
8 data bits in a byte. Normally, other lines are needed for the
communications protocol (eg. STB [data strobe] line to indicate
when data is valid, ACK line to acknowledge data has been read).
Parallel data transfer is usually fast. Each data bit typically needs
it’s own ground return line to reduce noise. A popular parallel data
transfer interface standard is the CENTRONICS type interface
which uses a 36-pin connector. The centronics interface is
commonly used in printers.
Serial data transfer involves sending the data on a single line, bit
by bit. The I/O interface converts the data from parallel to serial or
vice-versa using shift registers.
Serial connections are commonly used for data transfer over
longer distances (eg over telephone line). A popular standard for
serial data transmission is the RS232C standard.
Serial I/O
Asynchronous - no block synchronization bits. Each character is
identified by the start and stop bit(s) (stop bits can be 1, 1!, 2 bits)
inserted at the start and end of each character.
Synchronous serial data transfer is more efficient (ie. faster) since
asynchronous transfer “wastes” about 30% of the bits for start and
stop bits in sending a 7-bit ASCII code.
An example of asynchronous serial data transfer is the RS232
serial port found in most computers.
8255A Mode 0 Operation
In Mode 0 operation, no handshaking will be used.
If both port A and port B are initialized as mode 0 operation, port C
can be used together as an additional 8-bit port, or two 4-bit ports.
When used as an outputs, port C line can be set/reset by sending
special control word to the control register address.
The two halves of port C are independent and can be set as input
or output port independently.
Initializing 8254
When power on, programmable peripheral devices such as
8254 are usually in undefined state. → need initialization
Initialization steps:
1. Determine the base address of the device from the address decode
circuitry or the address decoder truth table.
2. Determine the internal address for each 8254 internal device (control
register, port, counters, status register, etc.)
3. Add each of the internal address to the system base address to
determine the system address of each device.
4. Look in data sheet for the device for the format of the control word(s)
that you have to send to the device to initialize it.
5. Construct the control word required to initialize the device.
6. Send the control word to the device. In case of the 8254, you need to
send the starting count to each of the counter registers.