Microprocessor Systems Course (EC 482)
Tutorial 6
Q1- If the 16550 is to generate a serial signal at a baud rate of 2400
baud and the baud rate divisor is programmed for 16, what is the
frequency of the signal?
Answer
The frequency of the signal: 2400 x 16*divisor rate = 2400 x 16*16 = 614,400 Hz
Q2- Hundred characters are serially transmitted per second using
16550 PCI. Each character consists of 1 start bit, 8 data bits, 1
parity bit and 2 stop bits. Sixteen clock periods per bit time are
used. Calculate the Baud Rate (B), the bit time, clock period per
bit time and the data rate.
Answer:
B = 100 characters/s × 12 bits/character = 1200 baud
Bit Time = 1 / Baud rate = 1/1200 = 0.000833 seconds
clock periods = Bit time / 16
Data Rate = 100 characters/s × 8 data bits/character = 800 bits/s
Q3- Sketch the logic waveform appearing at the output of the
UART when it transmits a character ' A ' at a baud rate of
9,600 . The sketch should show the bit durations in
microseconds, in addition to the waveform. The frame format
is of 1 start bit, 8 data bits, an odd parity bit, and 2 stop bits.
Hint character A in ASCII Hexadecimal (41)
Answer:
Bit duration = 1/Baud rate =104.17 microseconds
1. Start Bit: Low (0) for one bit duration
2. Data Bits: The binary representation of 'T' is 01000001.
- Bit 1: high (1) for one bit duration.
- Bit 2: low (0) for one bit duration.
- Bit 3: low (0) for one bit duration.
- Bit 4: low (0) for one bit duration.
- Bit 5: low (0) for one bit duration.
- Bit 6: low (0) for one bit duration.
- Bit 7: high (1) for one bit duration.
- Bit 8:low(0) for one bit duration.
3. Parity Bit: high (1) for one bit duration.
4. Stop Bits: : high (1) for two bit duration
Tutorial 6
Q4- Programming the control Registers and Baud rate generator
for the 16550 PCI having the following specification:
Asynchronous mode, 8-bit character even parity, 2 stop bits,
38400 baud.
Answer: The Baud rate can be calculated as: 18.432MHz/ ( 16*divisor rate)
MOV AL, 10011111 ; enable Baud divisor
OUT LINE, AL
MOV AL, 120 ; program Baud rate
OUT LSB, AL
MOV AL, 0
OUT MSB, AL
MOV AL, 00011111B ; program 7 data bit; odd parity
OUT LINE, AL ; &1 stop bit
Tutorial 6
Q5. Interface an 16550 A PCI to function at I/O port addresses 10H,
14H, 18H, 1CH, 20H, 24H, 28H, 2CH using 80386
microprocessor. Program the PCI for asynchronous mode
operation with 9600 baud using 8 data bits, even parity, one
stop bit, and the transmitting CLK equal 1843KHz. Write
procedure to check a parity error when a character is received.
If an error occurs, transmit " EE " to the PCI and out through
TXD ?
Answer:
The BRG divisor value would be (1843000 / 16 x 9600) = 12
LSB EQU 10H
MSB EQU 14H
FIFO EQU 18H
LCR EQU 1CH
MCR EQU 20H
LSR EQU 24H
MSR EQU 28H
SPR EQU 2CH
Interfacing circuit : to function at I/O port addresses 10H, 14H, 18H, 1CH,
20H, 24H, 28H, 2CH
Port A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2
Number
LSB 10 0 0 0 0 0 0 0 0 0 0 0 1 0 0
MSB 14 0 0 0 0 0 0 0 0 0 0 0 1 0 1
FIFO 18 0 0 0 0 0 0 0 0 0 0 0 1 1 0
LCR 1C 0 0 0 0 0 0 0 0 0 0 0 1 1 1
MCR 20 0 0 0 0 0 0 0 0 0 0 1 0 0 0
LSR 24 0 0 0 0 0 0 0 0 0 0 1 0 0 1
MSR 28 0 0 0 0 0 0 0 0 0 0 1 0 1 0
SPR 2C 0 0 0 0 0 0 0 0 0 0 1 0 1 1
A2
A6 D A3
A7 E
C Inverter
A4 •
O Q0
A8
D
. E
A15 R
A5 do not care
BE0
Tutorial 6
MAIN: MOV AL, 10011011 ; enable Baud divisor
OUT LCR, AL
MOV AL, 12 ; program Baud rate
OUT LSB, AL
MOV AL, 0
OUT MSB, AL
MOV AL, 00011011B ; program 7 data bit; odd parity
OUT LCR, AL ; &1 stop bit
MOV AL, 00000111B ; enable transmitter and receiver
OUT FIFO, AL
RET
END MAIN
RECV PROC
IN AL, LSR ; read line status register
TEST AL, 1H
JZ RECV
TEST AL, 04H
JNZ ERR
IN AL, DATA ; input received data
RECV END
ERR IN AL, LSR ; read line status register
TEST AL, 20H
JZ ERR
MOV AL, EEH
OUT LSB, AL ; transmit data
RET