I try read device to 1018 modbus address 4.bit. But I cant read it. How can I do it?
I tried this code int data = modbusClient.ReadInputRegisters(1018,16)[4];, but I cant read.
int data = modbusClient.ReadInputRegisters(1018,16)[4];
I try read device to 1018 modbus address 4.bit. But I cant read it. How can I do it?
I tried this code int data = modbusClient.ReadInputRegisters(1018,16)[4];, but I cant read.
int data = modbusClient.ReadInputRegisters(1018,16)[4];
Copyright © 2021 Jogjafile Inc.
According to your Modbus request you trying to read 16 input registers with starting address of 1018. The 1018 is the address of input registers and full address, that this function code will read is 31018. From this address it will read 16 registers. Your code will return 4th integer in array of 16. So this data is from address 1018 + 4 = 1022. If you need data from 1018 you need to change [4] to [0]. And you don’t need to read all 16 addresses so change 16 to 1. Remember that Easymodbus addresses starts with 0 and Modbus starts with 1.