tuxnsk / nodejs_libmodbus

libmodbus binding for nodejs
41 stars 66 forks source link

Random data when reading with native connection #30

Closed acrive82 closed 8 years ago

acrive82 commented 8 years ago

Hi

I'm trying to connect to modbus with native connection. Many times the data returned is totally randomize.

If I try write a value and after to read it, have a random value.

Disminder commented 8 years ago

Modbus TCP, yes?

It's probably error in libmodbus. I'm gonna to rewrite bindings to latest libmodbus version soon, just don't have enough time now.

acrive82 commented 8 years ago

Yes! With TCP.

Disminder commented 8 years ago

Rewrite to latest libmodbus version didn't help =_= Gonna make some experiments - I just didn't understand, why M libmodbus - S libmodbus works and M libmodbus - S real device - not.

Disminder commented 8 years ago

Not libmodbus error - you need to use native.set_slave(ctx, id) function to set which ID you requesting on the slave device. It helped me. Probably I'll add 0 as a default ID.