Você está na página 1de 3

Applications of the 8255 in the Handshake mode

Introduction
This report is based on the application of the 8255 in the handshake mode. There are a many applications
using the hand shake mode and a few are listed in this report. 8255 is a widely used general purpose
programmable devices, can be compatible with any microprocessor. The 8255 includes three programmable
ports, one of which can be used for bidirectional data transfer. This is an important additional feature in
comparison with the 8155 I/O ports. The 8255 has 24 I/0 pins that can be grouped primarily in two 8 bit
parallel ports. A & B, with the remaining eight bits as port c. the eight ports of port c can be used as individual
bits or be grouped in two 4-bit ports. The figure shows all the functions of 8255, classified according to two
modes: the BSR mode and I/P 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 the ports function as simple
I/O ports. Mode 1, is a handshake mode where by ports A and/or B use bits from port C as handshake signals.
In the handshake mode, two types of I/P data can be transferred implemented: status check and interrupt. In
mode 2, port A can be set up for bidirectional data transfer using handshake signals from port C, and port B
can be used to set up either in mode 0 or mode 1.

1. INTERFACING ANALOG TO DIGITAL DATA CONVERTERS


In most of the cases, the PIO 8255 is used for interfacing the analog to digital converters with a
Microprocessor.This section will only emphasize the
Interfacing techniques of analog to digital converters with 8255.
The function of an A/D converter is to produce a digital word which
Represents the magnitude of some analog voltage or current. The
Specifications for an A/D converter are very similar to those for D/A
Converter. The resolution of an A/D converter refers to the number of bits in
the output binary word. An 8-bit converter for example has a resolution of 1
Part in 256. Accuracy and linearity specifications have the same meaning
For an A/D converter as they do for a D/A converter. Another important
Specification for an ADC is its conversion time. This is simply the time it
takes the converter to produce a valid output binary code for an applied
input voltage. When we refer to a converter as high speed, we mean that it
has a short conversion time.
The analog to digital converter is treated as an input device by the
Microprocessor that sends an initialising signal to the ADC to start the
analog to digital data conversation process. The start of conversion signal is
a pulse of a specific duration. The process of analog to digital conversion is
a slow process, and the microprocessor has to wait for the digital data till
the conversion is over. After the conversion is over, the ADC sends end of
conversion (EOC) signal to inform the microprocessor that the conversion
is over and the result is ready at the output buffer of the ADC. These tasks
of issuing an SOC pulse to ADC, reading EOC signal from the ADC and
reading the digital output of the ADC are carried out by the CPU using
8255 I/O ports.
The time taken by the ADC from the active edge of SOC pulse (the
edge at which the conversion process actually starts) till the active edge of
EOC signal is called as the conversion delay of the ADC. Or broadly
speaking the time taken by the converter to calculate the equivalent digital
data output from the instant of the start of conversion is called conversion
delay. It may range any where from a few microseconds in case of fast
ADCs to even a few hundred milliseconds in case of slow ADCs. A number
of ADCs are available in the market, The selection of ADC for a particular
application is done, keeping in mind the required speed, resolution range of
operation, power supply requirements, sample and hold device
requirements and the cost factors are considered.
The available ADCs in the market use different conversion techniques
for the conversion of analog signals to digital signals. Parallel converter or

flash converter, Successive approximation and dual slope integration


techniques are the most popular techniques used in the integrated ADC
chips. Whatever may be the technique used for conversion, a general
algorithm for ADC interfacing contains the following steps.
1. Ensure the stability of analog input, applied to the ADC.
2. Issue start of conversion (SOC) pulse to ADC.
3. Read end of conversion (EOC) signal to mark the end of conversion
process.
4. Read digital data output of the ADC as equivalent digital output.
It may be noted that analog input voltage must be constant at the
input of the ADC right from the start of conversion till the end of
conversion to get correct results. This may be ensured by a sample and hold
circuit which samples the analog signal and holds it constant for a specified
time duration. The microprocessor may issue a hold signal to the sample
10
and Hold circuit. If the applied input changes before the complete conversion
process is over, the digital equivalent of the analog input calculated by the ADC
may not be correct.
ADC 0808 is an 8-bit Analog to Digital Converter chip. It comes in a 28 pin DIP. It uses
successive approximation technique. The conversion is quite fast. The conversion time is
100 micro seconds when the clock rate is 640 KHz. ADC 0808 has 8 analog inputs i/p
0-7. An input is selected for conversion based on C B A inputs. Start of Conversion SOC)
signal is needed to begin conversion. The end of conversion is indicated by activation of
EOC signal. The digital output comes out on Out7-0.
Program for A/D Conversion
MOV AL, 98H; Configure 8255
OUT 7FH, AL; PA as input, PB as output, PCL as output, PCU as input
MOV AL, 02H; Select i/p 2 as analog input
OUT 7DH, AL; by sending 02 to Port B
MOV AL, 00
OUT 7EH, AL; Send 0 on PC0
MOV AL, 01
OUT 7EH, AL; Send 1 on PC0
MOV AL, 00; Send 0 on PC0
OUT 7EH, AL; i.e. send SOC on PC0
WAIT: INAL, 7EH; Read Port C
ROL AL,1; Look at EOC by rotate left
JNC WAIT; Remain in loop while EOC is 0
IN AL, 7CH; Read from Port A after EOC
HLT

2. Digital to Analog Conversion


DAC 0800 is an 8-bit Digital to Analog Converter chip. It comes in a 16 pin DIP. It has 8
digital inputs. DAC 0808 generates analog current output.Current to voltage converter is
used externally. Current output is generated in about 100 milli seconds.
Program for Triangular waveform generation using DAC
MOV AL, 80H; Configure Port A as output in Mode 0
OUT 7FH, AL
MOV AL, 00; Initialize AL with 0
UP: OUT 7CH, AL; Next 4 instructions generate rising portion of triangular waveform
INC AL;
CMP AL, FFH;
JB UP
DOWN: OUT 7CH, AL; Next 4 instructions generate falling portion of triangular waveform
DEC AL;
CMP AL, 00;
JA DOWN
JMP UP;

3. Parallel Printer Interface:


For the most common printer such as the IBM PC printer, the Epson dot
matrix printers and the Panasonic dot matrix printers, data to be printed is sent to
the printer as ASCII characters on eight parallel lines. The printer receives the
characters to be printed and stores them in an internal RAM buffers. When the
printer detects a carriage return character, it prints out the first row of characters
from the print buffer. When the printer detects a second carries return, it prints out
the second row of characters etc. The process continuous until the desired
characters have been printed.
Transfer of the ASCII codes from a microcomputer to a printer must be
done on a handshake basis because the microcomputer can send characters much
faster than a printer can print them. The printer must in some way let the
microcomputer know that its buffer is full and that is cannot accept any more
characters until it prints some out. A common standard for interface with parallel
printers in the centronics parallel interface standard, named for the company that
developed it.
Centronics type printers usually have a 36-pin interface connected. This 36pin connector fall into two categories, i. Signals sent to the printer to tell it what
operation to do and ii. signals form the printer that indicate its status.
The major control signals to the printer are INIT on pin 31, which tells the
printer to perform its initialization sequence, and STROBE on pin1 which tells the
printer Here is a character for you. The two addition input pins pin14 and pin16
are usually taken care of inside the printer.
The major status signals output from the printer are
1. The ACKNLG signal on pin10, which when low indicates that the character
has been accepted and the printer is ready for the next character.
2. The BUSY signal on pin11, which is high if, for some reason such as being
out of paper, the printer is not ready to receive a character.
3. The PE signal on pin12 which goes high if the out of paper switch in the
printer is activated.

20
4. The SLCT signal on pin13, which goes high if the printer is selected for
receiving data
5. The ERROR signal on pin32, which goes low for a variety of problem
conditions in the printer.
with 8255

Você também pode gostar