Hi all,
Following some help on this forum, I made necessary configurations to use Modbus TCP (communication between PC and Roboguide). In particular, the following thread
RE: Fanuc Robot, IO CONTROL using tcp/ip through PC
I am using libmodbus and I was able to create a Modbus context and have a successful connection. Next, I tried reading some registers.
/* Read 5 registers from the address 0 */
rc = modbus_read_registers(mb, 0, 5, tab_reg);
if (rc == -1) {
fprintf(stderr, "%s\n", modbus_strerror(errno));
return -1;
}
for (i=0; i < rc; i++) {
printf("reg[%d]=%d (0x%X)\n", i, tab_reg[i], tab_reg[i]);
}
Since, by default, all the digital outputs were unset, therefore my output looked something like the following:
reg[0]=0 (0x0)
reg[1]=0 (0x0)
reg[2]=0 (0x0)
reg[3]=0 (0x0)
reg[4]=0 (0x0)
Now, I wanted to force some of the Digital outputs ON to see that I am reading the registers properly.
My understanding is that, Digital Outputs are mapped to Modbus Hodling Registers. Each Holding Register is a 16-bit word. Therefore, I wanted to map, the digital outputs to holding registers in the following way,
Holding register 0 ------------------- DO[1-16]
Holding register 1 ------------------- DO[17-32]
Holding register 2 ------------------- DO[33-48]
Holding register 3 ------------------- DO[49-64]
Holding register 4 ------------------- DO[65-80]
On the Roboguide, When i access I/O, Digital Outputs and then CONFIG. There is a range such as DO[1 --- 8], that I am unable to change the ending bit. Also, I changed the RACK and SLOT to 96 and 1 respectively to correspond to Modbus. There is another column which reads START. I do not know, how to set this? What that column means, or how to get a mapping that I want. If I just use a single entry, and say DO[1 ------ 80], does this automatically map 5 holding registers.
thanks for your help.
zahid