Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TCP id #12

Closed
snugglebitchi0 opened this issue Dec 7, 2014 · 6 comments
Closed

TCP id #12

snugglebitchi0 opened this issue Dec 7, 2014 · 6 comments

Comments

@snugglebitchi0
Copy link

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.

@tuxnsk
Copy link
Owner

tuxnsk commented Dec 7, 2014

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
#12.

Contacts: http://tuxnsk.ru/

@snugglebitchi0
Copy link
Author

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?

@chaser92
Copy link

chaser92 commented Dec 7, 2014

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
#12 (comment)
.

Pozdrawiam,
Mariusz Kierski

@robinxc
Copy link

robinxc commented Jan 16, 2015

I want used TCP slaveid ,but this cannot connect to specific slave with specific id

@snugglebitchi0
Copy link
Author

I was able to do it with this project:
https://github.com/morkai/h5.modbus

@aik8
Copy link
Collaborator

aik8 commented Mar 20, 2015

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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants