computer interfacing tutorial-printer, serial, game, usb port
 

 

Interrupt Enable Registers ( IER ) - Serial Port

Bit
Notes
Bit 7
Reserved
Bit 6
Reserved
Bit 5
Enables Low Power Mode (16750)
Bit 4
Enables Sleep Mode (16750)
Bit 3
Enable Modem Status Interrupt
Bit 2
Enable Receiver Line Status Interrupt
Bit 1
Enable Transmitter Holding Register Empty Interrupt
Bit 0
Enable Received Data Available Interrupt
Table 7 : Interrupt Enable Register

The Interrupt Enable Register could possibly be one of the easiest registers on a UART to understand. Setting Bit 0 high enables the Received Data Available Interrupt which generates an interrupt when the receiving register/FIFO contains data to be read by the CPU.

Bit 1 enables Transmit Holding Register Empty Interrupt. This interrupts the CPU when the transmitter buffer is empty. Bit 2 enables the receiver line status interrupt. The UART will interrupt when the receiver line status changes. Likewise for bit 3 which enables the modem status interrupt. Bits 4 to 7 are the easy ones. They are simply reserved. (If only everything was that easy!)

Interrupt Identification Registers ( IIR )

Bit
Notes
Bits 6 and 7
Bit 6
Bit 7
 
0
0
No FIFO
0
1
FIFO Enabled but Unusable
1
1
FIFO Enabled
Bit 5
64 Byte Fifo Enabled (16750 only)
Bit 4
Reserved
Bit 3
0
Reserved on 8250, 16450
1
16550 Time-out Interrupt Pending
Bits 1 and 2
Bit 2
Bit 1
 
0
0
Modem Status Interrupt
0
1
Transmitter Holding Register Empty Interrupt
1
0
Received Data Available Interrupt
1
1
Receiver Line Status Interrupt
Bit 0
0
Interrupt Pending
1
No Interrupt Pending
Table 8 : Interrupt Identification Register

The interrupt identification register is a read only register. Bits 6 and 7 give status on the FIFO Buffer. When both bits are '0' no FIFO buffers are active. This should be the only result you will get from a 8250 or 16450. If bit 7 is active but bit 6 is not active then the UART has it's buffers enabled but are unusable. This occurs on the 16550 UART where a bug in the FIFO buffer made the FIFO's unusable. If both bits are '1' then the FIFO buffers are enabled and fully operational.

Bits 4 and 5 are reserved. Bit 3 shows the status of the time-out interrupt on a 16550 or higher.

Lets jump to Bit 0 which shows whether an interrupt has occurred. If an interrupt has occurred it's status will shown by bits 1 and 2. These interrupts work on a priority status. The Line Status Interrupt has the highest Priority, followed by the Data Available Interrupt, then the Transmit Register Empty Interrupt and then the Modem Status Interrupt which has the lowest priority.

First In First Out ( FIFO )

Bit
Notes
Bits 6 and 7
Bit 7
Bit 6
Interrupt Trigger Level
0
0
1 Byte
0
1
4 Bytes
1
0
8 Bytes
1
1
14 Bytes
Bit 5
Enable 64 Byte FIFO (16750 only)
Bit 4
Reserved
Bit 3
DMA Mode Select. Change status of RXRDY & TXRDY pins from mode 1 to mode 2.
Bit 2
Clear Transmit FIFO
Bit 1
Clear Receive FIFO
Bit 0
Enable FIFO's
Table 9 : FIFO Control Register

The FIFO register is a write only register. This register is used to control the FIFO (First In / First Out) buffers which are found on 16550's and higher.

Bit 0 enables the operation of the receive and transmit FIFO's. Writing a '0' to this bit will disable the operation of transmit and receive FIFO's, thus you will loose all data stored in these FIFO buffers.

Bit's 1 and 2 control the clearing of the transmit or receive FIFO's. Bit 1 is responsible for the receive buffer while bit 2 is responsible for the transmit buffer. Setting these bits to 1 will only clear the contents of the FIFO and will not affect the shift registers. These two bits are self resetting, thus you don't need to set the bits to '0' when finished.

Bit 3 enables the DMA mode select which is found on 16550 UARTs and higher. More on this later. Bits 4 and 5 are those easy type again, Reserved.

Bits 6 and 7 are used to set the triggering level on the Receive FIFO. For example if bit 7 was set to '1' and bit 6 was set to '0' then the trigger level is set to 8 bytes. When there is 8 bytes of data in the receive FIFO then the Received Data Available interrupt is set. See (IIR)

PREVIOUS NEXT

 

Free Software
Delphi

Lesson 1
Delphi Programming
1.1. IDE Delphi
1.2. Component


Lesson 2
Printer Port
/ LPT
1.1.Basic
1.2.Address
1.3.Port Register
1.4.8 Bit Data Input
1.5.Test Circuitry
1.6.Assignment

Lesson 3
Printer Port / LPT
Experiments

3.1.LED
3.2.Swicht
3.3.Motor Stepper
3.4.DAC
3.5.ADC
3.6.Graph Display

Lesson 4
Serial Port

4.1.Basic
4.2.Hardware
4.3.Port Register

Lesson 5
Serial Port Experiments

5.1.LED
5.2.Stepper Motor
5.3.Swicht
5.4.ADC

Lesson 6
Game Port
Joy Stick
6.1. Basic
6.2. Experiments