I am making a VISUAL STUDIO software that reads MODBUS data from MODBUS rtu device. I need to know that how should connect them together as I have to use ethernet network..
By now I know that I need to use MODBUS gateway... But can I directly connect MODBUS gateway to my pc running TCP MODBUS master?
You mean something like this:
Yes, you can do that. Example of a such a gateway
Just a note, you can use VS to create program to communicate "directly" with the RTU device. As the PC/Master most probably won't have serial port, you can use an USB to RS485 converter. So you don't "need" to use gateway specifically.
Thanks for your reply sir.
Yes I have tested my VS with direct com port and it is working properly. You understood my network exactly how it is. But to overcome distance issues I am using TCP
By now I know that I can use a gateway that receives TCP messages and my rtu devices can be connected to it.
I am stuck at :-
1. If my rtu slave ID is 5 which is connected to gateway, how do I ask gateway to read register form this id?
>1. If my rtu slave ID is 5 which is connected to gateway,
>how do I ask gateway to read register form this id?
That will depend on the gateway (GW) that you use, but most will do the same or similar like the one I linked above.
Your application has to send MBTCP queries to the IP of the GW. This will then get the query and send out to the RS485 port. The ID and register information that you put in the original query is for the RTU slave. The default ID of the GW is 255, so if you send message for ID 5, it will be sent to RTU with ID 5.