Serial Programming Tools
Industio
CI-134 Series User’s Manual
4-11
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_SetWr iteTimeouts(por t, 0);
/* Set sio_wr ite() into block mode if for
Windows NT and Windows 95/98 */
sio_RTS(por t, 1);
/* Tur n on RTS signal. The RS-485
por t is r eady for tr ansmitting data. */
sio_wr ite(por t, buff, 10);
/* Wr ite 10 byte char acter s in " buff" .
The
function
blocks
until
last
char acter tr ansmitted */
sio_RTS(por t, 0);
/* Tur n off RTS signal. The RS-485
por t is r eady for r eceiving data. */
sio_r ead(por t, buff, 10);
/* Read 10 bytes */
Solution 2
There is a dedicated RS-485 function in
PComm
or API-232 library. It
integrates the above functions of solution 1 regarding sending data as one.
sio_putb_x(por t, buff, tick ); /*
1. Tur n on RTS and r eady for
tr ansmitting data.
2. Send data.
3. Wait for tick time.
4. Tur n off RTS and r eady for
r eceiving data. */
For more information on these functions, please refer to
PComm
library on-line Help
file for Windows NT and Windows 95/98 or API-232.txt file for DOS, respectively.