PCL-740 Serial Communication RS-232/422/485/Current-Loop Interface Card
Copyright Notice This documentation and the software included with this product are copyrighted 2001 by Advantech Co., Ltd. All rights are reserved. Advantech Co., Ltd. reserves the right to make improvements to the products described in this manual at any time without notice. No part of this manual or software may be reproduced, copied, translated or transmitted, in any form or by any means without the prior written permission of Advantech Co., Ltd.
Contents Chapter 1 Introduction .................................................. 1 Description ............................................................................. 2 Features ..........................................................................................3 Applications ...................................................................................3 Specifications .................................................................................4 Chapter 2 Hardware Installation ...
CHAPTER Introduction 1 Chapter 1 Introduction 1
Description The PCL-740 card enables RS-232, RS-422, RS-485 or current-loop serial communication for applications in difficult environments. You can configure its port to RS-232, RS-422, RS-485 or current-loop using on-board jumpers. The card features a 16C550 UARTs (with on-chip 16-byte FIFO) making serial I/O more reliable. By buffering data into 16-byte packets before putting it on the bus the UART drastically reduces the CPU load.
Features • Serial Port can be configured to RS-232/422/485 or current-loop • 16C550 FIFO UART (with 16-byte FIFO) • Baud rate up to 115 Kbps • IRQ selection: 3, 4, 5, 6, 7, 9, 10, 11, 12 or 15 • Complete RS-232 modem-control signals • Space reserved for optional surge protection (RS-422/485 only) • Space reserved for termination resistor (RS-422/485 only) • LED indicator on each port indicates data flow • Automatic data-flow control in RS-485 mode Applications • PLC monitoring and control • Serial communic
Specifications Board • Number of ports: 1 • Protocol selection: RS-232/422/485 or current-loop • UART: 16C550 (16-byte FIFO) • I/O address selection: From 200H to 3F8H • IRQ selection: 3, 4, 5, 6, 7, 9, 10, 11, 12 or 15 • Power consumption: +5 V, 250 mA typical, 350 mA Max. • Connectors: DB-9 male, DB-25 male • Operating temperature: 32 to 122oF (0 to 50oC) • Dimensions: 7.25" x 4.13" (18.4-cm x 10.5-cm) • Weight: 0.
Current-loop interface • Signal driver/Receiver: 6N136 • Signals: TxD+, TxD-, RxD+, RxD• Current value: 20 mA (Standard) • Mode: Asynchronous, full duplex • Baud-rate: 50 to 115200 bps • Transmission distance: 1000 m RS-422 Interface • Signal driver/receiver: SN75176, SN75173 • Signals: TxD+, TxD-, RxD+, RxD-, RTS+, RTS-, CTS+, CTS-, GND • Mode: Asynchronous full duplex, point-to-point • Max data rate: 115 Kbps • Max data distances: 4000 feet (1220 meters) RS-485 Interface • Signal driver/receiver: SN751
6 PCL-740 User's Manual
CHAPTER Hardware Installation 2 Chapter 2 Hardware Installation 7
Initial Inspection Depending on the option you ordered, you should find (in addition to this manual) the following items inside the shipping container: • PCL-740 1-port RS-232/422/485 or Current-loop Interface card We carefully inspected the PCL-740 mechanically and electrically before we shipped it. It should be free of marks and scratches and in perfect working order on receipt. As you unpack the PCL-740, check it for signs of shipping damage (damaged box, scratches, dents, etc.).
PCL-740 Jumper and Switch Locations RS-422/485 RS-232/Current-loop Current-loop select Tx Active/Passive Rx Active/Passive Protocol Selection Base Address IRQ Selection Chapter 2 Hardware Installation 9
Card Configuration Each port of the PCL-740 card has two associated status jumper groups and one six position DIP switch. If you do not use the boards default settings then these all require configuring prior to use. I/O port base address, interrupt level, RS-232/422/485/current-loop driver mode and receiver status all require setting up. The functions of the relevant DIP switches and jumpers are shown below.
Default Settings The board will be shipped in the RS-232 mode. If your requirements are the same as this default setting, you may simply install the card without the need for any setting up. The PCL-740 DIP switch and jumper default settings are as shown below: Protocol selection - RS-232 mode (JP5) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ RS-232 RS-422 RS-485 C.L.
Jumper settings Protocol Selection First you have to decide which mode each port will be operating in, RS-232, RS-422, RS-485 or current-loop driver mode. Select the correct jumper configuration on jumper JP5. RS-232 RS-422 RS-485 Current-Loop ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ RS-232 C.L. ¡ RS-485 ¡ RS-422 ¡ RS-232 ¡ C.L. ¡ RS-485 ¡ RS-422 ¡ RS-232 ¡ C.L. ¡ RS-485 ¡ RS-422 ¡ C.L.
PCL-740 port 1 Active Passive Tx Rx Active Passive Rx Tx Desktop computer or Workstation port 1 Active Tx Passive Rx Passive Rx Active Tx Plotter I/O Address and Interrupt Setup I/O Address Setup A8 A7 A6 A5 A4 A3 The I/O base address the PC-740 is selectable by a 6 position DIP switch, SW1. Refer to page 9 for the locations of the DIP switch SW1. The base address can be set anywhere in the I/O address area from hex 200 to hex 3F8.
Port base address (SW1) Base address 200-207 208-20F A3 l A4 l A5 l A6 l A7 l A8 l ¡ l l l l l ¡ l ¡ ¡ ¡ l ¡ ¡ ¡ ¡ ¡ l ¡ l ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ - 2E8-2EF - 2F8-2EF - 3E8-3EF - *3F8-3FF l:ON ¡:OFF *:Default The following example shows how to set the base address to 2F8: The switch sum is set to 2F8 = 200 + 80 + 40 + 20 + 10 + 8, (HEX).
Interrupt Level (IRQ) Setting The PCL-740 card is designed to access interrupt levels 3 up to level 15 with the exception of 8, 13, and 14. If the card is to be designated as COM1:, the interrupt level must be set to IRQ4 (the default). For COM2: the setting is IRQ3. Ensure that this does not conflict with any other card's IRQ.
Card installation Warning! Turn off your PC’s power supply whenever you install or remove the PCL-740 or its cables. Static electricity can easily damage computer equipment. Ground yourself by touching the chassis of the computer (metal) before you touch any boards. 1. Turn off the computer. Turn the power off to any peripheral devices (such as printers and monitors). 2. Disconnect the power cord and any other cables from the back of the computer. Turn the PC if necessary to gain access to the cables. 3.
APPENDIX A Register structure and format Appendix A Register structure and format 17
Register Structure This appendix gives short description of each of the module's registers. For more information please refer to the data book for the STARTECH 16C550 UART chip. All registers are one byte. Bit 0 is the least significant bit, and bit 7 is the most significant bit. The address of each register is specified as an offset from the port base address (BASE), selected with DIP switch SW1 or SW2. DLAB is the "Divisor Latch Access Bit", bit 7 of BASE+3.
BASE+1 BASE+2 Interrupt Status Register (ISR) when DLAB=0 bit 0 Enable received-data-available interrupt bit 1 Enable transmitter-holding-register-empty interrupt bit 2 Enable receiver-line-status interrupt bit 3 Enable modem-status interrupt FIFO Control Register (FCR) bit 0 Enable transmit and receive FIFOs bit 1 Clear contents of receive FIFO bit 2 Clear contents of transmit FIFO bits 6-7 Set trigger level for receiver FIFO interrupt.
BASE+4 BASE+5 BASE+6 BASE+7 20 Modem Control Register (MCR) bit 0 DTR bit 1 RTS Line Status Register (LSR) bit 0 Receiver data ready bit 1 Overrun error bit 2 Parity error bit 3 Framing error bit 4 Break interrupt bit 5 Transmitter holding register empty bit 6 Transmitter shift register empty bit 7 At least one parity error, framing error or break indication in the FIFO Modem Status Register (MSR) bit 0 Delta CTS bit 1 Delta DSR bit 2 Trailing edge ring indicator bit 3 Delta
Programming example The following C example shows how to program the PCL-740's registers directly. It uses I/O ports hex 3F8 and 2F8 to test the PCL740’s send, receive and FIFO functions. /**************************************************/ /* Program: DEMO01.C */ /* Description: */ /* Sends a string from COM1 to COM2 then reads */ /* it back from COM2 and displays it on the */ /* screen. It uses direct register control.
/* Set up Port 2 (COM2) */ outport((base1+2),0xc9); /* Enable FIFO */ outp(base1+3,0x80); /* Set DLAB=1 */ /* Set bps = 115,200 */ outp(base1 ,0x01); outp(base1+1,0); outp(base1+3,0x03); /* Set data=8; stop=1; no parity*/ outp(base1+1,0x00); /* Disable interrupt */ printf("\nEnter string (max 15 char) or Q to quit:"); gets(cmd); while (cmd[0] != ‘q’ && cmd[0] != ‘Q’) { /* Send string on Port 1 (COM1) */ i=0; cmd[strlen(cmd)] = 0x0d; flag=1; while (flag) { outportb(base0,cmd[i]); /* Send data */ if (cmd[i]
/* Receive data on Port 2 (COM2) */ i=0; flag=1; timeout=TIME_OUT; while (flag) { /* Check for received data on port*/ if ((inportb(base1+5) & 1) !=0) { rec[i]=inportb(base1); /* Receive data */ if (rec[i] == 0x0d) { rec[i+1]=’\0'; flag=0; printf(“\nReceived data: %s\n”, rec); } i++; } else { /* Check timeout */ timeout—; if (timeout == 0) { flag = 0; printf(“\nTimeout error\n”); } } } /* End of receive data while() */ printf("\nEnter string (max 15 char) or Q to quit:"); gets(cmd); } /* End of "Enter strin
24 PCL-740 User's Manual
APPENDIX PC I/O Address Reference B Appendix B: PC I/O Address Assignments 25
PC I/O Address Usage The following table indicates the PC I/O address usage assignment. To prevent conflicting settings of the PCL-740 with other devices or I/O cards, you are recommended to refer this table.