node-modbus-serial
node-modbus-serial copied to clipboard
Receiving modbus exception 2 after read/write-ing from start address 2050 and higher
Hi,
When I read from holding registers with start address 2050 and higher with registers length 1, I receive an error: "Modbus exception 2: Illegal data address (register not supported by device)". But when I read from start address 2048 with registers length 50, I am not receiving any error. However, I read from start address 2300 with registers length 2 by the Easy Modbus Client successfully. Same issue when I write in holding registers from start address 2050 and higher. What's the problem, and how can I read/write with a start address of 2050 and higher?
clientModbus.readHoldingRegisters(2049, 100, (err, data) => {
if(err) {
console.log(err);
} else{
console.log(data);
}
})
Received error
Error: Modbus exception 2: Illegal data address (register not supported by device)
at ModbusRTU._onReceive (/project/node_modules/modbus-serial/index.js:371:21)
at TcpPort.emit (node:events:527:28)
at Socket.<anonymous> (/project/node_modules/modbus-serial/ports/tcpport.js:92:20)
at Socket.emit (node:events:527:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Socket.Readable.push (node:internal/streams/readable:228:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
modbusCode: 2
}
Thank you.