#include <modbus.h>
void main(int argc, char *argv[]){
int device = Mb_open_device("/dev/ttyUSB0",9600,1,8,1);
Mbs_data = (int *) malloc(1000*sizeof(int));
Mbm_trame test;
test.device = device;
test.slave = 0x01;
test.function = 0x03;
test.address = 0x01;
test.length = 0x3C;
test.timeout = 10000;
Mb_slave(device,1,NULL,NULL,NULL);
int wynik=Mb_master(test,NULL,Mbs_data,NULL,NULL);
printf("%d\n",wynik);
int i;
for(i=0;i<60;i++) printf("%d\n",Mbs_data[i]);
Mb_close_device(device);
}
And I get always I/O possible.
Mb_master(test,NULL,Mbs_data,NULL,NULL); throws it.. why?
The lib is
http://pes.free.fr/libmodbus.html#2
Please help