GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  MODBUS_RTU_SET_RTS (3)

.ds Aq ’

NAME

modbus_rtu_set_rts - set the RTS mode in RTU

CONTENTS

SYNOPSIS

int modbus_rtu_set_rts(modbus_t *ctx, int mode)

DESCRIPTION

The modbus_rtu_set_rts() function shall set the Request To Send mode to communicate on a RS485 serial bus. By default, the mode is set to MODBUS_RTU_RTS_NONE and no signal is issued before writing data on the wire.

To enable the RTS mode, the values MODBUS_RTU_RTS_UP or MODBUS_RTU_RTS_DOWN must be used, these modes enable the RTS mode and set the polarity at the same time. When MODBUS_RTU_RTS_UP is used, an ioctl call is made with RTS flag enabled then data is written on the bus after a delay of 1ms, then another ioctl call is made with the RTS flag disabled and again a delay of 1ms occurs. The MODBUS_RTU_RTS_DOWN mode applies the same procedure but with an inversed RTS flag.

This function can only be used with a context using a RTU backend.

RETURN VALUE

The modbus_rtu_set_rts() function shall return 0 if successful. Otherwise it shall return -1 and set errno to one of the values defined below.

ERRORS

EINVAL

The libmodbus backend isn\(cqt RTU or the mode given in argument is invalid.

EXAMPLE

modbus_t *ctx;
uint16_t tab_reg[10];

ctx = modbus_new_rtu("/dev/ttyS0", 115200, N, 8, 1); modbus_set_slave(ctx, 1); modbus_rtu_set_serial_mode(ctx, MODBUS_RTU_RS485); modbus_rtu_set_rts(ctx, MODBUS_RTU_RTS_UP);

if (modbus_connect(ctx) == -1) { fprintf(stderr, "Connexion failed: %s\n", modbus_strerror(errno)); modbus_free(ctx); return -1; }

rc = modbus_read_registers(ctx, 0, 7, tab_reg); if (rc == -1) { fprintf(stderr, "%s\n", modbus_strerror(errno)); return -1; }

modbus_close(ctx); modbus_free(ctx);

SEE ALSO

modbus_rtu_get_rts(3)

AUTHORS

The libmodbus documentation was written by St\(&#146;ephane Raimbault <\m[blue]stephane.raimbault@gmail.com\m[][1]>

NOTES

1. stephane.raimbault@gmail.com  mailto:stephane.raimbault@gmail.com
Search for    or go to Top of page |  Section 3 |  Main Index


libmodbus 3&.1&.0 MODBUS_RTU_SET_RTS (3) 10/06/2013

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.