I just started working on a Modbus project with no background. What I am trying to do is Query an active Modbus device by using its IP address, reading registers etc.
I connected the device by using 'telnet' command with the relevant IP address and port number and when its connected, it waits for a command. The problem is when I type anything and press enter, It doesn't seem to send anything since it allows me to write more to the new line and it doesn't give any response.
I guess I lack knowledge about a very basic concept about querying this kind of devices over the Internet.
Asked
Active
Viewed 3,235 times
2
-
Which data are you sending to the device? – Ronaldo Sep 04 '15 at 10:45
-
I am trying to send basically anything to get a response, I don't even get an error. "11 03 006B 0003 7687" sent this, thinking this format is recognisable by the device. But I think the problem is I can't even send the command. – egebey Sep 04 '15 at 11:00
-
It seems you're sending a Modbus RTU frame. You need to send a Modbus TCP one, including the MBAP header. Aditionally, make sure you're sending binary data, not ASCII. – Ronaldo Sep 04 '15 at 11:09
1 Answers
2
Unless you are very good at typing binary data into telnet, and reading the binary response, you're not going to be able to communicate with a Modbus/TCP slave via telnet.
You'll want to locate one of the many open source Modbus libraries that are available on the Internet and use that. I'm the maintainer for "j2mod", which is available here --
https://sourceforge.net/projects/j2mod/
and write your own client. There are a large number of test programs in the "cmds" directory that you can use as templates until you learn the library. There are also open source libraries for languages other than Java. Generally speaking, searching for " modbus library" will find what you're looking for.

Julie in Austin
- 966
- 5
- 21