Moxa Technologies RS-422, RS-485 user manual Solution

Models: RS-422 RS-485

1 79
Download 79 pages 6.46 Kb
Page 61
Image 61

Serial Programming Tools

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

 

in PComm or API-232 library. It

There is a dedicated RS-485 function

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.

Industio CI-134 Series User’s Manual 4-11

Page 61
Image 61
Moxa Technologies RS-422, RS-485 user manual Solution