Beruflich Dokumente
Kultur Dokumente
8254
Introduction:
• The
BCD.
counter can count either in binary or
4
I/O Interface
5
PROGRAMMABLE INTERVAL TIMER
8254
7
PROGRAMMABLE INTERVAL TIMER
8254
Read/Write Logic :
A low on CS line enables the 8253. No operation will be
performed by 8253 till it
is enabled. Table below shows the selected operations for
various inputs of 8253:
CS RD WR A1 A0 selected operation
0 1 0 0 0 write counter 0
0 1 0 0 1 write counter 1
0 1 0 1 0 write counter 2
0 1 0 1 1 write control word
0 0 1 0 0 read counter 0
0 0 1 0 1 read counter 1
0 0 1 1 0 read counter 2
0 0 1 1 1 no operation
0 1 1 x x no operation 8
1 X x x x disabled
PROGRAMMABLE INTERVAL TIMER
8254
Control Word Register :
This register is accessed when lines A0 and A1 are at logic 1
It is used to write a command word which specifies the counter to
be used (binary or BCD), its mode, and either a read or write
operation.
Counters :
These three functional blocks are identical in operation. Each
counter consists of a single, 16 bit, pre-settable, down counter.
The counter can operate in either binary or BCD and its input,
gate and output are configured by the selection of modes stored
in the control word register.
The counters are fully independent. The programmer can read the
contents of any of the three counters without disturbing the
actual count in process. 9
PROGRAMMABLE INTERVAL TIMER
8254
Operational Description:
The complete functional definition of the 8253/54 is programmed by the
system
software. Once programmed, the 8253/54 is ready to perform whatever
timing tasks it is assigned to accomplish.
Programming the 8253/54 :
Each counter of the 8253/54 is individually programmed by writing a
control word into the control word register (A0 -A1 = 11).
The Fig. shows the control word format.
Bits SC1 and SC0 select the counter, bits RW1 and RW0 select the read,
write or latch command, bits M2,M1 and M0 select the mode of
operation and bit BCD decides whether it is a BCD counter or binary
counter.
The complete functional definition of the 8253/54 is programmed by the
system
software.
10
Once programmed, the 8253/54 is ready to perform whatever timing
tasks it is assigned to accomplish.
Programmable interval Timer 8254
The control word allows the programmer to select the counter, mode of
operation, binary or BCD count and type of operation (read/write).
11
Programmable interval Timer 8254
Programming the 8254
Each counter has a program control word used to select the way the
counter operates.
If two bytes are programmed, then the first byte (LSB) stops the
count, and the second byte (MSB) starts the counter with the new
count.
14
Programmable interval Timer 8253
Programming the 8254
Modes of operation
Mode 4: Software triggered one-shot (G must be 1).
15
16
Programmable interval Timer 8254 I/O Interface
Read Operations
0 0 1 1 0 1 0
0
= 34H(Mode 2)
0 0 1 1 0 1
1 0
= 36H(Mode 3) 19
CONTROL WORD
SELECT SC0 SC1 OPE RATION
COUNTER BIT
DEFINITION 0 0 Select channel 0
0 1 Select channel 1
1 0 Select channel 2
1 1 Illegeal
RL0 RL1 OPE RATION
READ\LOAD BIT
DEFINITION 0 0 Latch Counter
0 1 Read\Load(LSB)
1 0 Read\Load(MSB)
1 1 Read\Load LSB
first then 20
MSB
MODE
M2 M1 M0 SELECTED
MODE
0 0 0 MODE 0
0 1 MODE 1 MODE SELECT BIT DEFINITION
X 0 0 MODE 2
X 1 1 MODE 3
1 0 MODE 4
0 1 MODE 5
0
1 BCD OPERATION
1
0 Hex Count
1 BCD Count HEX\BCD BIT DEFINITION
21
RATE GENERATOR
MOV AL,34H Move the command word to A register
OUT 16,AL Output it to control register
22
SQUARE WAVE
MOV AL,36H Move the command word to A
register
OUT 16,AL Output it to control register
MOV AL,04H Move 04 to A register
23
I/O Interface
16550 Programmable Communications Interface:
• 16550 , A universal asynchronous receiver/transmitter (UART).
• it capable of operating speed: 0 to 1.5M Baud (Baud is # of bits
transmitted/sec, including start, stop, data and parity).
•It includes:
- A programmable Baud rate generator.
- Separate FIFO buffers for input and and output data (16
bytes each).
Asynchronous serial data:
Asynchronous serial data are transmitted and received without a
clock or timing signal.
24
Two 10-bit frames of asynchronous serial data, start bit, 7 data bit,
parity & stop bit.
I/O Interface
16550 functional description:
• can function :
- simplex: transmit only,
eg:FM radio station
-half-duplex: transmit and receive but not
simultaneously
eg: CB( citizen band) station
- full-duplex: transmit and receive
25
simultaneously
eg : telephone
I/O Interface
• the FIFO makes UART ideal when interfacing to high speed systems
26
I/O Interface
27
I/O Interface
: Address strobe used to latch address and chip select. Not
needed on Intel systems - connected to ground.
: Clock signal from Baud rate generator in transmitter.
CS0, CS1, : Chip selects must all be active enable the 16550
UART
: Clear to send -- indicates that the modem or data set is ready
to exchange information. (Used in half-duplex to turn the line around).
D7-D0: The data bus pins are connected to the microprocessor data
bus.
: The data carrier detect -- used by the modem to signal the
16550 that a carrier is present.
DDIS: Disable driver output -- set to 0 to indicate that the
28
microprocessor is reading data from the UART. Used to change
direction of data flow through a buffer.
I/O Interface
RCLK: Receiver clock, clock input to the receiver section of the UART.
29
Always 16X the desired receiver Baud rate.
I/O Interface
: Ring indicator input , set to 0 by modem to indicate telephone is
ringing.
RD, : Read inputs (either can be used), cause data to be read from the
register given by the address inputs
Programming 16550:
• the programming is a two part process
- initialization dialog
- operational dialog
Initializing 16550:
•Initialization dialog, occurs after a hardware or software reset,
Consists of two parts
- line control register
- baud rate generator
must be programmed
•Line control
31 register selects: number of stop & parity bit( even or odd)
• Stop bits: S = 1, 1.5 stop bits used for 5 data bits, 2 used for 6, 7 or
8.
32
• next 3 bits: ST(stick), P and PE used to send even or odd parity, to
send no parity or to send a 1 or a 0 in the parity bit position for all
data.
I/O Interface
Note : the actual number programmed into baud rate generator causes,
34 a clock that is 16 times the desired baud rate
to produce
eg : if 240 is programmed into baud rate divisor,
Baud rate = 18.432 MHz/(16X240) = 4800 baud.
I/O Interface
36
I/O Interface
UART error:
Operation:
It is also a good idea to check for errors.
•Parity error: Received data has wrong error, transmission bit flip due to
noise.
•Framing error: Start and stop bits not in their proper places.
This usually results if the receiver is receiving data at the incorrect baud
rate.
•Overrun error: Data has overrun the internal receiver FIFO buffer.
Software is failing to read the data from UART before the FIFO is full.
•( BI )Break
37 indicator bit: Software should check for this as well, i.e. two
consecutive frames of 0s.
I/O Interface
38
I/O Interface
• after the line control register & baud rate divisor are programmed ,
still it is not ready to function
39