Manual Number: 00650-148-1
Page 15
Chapter 5: Programming
Sample Programs
There are two sample programs installed with the diskette with the PCI-ICOM485/4 (/2) card.
These are:
Sample 1
This program is provided in C, Pascal, and QuickBASIC. It performs a test of the loopback feature
of the UART. It requires no external hardware and no interrupts.
PCI-COM
This is the Windows95/98/NT version. It also performs a test of the loopback feature of the UART.
It requires no external hardware and no interrupts.
In order for the PCI-COM program to work, you must have run PCINT from the tools diskette.
RS-422 and RS-485 Programming
Programming the UART for RS-422 communication can be divided into three distinct sections:
initialization, reception, and transmission. Initialization deals with option setup on the chip includ-
ing baud rate selection. Reception deals with incoming-character processing which can be done
using either polling or interrupts. Transmission deals with the process of sending the data out.
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 A3. In C code, the call would be:
outportb(BA3,0x80);
You then load the divisor into Base A0 (low byte) and Base A1 (high byte). The
following equation defines the relationship between baud rate and divisor:
desired baud rate = (UART clock frequency) / (32 * divisor)
On the PCI-ICOM485/4 (/2) card, the UART clock frequency is 1.8432 MHz. On the next page is
a table for the popular divisor frequencies:
Содержание PCI-ICOM485/4
Страница 1: ...Model PCI ICOM485 4 PCI ICOM485 2 Product Manual MANUAL NUMBER 00650 148 1C...
Страница 3: ...Page iv This page intentionally left blank...
Страница 7: ...Page viii This page intentionally left blank...
Страница 14: ...ManualNumber 00650 148 1 Page 6 PCI ICOM485 4 Manual This page intentionally left blank...
Страница 19: ...ManualNumber 00650 148 1 Page 11 PCI ICOM485 4 2 OPTION SELECTION MAP...
Страница 20: ...ManualNumber 00650 148 1 Page 12 PCI ICOM485 4 Manual This page intentionally left blank...
Страница 22: ...ManualNumber 00650 148 1 Page 14 PCI ICOM485 4 Manual This page intentionally left blank...
Страница 28: ...ManualNumber 00650 148 1 Page 20 PCI ICOM485 4 Manual This page intentionally left blank...
Страница 30: ...ManualNumber 00650 148 1 Page 22 PCI ICOM485 4 Manual This page intentionally left blank...