[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Serial Communication (RS-232)
The PC supports up to 4 serial communication ports at one
Name Interrupt Ports
COM1 0Ch 3F8-3FF
COM2 0Bh 2F8-2FF
COM3 0Ch 3E8-3EF
COM4 0Bh 2E8-2EF
A serial communication adapter has 8 ports:
xx8 Transmit/Receive buffer or Baud rate divisor LSB
xx9 Interrupt enable or Baud rate divisor MSB
xxA Interrupt identification register
xxB Line control register
xxC Modem control register
xxD Line status register
xxE Modem status register
xxF Scratch pad register
When programming the RS-232 port, a lot of steps has to be
made, and a lot af things has to be considered.
1. The communications parameters has to be set.
a. The baud rate (port xx8, xx9 and xxB).
Remember to reset bit 7 on port xxB afterwards.
b. The parity and number of stop-bits (port xxB).
2. Interrupt parameters has to be set.
a. Set interrupt vectors (int 0Ch and 0Bh).
b. Select which interrupts to answer (port xx9).
c. Enable interrupt (port 021).
3. The serial port has to be reset.
Read port xxA, xxD and xxC.
The interrupt handler has to do the following things:
1. Get interrupt type.
Read port xxA.
2. Multiplex on interrupt type.
a. If change-in-modem status
Read xxC and take action upon it.
b. If transmit-register-empty
Write next character to xx8 (if any).
c. If data-ready
Read data from xx8.
d. If line-status-change
An error has occurred - read port xxD and take
action upon it.
3. Return from interrupt
a. Send 20h to port 020 (signal end-of-interrupt).
b. Return from interrupt.
When the program terminate, it must do the following things:
1. Disable interrupt (port 021).
2. Restore interrupt vector.
See Also: 3F8 3F9 3FA 3FB 3FC 3FD 3FE 020 021 INT 0Ch INT 0Bh
Online resources provided by: http://www.ousob.com --- NG 2 HTML conversion by Dave Pearson