RS-485 Programming
If you intend to do
The
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
How to transmit and receive data for Windows NT, 95/98
We recommend you to configure
Solution 1
The following model is common in
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 |
| 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 |
| receiving data. */ |
sio_read(port, buff, 10) | /* Read 10 bytes */ |
Solution 2
There is a dedicated
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