Professional Documents
Culture Documents
Mpi Unit
Mpi Unit
Figure 1.2 shows all the functions of 8255; classified according to two modes: the Bit Set/Reset
(BSR) mode and I/O mode.
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 hand shake mode whereby Ports A and/or B use
bits from port C as handshake signals. 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
Block Diagram of the 8255
CONTROL LOGIC
(Read): This control signal enables the Read operation. When the signal is low, the MPU
reads data fro a selected I/O Port of the 8255.
(Write): This control signal enables the write operation. When the signal goes low,
MPU writes into a selected I/O Port or control register.
RESET: (Reset): This is an active high signal; it clears the control register and sets all ports in
the input mode.
, A0 and A1: Theses are device select signals. Chip Select is connected to a decoded
address, and A0 and A1 are generally connected to MPU address lines A0 and A1 respectively
2
CONTROL WORD
Figure 1.5 shows a register called the control register. The contents of this register called control
word. This register can be accessed to write a control word when A0 and A1 are at logic 1. This
control register is not accessible for a read operation.
Bit D7 of the control register specifies either I/O function or the Bit Set/Reset function. If bit
D7=1, bits D6-D0 determines I/O functions in various modes. If bit D7=0, Port C operates in the
Bit Set/Reset (BSR) mode. The BSR control word does not affect the functions of Port A and
Port B.
3
To communicate with peripherals through the 8255, three steps are necessary:
1. Determine the address of ports A, B and C and of the control register according to the chip
select logic and address lines A0 andA1.
2. Write the control word in the control register.
3. Write I/O instructions to communicate with peripherals through Ports A, B and C.
Operating Modes
4
The remaining three signals from port C can be used either as simple I/O or as handshake
for port B.
5
8251 Programmable Communication Interface
Receives parallel data from the CPU & transmits serial data after conversion.
Also receives serial data from the outside & transmits parallel data to the CPU after
conversion.
# Pin diagram
6
Block diagram of the 8251 USART
Sections of 8251A
Modem Control
Transmitter
• Receiver
7
2. Read/Write Control logic
Includes a control logic, six input signals & three buffer registers: Data register,
control register & status register.
Control logic : Interfaces the chip with MPU, determines the functions of the chip
according to the control word in the control register & monitors the data flow.
Input signals
CS – Chip Select : When signal goes low, the 8251A is selected by the MPU for
communication.
C/D – Control/Data : When signal is high, the control or status register is addressed;
when it is low, data buffer is addressed. (Control register & status register are
differentiated by WR and RD signals)
WR : When signal is low, the MPU either writes in the control register or sends output to
the data buffer.
RD : When signal goes low, the MPU either reads a status from the status register or
accepts data from data buffer.
RESET : A high on this signal reset 8252A & forces it into the idle mode.
CLK : Clock input, usually connected to the system clock for communication with the
microprocessor.
Status register
• Checks the ready status of the peripheral.
• Status word in the status register provides the information concerning register status and
transmission errors.
Data register
Used as an input and output port when the C/D is low
CS C/D WR RD Operation
8
3. Modem Control:
DSR - Data Set Ready : Checks if the Data Set is ready when communicating with a modem.
DTR - Data Terminal Ready : Indicates that the device is ready to accept data when the 8251 is
communicating with a modem.
CTS - Clear to Send : If its low, the 8251A is enabled to transmit the serial data provided the
enable bit in the command byte is set to ‘1’.
RTS - Request to Send Data : Low signal indicates the modem that the receiver is ready to
receive a data byte from the modem.
4. Transmitter section
Accepts parallel data from MPU & converts them into serial data.
Has two registers:
a. Buffer register : To hold eight bits
Output register : To convert eight bits into a stream of serial bits.
The MPU writes a byte in the buffer register.
Whenever the output register is empty; the contents of buffer register are transferred to
output register.
Transmitter section consists of three output & one input signals
TxD - Transmitted Data Output : Output signal to transmit the data to peripherals
TxC - Transmitter Clock Input : Input signal, controls the rate of transmission.
TxRDY - Transmitter Ready : Output signal, indicates the buffer register is empty
and the USART is ready to accept the next data byte.
TxE - Transmitter Empty : Output signal to indicate the output register is empty and
the USART is ready to accept the next data byte.
5. Receiver Section
Accepts serial data on the RxD pin and converts them to parallel data.
Has two registers :
a. Receiver input register
b. Buffer register
9
When RxD goes low, the control logic assumes it is a start bit, waits for half bit time, and
samples the line again. If the line is still low, the input register accepts the following data,
and loads it into buffer register at the rate determined by the receiver clock.
RxRDY - Receiver Ready Output: Output signal, goes high when the USART has a
character in the buffer register & is ready to transfer it to the MPU.
RxD - Receive Data Input : Bits are received serially on this line & converted into a
parallel byte in the receiver input register.
RxC - Receiver Clock Input : Clock signal that controls the rate at which bits are received
by the USART.
10
Programmable. Interval timer (Intel 8253 and 8254)
Compatible with All Intel and Most other Microprocessors and Handles Inputs from DC
to 10 MHz
8 MHz 8254 and 10 MHz 8254-2
The Intel 8254 is a counter/timer device designed to solve the common timing control
problems in microcomputer system design.
It provides three independent 16-bit counters, each capable of handling clock inputs up
to 10 MHz
Binary or BCD counting
Single a +5V Supply and Standard Temperature Range
Six Programmable Counter Modes and All modes are software programmable. The 8254
is a superset of the 8253.
The 8254 uses HMOS technology and comes in a 24-pin plastic or CERDIP package.
Used for controlling real-time events such as real-time clock, events counter, and motor
speed and direction control.
11
Counters:
Three Counters – C1,C2 & C3
Each 16 Bit Identical Presettable
Down Counter Operates In BCD /Hex
Controlled By Loading Count To Command Word Register
“On The Fly” Reading
Control Logic:
CS – Logic 0 – Enables 8254
RD – Logic 0 – Tells Microprocessor Reads Count From 8254
WR – Logic 0 – Tells Microprocessor Writes Count/ Command Into 8254
A1,a0 – Address Input Pins To Select Modes And Counters
Data Buffers:
8 Bit Bidirectional D0-d7 Connected To Data Bus Of Microprocessor
In Reads Data From Peripheral
Out Writes Data To Peripheral
Control Word Register:
Accepts 8 Bit Control Word Written By Microprocessor
Can Only Be Written ( Not Read)
Control Word Chooses One Of The Six Modes Of Operation
CS RD WR A1 A0 OPERATION
0 1 0 0 0 Write Counter 0
0 1 0 0 1 Write Counter 1
0 1 0 1 0 Write Counter 2
12
0 0 1 0 0 Read Counter 0
0 0 1 0 1 Read Counter 1
0 0 1 1 0 Read Counter 2
0 0 1 1 1 No Operation ( Tristated )
0 1 1 X X No Operation ( Tristated )
13
8254 Modes Of Operation
1. Mode 0 (Interrupt On Terminal Count )
2. Mode 1 (Programmable Monoshot )
3. Mode 2 (Rate Generator )
4. Mode 3 (Square Wave Generator )
5. Mode 4 (Software Triggered Strobe )
6. Mode 5 (Hardware Triggered Strobe )
14
Gate input is used as trigger input
Output remains high till the count is loaded after application of trigger, output goes low
and remains low till count becomes zero
Mode 1: One-shot mode
8253 8254
Its operating frequency is 0 - 2.6 MHz Its operating frequency is 0 - 10 MHz
It uses N-MOS technology It uses H-MOS technology
Read-Back command is not available Read-Back command is available
Reads and writes of the same counter cannot be Reads and writes of the same counter can be
interleaved. interleaved.
15
Mode 3: SQUARE WAVE RATE GENERATOR
1. When count N loaded is even output remains HIGH for half the count and LOW
for the rest half of the count
2. When count N loaded is odd output remains HIGH for (N+1)/2 and low for (N-
1)/2.
3. Repeated operation gives square wave
16
Mode 5: Hardware triggered Strobe
This mode generates a strobe in response to the rising edge at the trigger
Mode is used to generate a delayed strobe in response to an externally generated signal
Once mode is programmed and counter loaded, OUT goes HIGH
Counter starts counting after the rising edge of the trigger (GATE)
17
8279 Programmable Keyboard/Display Controller and Interfacing
The Keyboard/Display Controller 8279
Intel’s 8279 is a general purpose Keyboard Display controller that simultaneously drives the
display of a system and interfaces a Keyboard with the CPU.
Both of these functions are performed by the controller in repetitive fashion without involving
the CPU. The Keyboard is interfaced either in the interrupt or the polled mode.
18
Control and Timing Register and Timing Control
These registers store the keyboard and display modes and other operating conditions
programmed by CPU. The registers are written with Ao=1 and WR =0.
Scan Counter
The Scan Counter has two modes to scan the key matrix and refresh the display.In the Encoded
mode, the counter provides a binary count that is to be externally decoded to provide the scan
lines for keyboard and display (four externally decoded scan lines may drive up to 16 displays).
In Keyboard or strobed input mode, this block acts as 8-byte first-in-first-out (FIFO) RAM. Each
key code of the pressed key is entered in the order of the entry, and in the meantime, read by the
CPU, till the RAM becomes empty.
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 row of sensors in the matrix.
19
RS-232
One of the oldest serial interfaces is generically called RS-232. It was originally established in
1962 as a method of connecting data terminal equipment (DTE) such as electro mechanical
teletypewriters to data communications equipment (DCE). Over the years its use has included
connections to video terminals, computers, and modems. The first personal computers included
an RS-232 called a serial port for connection to a printer or other peripheral device. Today, it is
still widely used in embedded computer development systems, scientific instruments, and all
sorts of industrial control equipment.
The standard defines the pin numbering, meaning of signals and the connectors (9-pin or 25-pin
connector). For a minimal unidirectional communication, only 2 wires are needed (TX/RX and
GND). For a bidirectional connection, at least 3 wires are needed (TX, RX and GND). RS-232
has been available on many computer system and is commonly known as ‘serial port’. Because
of the simplicity of the protocol, many embedded devices have an UARTintegrated. As the
microcontroller typically does not provide the higher voltage levels as defined in the standard, an
additional line driver as the MAX232 is needed to communicate with devices over a larger
distance.
Comparison Table
USB RS-232
Wires 4 2-10
Power yes no
20
Handshaking built-in only with CTS/RTS wires
Interoperability yes no
The IEEE-488 Interface Bus (HP-IB) or general purpose interface bus (GP-IB) was developed to
provide a means for various instruments and devices to communicate with each other under the
direction of one or more master controllers. The HP-IB was originally intended to support a wide
range of instruments and devices, from the very fast to the very slow
A device may be capable of any other three types of functions: controller, listener, or talker. A
device on the bus may have only one of the three functions active at a given time. A controller
directs which devices will be talkers and listeners. The bus will allow multiple controllers, but
only one may be active at a given time. Each device on the bus should have a unique address in
the range of 0-30. The maximum length of the bus network is limited to 20 meters total
transmission path length.
21