Closed snugglebitchi0 closed 7 years ago
ModBus TCP devices not having id. For TCP id replaced to ip address.
2014-12-07 14:31 GMT+06:00 bShnaider notifications@github.com:
hi, How can I connect to specific slave with specific id? In the RTU connection I specify the slave Id when creating connection while in the TCP connection there is no option.
I would appreciate your help, thanks.
— Reply to this email directly or view it on GitHub https://github.com/tuxnsk/nodejs_libmodbus/issues/12.
Contacts: http://tuxnsk.ru/
I have several slave which connected serial on the same bus but all beyond tcp/ip communication card, so i have to create TCP connection. There is no option to request data from specific slave? Is there any other option?
Use my fork of jsmodbus for that. Unfortunately no documentation, just read into code or ask me
On Sunday, December 7, 2014, bShnaider notifications@github.com wrote:
I have several slave which connected serial on the same bus but all beyond tcp/ip communication card, so i have to create TCP connection. There is no option to request data from specific slave? Is there any other option?
— Reply to this email directly or view it on GitHub https://github.com/tuxnsk/nodejs_libmodbus/issues/12#issuecomment-65931858 .
Pozdrawiam, Mariusz Kierski
I want used TCP slaveid ,but this cannot connect to specific slave with specific id
I was able to do it with this project: https://github.com/morkai/h5.modbus
You could also use native functions. Check this example from README:
var log = console.log;
var native = require('modbus').native;
// create context
var ctx = native.new_tcp("127.0.0.1", 1502);
/* Here you can set the slave id */
native.set_slave(ctx, 255);
// connect to slave device
native.connect(ctx);
// get value
var result = [];
native.read_registers(ctx, 2, 1, result);
log(result[0]);
// set value
native.write_bit(ctx, 1, native.OFF);
// close context
native.close(ctx);
native.free(ctx);
hi, How can I connect to specific slave with specific id? In the RTU connection I specify the slave Id when creating connection while in the TCP connection there is no option.
I would appreciate your help, thanks.