Interfacing IC
Interfacing IC
8251 8259
Microprocessor
Or
CPU
Assume that the data is transmitted from transmitter to receiver from LSB,
for every single byte start and stop bits will be present so overhead ( extra
data is more) . The number of stop bits can be set by control word in 8251.
8253/54-ProgrammableTimer/Counter
Modes of operation:
1. Mode0- Interrupt on terminal count
2. Mode1- Programmable one shot/hardware
re-triggerable
3. Mode2- Rate generator
4. Mode3- Square wave generator
5. Mode4- Software triggered strobe
6. Mode5- Hardware triggered strobe
Modes & similarities
• Count & Gate signal is required to start the mode, in some
modes when GATE is on/off , its count changes at o/p.
Mode-0: When GATE—1, count loaded, in next clock for every one
clock, count decrements and finally an interrupt is generated. If
GATE-0, while running , count also stops for that many clocks ,
when GATE – 1 again , count starts.
Mode-1 : Even the count is loaded, GATE –1(must), then only count
starts decrementing, if GATE is off while running, count continues
but when GATE is on , then count restarts again , that is why it is
known as re-triggerable.
Mode-5 : Similar to Mode-1 , except that a strobe signal is
generated.
Mode -2 : When count starts, in the last clock , o/p is low for
one clock period but this mode is auto-reloadable, again the
count starts and continues.
Mode-3 : If the count is odd then o/p will be n+1/2 clocks high
and n-1/2 clocks low.
If the count is even then n/2 clocks , o/p will be high and n/2
clocks o/p will be low.
O/P 3 2 1 0
O/P COUNT
3 STOPS 2 1 0
WRn 3
GATE
O/P 3 2 1 0
GATE
O/P 3 2 3 2 1 0
WRn 3
3 2 1 3 2 1
O/P 0 0
GATE
O/P
3 2 3 2 1 0
WRn 3
1 1 1
0 0
O/P
1 1 1 1
O/P
WRn 3
3 2 1 0
O/P
STROBE
GATE
O/P
COUNT
3 STOPS 2 1 0 STROBE
WRn 3
GATE 3 2 1 0
O/P
GATE
O/P
3 2 3 2 1 0
34 Q. What do mean by handshaking
signals . Explain with example using 8255
PPI
• 8255-PPI/PIO
-Programmable Peripheral Interface or
Parallel i/p o/p device
Features:
Has 24 i/o lines , i.e 3 ports-PortA,PortB,PortC
Port C- can be 4bit/ 8 bit Port
Group A signals->PA and PC7- PC4
Group B signals-> PB and PC3- PC0
Select lines A1 and A0 are used to select port
and CWR(Control Word Register)
CS A1 A0 SELECTION
0 0 0 PORT-A
0 0 1 PORT-B
0 1 0 PORT-C
0 1 1 CWR
Modes of operation
1.BSR Mode: Bit Set Reset Mode
Only Port C pins can be used to make 0/1
2.I/O Mode
Mode 0: Simple I/O mode
Any ports can be used as i/p or o/p
Mode 1: Strobed I/O mode
(strobed mode indicates , communication with
acknowledgements).
PA and PB ---- i/p or o/p
PC--- Control/ Handshake signals for PA & PB
Mode 2: Strobed Bi-directional I/O Mode
PA–> Bi-Directional Port
PB-> i/p or o/p port
PC- >to generate control signals.
Ex : BSR mode .
find control word to ‘set’ PC7.
D7 – D0 bits in control word would be
0 0 0 0 1 1 1 1 = 0 FH loaded into control word
register.
INTR STB
INTR i/p
Device
IBF
8255
8085
OBF
o/p Device
ACK
8085 8259
INTA INTA
IR7 I/O 8
IR0
8085 8259
MASTER
IR0
INTA INTA
IR7 8259
SLAVE IR7
Pipelining Technique:
More than one instruction can be at different
stages of execution at a single interval of time, so
speed increases.
36 Q. Explain the significance of
effective address calculation in 8086
Memory Segmentation
• 1 MB of memory is divided into 16 logical segments
of each 64KB.
• Base Address: It indicates the starting location of a
particular segment. It is present in Segment
registers.
• Offset Address : It is the distance of required
memory location from the beginning of the
segment. It is present in offset or index registers.
• Physical/Effective Address: It is the distance of
required memory location from the beginning of
memory.
• Physical address calculation:
1. Shift the Base/Segment address by 4 bit
locations left or 1 hexadecimal digit.
Shifting is equalent to multiplying CS by 10H.
2.Add the offset address to the shifted segment
value.
Ex: CS 9000H & IP 0FFF H
90000 H
+ 0FFF H
90FFF H
Effective Adrs Base Adrs 1MB
00000H 0000H 0000h
64KB
0FFFFH FFFFh
1000H
10000H 0000h
64KB
FFFFh
2000H
0000h
64KB
FFFFh
F000H
0000h
64KB
FFFFFH
FFFFh
Registers to point Segment and offset addresses
1. Code Segment: To store program or code
Base Address : CS
Offset Address: IP
2. Data Segment: To store Data
Base Address : DS
Offset Address: BP/BX
3. Stack Segment: To store temporary data
Base Address : SS
Offset Address :SP
4. Extra Segment: Alternate Data segment
Base Address : ES
Offset Address: SI/DI
Range of segment address- 0000H to F000H
Range of offset address 0000H to FFFFH
Addressing modes
• There are two types of instructions in 8086
1.Sequential flow ---8 modes
2. Control transfer--- 4 modes
Effective address: DS * 10H + offset address
1. Immediate --MOV AL, 80H; MOV AX,8000H
2. Direct ---MOV AL, [8000H]
3. Register---MOV AL, BL; MOV AX,BX
4. Register Indirect---MOV AL, [BX]
5. Register relative---MOV AL, 06H[BX]
6. Indexed---MOV AL, [SI]
7. Based Indexed--- MOV AL, [BX][SI]
8. Relative based indexed -- MOV AL, 07H[BX][SI]
Ex: Mathematically effective address can be
written as DS * 10H + offset address for data
segment.
Control transfer:
1. Intra segment – Program control is transferred
within the same segment
2. Inter segment – Program control is transferred
from one segment to another.
Important Pins in 8086
• ALE – Address latch enable
1; All 20 line --- As address bus
0; A19 – A 16 status signals
AD15 – AD0 Data bus
AD15 – AD8 : Higher byte of Data bus
AD7 – AD0 : Lower byte of Data bus
BHE- Bus high enable,
-- 0; If AD15 – AD8 are used for Data/Address .
BHE is used along with A0 line for selecting the even or odd bank of
memory
BHE A0
0 0 --- whole word (Two bytes)
0 1 --- odd bank byte
1 0 ---- even bank bye
1 1 --- Not used
• DT/R–> Data transmit or receive for bidirectional
buffers
-- 0: Receive ; 1: transmit
• DEN To enable the data buffers when data is
transmitted through AD15 – AD0 lines
• LOCK –> o/p signal , which indicates that Mp is
executing some important instruction having lock
prefix and buses can not be used by other system.
• TEST 0: then only processor executes further
instruction, used with WAIT instruction.
Miscellaneous topics(for IES)
• Communication Interfaces
• Disadvantage of RS232C:
Slow in operation and can’t support voice data
synchronously
• Synchronous serial transfer protocols:
USART-Universal Synchronous Asynchronous
Receiver and Transmitter
SPI- Synchronous Peripheral Interface bus
IIC- Inter-Integrated circuit bus
CAN –Control Area Network bus
USB-Universal Serial Bus
SPI
Clock source is supplied only by transmitting device
Receiving device must accept clock
Transmitting Unit- Master
Receiving Unit – Slave
Uses 3 wires for communication apart from the
ground.
MOSI: Master out slave in
MISO: Master in slave out
SCK : Clock source from master
SS : Slave select pin
IIC BUS
2 Wire synchronous bus with
SCK—Clock signal(by Master)
SDA– Data signal by both Master and slave
Used for inter IC Communication applications
Doesn’t require decoders as 7 bit address is
given for identifying slave
Multi master capability
CAN
Developed by BOSCH –For multi-master
broadcast system having 1mega bit per sec
Used for Automotive industry to replace complex
wiring with 2 wire bus
Has robust noise immunity and fault tolerance
A node in the bus may have a Microcontroller,
CAN controller, CAN transceiver
Uses 4 different message types:
Data frame, remote frame , error frame and overload
frame
Suitable in applications requiring large short
messages with high reliability
CAN is message based not address based
USB
Advantages
1. One interface for many devices
2. Automatic configuration
3. No power supply required
4. Loss less data transfers
5. Speed can be up to 1.5 Mbps to 480 Mbps
6. Low power consumption
7. It is a packet based protocol- start frame ,
transactions and handshake signals with ack and
nak controls
8. Has 4 wires-Gnd, 2 data, power supply
Reference Books for Microprocessor:
8085: Ramesh .S. Gaonkar or B.Ram
8086: A.K.Ray
Interfacing IC’s: Data sheets ,Material given in the lectures
& Reference books.