Moxa Technologies CA-132/132I user manual RS-485 Programming, By RTS Mode For back-compatibility

Page 44

RS-485 Programming

If you intend to do RS-485 communication with CA-132/132I Series boards, please follow the RS-485 programming guide below and also refer to the chapter, “Connection Cable and Cable Wiring”, for more RS-485 operation details.

The CA-132/132I Series supports only 2-wire half-duplex RS-485 communication. Data+/- pins are used for both data transmitting and receiving, depending on the mode selected: either Automatic Data Direction Control or By RTS.

By RTS Mode (For back-compatibility)

If the mode switch for the port is set to the OFF position, By RTS Mode is used. The port is ready for transmitting data if RTS signal is asserted and ready for receiving data if RTS signal is not asserted. RTS scheme is the traditional method, and is suitable for most systems, including Windows NT, Windows 95/98 and DOS, or even UNIX, that permits RTS control from application programs. This mode should be compatible with most existing RS-485 applications.

How to transmit and receive data for Windows NT, 95/98

We recommend you to configure CA-132/132I Series ports as follows in order to acquire precise timing control in RS-485 2-wire transmission. There are 2 solutions to control RS-485 2-wire transmission.

Solution 1

The following model is common in RS-485 2-wire transmission.

sio_SetWriteTimeouts(port, 0)

/* Set sio_write() into block mode if for Windows

 

NT and Windows 95/98 */

sio_RTS(port, 1)

/* Turn on RTS signal. The RS-485 port is ready for

 

transmitting data. */

sio_write(port, buff, 10)

/* Write 10 byte characters in "buff". The function

 

blocks until last character transmitted */

sio_RTS(port, 0)

/* Turn off RTS signal. The RS-485 port is ready for

 

receiving data. */

sio_read(port, buff, 10)

/* Read 10 bytes */

Solution 2

There is a dedicated RS-485 function in PComm library. It integrates the above functions of solution 1 regarding sending data as one.

sio_putb_x(port, buff, tick ); /*

1.Turn on RTS and ready for transmitting data.

2.Send data.

3.Wait for tick time.

4.Turn off RTS and ready for receiving data. */

For more information on these functions, please refer to PComm library on-line Help file for Windows NT and Windows 95/98 respectively.

4-4 CA-132/132I User’s Manual

Image 44
Contents CA-132/132I User’s Manual Third Edition, NovemberDisclaimer Copyright NoticeTrademarks Page Table of Contents Introduction Package Checklist Product FeaturesProduct Specifications OverviewIntroduction Page Hardware Installation Hardware Installation Block Diagram of CA-132/132IRS-422/485 Interface Settings Base Address & Interrupt Vector SettingsCA-132/132I User’s Manual IRQ Setting Initial InspectionRS-422/485 Pin Assignments Async Port 4-wire RS-422/4-wire 485 Pin Assignment RJ45Async Port 2-wire RS-485 Pin Assignment RJ45 Software Installation Installing the driver Windows NTSoftware Installation CA-132/132I User’s Manual Removing a CA-132/132I serial board Windows 2000/XP/2003 Software Installation CA-132/132I User’s Manual Software Installation 10 CA-132/132I User’s Manual Software Installation 12 CA-132/132I User’s Manual Software Installation Disabling the device Software Installation Uninstalling the device Windows 95/98/MESoftware Installation 18 CA-132/132I User’s Manual Software Installation Removing the device Uninstalling the driver Installing Driver DOSDriver Setup 24 CA-132/132I User’s Manual Port number TxD buffer size RxD buffer size F5 Group Edit Loading Driver Unloading DriverSerial Programming Tool PComm Installation Diagnostic for Moxa boards onlyPComm Programming Library UtilitiesMonitor for Moxa boards under Windows NT Only Terminal EmulatorRS-485 Programming By RTS Mode For back-compatibilityHow to transmit and receive data for Windows NT, 95/98 Service Information Moxa Internet Services Following services are providedProblem Report Form Moxa CA-132/132I SeriesProduct Return Procedure Revision History Document Edition Revision Date Revision Details