Microprocessor
Microprocessor
Microprocessor
1
Table: internal address of 8155
CONTROL REGISTER
Control register also called command register.
It is a 8-bit which defines different functions.
It defines the function of different ports such as input, output or handshaking mode.
It also defines timer command for timer to start and stop.
D7 D6 D5 D4 D3 D2 D1 D0
PC - ALT1 (00) and
Timer command IEB IEA PB PA
ALT2 (11)
Input or output for PA and PB respectively:
1-output; 0-input
2
Timer command:
00 -No effect
01 -Stop counting if timer is running. No operation if counter is not running.
10 -Stop after terminal counter is reached.
11 -Start timer if timer is not running. If timer is running reload the TC and then continue.
8155 timer
Timer MSB:
M2 M1 T13 T12 T11 T10 T9 T8
Timer LSB:
T7 T6 T5 T4 T3 T2 T1 T0
M2 M1
00(Mode 0)- Single Square Wave
01(Mode 1)- Square Wave
10(Mode 2)- Single Pulse on TC(terminal count)
11(Mode 3)- Pulse every TC
Mode 0: In this mode, timer gives only one cycle of square wave, the output remains high
for 1/2 count and remain s low for 1/2 count. If count is odd it remains high for (n+1)/2 and
low for (n-1)/2. Where n is count value. Wave width depends on two factor: one is Input clock
pulse frequency, and the other is count loaded in counter.
Mode 1: This mode is similar to single square wave in operation but the when counter
becomes zero, the count value is automatically reloaded. Thus it provides continuous square
wave.
Mode 2: This mode gives a single clock pulse as a output of the end of the count. The
output is high normally, but it becomes low for 1 clock pulse and again it will become high
and remain high.
Mode 3: This mode is similar to mode 2 but when the counter becomes zero the count value
is automatically reloaded. Thus it provides continuous pulses.
8155 has a status register which can be read by processor by using the control register
address. They both have same port address and they can be differentiated by only RD &
WR signals. The processor can only write to control register and it can only read the status
register.
When a port is programmed as a handshake input port then handshake signals are used to
transfer the data from input device to the port. When the port receives a data, it interrupts the
3
processor for executing a subroutine for reading the data from the port and storing in
appropriate place. Alternately, the processor can check the status register of 8155 to know
any data is available on the port, if a data is available on the port then the processor
executes a subroutine to read the data and store it in appropriate place.
When a port is programmed as a handshake output port then handshake signals are used to
transfer the data from port to the output device. The processor first loads a data to the port.
When the data is accepted by the output device the port will send an interrupt signal to the
processor. Now the processor can load the next data to the port. Alternatively the processor
can check the status register before loading the next data.
4
8355
The INTEL 8755 is an EPROM and IO chip.
It can be used in 8085A and 8088 microprocessor.
The ROM portion has 2kbyte memory with word size of 8-bit.
It has maximum access time of 400 ns so that the device can be used without wait
states in 8085A CPU.
The 8355-2 has 300ns access time for compatibility with the 8085A-2 and full speed
5 MHz 8088 microprocessor.
It is a 40 pin IC available in DIP. It has multiplexed address and data lines. It has an
internal address latch to demultiplex the address and data lines using the signal ALE.
The IO portion consists of two general purpose IO ports each with 8 port lines.
8755
The INTEL 8755 is an EPROM and IO chip.
It can be used in 8085A and 8088 microprocessor.
It has 2kbyte memory with word size of 8-bit.
It has maximum access time of 450 ns so that the device can be used without wait
states in 8085A CPU.
5
internal block diagram of 8755
The ports are programmed as input or output port by loading an 8-bit word in the Data
Direction Register of the connected port. Each line of the port can be individually used as
input or output lines. A zero loaded in the DDR makes the corresponding line of the port as
input line of the port.
The ports and data direction registers are selected by two bit internal address A0, A1. when
A1 A0 = 00 port A, 01 port B, 10 DDRA, 11 DDRB
When the device is reset by applying a high signal at RESET pin, the DDRs are cleared and
the ports are initialized in the input mode.
6
Features of 8255 PPI:
This three-state bi-directional 8-bit buffer (D0 to D7) is used to interface the
8255 to the system data bus. Data is transmitted or received by the buffer
upon execution of input or output instructions by the microprocessor. The
direction of data bus is decided by read and writes control signals. Control
words and status information are also transferred through the data bus buffer.
The architecture of 8255 is given as below
The function of this block is to manage all of the internal and external
transfers of both Data and Control or Status words. It accepts inputs from the
CPU Address and Control busses and in turn, issues commands to both of
the Control Groups.
7
(Chip Select):
A “low” on this input pin enables the communication between the 8255 and
the microprocessor.
(Read):
A “low” on this input pin enables 8255 to send the data or status information to
the microprocessor on the data bus. In essence, it allows the microprocessor
to “read from” the 8255. The pin diagram of 8255 is as shown below.
8
9
(Write):
A “low” on this input pin enables the microprocessor to write data or control
words into the 8255.
Port Select 0 and Port Select 1. The selection of one of the three ports of the
control word register. They are normally connected to the least significant bits
of the address bus (A0 and A1).
A1 A0 Operation
0 0 Port A
0 1 Port B
1 0 Port C
1 1 Control Word Register
RESET
A “high” on this reset the 8255 operation. All ports (A, B, C) are set to the
input mode. “Bus hold” devices internal to the 82C55A will hold the I/O port
inputs to a logic “1” state with a maximum hold current of 400mA
The control word contains information such as “mode”, “bit set”, “bit reset”,
etc., that initializes the functional configuration of the 82C55A. Each of the
Control blocks (Group A and Group B) accepts “commands” from the
Read/Write Control logic, receives “control words” from the internal data bus
and issues the proper commands to its associated ports.
Control Group A - Port A and Port C upper (PC7 - PC4)
Control Group B - Port B and Port C lower (PC3 -PC0)
The control word register can be both written and read as shown in the “Basic
Operation” table. Figure 4 shows the control word format for both Read and
Write operations. When the control word is read, bit D7 will always be logic
10
“1”, as this implies control word mode information.
11
Operating Modes
This functional configuration provides simple input and output operations for
each of the three ports. No handshaking is required, data is simply written to
or read from a specific port.
Mode 0 Basic Functional Definitions:
1. Two 8-bit ports and two 4-bit ports
2. Any Port can be input or output
3. Outputs are latched
4. Input are not latched
5. 16 different Input/output configurations possible
Mode 0 Configurations
12
13
Mode 1 - (Strobbed Input/output mode or Handshake Input/output mode):
(Strobe Input):
A “low” on this input loads data into the input latch.
14
IBF (Input Buffer Full F/F):
A “high” on this output indicates that the data has been loaded into the input
latch: in essence, and acknowledgment. IBF is set by STB input being low
and is reset by the rising edge of the read input.
15
INTE B
It is controlled by bit set/reset of PC2.
16
INTE B
It is controlled by Bit Set/Reset of PC2.
NOTE:
To strobe data into the peripheral device, the user must operate the strobe
line in a hand shaking mode. The user needs to send OBF to the peripheral
device generates an ACK from the peripheral device and then latch data into
the peripheral device on the rising edge of OBF.
17
Mode 2 (Strobbed Bi-Directional I/O Mode):
18
INTR (Interrupt Request):
A high on this output can be used to interrupt the CPU for both input or output
operations.
Output Operations
Input Operations
STB (Strobe Input):
A “low” on this input loads data into the input latch.
IBF (Input Buffer Full F/F):
A “high” on this output indicates that data has been loaded into the input
latch.
INTE 2 (The INTE flip-flop associated with IBF):
It is controlled by bit set/reset of PC4.
19
20
STATUS WORD OF 8255:
The 82C55A is a very powerful tool for interfacing peripheral equipment to the
microcomputer system. It represents the optimum use of available pins and is
flexible enough to interface almost any I/O device without the need for
additional external logic.
Each peripheral device in a microcomputer system usually has a “service
routine” associated with it. The routine manages the software interface
between the device and the CPU. The functional definition of the 82C55A is
programmed by the I/O service routine and becomes an extension of the
system software. By examining the I/O devices interface characteristics for
both data transfer and timing, and matching this information to the examples
and tables in the detailed operational description, a control word can easily be
developed to initialize the 82C55A to exactly “fit” the application.
21
8253/8254 PIT (PROGRAMMABLE INTERVAL TIMER)
22
READ/WRITE LOGIC : The Read/Write Logic accepts inputs from the system bus and
generates control signals for the other functional blocks of the 8254. A ``low'' on the RD
input tells the 8254 that the CPU is reading one of the counters. A ``low'' on the WR input
tells the 8254 that the CPU is writing either a Control Word or an initial count. Both RD and
WR are qualified by CS; RD and WR are ignored unless the 8254 has been selected by
holding CS low. A1 and A0 select one of the three counters or the Control Word Register to
be read from/written into.
A1 A0 selection
0 0 counter 0
0 1 counter 1
1 0 counter 2
1 1 control register
D7 D6 D5 D4 D3 D2 D1 D0
SC1 SC0 RW1 RW0 M2 M1 M0 BCD
modes M2 M1 M0
Mode 0 0 0 0
SC1 SC0
Mode1 0 0 1 Select counter 0 0 0
Mode2 X 1 0 Select counter 1 0 1
Mode3 X 1 1
Select counter 2 1 0
Mode4 1 0 0 Read back 1 1
Mode5 1 0 1 command
RW 1 RW 0
Counter latch command 0 0
Rd/ wr least significant byte only 0 1
Rd/ wr most significant byte only 1 0
Rd/ wr least significant byte then 1 1
most significant byte
Mode:
The 8254 has 6 different modes, the gate of a counter is used either to enable or disable
counting.
In mode 0, after the count is written and if the gate is high, the count is decremented every
clock cycle. When the count reaches zero, the output goes high and remains high until a
new count or mode word is loaded.
In mode 1, the out is initially high. When the gate is triggered, the out goes low and at the
end of the count, the out goes high again.
23
Mode 2 is used to generate a pulse equal to the clock period at a given interval. When the
counter is loaded, the out stays high until the count reaches 1 and then the out goes low for
one clock cycle period. The count is reloaded automatically, and the pulse is generated
continuously.
In mode 3, when count is loaded, the out is high. The count is decremented by 2 in every
clock cycle and when it reaches 0, the out goes low and the count is reloaded again. So a
continuous square wave is generated with period equal to the period of the count.
Mode 4 is software triggered strobe. Here, out is initially high; it goes low for one clock
period at the end of the count. The count must be reloaded for subsequent output.
Mode 5 is similar to mode 4 except that it is triggered by the rising pulse at the gate. Initially
the out is low and when the gate pulse is triggered from low to high, the count begins. At the
end of the count OUT goes low for one clock period.
Read back commend allows the user to read the count and status of the counter. This
command is not available in 8253.
READ BACK COMMAND FORMAT
D7 D6 D5 D4 D3 D2 D1 D0
1 1 COUNT STATUS CNT 2 CNT1 CNT0 0
STATUS BYTE
D7 D6 D5 D4 D3 D2 D1 D0
NULL
OUTPUT RW1 RW0 M2 M1 M0 BCD
COUNT
24
READ/ WRITE CONTROL LOGIC
The read/ write control logic interfaces the 8251 with CPU, determines the functions of the
8251 according to the control word written into its control register and monitors the data flow.
This section has three registers and they are control register, status register and data buffer.
The read, write and chip select signals are used to read/ write operations with these
registers. When signal is high, the control register is selected for writing control word or
reading status word. When signal is low the data buffer is selected for read/write
operation. A high on reset input forces 8251 into idle mode. The clock input is necessary fro
communication with CPU and the clock does not control either serial transmission or the
reception rate.
TRANSMITTER SECTION
The transmitter section accepts parallel data from CPU and converts them into serial data.
This section is double buffered i.e. it has a buffer register to hold an 8-bit parallel data and
another register called output register to convert the previous data into a stream of serial
bits.
25
The processor loads a data into the buffer register. When output register is empty, the data
is transferred from buffer to output register. Now the processor can again load another data
in buffer register. If the buffer register is empty, then TxRDY is asserted high and if output
register is empty the TxEMPTY is asserted high. These signals can also be used as interrupt
or status for data transmission.
The clock signal controls the rate at which the bits are transmitted by the USART. The
clock frequency can be 1, 16 or 64 times the baud rate.
RECEIVER SECTION
The receiver section accepts serial data and converts them into parallel data. The receiver
section is double buffered.
Normally RxD line is high, 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 character and loads it into the buffer register.
The CPU reads the parallel data from buffer register. When the input register loads a parallel
data to buffer register, the RxRDY line goes high. The signal can be used as an interrupt or
status to indicate the readiness of the receiver section to CPU. The clock signal
controls the rate at which bits are received by the USART. In the asynchronous mode, the
clock frequency can be set to 1, 16, 64 times the baud rate.
During asynchronous mode, the signal SYNDET/BRKDET will indicate the intentional break
in data transmission. If the RxD line remains low for more than 2 character time then this
signal is asserted high to indicate the break in the transmission.
During synchronous mode, the signal SYNDET/BRKDET will indicate reception of
synchronous character. If the 8251 finds a synchronous character in the incoming string of
data bits then it asserts SYNDET signal as high.
MODEM CONTROL
The modem control unit allows to interface a MODEM to 8251 and to establish data
communication through MODEM over telephone lines. This unit takes care of handshake
signals for MODEM interface.
The 8251 is programmed by sending mode word and command word. First reset the 8251
and then send a mode word to control register address. Next, the command word is sent to
the same address. The CPU can check the readiness of the 8251 for data transfer by
reading the status register. The format of status and control register are shown.
26
Interfacing of 8251 with 8085
A simple schematic for interfacing the 8251 with 8085 is shown. The 8251 can either be
memory mapped or IO mapped in the system. In the schematic the 8251 is IO mapped in the
system. The chip select signal for IO mapped devices are generated by using a 3-to-8
decoder. The address lines A4, A5, A6 are decoded to generate eight chip select signals and
in this, the signal IOCS 2 is used to select 8251. The address line A7 and the control signal
27
The address line A0 of 8085 is connected to of 8251 to provide the internal addresses.
The IO addresses allotted to the internal devices of 8251 are listed above. The data line are
connected to the processor to achieve parallel data transfer. The RESET and clock signals
are supplied by the processor. Here the processor clock is directly connected to 8251. This
clock controls the parallel data transfer between the processor and the 8251.
The output clock signal of 8085, is divided by suitable clock dividers and then used as clock
for serial transmission and reception. In 8251 the transmission and reception baun rates can
be same or different.
The TTL logic levels of the serial data lines and control signals necessary for serial
transmission and reception are converted to RS232 logic levels using MAX232 and then
28
terminated on a standard 9 pin D type connector. The device which requires serial
communication with processor can be connected to this 9 pin D type connector using 9 core
cable.
The signals TxEMPTY, TxRDY and RxRDY can be used as interrupt signals to initiate
interrupt driven data transfer scheme.
RS 232
A communication standard for connecting computers to printers, modems, etc.The most
common communication standard. Defined in the 1950’s.It uses voltages between +15 and –
15 V Restricted to speeds less than 20 K baud. Restricted to distances of less than 50 feet
(15 m).The original standard uses 25 wires to connect the two devices. However, in reality
only three of these wires are needed.
29