Moxa Technologies C168H Network Card User Manual


 
4-6 Smartio C168H/PCI Users Manual
RS-485 Programming for Opt8J
If you intend to do RS-485 communication with Opt8J, please follow the RS-485
programming guide below and also refer to Chapter Connection Option (Opt8x)
and Cable Wiring for more Opt8J RS-485 operation details.
The Opt8J supports only 2-wire half-duplex RS-485 communication. Data+/-
pins are served for both data transmitting and receiving, depending on the RTS
signal.
The port switch of each port should be set to On position. The port is for
transmitting data if RTS is asserted and for receiving data if RTS is not asserted.
RTS scheme is suitable for any system, including Windows NT and Windows
95/98, DOS, or UNIX, that permits RTS control from application programs.
How to transmit and receive data under Windows NT and
Windows 95/98
We recommend you to configure Smartio C168H/PCI 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 */
sio_RTS(port, 1); /* Turn on RTS signal. The RS-485 port is ready for t
ransmitting data. */
sio_write(port, buff, 10); /* Write 10 byte characters in "buff". The function bl
ocks 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 */