Beruflich Dokumente
Kultur Dokumente
The read/write control logic controls the 8-bit data bus buffer. The
read/write control logic manages all the internal and external transfers of
both the data and control words. RD, WR, A1, A0 and RESET ate the
input provided by the microprocessor to read/write control logic of 8255.
The Read/write control logic is having six signal lines. Which are
RD, WR, RESET, CS, A0 and A1
RD [READ] :- This control signal enables the read operation. When the
signal is low, the microprocessor reads data from a selected I/O port of
8255
RESET :- This is an active high signal, A logic high on this line clears
the control word register and set all ports in the input mode. (that is , set
as input port by default after reset)
1
CS [CHIP SELECT] :- This is a Chip Select line. If the line goes low it
enables the 8255 to respond to RD and WR signals.
CS A1 A0 Selected
0 0 0 Port A
0 0 1 Port B
0 1 0 Port C
0 1 1 Control Register
1 X X 8255 is not selected.
PA7 – PA0 :- These are eight port A lines that act either as input or output
lines depending up on the control word loaded into the control word
register.
PC7 – PC4 :- These are four Port C upper lines that can act as input or
output lines. This port can be used for the generation of handshake lines.
PC3 – PCo : - These are four port C lower lines that can act as input or
output lines. This port can also be used for the generation of handshake
lines.
PB0 – PB7 :- These are 8 port B lines which can be input or output lines
in the same way as port A
D0 – D7 :- These are the data bus lines that carry data or control word
to/from the microprocessor.
This 8255 is a widely used, flexible and economical I/O device that
can be used with almost all microprocessors when multiple I/O ports are
required. 8255 is a 40 pin IC.
2
MODES OF OPERATION OF 8255
All the functions of 8255 A is classified according to two modes: the Bit
Set/Reset (BSR) mode and the 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 as
I/O ports. Mode 1 is a handshake mode whereby port A and port B use
bits from port C as handshake signals. In the handshake mode, two types
of I/O data transfer can be implemented: status checks and interrupt. In
Mode 2 port A can be set up for bidirectional data transfer using
handshaking signals from port C and port B can be set up either in Mode
0 or Mode 1.
1. I/O MODE
This is also called basic I/O mode. In this mode, ports A and B are
used as two simple 8-bit I/O ports and port C as two 4-bit ports. Each port
(or half-port in case of C) can be programmed to function as simply an
input or an output port. The input/output features in Mode 0 as follows:
1. Output is latched.
2. Inputs are not latched.
3. Ports do not have handshake or interrupt capability.
4. Any port can be used as input or output port.
5. 4-bit can combined used as a third 8-bit port.
3
2. Each port uses three lines from port C as handshake signals.
The remaining two lines of port C can be used for simple I/O
functions.
3. Input and output data are latched.
4. Interrupt logic is supported.
In the 8255, the specific lines from port C used for handshake
signals vary according to the I/O function of a port. Therefore input
and output functions in Mode 1 are discussed separately.
The associated control signals are used for handshaking when ports
A & B are configured as inputs. Port A uses PC3, PC4, PC5 and PC0, PC1,
PC2. The functions of these signals are as follows:
OBF(Output Buffer Full):- This is an output signal that goes low when
the MPU writes data into the output latch of the 8255 A.
This signal indicates to an output peripheral that new data are ready to be
4
read. It goes high again after the 8255A receives an ACK from the
peripheral.
2. BSR MODE:
The BSR mode is concerned only with the 8 bit of port C, which
can be set or reset by writing an appropriate control word in the control
register. A control word with bit d7=0 is recognized as a BSR control
word. It does not alter any previously transmitted control word with bit
d7=1 : thus the I/O operations of ports A & B are not affected by the BSR
control word. In the BSR mode individual bits of port C can be used for
applications such as an on/off switch.
5
The figure below shows the register called the control
register. The contents of this register called the control word specify an
I/O function for each port, that is the ports can function independently as
input or output ports, which is achieved by the Control Word Register
(CWR).
Bit D7 of the control register specifies either the I/O function or the
Bit Set/ Reset function. If the bit D7=1, bits D6-D0 determine the I/O
function in various modes. If bit D7=0, port C operates in the Bit
Set/Reset (BSR) mode. The BSR control word does not affect functions
of port A and B.
The 8279 is a 40 pin drive with two major segments, Keyboard and
Display. The keyboard can be connected to a max of 64 – contact ky
matrix. Keyboard entries are denounced and stored in the internal FIFO
RAM and an interrupt signal is generated with each entry. The display
segment can provide a 16 character (byte) scanned display. This segment
contains 16 x 8 R/w memory (RAM), which can be used to read or write
information for the display purposes. This 16-byte display RAM can be
used either as an integrated block of 16 x 8 bits or 16 x 4 bits of 2 blocks.
The internal architecture of 8279 is shown in the fig.
6
The keyboard display controller 8279 is provided with a) set of
four scan lines and eight return lines for interfacing keyboards.
I/O CONTROL :- This I/O control block controls the flow of data to or
from the 8279. This A0. RD, WR Select the command, status or data
read/write operations carried out by the CPU with 8279.
DATA BUFFER:- This data buffer interface the internal bus of the 8279
with the external system bus. This can be used to transfer data, status/
control word.
In scanned sensor matrix mode this unit acts as sensor RAM. Each
row of the Sensor RAM is loaded with the status of the corresponding
7
row of the sensors in the matrix. If the sensor changes its state the IRZ
line goes high to interrupt the CPU.
The display address register hold the address of the word currently
being written or read by the CPU to or from the display RAM.
DB0 – DB7 :- These are bidirectional data bus lines. The data and
command words to and from the CPU are transferred on these lines.
RESET:- This pin is used to reset 8279. A high on this line resets 8279.
After resetting 8279 is in sixteen 8 bit display, left entry display mode
and 2 key lock out mode.
CS [CHIP SELECT] :- A low on this line enables 8279 for the read or
write operations.
IRQ :- The interrupt line goes high when there is data in the
FIFO/Sensor RAM. This line goes low with each FIFO RAM read
operation. If the FIFO RAM again contain any key code entry to be read
by CPU this pin again goes high to generate an interrupt to the CPU.
SL0 – SL3 [SCAN LINES] :- These lines are used to Scan the key board
matrix are used to scan the key board matrix and to refresh the display.
These lines can be programmed as encoded or decoded using the mode
control register.
8
RL0 – RL7 :- These are the input lines one terminal of the key is
connected to this line and other terminal is connected to the scan lines.
These are normally high and pulled low when a key is pressed.
SHIFT :- The status if the Shift input is stored along with each key code
in FIFO; in scanned key board mode.
In the strobe input mode this line is a strobe line that enters the data
into the FIFO RAM.
OUT A0 – OUT A3 and OUT B0 – OUT B3 :- These are the output lines
of two 16 x 4 or 16 x 8 internal display registers. The data from these
lines are synchronized with the scan lines to refresh the display. The two
4-bit ports can also be used as one 8 bit port.
9
3) Scanned Keyboard Special error Mode.
This mode is valid under the N-key Rollover Mode. This mode is
programmed using error mode set command. If during a single debounce
period [debounce cycle] two keys are found pressed, that is considered as
simultaneous depression and an error flag is set in this case. This error
flag if set prevents the further writing in FIFO but allows the generation
of interrupts to CPU for FIFO READ. This error flag can be read by
reading the FIFO Status word. This error flag can be reset or the FIFO
can be cleared by using the clear command with CF = 1 [clear FIFO]
10
1) Sensor Matrix Mode:- In the sensor matrix
mode 8 bit FIFO RAM act as an 8 x 8 memory matrix. The status
of the sensor matrix is fed in to sensor RAM matrix. Thus the
sensor RAM contains the Row wise and Column wise status of the
sensors in the Sensor Matrix. The IRQ line goes high if any
change in the sensor value is detected and this IRQ line is reset by
the data read operation.
a) Display Scan
b) Display Entry
a) Display Scan
b) Display Entry
This mode provides two options for data entry on the displays.
First one is known as left entry mode and the second as right entry mode.
This left entry mode is also known as typewriter mode and right entry
mode is known as calculator mode.
11
display at the seventeenth entry and is lost ie., it pushed out
of the display RAM.
Modem Control Unit: - This modem control unit handles the modem
handshake signals to coordinate the communication between modem and
the USART. Modem is used as a modulating/demodulating device.
Transmit Control: - This unit transmits the data byte received by the
data buffer from the CPU, for further serial communication. The transmit
rate is controlled by the T x C input frequency of this unit. This also
contain two status signal named T x RDY and T x EMPTY. Which the
CPU for handshaking can use?
12
generates a R x RDY receiver ready signal that can be used by the CPU
for handshaking. This unit also detects the break in the data string while
8251 is in a synchronous mode and detects the synchronous characters in
synchronous mode. Using the SYNDET/BD pin.
C/D [Control Word/ Data]:- This input pin informs the 8251 that the
word on the bus is either a data or control/status information. In the pin
is 1 control/status is on the bus, otherwise data is on the bus.
WR :- This is an active low input which is used to inform that the CPU
is writing data or control word to 8251.
CLK :- This CLK is used to generate the internal device timings. The
frequency should be 30 times greater than the receiver or transmitter data
bit transfer rate.
RESET :- A high on this set the 8251 A into an idle state. The device
will remain idle till this signal goes low and a new control word is written
into it.
13
T x D [Transmitted Data Output] :- This output pin carries the serial
stream of the transmitted bits along with the information’s like start bit,
stop bit and parity bit.
DSR [ Data Set Ready]:- This signal is used to reply 8251 for DTR
signal. By making this signal active the modem replies 8251 that it is
ready for the transmission of data.
RTS [Request to Send] :- This signal is used for the initiation of data
transmission. When both the modem and 8251 are ready for data
transmission then the 8251 initiate the data transmission by activating the
RTS signal.
DTR [Data Terminal Ready] :- This signal is sent by the 8251 to the
modem to an active CTS signal enables the transmission logic of 8251.
14
character is received from the CPU for further transmission. This can be
used to indicate the end of a transmission mode.
In the asynchronous mode the pin acts as a break detect. This goes
high when the R x D pin remains low for two consecutive stop bit
sequences.
15
In this mode when data characters are sent it adds start bit followed
by stop bits and parity bits. This sequence is then transmitted using the T
x D output pin on the falling edge of T x C.
In the receiving side if a start bit is marked as a valid start bit then
a bit counter starts counting. The bit counter locates the data bits, parity
bit and stop bit. If a parity error occurs then the parity error flag is set. If
an error in the frame is detected then framing error flag is set. When the
received character is loaded in the buffer R x RDY then raise high to
indicate CPU that a character is ready for it. An overrun flag is set in the
case of previous characters loss in the buffer by the overwriting of buffer
with new characters.
b) Synchronous Mode
16
This controls the actual operations of the mode selected. The
operations like enable transmit/receive error reset and modem control.
Once the mode instruction has been written into 8251 then all control
words written with C/D =1 will load a command instruction. A reset
operation returns 8251 back to mode instruction format.
17