Unit 3 - 16-Bit Microprocessor and Peripheral Devices
Unit 3 - 16-Bit Microprocessor and Peripheral Devices
UNIT
16-bit Microprocessor and
Peripheral devices
SYLLABUS
16-bit Microprocessors (8086): Architecture, Pin Description, Physical address, Segmentation,
Addressing modes.
Peripheral Devices: 8237 DMA Controller, 8255 Programmable Peripheral Interface,
8253/8254 Programmable Timer/Counter, 8259 Programmable Interrupt Controller, 8251
USART and RS 232C.
16-BIT MICROPROCESSOR
3.1 Introduction to 16-bit Microprocessor 8086
Page | 1
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
Figure 3.1 shows the 8086 Microprocessor internal architecture.
The 8086 microprocessor has two main execution units:
i. The Bus Interface Unit (BIU) and
ii. The Execution Unit (EU).
The BIU is responsible for fetching instructions from memory and decoding them, while the
EU executes the instructions. The BIU also manages data transfer between the
microprocessor and memory or I/O devices.
Segment Registers:
The 8086 has four primary segment registers: CS (Code Segment), DS (Data Segment), SS (Stack
Segment), and ES (Extra Segment). Each of these registers holds a 16-bit value that represents
the base address of a specific segment in memory.
Code Segment (CS) register : CS is a 16 Bit register, holds the base address for the Code
(64 KB) Segment. All programs are stored in the Code Segment and
accessed via the IP.
Data Segment (DS) register : DS is a 16 Bit register, holds the base address for the Data
(64 KB) Segment.
Stack Segment register : SS is a 16 Bit register, holds the base address for the Stack
(64 KB) Segment.
Extra Segment register : ES is a 16 Bit register, holds the base address for the Extra
(64 KB) Segment.
Page | 2
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
• The code segment (CS) is multiplied by 10H to give the 20-bit physical address of the Code
Segment.
• The address of the next instruction is calculated by using the formula CS x 10H + IP.
Address Bus:
The 8086 microprocessor has a 20-bit address bus, which can address up to 1 MB of memory (220
= 1,048,576), and a 16-bit data bus, which can transfer 16-bit data between the microprocessor
and memory or I/O devices.
Data Bus:
The data bus is used to transfer data between the microprocessor and memory. The data bus is
16 bits wide, allowing the 8086 to transfer 16-bit data words at a time.
Control Bus: The control bus is used to transfer control signals between the microprocessor and
other components in the computer system. The control bus is used to send signals such as read,
write, and interrupt requests, and to transfer status information between the microprocessor and
other components.
General-Purpose Registers:
8086 has four 16-bit general purpose registers AX, BX, CX, and DX which store intermediate
values during execution. Each of these has two 8-bit parts (higher and lower) i.e. AH, AL, BH, BL,
CH, CL, DH and DL to store 8-bit data.
Page | 3
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
CX register: (Combination of CL and CH Registers)
It holds the count for instructions like a loop, rotates, shifts and string operations.
DX register: (Combination of DL and DH Registers)
It is used with AX to hold 32-bit values during multiplication and division
Control Unit:
The Control Unit in the 8086 microprocessor is a component that manages the overall operation
of the microprocessor. It interprets the opcode of an instruction, determines the operation to be
performed, and generates control signals to execute that operation.
Instruction Decode:
• The EU decodes the instruction fetched from memory to understand what operation needs to
be performed and which operands to use.
• It works in parallel with the Prefetch Unit, which fetches instructions from memory and stores
them in a queue.
Flag Register:
The 8086 flag register contents indicate the results of computation in the ALU. It also contains
some flag bits to control the CPU operations.
It consists of 9 active flags out of 16. The remaining 7 flags marked ‘X’ are undefined flags.
These 9 flags are of two types:
• Conditional flags (6) and
• Control flags (3)
Page | 4
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
The conditional flags are:
Carry Flag (CF) : CF=1; Whenever there is a carry or borrow out of the MSB (most
significant bit) of a result
CF=0; Otherwise.
Parity Flag (PF) : PF=1; If the number of 1’s in the result are even.
PF=0; If the number of 1’s in the result are odd.
Auxiliary Carry : AF=1; If a carry is generated out of the lower nibble (out of D3 bit)
Flag (AF) AF=0; Otherwise.
Sign Flag (SF) : SF=1; if the MSB of the result is 1. For signed operations such a
number is treated as negative.
SF=0; Otherwise.
Trap Flag (TF) : TF=1; the execution will be done step by step where it executes one
instruction at a time i.e. start single stepping mode. This is useful for
debugging.
TF=0; Otherwise (the free-running operation will be done).
Interrupt Flag (IF) : IF=1; interrupts are enabled and can be serviced by the CPU.
IF=0; interrupts are disabled.
Page | 5
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
The figure below represents the pin diagram of 8086 microprocessor:
From figure 3.3, it is clear that from pin number 24 to 32, we have shown the different
configuration for minimum and maximum mode. Excluding these 8 pins, the rest 32 pins are the
same for both minimum as well as maximum mode.
Page | 6
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
INTR pin, the CPU acknowledges it, pauses its current operation, and
processes the interrupt. This enables efficient communication
between the CPU and external devices.
It provides timing to the microprocessor for operations. Its frequency
19 CLK is different for different versions, i.e. 5MHz, 8MHz and 10MHz.
̅̅̅̅̅̅̅̅̅ pin is used to reset the microprocessor, returning it to its
The 𝐑𝐄𝐒𝐄𝐓
̅̅̅̅̅̅̅̅̅ initial or default state. When a low-level signal (logic 0) is applied to
21 𝐑𝐄𝐒𝐄𝐓
the ̅̅̅̅̅̅̅̅̅
𝐑𝐄𝐒𝐄𝐓 pin, it forces the 8086 CPU to restart its operation from the
beginning, clearing all registers.
READY signal is used by the peripherals and memory devices in order
to show the readiness for the next operation.
22 READY It is an active high signal. When it is high, it indicates that the device is
ready to transfer data. When it is low, it indicates wait state.
These are basically 3 status pins and are active low. This means that if
the status at all the 3 pins is 0 then it shows that multiple interrupts
are to be handled in maximum mode.
The table below is representing the status of the processor in
different combinations
̅̅̅̅
𝐒𝐨 ̅̅̅̅
𝐒𝟏 ̅̅̅̅
𝐒𝟐 Status
26 ̅̅̅̅ 0 0 0 Interrupt acknowledgement (INTA)
𝐒𝐨 , ̅̅̅̅
𝐒𝟏 & ̅̅̅̅
𝐒𝟐
to
0 0 1 I/O Read
28
0 1 0 I/O Write
0 1 1 Halt
1 0 0 Opcode fetch
1 0 1 Memory Read
1 1 0 Memory Write
1 1 1 None
Page | 7
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
The MN/𝐌𝐗 ̅̅̅̅̅ pin shows whether the 8086 microprocessor is
operating in the minimum mode or maximum mode.
̅̅̅̅̅̅
𝐁𝐇𝐄 is an acronym for Bus High Enable. The combination of the ̅̅̅̅̅̅
𝐁𝐇𝐄
signal and S7 status informs about the existence of the data on the bus.
Also, different combinations show whether the bus is containing
overall 16-bit, upper byte or lower byte of the data.
34 ̅̅̅̅̅̅/ S7
𝐁𝐇𝐄 𝐁𝐇𝐄 S7 Status
̅̅̅̅̅̅
0 0 All 16-bit data will be accessed
0 1 Upper byte of the data will be accessed
1 0 Lower byte of the data will be accessed
1 1 None or Idle
35 A16/S3, Out of 20 address bits, 4 are present in the multiplexed form with the
to A17/S4, status signals. In the case of memory operations, these pins act as an
38 A18/S5 and address bus and contain the memory address of any particular
A19/S6 instruction or data.
However, from I/O operations these pins are low that shows the status
of the processor.
Basically, the signal at S3 and S4 show that which segment is currently
accessed by the microprocessor among the four segments present in
it.
S3 S4 STATUS
0 0 Extra Segment access
0 1 Stack segment access
1 0 Code segment access
1 1 Data segment
S5: when enabled, shows the presence of an interrupts in the
microprocessor. So, basically, it serves as an interrupt flag.
S6: Shows the status of the bus master for the current operation i.e.
Whether the 8086 is the bus master or any other proficient device is
acting as the bus master.
When S6= 0; it indicates the 8086 is holding the access of the bus
otherwise it is high i.e., 1.
40 VCC The external power supply of +5V is connected to the microprocessor
Page | 8
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
̅̅̅̅̅̅
𝐃𝐄𝐍 is used for data enable and this is an active low pin.
26 ̅̅̅̅̅̅
𝐃𝐄𝐍 ̅̅̅̅̅̅
𝐃𝐄𝐍0; then the transceiver gets enabled and it separates the data from
the multiplexed address and data bus.
The 8086 microprocessor has 20 lines address bus. With 20 address lines, the memory, allowing
it to address memory of up to 220 bytes i.e. 220= 1,048,576 bytes (1 MB). 8086 can access memory
with address ranging from 00000 H to FFFFF H.
Page | 9
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
Explain the physical address, offset address and segment address in context to 8086.
AKTU Question Paper 2021-22, 2 MARKS
The starting (base) address and end address (top) of each segment are as below:
Segment Register:
The 8086 has four primary segment registers: CS (Code Segment), DS (Data Segment), SS (Stack
Segment), and ES (Extra Segment). Each of these registers holds a 16-bit value that represents
the base address of a specific segment in memory.
Offset Address:
Within each segment, memory is addressed using an offset value. The offset is a 16-bit value that
specifies the location of data or instructions within the segment. It's essentially a displacement
from the base address of the segment.
Physical Address:
The 20-bit address of a data or instructions is called its Physical Address i.e. a physical address
represents a specific location in the memory where data or instructions are stored. To calculate
the physical address of a memory location, the 8086 combines the value in the segment register
with the offset. This 20-bit physical address allows access to up to 1 MB of memory.
Page | 10
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
Rules of Segmentation
• The starting address of a segment should be such that it can be evenly divided by 16.
• Minimum size of a segment can be 16 bytes and the maximum can be 64 kB.
Solution:
The offset of the CS Register is the IP register. Therefore, the effective address of the memory
location pointed by the CS register is calculated as follows:
Physical address = (Base address of CS register X 10H) + Address of IP
Physical address = 4042 X 10H + 0580
=40420+0580
Physical address =409A0H
Page | 11
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
Example 3: Calculate the effective address for the following register: SS: 3640H, SP: 1735H, BP:
4826H
Solution:
Both SP and BP are the offsets for Stack Register (SS). The address calculated when BP is taken as
the offset gives the starting address of the stack. The address when SP is taken as the offset
denotes the memory location where the top of the stack lies.
Therefore, the effective address for both these cases is:
(SS X 10H) + SP = 3640H X 10H + 1735H
= 36400H + 1735H
= 37B35H
(SS X 10H) + BP = 3640H X 10H + 4826H
= 36400H + 4826H
= 3AC26H
Example 4: The value of the DS register is 3032H. And the BX register contains a 16-bit value
which is equal to 3032H. 0008H is added to BX. ADD BX, 0008H, the register AX contains some
value which needs to be stored at a location as follows: MOV [BX], AX
Calculate the address at which the value of the AX will be stored
Solution:
After executing the first instruction, the value of BX Register is as follows:
BX = 303AH
The BX register is an offset of the Data Segment (DS) register. So, the location at which the value
of the AX register will be stored is calculated as follows:
(DS X 10H) + BX = 3032H X 10H +303AH
= 30320H + 303AH
= 3335AH
Example 5: You are provided the following values: DS: 3056H, IP: 1023H, BP: 2322H and SP:
3029H. Can you calculate the effective address of the memory location as per the DS register?
Solution:
No, the effective address of the DS register cannot be calculated from the given values because
none of the given offset is an offset of the DS Register.
Page | 12
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
3.1.5. Addressing Modes of 8086
Discuss the various addressing modes in 8085 along-with examples.
AKTU Question Paper 2020-21, 10 MARKS
Discuss the various addressing modes available in 8086 along-with examples.
AKTU Question Paper 2021-22, 10 MARKS
The Intel 8086 microprocessor supports various addressing modes, which determine how
operands (data) are accessed or addressed in instructions. These addressing modes provide
flexibility in how data is fetched or manipulated during program execution. The commonly used
addressing modes of the 8086 are as follows:
1 Immediate In this addressing mode, the operand is a constant value specified in the
Addressing: instruction itself.
Example: MOV AX, 1234; loads the value 1234 H into the AX register.
2 Register In this addressing mode, the operand is stored in one of the CPU registers.
Addressing: Example: ADD AX, BX; adds the value in the BX register to the AX
register.
3 Direct In this addressing mode, the operand's address is directly specified in the
Addressing: instruction.
Example: MOV AX, [1592H]
MOV AL, [0A00H]; moves the value at memory address 0A00H into the
AL register.
4 Register In this addressing mode addressing mode allows data to be addressed at
Indirect any memory location through an offset address held in any of the
Addressing: following registers: BP, BX, DI & SI.
Example: MOV AX, [BX]; Suppose the register BX contains 4895H, then
the contents 4895H are moved to AX
5 Based In this addressing mode, the offset address of the operand is given by the
Addressing: sum of contents of the BX/BP registers and 8-bit/16-bit displacement.
Example: MOV DX, [BX+04]
6 Based-index In this addressing mode, the operands offset address is found by adding
addressing the contents of SI or DI register and 8-bit/16-bit displacements.
mode: Example: MOV BX, [SI+16]
7 Based In this addressing mode, the operands offset is computed by adding the
indexed with base register contents and Index registers contents and 8 or 16-bit
displacement displacement.
mode: Example: MOV AX, [BX+DI+08]
8 Scaled Index In this addressing mode, an index register is multiplied by a scaling factor
Addressing and added to a base register to form an address.
Mode Example: MOV AL, [BX+SI*2] moves the value at the memory location
pointed to by (BX+SI*2) into the AL register.
Page | 13
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
EVOLUTION OF MICROPROCESSORS:
Explain the various generations of microprocessor.
AKTU Question Paper 2022-23, 10 MARKS
Page | 14
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
As technology continues to evolve, microprocessors are expected to become more powerful,
energy-efficient, and versatile, enabling a wide range of applications in both consumer and
industrial domains.
8086 ARCHITECTURE
Draw the architecture of 8086 Microprocessors and explain its all blocks.
AKTU Question Paper 2022-23, 10 MARKS
MEMORY SEGMENTATION
Discuss the memory segmentation in 8086 and the various segments of the memory.
AKTU Question Paper 2020-21, 2 MARKS
PHYSICAL ADDRESS
Explain the physical address, offset address and segment address in context to 8086.
AKTU Question Paper 2021-22, 2 MARKS
EVOLUTION OF MICROPROCESSORS
Explain the various generations of microprocessor.
AKTU Question Paper 2022-23, 10 MARKS
Page | 15
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
PERIPHERAL DEVICES
Peripheral Devices: 8237 DMA Controller, 8255 Programmable Peripheral Interface,
8253/8254 Programmable Timer/Counter, 8259 Programmable Interrupt Controller, 8251
USART and RS 232C.
With the help of a functional block diagram and working of 8257 DMA controller.
AKTU Question Paper 2022-23, 10 MARKS
Explain Direct Memory Access (DMA).
AKTU Question Paper 2022-23, 2 MARKS
Explain Direct Memory Access (DMA).
AKTU Question Paper 2020-21, 2 MARKS
Illustrate the process of DMA with the help of 8237 DMA controller.
AKTU Question Paper 2020-21, 10 MARKS
Direct Memory Access is a process where data is transferred between two peripherals
directly without the involvement of the microprocessor.
This process employs the 2 signals HOLD and HLDA pin on the microprocessor.
HOLD: This is an active high input signal to the 8085 microprocessor from another master
requesting the use of the address and data buses. After receiving the Hold request, the
microprocessor relinquishes the buses. The Hold Acknowledge (HLDA) signal is sent out. The
microprocessor regains the control of the buses after HOLD goes low.
HLDA (Hold Acknowledge): This is an active high output signal indicating that the
microprocessor is relinquishing control of the buses.
A DMA controller uses these signals as if it were a peripheral requesting the MPU for the control
of the buses. The MPU communicates with the controller by using the Chip Select line, buses, and
control signals. Once the controller has gained control, it plays the role of a processor for data
transfer.
To perform data transfer operation, the DMA should have the following
1 a data bus,
2 an address bus,
3 Read/Write control signals, and
4 control signals to disable its role as a peripheral and to enable its role as a processor.
This process is called switching from the slave mode to the master mode.
Page | 16
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
DMA CHANNEL AND INTERFACING:
Figure 3.7 shows a logical pin out and internal registers of the 8237A and interfacing with the
8085 using a 3-to-8 decoder.
The 8237 has four independent channels, CHO to CH3. Internally, two 16-bit registers are
associated with each channel: One is used to load a starting address of the byte to be copied
and the second is used to load a count of the number of bytes to be copied.
Figure 3.7 shows eight such registers that can be accessed by the MPU. The addresses of these
registers are determined by four address lines, A3 to A0, and the Chip Select (CS) signal.
Address lines Hex
Selected Channels/Register etc.
A3 A2 A 1 A0 Address
0000 00 H CHO Memory Address Register (MAR)
0001 01 H CH0 Count Register
0010 02 H CH1 Memory Address Register (MAR)
0011 03 H CH1 Count Register
.
.
.
Page | 17
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
The address 0000 on lines A3 to A0 selects CHO Memory Address Register (MAR) and address
0001 selects the next register, CH0 Count. Similarly, all the remaining registers are selected in
sequential order. The last eight registers are used to write commands or read status as
shown in figure 3.7, the MPU accesses the DMA controller by asserting the signal Y_0 of the
decoder. Therefore, the addresses of these internal registers range from 00 to 0FH as follows:
DMA SIGNALS:
In figure 3.7: signals are divided into two groups
i. The left of the 8237 is used for interfacing with the microprocessor
ii. The right-hand side of the 8237 is for communicating with peripherals.
The signals that are necessary to understand the DMA operations are explained as follows:
CLK: Clock input to 8237. The maximum clock frequency is 5 MHz. In the 8085 system, the
processor clock is inverted and applied to CLK 8237.
CS: Logic low chip select signal. It is an input signal to select 8237 during programming mode.
RESET : Reset input to 8237. Connected to a system reset, when the RESET signal
goes high the command, status, request, and temporary registers are
cleared. It also clears the first-last flip-flop and sets the mask register.
READY : Ready input signal and it is tied to VCC for normal timings. When READY
input is tied low, the 8237 enters a wait state. This is used to get extra time
in DMA machine cycles to transfer data between slow memory and IO
devices.
HRQ : Hold request output signal. It is the hold request signal sent by 8237 to the
processor HOLD pin, to make a request for the bus to perform a DMA
transfer.
HLDA : Hold acknowledge input signal. It is the hold acknowledge signal to be sent
by the processor to inform the acceptance of the hold request.
DREQ3 – : These are the four independent, asynchronous input signals to the DMA
DREQ0 channels from peripherals such as floppy disks and the hard disk. Used by
IO devices to request for DMA to transfer.
DACK3 – : These are output lines to inform the individual peripherals that a DMA is
DACK0 granted. DREQ and DACK are equivalent to handshake signals in I/O
devices.
DB7 – DB0 : Data bus lines. These pins are used for data transfer between the processor
and DMA.
̅̅̅̅̅
𝐈𝐎𝐑 : Bidirectional IO read control signal. It is an input control signal for reading
the DMA controller during programming mode and an output control signal
for reading the IO device during DMA (memory) write cycle.
̅̅̅̅̅̅
𝐈𝐎𝐖 : Bidirectional IO writes control signal. It is an input control signal for writing
the DMA controller during programming mode and an output control signal
for writing the IO device during DMA (memory) read cycle.
EOP : End of process. It is a bidirectional low active signal. It is used either as an
input to terminate a DMA process or as an output to inform the end of the
DMA transfer to the processor. This output can be used as an interrupt to
terminate DMA.
A3 – A0 : Four bidirectional address lines. Used as input address during
programming mode to select internal registers. During DMA mode the low-
order four bits of memory address are output by 8237 on these lines.
Page | 18
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
A7 – A4 : Four unidirectional address lines. Used to output the memory address bits
A7 to A4 during DMA mode.
AEN : Address enable output signal. It is used to enable the address latch
connected to DB7 – DB0 pins of 8237. It is also used to disable any buffers in
the system connected to the processor.
ADSTB : Address strobe output signal. It is used to latch the high-byte memory
address issued through DB7 to DB0 lines by 8237 during DMA mode into an
external latch.
̅̅̅̅̅̅̅̅
𝐌𝐄𝐌𝐑 : Memory read control signal. It is an output control signal issued during a
DMA read operation.
̅̅̅̅̅̅̅̅̅
𝐌𝐄𝐌𝐖 : Memory write control signal. It is an output control signal issued during
DMA write operation.
Page | 19
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
After the transfer of the first byte, the latch is updated when the lower byte generates a carry or
borrow.
Figure 3.8 has two latches, one latch (373 #1) to latch a high-order address from the data bus by
using the AEN and ADSTB signals, and the second latch (373 #2) to demultiplex the 8085 bus and
generate the low-order address bus by using the ALE (Address Latch Enable from the 8085)
signal. The AEN signal is connected to the ̅̅̅̅
OE signal of the second latch to disable the low-order
address bus from the 8085 when the first latch is enabled to latch the high-order byte of the
address.
PROGRAMMING THE 8237:
To implement the DMA transfer, the 8237 should be initialized by writing into various control
registers discussed earlier in the DMA channels and interfacing section.
DMA OPERATION:
The DMA controller can be classified under two modes:
i. The microprocessor and peripherals such as floppy disks. The DMA plays two roles in
a given system: It is an I/O to the microprocessor (Slave Mode) and
ii. It is a data transfer processor to peripherals such as floppy disks (Master Mode).
Page | 20
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
8255 PROGRAMMABLE PERIPHERAL INTERFACE:
Explain the pin diagram of 8255 along-with the block diagram.
AKTU Question Paper 2020-21, 10 MARKS
Explain the CWR of 8255 Programmable Peripheral Interface and also discuss the BSR
mode. AKTU Question Paper 2022-23, 2 MARKS
With the help of a functional block diagram explain the organization and working of 8255
microprocessor. AKTU Question Paper 2022-23, 2 MARKS
• PPI 8255 is a general purpose programmable I/O device designed to interface the
microprocessor with its outside world such as ADC, DAC, keyboard etc.
Page | 21
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
1. DATA BUS BUFFER:
• The 8-bit bidirectional data bus buffer is used to interface the 8255 internal data bus with
the system data bus (Microprocessor).
• The direction of the data buffer is decided by read and write control signals.
• When the read is activated, it transmits data to the system data bus.
• When a write is activated, it receives data from the system data bus.
4. PORT C
• Port C consists of an 8-bit bidirectional data output latch/buffer and an 8-bit data input
buffer.
• It is divided into 2 sections, Port C upper PCU and Port C lower PCL. These two sections
can be programmed and used separately as a 4-bit I/O port.
• It can be used as
i. Simple I/O
ii. Handshake signals
iii. Status signal inputs.
• Port C is used in combination with port A & Port B for both the status and handshaking
signals.
Page | 22
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
BSR (BIT SET RESET MODE):
The content of the control word register will be as follows, when used in the BSR mode
Mode 1:
• In this mode, input or outputting of data is carried out by taking the help of handshaking
signals, also known as strobe signals. The basic features of this mode are:
• Ports A and B can function as 8-bit I/O ports, taking the help of pins of Port C.
• I/Ps and O/Ps are latched.
• Interrupt logic is supported.
• Handshake signals are exchanged between CPU and peripheral prior to data transfer.
• In this mode, Port C is called status port.
• There are two groups in this mode Group A and Group B. They can be configured
separately. Each group consists of an 8-bit port and a 4-bit port. This 4-bit port is used for
handshaking in each group.
Mode 2:
• In this mode, the ports can be utilized for the bidirectional flow of information by
handshaking signals.
• The pins of group A can be programmed to acts as bidirectional data bus and the Port C
upper (PC7 – PC4) are used by the handshaking signal. The rest 4 lower Port C bits are
utilized for I/O operations.
• Port B can be programmed in mode 0 & 1 and in mode 1 the lower bits of Port C of group
B are used for handshaking signals.
• It also has interrupt handling capacity.
Page | 24
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
These are 8-bit bi-directional data bus lines, connected to the system
D0-D7 Data Bus
data bus for data transfer between CPU and 8255.
It is the signal used for read operation. A low signal at this pin shows
̅̅̅̅
𝐑𝐃 Read that CPU is performing read operation at the ports or status word
through data buffer.
It is the signal used for write operation. A low signal at this pin allows
̅̅̅̅̅
𝐖𝐑 Write the CPU to perform write operation over the ports or control register
of 8255 using the data bus buffer.
Address These are basically used to select the desired port among all the
A0-A1
lines ports of the 8255. i.e. Port A, Port B, Port C, and Control register.
This is an active HIGH input signal used to reset 8255. When 8255 is
RESET Reset reset, it clears the control word register and all ports are set to input
mode.
These are 8-bit bidirectional I/O pins used to send data to the
PA0- Port A pins
peripheral or to read data from the peripheral. The contents are
PA7 0 to 7
transferred to/from Port A.
Port B pins
PB0-PB7 These are 8-bit bidirectional I/O pins used the same as PA0-PA7
0 to 7
These are 8-bit bidirectional I/O pins. These lines are divided into 2
Port C pins sections i.e. PC0-PC3 and PC4-PC7. These two sections can be
PC0-PC7
0 to 7 individually used to transfer 4 bits of data from two separate port C
sections.
The Intel 8253 Programmable Interval Timer (PIT) is timing device commonly used in
microprocessor-based systems to generate precise time delays and control events. It provides
a reliable and accurate timing reference for various applications.
The Intel 8253 and 8254 are Programmable Interval Timers (PTIs) designed for microprocessors
to perform timing and counting functions using three 16-bit counters each capable of handling
clock inputs up to 10 MHz. Each counter has 2 input pins, i.e. Clock & Gate, and 1 pin for “OUT”
output. To operate a counter, a 16-bit count is loaded in its register. On command, it begins to
decrement the count until it reaches 0, then it generates a pulse that can be used to interrupt
the CPU.
Page | 25
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
In the above figure, there are three counters, a data bus buffer, Read/Write control logic, and a
control register. Each counter has two input signals - CLOCK & GATE, and one output signal - OUT.
Read/Write Logic:
It includes 5 signals, i.e. RD, WR, CS, and the address lines A0 & A1. In the peripheral I/O mode,
the RD and WR signals are connected to IOR and IOW, respectively. In the memory mapped I/O
mode, these are connected to MEMR and MEMW. Address lines A0 & A1 of the CPU are connected
to lines A0 and A1 of the 8253/54, and CS is tied to a decoded address. The control word register
and counters are selected according to the signals on lines A0 & A1.
̅𝐂𝐒
̅̅̅ A1 A0 OPERATION
0 0 0 Counter 0
0 0 1 Counter 1
0 1 0 Counter 2
0 1 1 Control Word Register
COUNTERS:
Each counter consists of a single, 16 bit-down counters, which can be operated in either binary
or BCD. Its input and output are configured by the selection of modes stored in the control word
register. The programmer can read the contents of any of the three counters.
Page | 26
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
Control Word Register:
This register is accessed when lines A0 & A1 are at logic 1. It is used to write a command word,
which specifies the counter to be used, its mode, and either a read or write operation. Following
table shows the result for various control inputs.
OPERATION OF 8253:
The functions of the 8253/54 can be described by Write and Read operation.
WRITE Operation:
• Write a control word into control register.
• Load the low-order byte of a count in the counter register.
• Load the high-order byte of count in the counter register.
READ OPERATION:
1. Simple Read:
It involves reading a count after inhibiting the counter by controlling the gate input or the
clock input of the selected counter, and two I/O read operations are performed by the
CPU. The first I/O operation reads the low-order byte, and the second I/O operation reads
the high order byte.
Page | 27
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
The Description and operation of various modes of timer are depicted in the figures below.
This is used for event counting. After writing the control word, OUT is low at first. It will remain
low until the counter reaches 0, it is decremented by 1 after each clock cycle. Then the OUT
goes high, and remains high until a new count is there or a new Mode 0 control word is written
into the counter. The GATE=1 indicates enable counting, and 0 indicates disable counting.
Page | 28
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
OUT will be high at first, it will go low on the clock pulse following a trigger to begin the one-
shot pulse. It will remain 0 until the counter reaches 0.
Page | 29
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
Initially OUT is low. When the counting is enabled, it goes HIGH. This process repeats
periodically. This mode is used as frequency divided.
If the GATE is 1, then the counting is enabled, otherwise it is disabled. This mode is used to
generate the square wave. The time period is equal to count. If the count is even, the on-time of
wave is count/2. Otherwise on-time is (count+1)/2 and off-time is (count-1)/2.
Page | 30
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
MODE 4: SOFTWARE TRIGGERED STROBE
1. The output will be initially high
2. The output will go low for one CLK pulse after the terminal count (TC).
If the GATE is 1, then the counting is enabled, otherwise it is disabled. Initially OUT value is
high and go low when count is at the last stage. The count is reloaded again for subsequent
clock pulse.
Page | 31
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
Initially OUT value is high. The counting is triggered by the rising edge of the Gate (Clock pulse).
When initial count is expired the OUT becomes low for one clock pulse, then high again. After
writing the control word and the initial count, the counter will not be loaded until clock pulse
after one trigger.
Intel 8253 is a 24 Pin programmable IC. It has three counters which work independently and
whose width is of 16-bits.
VCC and GND These are the Power supply and ground pins which 8253 uses +5V as power
supply
D7-D0 These are 8-bit bidirectional data bus lines, connected to the system data bus
for data transfer between 8085 and 8254.
̅̅̅̅
RD ̅̅̅̅=0, the microprocessor reads the data from the
It is active low pin. When 𝐑𝐃
Selected counter
̅̅̅̅̅
WR It is active low pin. When ̅̅̅̅̅ 𝐖𝐑=0, the microprocessor writes into
counter/control register i.e. writes control information/loading of counters.
A1 & A0 A1 & A0 pins are connected to the address bus. These pins are used for the
selection of counters and control word register.
A1 A0 OPERATION
0 0 Counter 0
0 1 Counter 1
1 0 Counter 2
1 1 Control Word Register
̅̅̅
CS ̅̅̅= 0 then 8254
This is an active low input signal, used to select the 8254 IC. If CS
will be active and take part in data transfer from/to 8085 otherwise 8254 will
be in the de-active state.
Page | 32
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
Gate0 Controls function of counter 0 (i.e. gate terminals for triggering purpose)
Gate1 Controls function of counter 1 (i.e. gate terminals for triggering purpose)
Gate2 Controls function of counter 2 (i.e. gate terminals for triggering purpose)
APPLICATIONS OF 8253/8254:
• To generate an accurate time delay
• As an event counter
• Square wave generator
• Rate generator
• Digital one shot
FEATURES OF 8253/54:
The most prominent features of 8253/54 are as follows:
• It has three independent 16-bit down counters.
• It can operate from DC up to 10MHz.
• The three counters can be programmed for either binary or BCD count.
• It is compatible with almost all microprocessors.
• 8254 has a powerful command called READ BACK command, which allows the user to
check the count value, the programmed mode, the current mode, and the status of the
counter.
• Counters can be programmed in six different modes.
Page | 33
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
8259 PROGRAMMABLE INTERRUPT CONTROLLER:
The 8259 is a programmable interrupt controller specially designed to work with Intel
microprocessor 8080, 8085, 8086, 8088. The main features of 8259 programmable interrupt
controller are given below:
1. It can handle eight interrupt inputs. This is equivalent to providing eight interrupt pins
on the processor in place of one INTR (in 8085)/INT (in 8086) pin.
2. The chip can vector an interrupt request anywhere in the memory map from 0000H to
FFFFH in 8085 microprocessor. However, all the eight interrupts are spaced at an interval
of either four or eight locations. This eliminates the major drawback of 8085 interrupts
in which all interrupts are vectored to memory location on page 00H i.e., TRAP, RST7.5,
RST6.5 and RST5.5 are vectored to memory locations 0024H, 003CH, 0034H and 002CH
respectively.
3. It can resolve eight levels of interrupt priorities in a variety of modes. The priorities of
interrupts can be changed under running condition. Some of the desired lower priority
interrupts may be allowed to be acknowledged during the service of higher priority
interrupts.
4. Each of the interrupt requests can be masked individually similar to RST7.5, RST6.5 and
RST5.5 interrupts of 8085.
5. The status of pending interrupts, in service interrupts, and masked interrupts can be read
at any time similar to RST interrupts of 8085.
6. The chip can be programmed to accept interrupt requests either as level triggered or edge
triggered interrupt request unlike your RST interrupts where some are edge triggered
and some are level triggered. However, all interrupts must be either level triggered or
edge triggered.
7. If required, nine 8259 can be cascaded in a master-slave configuration mode to handle 64
interrupt inputs. In this case, the interrupting devices send their interrupt requests either
to slave 8259 or to master 8259 directly. The slave 8259 send their interrupt to master
interrupt request inputs and the master will send a single interrupt to microprocessor
interrupt pin INTR/INT.
INTERRUPT REQUEST REGISTER (IRR): The interrupts at IRQ input lines are handled by
Interrupt Request Register internally. IRR stores all the interrupt requests in it in order to serve
them one by one on the priority basis.
IN-SERVICE REGISTER (ISR): This register stores all the interrupt requests those are being
served, i.e. ISR keeps a track of the requests being served.
Page | 34
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
PRIORITY RESOLVER: This unit determines the priorities of the interrupt requests appearing
simultaneously. The highest priority is selected and stored into the corresponding bit of ISR
during INTA pulse. The IR0 has the highest priority while the IR7 has the lowest one, normally in
fixed priority mode. The priorities however may be altered by programming the 8259 in rotating
priority mode.
INTERRUPT MASK REGISTER (IMR): This register stores the bits required to mask the interrupt
puts. IMR operates on IRR at the direction of the Priority Resolver.
INTERRUPT CONTROL LOGIC: This block manages the interrupt and interrupt acknowledge
signals to be sent to the CPU for serving one of the eight interrupt requests. This also accepts
interrupt acknowledge (INTA) signal from CPU that causes the 8259 to release vector address on
to the data bus.
DATA BUS BUFFER: This tristate bidirectional buffer interfaces internal 8259 bus to the
microprocessor system data bus. Control words, status and vector information pass through
buffer during read or write operations.
READ WRITE CONTROL LOGIC: This circuit accepts and decodes commands from the CPU. This
also allows the status of the 8259 to be transferred on to the data bus.
CASCADE BUFFER/COMPARATOR: This block stores and compares the ID's of all the 8259 used
in the system. The three I/O pins CAS0-2 are outputs, when the 8259 is used as a master. The
same pins act as inputs when the 8259 is in slave mode. The 8259 in master mode sends the ID
of the interrupting slave device on these lines. The slave thus selected, will send its pre-
programmed vector address on the data bus during the next INTA pulse.
INTERRUPT SEQUENCE:
The powerful features of the 8259 in a microcomputer system are its programmability and the
interrupt routine addressing capability. The latter allows direct or indirect jumping to the specific
interrupt routine requested without any polling of the interrupting devices. The normal sequence
of events during an interrupt depends on the type of CPU being used. The events occur as follows
in an 8085 system:
1. One or more of the INTERRUPT REQUEST lines (IR7-0) are raised high, setting the
corresponding IRR bit(s).
2. The 8259 evaluates these requests, and sends an INT to the CPU, if appropriate.
3. The CPU acknowledges the INT and responds with an INTA pulse.
4. Upon receiving an INTA from the CPU group, the highest priority ISR bit is set, and the
corresponding IRR bit is reset. The 8259 will also release a CALL instruction code
(11001101) onto the 8-bit Data Bus through its D7-0 pins.
5. This CALL instruction will initiate two more INTA pulses to be sent to the 8259A from the
CPU group.
6. These two INTA pulses allow the 8259 to release its preprogrammed subroutine address
onto the Data Bus. The lower 8-bit address is released at the first INTA pulse and the
higher 8-bit address is released at the second INTA pulse. 7. This completes the 3-byte
CALL instruction released by the 8259. In the AEOI mode the ISR bit is reset at the end of
the third INTA pulse.
7. Otherwise, the ISR bit remains set until an appropriate EOI command is issued at the end
of the interrupt sequence.
When the 8259 PIC receives an interrupt, INT becomes active and an interrupt acknowledge cycle
is started. If a higher priority interrupt occurs between the two INTA pulses, the INT line goes
inactive immediately after the second INTA pulse. After an unspecified amount of time the INT
line is activated again to signify the higher priority interrupt waiting for service. This inactive
time is not specified and can vary between parts.
Page | 35
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
PIN DIAGRAM OF 8259:
Page | 36
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
8251 USART & RS 232C:
Data Bus Buffer: It basically interfaces the 8251 with the internal system buses of the processor.
The data bus buffer has 8-bit bidirectional data bus that allows the transfer of data bytes, status
or command word between the processor and external devices.
Read/Write Control Logic: This functional unit generates a control signal for the operation of
8251 according to the signal present in the control bus of the processor. Basically, it performs
decoding operation of the control signal produced by the processor, so that respective operation
can be performed by the USART.
The control formats for system operation is stored in control and command word registers
present in the read/write logic unit.
The signals handled by the read/write control logic unit are discussed below:
• CS: It is chip select. A low signal at this pin shows that processor has selected 8251 in order
to communicate with the peripheral devices.
• C/D: As the system has control, status and data register. So, when a high signal is present at
this pin then control or status register is addressed. While in case of low signal data register
is addressed.
• RD and WR: Both read and write are active low signal pins. A low signal at RD shows that the
processor is reading the control, status or data bytes from the 8251. While at WR indicates
the write operation over the data bus of 8251.
• CLK and RESET: CLK stands for clock and it produces the internal timing for the device. While
an active high signal at the RESET pin puts the 8251 in the idle mode.
Page | 37
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
3. Transmit Buffer: This unit is used to change the parallel data received from the CPU into serial
data by inserting the necessary framing information. Once the data is transformed into serial
form, then in order to transmit it to the external devices, it is provided to the TxD pin of the 8251.
This unit consists of 2 registers. These are as follows:
• Buffer register: Basically, the data provided by the processor is stored in the buffer register.
As we know that initially, the CPU provides parallel data to 8251. So, the processor loads the
parallel data to the buffer register. Further, this data is fed to the output register.
• Output register: The parallel data from the buffer register is fed to the empty output register.
This register changes the 8-bit parallel data into a stream of serial bits. Then further the serial
data is provided at the TxD pin so as to have its transfer to the peripheral device.
It performs both synchronous and asynchronous transmission and reception. Thus, in case of
asynchronous transmission, start and stop bit is added by the transmitter in order to notify the
external devices about the data transmission.
But in case of synchronous transmission, the clock signal is used thus there exists no need of
adding additional bits expect the parity bit (if required).
4. Transmit Control: As the name of the unit is itself indicating that it is controlling the
transmission action. And it does so by accepting and sending signals both externally and
internally.
The various control signal generated by this unit are as given below:
• TxRDY: It implies transmit ready. This signal is used to notify the processor that the buffer
register of the 8251 is empty and ready to accept the data.
• The status read operation is utilized by the processor in order to check the presence of the
signal.
• TxE: This stands for transmitter empty. It is an active high signal that indicates that the output
buffer is empty and thus data received from the processor can be loaded to it for conversion.
• TxC: It stands for transmitter clock and is an active low pin. It controls the rate of character
transmission by the USART.
• However, 8251 offers programmable clock rate. As by writing appropriate mode word in the
mode set register the clock division can be programmed.
5. Receive Buffer:
• This unit takes the serial data from the external devices, changes the serial data into the
parallel form so that it can be accepted by the processor. It consists of 2 registers: receiver
input register and buffer register.
• When the external device is ready to send the data to the 8251 then it sends a low signal
to the RxD line of the 8251. In asynchronous mode, once 8251 receives a low signal it
considers that signal as start bit of the data.
• So, once the start bit is successfully accepted by 8251, then it also receives the whole data
bits in serial form along with parity and stop bits.
• Once the data is received by the receiver input register then it converts the data bits in
parallel form and sends it to the receiver buffer register.
• In case of the synchronous mode of operation, according to the clock input, the external
device loads the serial data bits in the receiver input register. And on converting the serial
data to parallel format the receiver input register sends the data to the buffer register.
6. Receiver Control
This unit controls the operation of the receiver buffer. It manages the data reception, along with
that it also detects the presence of false start bit, error in parity bit, framing errors etc.
• RxRDY: It stands for receiver ready. When this signal goes high then it indicates that the
receiver buffer register is holding the data and is ready to transfer it to the processor. Once
the CPU reads the data sent by the 8251 then this pin is reset.
• RxC: It stands for receiver clock. This clock signaling controls the rate at which the 8251
receives the data in the synchronous mode of operation. It is provided by the modem and is
equal to the baud rate. While asynchronous mode offers the clock rate as 1, 16 or 64 times of
the baud rate as it is programmable.
Page | 38
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
7. Modem Control: This unit of 8251 holds input and output control signals that simplify the
operation of the whole system. The control circuitry for handing various signals is provided by
the modem control unit. It includes DTS, RTS, DTR and CTS.
These are all active low signals.
• DSR: Stands for data set ready and the signal is used to check whether the data set is ready or
not when the processor is in the urge of communication.
• DTR: Implies data terminal ready. An active-low signal at this pin shows that the 8251 is now
ready to accept the data from the processor.
• RTS: It stands for the request to send. A low signal shows an assertion for data transmission.
• CTS: Clear to send. When 8251 receives a low signal at this pin then it clears all the data
present in the modem in order to allow further communication.
RS232C
Pin Description
1 Data carrier detect (DCD)
2 Received data (RxD)
3 Transmitted data (TxD)
4 Data terminal ready (DTR)
5 Signal ground (GND)
6 Data set ready (DSR)
7 Request to send (RTS)
8 Clear to send (CTS)
9 Ring indicator (Rl)
RS232 is an Interface and the protocol between DTE (data terminal equipment) and DCE (data
communication equipment) using serial binary data exchange. Here C is used for the current
version. Universal Asynchronous Data Receiver & Transmitter (UART), attached in a
motherboard, used in connection with RS232 for transmitting data to any serial device like
modem or printer from its DTE interface.
Figure: RS 232C
ELECTRICAL SPECIFICATIONS:
1. Voltages:
There can be two states in the signal level of RS232C pins.
• Mark state – It is the high bit which is represented by binary 1 and have negative
voltages. Its voltage limits for transmitting signal ranges from -5 to -15V. Its voltage
limits for receiving signals ranges from -3 to -25V.
Page | 39
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
• Space state – It is the low bit which is represented by binary 0 and have positive
voltages. Its voltage limits for transmitting signal ranges from +5 to +15V. Its voltage
limits for receiving signals ranges from +3 to +25V.
4. Current:
Maximum current rating is 3Amps at the maximum operating voltage of 250V AC.
WORKING OF RS 232C:
RS232C requires 25 pins connector for connecting DTE and DCE. Here is the list of pins and
signals of RS232C and the connection between DTE and DCE using drivers and receivers.
1. Data Carrier Detect: After a data terminal is detected, a signal is sent to the data set that is
going to be transmitted to the terminal.
2. Received Data: The data set receives the initial signal via the receive data line (RxD).
3. Transmitted Data: The data terminal gets a signal from the data set, a confirmation that
there is a connection between the data terminal and the data set.
4. Data Terminal Ready: A positive voltage is applied to the data terminal ready (DTR) line, a
sign that the data terminal is prepared for the transmission of data.
5. Signal Ground: A return for all the signals on a single interface, the signal ground (SG) offers
a return path for serial communications. Without SG, serial data cannot be transmitted
between devices.
6. Data Set Ready: A positive voltage is applied to the data set ready (DSR) line, which ensures
the serial communications between a data terminal and a data set can be completed.
Page | 40
Microprocessor & Microcontroller Unit-3: 16-bit Microprocessor and Peripheral devices
7. Request to Send: A positive voltage indicates the request to send (RTS) can be performed,
which means the data set is able to send information to the data terminal without
interference.
8. Clear to Send: After a connection has been established between a data terminal and a distant
modem, a clear to send (CS) signal ensures the data terminal recognizes that communications
can be performed.
9. Ring Indicator: The ring indicator (RI) signal will be activated if a modem that operates as
a data set detects low frequency. When this occurs, the data terminal is alerted, but the RI
will not stop the flow of serial data between devices.
HANDSHAKING:
Before the actual data transfer, signals are transmitted from DTE to DCE in order to make
connections by a process known as handshaking. Following is the sequence of signal
handshaking:
• Initially, the computer activates RTS signal to modem when a data is transferred from
computer to modem.
• Modem in turn activates the DCD and then the CTS gets activated.
• Computer then sends data on TXD. After the data transmission is completed, the computer
deactivates the RTS which causes the modem to deactivate CTS.
APPLICATIONS:
It is used in establishing communication between the computer and embedded systems.
1. Due to its lower costs, it plays a vital role in CNC machines and servo controllers
2. Some microcontroller boards and PLC machines uses RS232C.
3. RS232C ports are used to communicate in headless systems in the absence of any network
connection.
4. Many Computerized Numerical Control Systems are containing RS232C port.
Page | 41