Modbus485Slave Adress


#1

Hi,
in this library, how can change the onRead startingAddress?


#2

Hi,

It’s described in the Modbus485Slave documentation, see onRead(callback) method and example:

modbus.onRead(function(slaveID, functionCode, startingAddress, quantity){
  server.log("Slave ID : " + slaveID);
  server.log("Function Code: " + functionCode);
  server.log("Starting Address : " + startingAddress);
  server.log("Quantity : " + quantity);
  return [true,false,false,true,true]; }.bindenv(this));

Is that not what you are looking for?

Best,
– Terrence


#3

Hi terrence,
precisely that code I have implemented, but I indicated address 99, I need to change it,
Captura1


#4

Hi,

Sorry for the slow reply. It would be easiest if you could post the code, or send it to terrence [ at] electricimp.com

Best,
– Terrence


#5

i need some code help,
I’m using the imp gateway in a industrial plant to obtain a data from a web page … and send it via modbus rs485 to a plc branded Foxboro de Schenider.
the code is here


the tests work well,
but when I connect the gateway to the plc I have a doubt on which modbus registry address is being sent because the plc does not read it, I already tested plc simulating sending information from a pc program and if it arrives.
if I wanted to change that modbus shipping address, how to do it?

with the debugger obtain it.
image

any suggest is welcome!