Moxa Technologies CP-132U Series Switch User Manual


 
CP-132U Series User’s Manual
4-6
and receiving), since it is automatically managed with the board’s built-in intelligent
hardware mechanism. This means that RS-485 programming using ADDC™ mode is
just as simple and straightforward as RS-232 or RS-422 programming.
How to transmit and receive data for Windows 95/98NT/2000/XP/2003
In order to acquire precise timing control for RS-485 2-wire transmission, we recommend
that you configure your CP-132UL Series ports as described below.
There are 2 solutions to control RS-485 2-wire transmission.
Solution 1
The following method is commonly used for 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 the last character is 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
The PComm or API-232 library includes a dedicated RS-485 function that integrates the
functions described in solution 1 above into one function:
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, refer to the PComm library’s on-line Help file for
Windows 95/98/NT/2000/XP/2003.