User manual

Chapter 5: Programming
There are sample programs provided with the card in C, Pascal, QuickBASIC, and several Windows
languages. DOS samples are located in the DOS directory and Windows samples are located in the WIN32
directory.
Initialization
Initializing the chip requires knowledge of the UART's register set. The first step is to set the baud
rate divisor. You do this by first setting the DLAB (Divisor Latch Access Bit) high. This bit is Bit 7 at
Base Address +3. In C code, the call would be:
outportb(BASEADDR +3,0x80);
You then load the divisor into Base Address +0 (low byte) and Base Address +1 (high byte). The
following equation defines the relationship between baud rate and divisor:
desired baud rate = (UART clock frequency) / (32 * divisor)
When the BAUD jumper is in the X1 position, the UART clock frequency is 1.8432 Mhz. When the
jumper is in the X4 position, the clock frequency is 7.3728 MHz. The following table lists popular
divisor frequencies. Note that there are two columns to consider depending on the position of the
BAUD jumper.
Baud Rate Divisor x1 Divisor x4 Max Diff. Cable Length*
460800 - 1 550 ft
230400 - 2 1400 ft
153600 - 3 2500 ft
115200 1 4 3000 ft
57600 2 8 4000 ft
38400 3 12 4000 ft
28800 4 16 4000 ft
19200 6 24 4000 ft
14400 8 32 4000 ft
9600 12 48 – Most Common 4000 ft
4800 24 96 4000 ft
2400 48 192 4000 ft
1200 96 384 4000 ft
* Recommended maximum distances for differentially driven data cables (RS422 or RS485) are for typical conditions.
Table 5-1: Baud Rate Divisor Values
In C, the code to set the chip to 9600 baud is:
outportb(BASEADDR, 0x0C);
outportb(BASEADDR +1,0);
Manual PCI-ICM-422(485)/2(4)
15