background image

Manual Number: 00650-146-1

Page 13

Chapter 5:  Programming

Sample Programs

There are two sample programs installed with the diskette with the PCI-COM485/8 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.

Sample 2

This program is provided in C only and demonstrates interrupt-driven RS-485 half-duplex opera-
tion. The program requires at least two computers with one card in each and a two-wire cable
interconnecting them. That cable must connect the Tx pins from card 1 to the Rx  pins respectively
of card 2 and the Tx pins from card 2 to the Rx pins at card 1.

   Card 1

      Card 2

RS-485 Programming

Programming the UART for RS-485 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)

Содержание PCI-COM485/8

Страница 1: ...Model PCI COM485 8 Product Manual MANUAL NUMBER 00650 146 1B...

Страница 2: ...ual in our online Support Library Thank you The information in this document is provided for reference only ICS Advent does not assume any liability arising from the application or use of the informat...

Страница 3: ...Page iv This page intentionally left blank...

Страница 4: ...ts which are not in an as new and re saleable condition are not eligible for credit return and will be returned to the customer Limited Warranty Effective April 1 1998 all products carry a 2 year limi...

Страница 5: ...made by various manufacturers in performing warranty repairs and building replacement products If ICS Advent repairs or replaces a product its warranty term is not extended ICSAdvent will normally re...

Страница 6: ...Cautions and Warnings are accented with triangular symbols The exclamation symbol is used in all cautions and warnings to help alert you to the important instructions The lightning flash symbol is us...

Страница 7: ...Page viii This page intentionally left blank...

Страница 8: ...s 5 Input Output Connections 6 Chapter 2 Functional Description 8 RS 485 Balanced Mode Operation 8 Comm Port Compatibility 8 Communication Mode 8 Baud Rate Ranges 9 Auto RTS Transceiver Control 9 Chap...

Страница 9: ...f Figures Figure 2 1 PCI COM485 8 BLOCK DIAGRAM 9 Figure 3 1 PCI COM485 8 Option Selection Map 11 List of Tables Table 1 1 Pin Connections 7 Table 5 1 Baud Rate Divisor Values 14 Current Revision 1B D...

Страница 10: ...propriate 2 Change the active drive to A by typing a Enter 3 Type install Enter and follow the on screen prompts The installation process will create several directories on your hard disk If you accep...

Страница 11: ...DeviceIOControl handles direct to the SYS file slightly faster ACCESNT EXE Run this program on Windows NT to prepare ACCES32 DLL for use This is the install program for the SYS file itself The ACCESN...

Страница 12: ...Windows 95 pro grams PCI32 This program is used to determine the base address and IRQ of installed PCI cards in Windows 95 98 and NT Run this program to both install and use NtioPCI SYS or PCIFind DLL...

Страница 13: ...nter the CMOS setup program of your system and verify that the PCI plug and play option is set appropriately for your system Systems running Windows95 or any other PNP compliant Operating System shoul...

Страница 14: ...uble click to run the PCINT EXE program This pro gram copies NTIOPCI SYS to the NT SYSTEM32 DRIVERS directory and dynamically loads and runs the driver Note If you previously installed an older versio...

Страница 15: ...ss 0xFC00 with an interrupt of 05 the values in the Registry are Serial2 subkey Serial6 subkey PortAddress REG_DWORD 0xFC00 PortAddress REG_DWORD 0xFC20 Interrupt REG_WORD 5 Interrupt REG_DWORD 5 DosD...

Страница 16: ...P m h O 0 0 1 u r h t D N G 9 2 n i P m h O 0 0 1 u r h t D N G 5 n i P n i A 0 3 n i P n i E 6 n i P n i A 1 3 n i P n i E 7 n i P d n u o r G D N G 2 3 n i P d n u o r G D N G 8 n i P t u o B 3 3 n...

Страница 17: ...by default and supports termination by jumpers on the card If your application requires the transmitter to be un biased please contact the factory Comm Port Compatibility Type 16550 UART s are used a...

Страница 18: ...is ready to be transmitted The driver remains en abled for one additional character s transmission time after data transfer is complete and then is disabled The receiver is also normally enabled then...

Страница 19: ...it receive input output for RS 485 operation Simplified Termination Schematic In RS 485 operations where there are multiple terminals only the RS 485 ports at each end of the network should have termi...

Страница 20: ...beled CLK X1 and CLK X4 provide means to select baud rates in either of two ranges When in the X1 position the baud rate range is up to 115 200 baud When in the CLK X4 position the baud rate range is...

Страница 21: ...rd s base address You can only determine what the system has assigned To determine the base address that has been as signed run the provided PCIFind EXE or PCINT utility program Alternatively some ope...

Страница 22: ...d 2 RS 485 Programming Programming the UART for RS 485 communication can be divided into three distinct sections initialization reception and transmission Initialization deals with option setup on the...

Страница 23: ...stances for differentially driven data cables RS422 or RS 485 are for typical conditions RS 232 communication lines have a maximum length of 50 feet regardless of speed In C the code to set the chip t...

Страница 24: ...op and uses a value of 13 ASCII Carriage Return as an end of transmis sion marker do while inportb BASEADDR 5 1 Wait until data ready data i inportb BASEADDR while data i 13 Reads the line until null...

Страница 25: ...r at Base Address 5 That bit is the transmitter holding register empty flag If it is high the transmitter has sent the data The process of checking the bit until it goes high followed by a write is re...

Страница 26: ...3 1995RadiatedRFFieldImmunity EN61000 4 4 1995EFTImmunityforACandI OLines EN 60950 1992 Safety of InformationTechnology Equipment Thetechnicaldocumentationrequiredtodemonstratethisproductmeetstherequi...

Отзывы: