Unit 03
Unit 03
com
2/17/2008
2/17/2008
www.Vidyarthiplus.com
www.Vidyarthiplus.com
2/17/2008
Port B
2/17/2008
Two Modes Bit Set/Reset (BSR) mode is used to set or reset the bits in port C I/O mode Mode 0 Mode 1 Mode 2 In mode 0 all ports function as simple I/O ports Mode 1 is a handshake mode whereby ports A and/or B use bits from port C as handshake signals. Handshake mode (two types of I/O data transfer) status check & interrupt In Mode 2, port A can be set up for bidirectional data transfer using handshake signals from port C and port B can be set up in either Mode 0 or Mode1. 2/17/2008
www.Vidyarthiplus.com
www.Vidyarthiplus.com
2/17/2008
Modes of 8255
D7 D6 0/1
BSR Mode (Bit set/Reset) For Port C No effect on I/O mode Mode 0 Simple I/O For ports A,B and C
D5 D4 D3
D2 D1
D0
I/O Mode
Mode 1 Handshake I/O for ports A and/or B Port C bits are used for handshake
Mode 2 Bidirectional data bus for port A Port B either in Mode 0 or 1 Port C bits are used for handshake
2/17/2008
Pin Configuration
2/17/2008
www.Vidyarthiplus.com
www.Vidyarthiplus.com
2/17/2008
Signals of 8255
2/17/2008
It has a 40 pins of 4 groups. 1. Data bus buffer 2. Read Write control logic 3. Group A and Group B controls 4. Port A, B and C Data bus buffer: This is a tristate bidirectional buffer used to interface the 8255 to system data bus. Data is transmitted or received by the buffer on execution of input or output instruction by the CPU. Read/Write control logic: This unit accepts control signals ( RD , WR ) and also inputs from address bus and issues commands to individual group of control blocks ( Group A, Group B). 2/17/2008
www.Vidyarthiplus.com
www.Vidyarthiplus.com
2/17/2008
2/17/2008
RD(active low): Read signal enables the read operation. When this signal is low, the MPU reads data from a selected I/O port of the 8255 WR(active low): Write control signal enables the write operation. When this signal is low, the MPU writes into a selected I/O port or the control register RESET(active high): This signal clears the control register and sets all ports in the input mode. CS,A0 and A1: Device select signals: chip select is connected to a decoded address and A0 and A1 are generally connected to MPU address lines respectively
2/17/2008
www.Vidyarthiplus.com
www.Vidyarthiplus.com
2/17/2008
2/17/2008
The CS signal is the master chip select & A1 and A0 specify one of the I/O ports
CS 0 0 0 0 1
A1 0 0 1 1 X
A0 0 1 0 1 X
2/17/2008
www.Vidyarthiplus.com
www.Vidyarthiplus.com
2/17/2008
Group A and Group B controls : These block receive control from the CPU and issues commands to their respective ports. Group A - PA and PCU ( PC7 PC4) Group B PB and PCL ( PC3 PC0) Control word register can only be written into & no read operation of the CW register is allowed.
2/17/2008
a) Port A: This has an 8 bit latched/buffered O/P and 8 bit input latch. It can be programmed in 3 modes mode 0, mode 1, mode 2. b) Port B: This has an 8 bit latched / buffered O/P and 8 bit input latch. It can be programmed in mode 0, mode1. c) Port C : This has an 8 bit latched input buffer and 8 bit out put latched/buffer. This port can be divided into two 4 bit ports and can be used as control signals for port A and port B. it can be programmed in mode 0.
2/17/2008
www.Vidyarthiplus.com
www.Vidyarthiplus.com
2/17/2008
2/17/2008
CONTROL WORD
The contents of the control register called the control word specify an I/O function for each port. This register can be accessed to write a control word when A0 & A1 are at logic 1 Control word register can only be written into and no read operation of the CW register is allowed. Bit D7 of the control register specifies either the I/O function or the Bit Set/Reset function. If Bit D7 =1, bits D6- D1 determine I/O functions in various mode If bit D7 = 0, port C operates in the Bit Set/Reset(BSR)mode.
2/17/2008
www.Vidyarthiplus.com
www.Vidyarthiplus.com
2/17/2008
2/17/2008
2/17/2008
www.Vidyarthiplus.com
www.Vidyarthiplus.com
2/17/2008
2/17/2008
2/17/2008
www.Vidyarthiplus.com
10
www.Vidyarthiplus.com
2/17/2008
2/17/2008
2/17/2008
www.Vidyarthiplus.com
11
www.Vidyarthiplus.com
2/17/2008
2/17/2008
2/17/2008
www.Vidyarthiplus.com
12
www.Vidyarthiplus.com
2/17/2008
IBF(Input Buffer Full):This signal is an acknowledgement by the 8255A to indicate that the input latch has received the data byte. This is reset when the MPU reads the data INTR(Interrupt Request): This is an output signal that may be used to interrupt the MPU. This signal is generated if STB,IBF and INTE(Internal flip-flop) are all at logic 1. This is reset by the falling edge of the RD signal. INTE(Interrupt Enable): This is an internal flip-flop used to enable or disable the generation of the INTR signal. The two flip flops INTEA and INTEB are set/reset using the BSR mode. The INTEA is enabled or disabled through PC4 & INTEB is enabled or disabled through PC2.
2/17/2008
2/17/2008
www.Vidyarthiplus.com
13
www.Vidyarthiplus.com
2/17/2008
2/17/2008
www.Vidyarthiplus.com
14
www.Vidyarthiplus.com
2/17/2008
2/17/2008
2/17/2008
www.Vidyarthiplus.com
15
www.Vidyarthiplus.com
2/17/2008
2/17/2008
2/17/2008
www.Vidyarthiplus.com
16
www.Vidyarthiplus.com
2/17/2008
2/17/2008
2/17/2008
www.Vidyarthiplus.com
17
www.Vidyarthiplus.com
2/17/2008
REFERENCES
Microprocessor Architecture, Programming and Applications Ramesh Gaonkar Intel 8255 datasheet www.DatasheetCatalog.com
2/17/2008
2/17/2008
www.Vidyarthiplus.com
18
www.Vidyarthiplus.com
2/17/2008
Introduction
8254 programmable interval timer/counter is functionally similar to software designed counters and timers
Generates accurate time delays can be used for applications such as a real time clock, event counter, digital one-shot, square wave generator & a complex waveform generator Includes 3 identical counters that can operate in any one of 6 modes
2/17/2008
Introduction(cont.)
A 16 bit count is loaded in its register and, on command, begins to decrement the count until it reaches 0 At the end of count it generates a pulse that can be used to interrupt the MPU The counter can count either in binary or BCD. 8254 is an upgraded version of 8253 and they are pincompatible
2/17/2008
www.Vidyarthiplus.com
19
www.Vidyarthiplus.com
2/17/2008
SPECIFICATIONS
Compatible with All Intel and Most other Microprocessors Handles Inputs from DC to 2 MHz 8 MHz 8254 10 MHz 8254-2 8254 includes Status Read-Back Command that can latch the count and the status of the counters. Single 5V Supply
2/17/2008
2/17/2008
www.Vidyarthiplus.com
20
www.Vidyarthiplus.com
2/17/2008
2/17/2008
CLK 0
8 Data Bus Buffer Counter =0
GATE
OUT 0 OUT 0
Internal Bus
RD WR A0 A1
Read/Write Logic Counter =1
OUT 1
CS
Control Word Register
2/17/2008
OUT 2
www.Vidyarthiplus.com
21
www.Vidyarthiplus.com
2/17/2008
In peripheral I/O mode, the RD & WR signals are connected to IOR and IOW respectively In memory mapped I/O, these are connected to MEMR(Memory Read) and MEMW (Memory Write) Address lines A1and A0 of the MPU are usually connected to A1and A0 lines of the 8254, & CS is tied to a decoded address Control word register and counters are selected according to the signals on lines A1and A0 as shown
A1 0 0 1 1
2/17/2008
A0 0 1 0 1
www.Vidyarthiplus.com
22
www.Vidyarthiplus.com
2/17/2008
2/17/2008
2/17/2008
www.Vidyarthiplus.com
23
www.Vidyarthiplus.com
2/17/2008
2/17/2008
Mode
8254 can operate in 6 different modes, and the gate of a counter is used either to disable or enable counting
2/17/2008
www.Vidyarthiplus.com
24
www.Vidyarthiplus.com
2/17/2008
2/17/2008
D6 SC0
D5 RW1
D4 RW0
D3 M2 M2
D2 M1 M1 0 0 1 1 0 0 M0 0 1 0 1 0 1
D1 M0
D0 BCD
0 0 X X 1 1
RW1 0 0 1 1
RW0 0 1 0 1 Counter Latch Command Read/Write least significant byte Read/Write most significant byte Read/Write least significant byte first and then most significant byte
2/17/2008
www.Vidyarthiplus.com
25
www.Vidyarthiplus.com
2/17/2008
Write Operation
Write a control word into the control register Load the low-order byte of a count in the counter register Load the high-order byte of a count in the counter register With a clock and an appropriate gate signal to one of the counters, the above steps should start the counter and provide appropriate output according to the control word
2/17/2008
Read Operations
In some applications, especially in event counters it is necessary to read the value of the count in progress. Reading a count after inhibiting the counter to be read Counting is stopped by controlling the gate input or the clock input of the selected counter and the two I/O read operations are performed by the MPU. The first I/O operation reads the low-order byte and the second I/O operation reads the high-order byte. Reading a count while the count is in progress An appropriate control word is written into the control register to latch a count in the output latch, and two I/O Read operations are performed by the MPU.
2/17/2008
www.Vidyarthiplus.com
26
www.Vidyarthiplus.com
2/17/2008
2/17/2008
2/17/2008
www.Vidyarthiplus.com
27
www.Vidyarthiplus.com
2/17/2008
2/17/2008
2/17/2008
www.Vidyarthiplus.com
28
www.Vidyarthiplus.com
2/17/2008
2/17/2008
2/17/2008
www.Vidyarthiplus.com
29
www.Vidyarthiplus.com
2/17/2008
2/17/2008
RATE GENERATOR
2/17/2008
www.Vidyarthiplus.com
30
www.Vidyarthiplus.com
2/17/2008
Square-Wave Generator
2/17/2008
www.Vidyarthiplus.com
31
www.Vidyarthiplus.com
2/17/2008
2/17/2008
2/17/2008
www.Vidyarthiplus.com
32
www.Vidyarthiplus.com
2/17/2008
2/17/2008
www.Vidyarthiplus.com
33
www.Vidyarthiplus.com
2/17/2008
COUNT
STATUS
CNT 2
CNT 1
CNT 0
D5 =Latch Count of Selected Counter(s) D4 =Latch Count of Selected Counter(s) D3 =Select Counter 2 D2 =Select Counter 1 D1 =Select Counter 0
A0,A1 =11 CS = 0 RD = 1 WR = 0
The command is written in the control register, and the count of the specified counter can be latched if COUNT(bit D5 is 0) A counter or a combination of counters is specified by keeping the respective CNT bits (D1,D2, and D3)high For example the control word 1 1 0 1 0 1 1 0(D6H) written in the control register will latch the counts of Counter 0 and Counter 1, and these counts can be obtained by reading respective counter port addresses. The latched counts are held until they are read or the counters are reprogrammed.
2/17/2008
www.Vidyarthiplus.com
34
www.Vidyarthiplus.com
2/17/2008
STATUS BYTE
The status of the counter can be read if STATUS bit (D4) of the Read Back Command Is low
D7
OUTPUT
D6
NULL COUNT
D5
RW1
D4
RW0
D3 D2
M2
D1
M1
D0
M0 BCD
D7:1 = Out Pin is 1 :0 = Out Pin is 0 D6:1 = Null Count :0 = Count Available for Reading D5 D0 = Counter Programmed Mode
2/17/2008
References
Microprocessor Architecture, Programming and Applications Ramesh Gaonkar Intel 8255 datasheet www.DatasheetCatalog.com PPT by Dr. Khurram Waheed San Diego State University
2/17/2008
www.Vidyarthiplus.com
35
www.Vidyarthiplus.com
2/17/2008
Introduction
8259 Programmable interrupt controller can
Manage eight interrupts according to the instructions written into its control registers Vector an interrupt request anywhere in the memory map.(Eight interrupts are spaced at the interval of either 4 or 8 memory locations. Resolve 8 levels of interrupt priorities in a variety of modes, such as fully nested mode, automatic rotation mode & specific rotation mode Mask each interrupt request individually Read the status of pending interrupts, in-service interrupts & masked interrupts
2/17/2008
www.Vidyarthiplus.com
36
www.Vidyarthiplus.com
2/17/2008
Introduction(cont.)
Be set up to accept either the level-triggered or the edge-triggered interrupt request Be expanded to 64 priority levels by cascading additional 8259As Be set up to work with either the 8085 microprocessor mode or the 8086/8088 microprocessor mode.
2/17/2008
PIN CONFIGURATION
2/17/2008
www.Vidyarthiplus.com
37
www.Vidyarthiplus.com
2/17/2008
PIN DETAILS
D0-D7 Bi-directional, tristated, buffered data lines. Connected to data bus directly or through buffers RD-bar Active low read control WR-bar Active low write control A0 Address input line, used to select control register CS-bar Active low chip select CAS0-2 Bi-directional, 3 bit cascade lines. In master mode, PIC places slave ID no. on these lines. In slave mode, the PIC reads slave ID no. from master on these lines. It may be regarded as slave-select.
2/17/2008
PIN DETAILS(cont.)
SP-bar / EN-bar Slave program / enable. In non-buffered mode, it is SP-bar input, used to distinguish master/slave PIC. In buffered mode, it is output line used to enable buffers INT Interrupt line, connected to INTR of microprocessor INTA-bar Interrupt ack, received active low from microprocessor IR0-7 Asynchronous IRQ input lines, generated by peripherals.
2/17/2008
www.Vidyarthiplus.com
38
www.Vidyarthiplus.com
2/17/2008
Architecture of 8259
It includes 8 blocks Control Logic Read/Write logic Data bus buffer Three registers(IRR,ISR,IMR) Priority Resolver and Cascade Buffer
2/17/2008
Block diagram
2/17/2008
www.Vidyarthiplus.com
39
www.Vidyarthiplus.com
2/17/2008
INTA
INT
D7 D0
Data Bus Buffer Control Register
RD WR A0
Priority Resolver
IRR CS
SP/EN 2/17/2008
Block diagram(cont.)
CONTROL LOGIC Has two pins INT as an output, & INTA as an input INT pin is connected to the interrupt pin of MPU. Whenever a valid interrupt is asserted, this signal goes high. INTA is the interrupt acknowledge signal from MPU
2/17/2008
www.Vidyarthiplus.com
40
www.Vidyarthiplus.com
2/17/2008
Block diagram(cont.)
READ/WRITE LOGIC
When the address line A0 is at logic 0, the controller is selected to write a command or read a status Chip Select logic and A0 determine the port address of the controller
2/17/2008
Block diagram(cont.)
DATA BUS BUFFER
This 3-state, bidirectional 8-bit buffer is used to interface the 82C59A to the System Data Bus. Control words and status information are transferred through the Data Bus Buffer.
2/17/2008
www.Vidyarthiplus.com
41
www.Vidyarthiplus.com
2/17/2008
Block diagram(cont.)
INTERRUPT REGISTERS & PRIORITY RESOLVER Interrupt Request Register (IRR) has 8 input lines (IR0 IR7) for interrupt When these lines go high, the requests are stored in the register. In-Service Register (ISR) stores all the levels that are currently being serviced Interrupt Mask Register (IMR) stores the masking bits of the interrupt lines to be masked. Priority Resolver(PR)examines these 3 registers and determine whether INT should be sent to MPU
2/17/2008
Block diagram(cont.)
CASCADE BUFFER/COMPARATOR
Expands the number of interrupt levels by cascading two or more 8259As
2/17/2008
www.Vidyarthiplus.com
42
www.Vidyarthiplus.com
2/17/2008
2/17/2008
INTERRUPT OPERATION
To enable interrupts the Interrupt Enable flip-flop in the P should be enabled by writing the EI instruction & 8259A should be initialized by writing control words in control register Two types of control words Initialization Command Words(ICWs) Operational Command Words(OCWs) ICWs are used to set up the proper conditions & specify RST vector addresses OCWs are used to perform functions such as masking interrupts, setting up status-read operations etc.
2/17/2008
www.Vidyarthiplus.com
43
www.Vidyarthiplus.com
2/17/2008
INTERRUPT OPERATION
(Sequence of Events) The IRR stores the requests The priority resolver checks 3 registers: IRR for interrupt requests IMR for masking bits ISR for serving the interrupt request It resolves the priority & sets the INT high when appropriate o MPU acknowledges the interrupt by sending INTA o After receiving the INTA, the appropriate bit in the ISR is set to indicate which interrupt level is being served and the corresponding bit in the IRR is reset to indicate that the request is accepted. The opcode for CALL instruction is placed on data bus
2/17/2008
Sequence of Events(CONT.)
When the MPU decodes the CALL instruction, it places two more INTA signals on the data bus When the 8259A receives the 2nd INTA, it places the low-order byte of the CALL address on data bus At 3rd INTA it places the higher order byte on the data bus The CALL address is the vector memory location for the interrupt & it is placed in the control register during initialization o During the 3rd INTA pulse , the ISR bit is reset either automatically(Automatic-End-of-Interrupt--AEOI) or by a command word that must be issued at the end of the service routine(End-of- Interrupt-EOI) o Program sequence is transferred to the memory location specified by CALL instruction
2/17/2008
www.Vidyarthiplus.com
44
www.Vidyarthiplus.com
2/17/2008
PRIORITY MODES
1. Fully Nested Mode: General purpose mode All IRs are arranged from highest to lowest (IR0 highest & IR7 lowest) In addition any IR can be assigned highest priority & priority sequence will begin at that IR. Ex.
IR0 4 IR1 5 IR2 6 IR3 7 IR4 0 IR5 1 IR6 2 IR7 3
Lowest Priority
2/17/2008
Highest Priority
PRIORITY MODES(CONT.)
AUTOMATIC ROTATION MODE A device after being serviced, receives the lowest priority Ex. Assuming that IR2 has just been services, it will receive the seventh priority as shown
IR0 5 IR1 6 IR2 7 IR3 0 IR4 1 IR5 2 IR6 3 IR7 4
2/17/2008
www.Vidyarthiplus.com
45
www.Vidyarthiplus.com
2/17/2008
PRIORITY MODES(CONT.)
SPECIFIC ROTATION MODE
This mode is similar to the automatic rotation mode, except that the user can select any IR for the lowest priority, thus fixing all other priorities.
2/17/2008
END OF INTERRUPT
After the completion of an interrupt service, the corresponding ISR bit needs to be reset to update the information in the ISR Three formats Nonspecific EOI Command: When this command is sent to the 8259A, it resets the highest priority ISR bit Specific EOI Command: This command specifies which ISR bit to reset. Automatic EOI: In this mode no command is necessary. During 3rd INTA the ISR bit is reset.
2/17/2008
www.Vidyarthiplus.com
46
www.Vidyarthiplus.com
2/17/2008
A7 0
2/17/2008
A6 1
A5 1
A4 0
A3 0
A2 0
A1 0
A0 0
= 60 H
2/17/2008
www.Vidyarthiplus.com
47
www.Vidyarthiplus.com
2/17/2008
ICW1
A0 0 D7 A7 D6 A6 D5 A5 D4 1 D3 LTIM D2 ADI D1 SNGL D0 IC4
1 ICW4 needed 0 Not needed 1 Single 0 Cascade Mode
ICW2
A0 1 D7 A15 D6 A14 D5 A13 D4 A12 D3 A11 D2 A10 D1 A9 D0 A8
2/17/2008
www.Vidyarthiplus.com
48
www.Vidyarthiplus.com
2/17/2008
2/17/2008
A programmable keyboard and display interfacing chip. Scans and encodes up to a 64-key keyboard. Controls up to a 16-digit numerical display. Keyboard section has a built-in FIFO 8 character buffer. The display is controlled from an internal 16x8 RAM that stores the coded display information.
2/17/2008
www.Vidyarthiplus.com
49
www.Vidyarthiplus.com
2/17/2008
2/17/2008
2/17/2008
www.Vidyarthiplus.com
50
www.Vidyarthiplus.com
2/17/2008
PIN DESCRIPTION
A0: Selects data (0) or control/status (1) for reads and writes between micro and 8279. BD: Output that blanks the displays. CLK: Used internally for timing. Max is 3 MHz. CN/ST: Control/strobe, connected to the control key on the keyboard. CS: Chip select that enables programming, reading the keyboard, etc. DB7-DB0: Consists of bidirectional pins that connect to data bus on micro.
2/17/2008
PIN DESCRIPTION(cont.)
IRQ: Interrupt request, becomes 1 when a key is pressed, data is available. OUT A3-A0/B3-B0: Outputs that sends data to the most significant/least significant nibble of display. RD(WR): Connects to micro's IORC or RD signal, reads data/status registers. RESET: Connects to system RESET. RL7-RL0: Return lines are inputs used to sense key depression in the keyboard matrix. Shift: Shift connects to Shift key on keyboard. SL3-SL0: Scan line outputs scan both the keyboard and displays.
2/17/2008
www.Vidyarthiplus.com
51
www.Vidyarthiplus.com
2/17/2008
2/17/2008
2/17/2008
www.Vidyarthiplus.com
52
www.Vidyarthiplus.com
2/17/2008
2/17/2008
2/17/2008
www.Vidyarthiplus.com
53
www.Vidyarthiplus.com
2/17/2008
Data Buffers
I/O Control
Display Address Registers 16x8 Display RAM
Display Registers
2/17/2008
OUT A0 A3 OUT B0 B3
SCAN COUNTER
Return
BD
SL0 SL
KEYBOARD SECTION
Has 8 lines(RL0 RL7) which can be connected to 8 columns of a keyboard, + 2 additional lines: Shift & CNTL/STB(Control/Strobe) Status of the SHIFT key and the control key can be stored along with a key closure The keys are automatically debounced, & the keyboard can operate in two modes Two-key lockout N key rollover In two key lockout mode, if two keys are pressed almost simultaneously, only the 1st key is recognized
2/17/2008
www.Vidyarthiplus.com
54
www.Vidyarthiplus.com
2/17/2008
KEYBOARD SECTION(CONT.)
N key rollover mode, simultaneous keys are recognized & their codes are stored in internal buffer Also includes 8 x 8 FIFO RAM FIFO consists of 8 registers that can store 8 keyboard entries that can be read in the order of entries. The status logic keep track of the number of entries & provides an IRQ(Interrupt Request) signal when the FIFO is not empty. The status logic keep track of the number of entries & provides an IRQ(Interrupt Request) signal when the FIFO is not empty
2/17/2008
SCAN SECTION
Has a scan counter & 4 scan lines(SL0 - SL3) These 4 scan lines are decoded using 4 to 16 decoder to generate 16 lines for scanning These lines can be connected to the rows of a matrix keyboard & the digit drivers of a multiplexed display
2/17/2008
www.Vidyarthiplus.com
55
www.Vidyarthiplus.com
2/17/2008
DISPLAY SECTION
Has 8 output lines divided into 2 groups A0 A7 & B0 B7 These lines can be used either as a group of 8 lines or as 2 groups of 4 in conjunction with the scan lines for a multiplexed display The display can be blanked by using the BD line Includes 16 x 8 display RAM MPU can read from or write into any of these registers
2/17/2008
www.Vidyarthiplus.com
56
www.Vidyarthiplus.com
2/17/2008
2/17/2008
FEATURES OF 8251A(USART)
8251A is an universal synchronous & asynchronous communication controller supports standard asynchronous protocol with 5 to 8 bit character format Odd, even or no parity generation & detection Baud rate from DC to 19.2kbaud False rate bit detection Automatic break detect and handling
2/17/2008
www.Vidyarthiplus.com
57
www.Vidyarthiplus.com
2/17/2008
FEATURES OF 8251A(USART)(cont.)
Has built in baud rate generator Supports standard synchronous protocol with 5 to 8 bit character format Internal or external character synchronization Automatic sync insertion Baud rate from dc to 64kbaud Allows full duplex transmission & reception
2/17/2008
2/17/2008
www.Vidyarthiplus.com
58
www.Vidyarthiplus.com
2/17/2008
2/17/2008
2/17/2008
www.Vidyarthiplus.com
59
www.Vidyarthiplus.com
2/17/2008
2/17/2008
2/17/2008
www.Vidyarthiplus.com
60
www.Vidyarthiplus.com
2/17/2008
C/D 0 0 1 1
2/17/2008
RD 0 1 0 1 1
WR 1 0 1 0 1
Operation CPU reads data from USART CPU sends data to USART CPU reads status from USART CPU writes command to USART USART Bus timing
2/17/2008
www.Vidyarthiplus.com
61
www.Vidyarthiplus.com
2/17/2008
2/17/2008
2/17/2008
www.Vidyarthiplus.com
62
www.Vidyarthiplus.com
2/17/2008
2/17/2008
2/17/2008
www.Vidyarthiplus.com
63
www.Vidyarthiplus.com
2/17/2008
2/17/2008
2/17/2008
www.Vidyarthiplus.com
64
www.Vidyarthiplus.com
2/17/2008
2/17/2008
2/17/2008
www.Vidyarthiplus.com
65
www.Vidyarthiplus.com
2/17/2008
2/17/2008
BLOCK DIAGRAM(cont.)
Read/Write control logic: The functional block accepts inputs from the system control bus and generates control signals for overall device operation. It decodes control signals on the 8085 control bus into signals which controls the internal and external I/O bus. It contains the control word register and command word register that stores the various control formats for the device functional definition.
2/17/2008
www.Vidyarthiplus.com
66
www.Vidyarthiplus.com
2/17/2008
BLOCK DIAGRAM(cont.)
Transmit Buffer The transmit buffer accepts parallel data from the CPU adds the appropriate framing information, serializes it, and transmits it on the TxD pin the falling edge of TxC Has two registers Buffer register to hold 8 bits & an output register to convert 8 bits into a stream of serial bits. The CPU writes a byte in the buffer register, which is transferred to the output register when it is empty. The output register then transmits serial data on the TxD pin
2/17/2008
BLOCK DIAGRAM(cont.)
In the asynchronous mode the transmitter always adds START bit; depending on how the init is programmed, it also adds an optional even or odd parity bit, and either 1, 11/2 or 2 STOP bits. In synchronous mode no extra bits (other than parity, if enable) are generated by the transmitter.
2/17/2008
www.Vidyarthiplus.com
67
www.Vidyarthiplus.com
2/17/2008
2/17/2008
2/17/2008
www.Vidyarthiplus.com
68
www.Vidyarthiplus.com
2/17/2008
BLOCK DIAGRAM(cont.)
TRANSMIT CONTROL
TxC(Transmitter Clock) This clock controls the rate at which characters are transmitted by USART. In the synchronous mode TxC is equivalent to the baud rate, and is supplied by the modem. In asynchronous mode TxC is equivalent to the baud rate,, and is supplied by the modem. In asynchronous mode TxC is 1,16, or 64 times the baud rate. The clock division is programmable. It can be programmed by writing proper mode word in the mode set register.
2/17/2008
BLOCK DIAGRAM(cont.)
TRANSMIT CONTROL
Receiver Buffer: The receiver accepts serial data on the RxD line, converts this serial data to parallel format, checks for bits or characters that are unique to the communication technique and sends an assembled character to the CPU When 8251 is in the asynchronous mode and it is ready to accept a character, it looks for a low level on the RxD line. When it receives the low level, it assumes that it is a START bit and enables an internal counter.
2/17/2008
www.Vidyarthiplus.com
69
www.Vidyarthiplus.com
2/17/2008
BLOCK DIAGRAM(cont.)
TRANSMIT CONTROL
At a count equivalent to one-half of a bit time, the RxD line is sampled again. If the line is still low, a valid START bit is detected & the 8251A proceeds to assemble the character. After successful reception of a START bit the 8251A receives data, parity & STOP bits, and then transfers the data on the receiver input register. The data is then transferred into the receiver buffer register. In synchronous mode the receiver simply receives the specified no. of data bits & transfers them to the receiver input register & then to the receiver buffer register.
2/17/2008
BLOCK DIAGRAM(cont.)
RECEIVER CONTROL
It manages all receiver-related activities. Along with data reception, it dos false start bit detection, parity error detection, framing error detection, sync detection & break detection. RxRDY(Receiver Ready): This is an output signal. It goes high when the USART has a character in the buffer register and is ready to transfer it to the CPU.
2/17/2008
www.Vidyarthiplus.com
70
www.Vidyarthiplus.com
2/17/2008
BLOCK DIAGRAM(cont.)
RECEIVER CONTROL
This line can be used either to indicate the status in the status register or to interrupt the CPU. This signal is reset when a data byte from receiver buffer is read by the CPU. RxC(Receiver Clock): This clock controls the rate at which the character is to be received by USART in the synchronous mode. RxC is equivalent to the baud rate, and is supplied by the modem.
2/17/2008
BLOCK DIAGRAM(cont.)
RECEIVER CONTROL
In asynchronous mode RxC is 1,16 or 64 times the baud rate. The clock division is programmable. It can be programmed by writing proper mode word in the mode set register.
2/17/2008
www.Vidyarthiplus.com
71
www.Vidyarthiplus.com
2/17/2008
BLOCK DIAGRAM(cont.)
MODEM CONTROL
It provides control circuitry for the generation of RTS & DTR and the reception of CTS and DSR. In addition, a general purpose inverted output & a general purpose input are provided. The output is labeled DTR and the input is labeled DSR. DTR can be asserted by setting bit 2 of the command instruction; DSR can be sensed as bit 7 of the status register. When used as a modem control signal DTR indicates that the terminal is ready to communicate and DSR indicates that it is ready for communication
2/17/2008
D7
D6
D5
D4
D3
D2
D1
D0
Mode register
Number of Stop bits 00: 01: 10: 11: invalid 1 bit 1.5 bits 2 bits
Parity Control 0: disable 1: enable Character length 00: 01: 10: 11: 5 bits 6 bits 7 bits 8 bits
Baud Rate Factor 00: Syn. Mode 01: Async x 1 10: Async x 16 11: Async x 64
144
www.Vidyarthiplus.com
72
www.Vidyarthiplus.com
2/17/2008
Programming 8251
8251 command register
EH
IR
RTS
ER
SBRK
RxE
DTR
TxE
command register
TxE: transmit enable DTR: data terminal ready RxE: receiver enable SBPRK: send break character ER: error reset RTS: request to send IR: internal reset EH: enter hunt mode
2/17/2008
1=Enable 0 = Disable 1= Enable DTR 1=Enable 0=Disable 1=Forces TxD low 0=Normal Operation 1=Reset error flags (PE.OE.FE) 1=Enable RTS 1=Resets 8251 to mode 1=Enable search for synch characters
Programming 8251
8251 status register
DSR
SYNDET
FE
OE
PE
status register
transmit ready receiver ready transmitter empty parity error overrun error framing error sync. character detected data set ready
www.Vidyarthiplus.com
73
www.Vidyarthiplus.com
2/17/2008
clk
data B0
2/17/2008
B1
B2
B3
B4
B5
Summary
8255 PPI 8254 PIT 8259 PIC 8279 Keyboard/Display Interface 8251 USART
2/17/2008
www.Vidyarthiplus.com
74