carcelen / simple-modbus

Automatically exported from code.google.com/p/simple-modbus
0 stars 0 forks source link

Variable Address #31

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hello!

I have a problem. How can i change address in the loop (arduino 103) ?
I try, but dosn't work: (Always read the Address 1 and not read Address 2)

unsigned int modbusaddress = 1;

void setup()
{
.........
modbus_construct(packet1, modbusaddress, READ_HOLDING_REGISTERS, 0, 1, 
readRegs);
.......
void loop()
{
  modbusaddress = 2;  
  modbus_update();
  ...
}

Somebody help me please!
Thanks

Original issue reported on code.google.com by vectra...@gmail.com on 27 Jun 2014 at 4:13

Attachments:

GoogleCodeExporter commented 8 years ago
This is not a defect. You are using the functions incorrectly. Use a different 
packet when polling different id addresses, functions or register addresses. 
See the library examples and check out the forum thread: 
http://forum.arduino.cc/index.php?topic=176142.0 for more information and help.

Original comment by bester.j...@gmail.com on 28 Jun 2014 at 3:07