We support Modbus RTU/ASCII with serial interface and TCP. The basic Modbus class is rlModbus . In order to create a Modbus daemon you choose "Daemon->Modbus" in pvdevelop. Now you can edit a small INI-File, which describes what to read from Modbus
Within your pvserver now you can use rlModbusClient to communicate with Modbus.
Modbus is available for a lot of devices. Even if the device does not support Modbus directly, there is a change to use a gateway to connect it to Modbus.
In order to use Modbus select menu "rllib->uncomment modbus" in pvdevelop.
Modbus Demo
typedef struct // (todo: define your data structure here) { char s[6]; // switches } DATA; static int slotInit(PARAM *p, DATA *d) { if(p == NULL || d == NULL) return -1; memset(d,0,sizeof(DATA)); d->s[0] = -1; d->s[1] = -1; d->s[2] = -1; d->s[3] = -1; d->s[4] = -1; d->s[5] = -1; return 0; } static int slotNullEvent(PARAM *p, DATA *d) { if(p == NULL || d == NULL) return -1; int i,val; for(i=0; i<6; i++) { val = modbus.readBit(0,i+4); // the first 4 bits are outputs if(d->s[i] != val) { if(val == 1) pvSetTablePixmap(p,table1,0,i,"icon_green.bmp"); else pvSetTablePixmap(p,table1,0,i,"icon_red.bmp"); d->s[i] = val; } } return 0; } static int slotTableTextEvent(PARAM *p, int id, DATA *d, int x, int y, const char *text) { if(p == NULL || id == 0 || d == NULL || x < -1000 || y < -1000 || text == NULL) return -1; if(i == table1 && x == 1) { int val; sscanf(text,"%d",&val); modbus.writeSingleCoil(1,y,val); } return 0; }