Input Output Interfaces
Input Output Interfaces
Input/output Interfaces
Serial Communication
o Introduction and Applications
o Introduction to Programmable Communication Interface 8251
o Basic Concept of Synchronous and Asynchronous Modes
Parallel Communication
o Introduction and Applications
Simple I/O, Strobe I/O, Single handshake I/O, Double handshake I/O
8255A and it’s Working
o Block Diagram
o Modes of Operation
o Control Word
RS-232
o Introduction,
o Pin Configuration (9 pin and 25 pin) and function of each pin,
o Interconnection between DTE-DTE and DTE-DCE
Input-Output Interface
Functions of Input-Output Interface:
It is used to synchronize the operating speed of CPU with respect to input-output devices.
It selects the input-output device which is appropriate for the interpretation of the input-output device.
It is capable of providing signals like control and timing signals.
In this data buffering can be possible through data bus.
There are various error detectors.
It converts serial data into parallel data and vice-versa.
It also converts digital data into analog signal and vice-versa.
Data transmission
Data transmission refers to the movement of data in form of bits between two or more digital devices.
This transfer of data takes place via some form of transmission media (for example, coaxial cable, fiber
optics etc.)
Data is transmitted from one device to another in analog or digital format. Basically, data transmission
enables devices or components within devices to speak to each other.
Serial Communication
It is a method of conveying a single bit at a time i.e. only one bit of a word is transmitted at a
time.
Fig 1 shows a serial communication system.
It is slower.
Hardware requirement is simple.
E.g. RS-232C
An example of serial communication is transmission of data between two computers
II. Asynchronous
Both transmitter and receiver are synchronized by separate clock pulse.
It is also called character-oriented data transmission.
Speed: <20 Kbps
Always implemented with hardware and software.
Asynchronous transmission sends only one character at a time where a character is either a letter
of the alphabet or number or control character i.e. it sends one byte of data at a time.
Bit synchronization between two devices is made possible using start bit and stop bit.
Start bit indicates the beginning of data i.e. alerts the receiver to the arrival of new group of bits.
A start bit usually 0 is added to the beginning of each byte.
Stop bit indicates the end of data i.e. to let the receiver know that byte is finished, one or more
additional bits are appended to the end of the byte. These bits, usually 1s are called stop bits.
Addition of start and stop increase the number of data bits. Hence more bandwidth is consumed
in asynchronous transmission.
There is idle time between the transmissions of different data bytes. This idle time is also known
as Gap
The gap or idle time can be of varying intervals. This mechanism is called Asynchronous,
because at byte level sender and receiver need not to be synchronized. But within each byte,
receiver must be synchronized with the incoming bit stream.
Application of Asynchronous Transmission
Asynchronous transmission is well suited for keyboard type-terminals and paper tape devices.
The advantage of this method is that it does not require any local storage at the terminal or the
computer as transmission takes place character by character.
Asynchronous transmission is best suited to Internet traffic in which information is transmitted
in short bursts. This type of transmission is used by modems.
8251A PCI (Programmable Communication Interface)
The 8251A is a programmable serial communication interface chip designed for synchronous
and asynchronous serial data communication.
It supports the serial transmission of data.
It is packed in a 28 pin DIP.
It is also called USART (Universal Synchronous Asynchronous Receiver Transmitter).
The table shows the pin details of 8251A as:
Block Diagram:
The functional block diagram of 8251A consists of five sections. They are:
o Read/Write control logic
o Transmitter
o Receiver
o Data bus buffer
o Modem control.
The functional block diagram is shown in fig:
Receiver Section:
The receiver section accepts serial data and convert them into parallel data
The receiver section is double buffered, i.e., it has an input register to receive serial data and convert to
parallel, and a buffer register to hold the parallel data.
When the RxD line goes low, the control logic assumes it as a START bit, waits for half a bit time and
samples the line again.
If the line is still low, then the input register accepts the following bits, forms a character and loads it into
the buffer register.
The CPU reads the parallel data from the buffer register.
When the input register loads a parallel data to buffer register, the RxRDY line goes high.
The clock signal RxC controls the rate at which bits are received by the USART.
During asynchronous mode, the signal SYNDET/BRKDET will indicate the break in the data
transmission.
During synchronous mode, the signal SYNDET/BRKDET will indicate the reception of synchronous
character.
MODEM Control:
The MODEM control unit allows to interface a MODEM to 8251A and to establish data communication
through MODEM over telephone lines.
This unit takes care of handshake signals for MODEM interface.
Parallel Communication
It is a method of conveying multiple binary digits (bits) simultaneously i.e. all bits of word are transferred
at a time.
It is faster.
Hardware requirement is complex.
It is used for short distance data travel.
E.g. 8255A PPI
Methods of parallel data transfer
I. Simple I/O
When you need to get digital data from simple switch, such as thermostat, into microprocessor, all you
have to do is connect the switch to an I/O port line and read the port.
Likewise, when you need to output data to simple display device, such as LED, all you have to do is
connect the input of the LED buffer on an output port pin and output the logical level required to turn on
the light.
E.g. the ASCII-encoded keyboard. When a key is pressed, circuitry on the keyboard sends out the ASCII
code for the pressed key on eight parallel data lines, and then sends out a strobe signal on another line to
indicate that valid data is present on the eight data lines.
Modes of Operation
The 8255A is primarily operated in two modes: I/O (input-output) mode and the BSR (Bit-Set-Reset)
mode. The I/O mode is further grouped into Mode 0 (Simple I/O interfacing), Mode 1 (Interfacing with
handshake signals) and Mode 2 (Bidirectional I/O interfacing).
Figure (b) shows all the functions of 8255A, classifying according to two modes:
o Bit Set-Reset (BSR) mode and
o Input Output (I/O) mode.
The BSR mode is used to set or reset the bits in port C.
The I/O mode is further divided into three modes: mode 0, mode 1 and mode 2.
In mode 0, all ports function as simple I/O ports.
Mode 1 is a handshake mode whereby ports A and ports B use bits from port C as handshake
signals. In the handshake mode, two types of data transfer can be implemented: status check and
interrupt.
In mode 2, port A can be set up for bidirectional data transfer using handshake signal from port
C, and port B can be set up either in mode 0 or mode 1.
Fig (b): Control word specifying various modes
When D7=0, BSR mode
For port C
No effect on I/O mode and functions of port A and B
Individual bits of port C can be used for applications such as ON/OFF switch
When D7=1, I/O mode
I. Mode 0:
Simple I/O interfacing for port A, B and C
II. Mode 1
Interfacing with handshake signals for port A and B
Port C bits are used for handshake
III. Mode 2
Bidirectional I/O interfacing for port A
Port B: either in mode 0 or mode 1
Port C bits used for handshake
Control Word
The content of control register is called control word specifying an input output functions for each port.
The register can be accessed to write a control word when A0 and A1 are at logic 1. The register is not
accessible for read operation.
Bit D7 of the control register specifies either I/O functions or Bit Set-Reset function as classified in figure
(b).
If bit D7=1, bit D6-D0 determine I/O function in various modes as shown in figure (b).
If bit D7=0, port C operates in Bit Set-Reset mode.
The BSR control word does not affect the function of port A and port B.
RS-232C
In 8251A (USART), we discussed how serial communication takes place. The TTL signals output by a
USART, however, are not suitable for transmission over long distances, so these signals are converted to
some other form to be transmitted. In this section we discuss device used to send serial data signals over
long distances.
RS232 is the most widely used serial I/O interfacing standard.
However, the I/O voltage levels are not TTL compatible. In the RS232, a 1 is represented by –3 to –25 V,
while 0 bit is +3 to +25 V, making –3 to +3 undefined.
For this reason, voltage converter such as MC1488 and MC1489 are used to convert the TTL logic levels
to the RS232 voltage levels and vice versa. See Figure below.
RS 232 Handshaking
In order that data can be exchanged on an RS 232 link, the control signals must indicate that the equipment
at either end of the link is ready to send the data and ready to receive the data. This can be achieved in a
number of ways, but one of the more common is to use the RTS, CTS, and DTR lines.
These lines are found in the Data Terminal Equipment, DTE and Data Communications Equipment, DCE
as follows:
,
The handshaking exchange to start the data flow is quite straightforward and can be seen as a number of
distinct stages:
1. RTS is put in the ON state by the DTE.
2. The DCE then put the CTS line into the ON state.
3. The DTE then responds by placing the DTR line into the ON state.
4. The DTR line remains on while data is being transmitted.
At the end of the transmission, DTR and RTS are pulled to the OFF state and then the DCE pulls the CTS
line to the OFF state. This series of handshake controls was devised to allow the DTE to request control
of the communications link from the related modem, and then to let the modem inform the terminal
equipment that the control has been acquired. In this way the communications will only take place when
both ends of the link are ready.
The RS 232 data communications standard is a reliable for of data communications which has been used
for many years and shows every sign of being used for many years to come. In order that it is able to
communicate satisfactorily the RS 232 signals and voltage levels must be able to ensure that the line
receivers are able to decode the data with no errors and that the communications protocols are adhered to.
Once these are all established, data can be exchanged reliably and efficiently.
Keyboard and Display Controller: Introduction to 8279
The INTEL 8279 is specially developed for interfacing keyboard and display devices to 8085/8086/8088
microprocessor based system. The important features of 8279 are:
Simultaneous keyboard and display operations.
Scanned keyboard mode.
Scanned sensor mode.
8-character keyboard FIFO.
16-character display.
Right or left entry 16-byte
display RAM.
Programmable scan timing.
Fig: Pins of 8279
Keyboard section:
The keyboard section consists of eight return lines RL0 - RL7 that can be used to form the columns of a
keyboard matrix.
It has two additional inputs: shift and control/strobe. The keys are automatically debounced.
The two operating modes of keyboard section are 2-key lockout and N-key rollover.
In the 2-key lockout mode, if two keys are pressed simultaneously, only the first key is recognized.
In the N-key rollover mode, simultaneous keys are recognized and their codes are stored in FIFO.
The keyboard section also has an 8x8 FIFO (First-In-First-Out) RAM.
The FIFO can store eight key codes in the scan keyboard mode. The status of the shift key and control key
are also stored along with key code. The 8279 generate an interrupt signal when there is an entry in FIFO.
The format of key code entry in FIFO for scan keyboard mode is,
In sensor matrix mode, the condition (i.e., open/close status) of 64 switches is stored in FIFO RAM. If the
condition of any of the switches changes, then the 8279 asserts IRQ (interrupt request) as high to interrupt
the processor.
Display section:
The display section has eight output lines divided into two groups A0-A3 and B0-B3.
The output lines can be used either as a single group of eight lines or as two groups of four lines, in
conjunction with the scan lines for a multiplexed display.
The output lines are connected to the anodes through driver transistor in case of common cathode 7-
segment LEDs.
The cathodes are connected to scan lines through driver transistors.
The display can be blanked by BD (low) line.
The display section consists of 16x8 display RAM. The CPU can read from or write into any location of
the display RAM.
Scan section:
The scan section has a scan counter and four scan lines, SL0 to SL3.
In decoded scan mode, the output of scan lines will be similar to a 2-to-4 decoder.
In encoded scan mode, the output of scan lines will be binary count, and so an external decoder should
be used to convert the binary count to decoded output.
The scan lines are common for keyboard and display.
The scan lines are used to form the rows of a matrix keyboard and also connected to digit drivers of a
multiplexed display, to turn ON/OFF.