M340 PLC as Modbus gateway

другие контроллеры
krishy
Posts: 13
Joined: Tue Nov 22, 2011 5:07 pm

M340 PLC as Modbus gateway

Post by krishy »

Hi All!

I have an M340 P2020 CPU.
Some measuring devices are on RS485, modbus RTU connected to PLC's serial port.
I need to read and trend periodically some values of the devices with an XBTGT connected to CPU over ethernet.

The easiest way would be to have the PLC act as a Modbus Gateway (like an EGX100). Is it working somehow?
What does the CPU answer when it gets a Modbus/TCP query on ethernet port with an ID else then 1?

Thanks.
Novice
Posts: 43
Joined: Mon Jan 21, 2013 9:29 pm

Re: M340 PLC as Modbus gateway

Post by Novice »

Dear krishy

you can use Read_var and Write_var, We powerful function !
krishy
Posts: 13
Joined: Tue Nov 22, 2011 5:07 pm

Re: M340 PLC as Modbus gateway

Post by krishy »

Thanks, but in that case I need to program all the Modbus RTU devices to read from and store it an %MW area. Afterwards it can be read from Modbus TCP. Thats what I wanted to avoid.
krishy
Posts: 13
Joined: Tue Nov 22, 2011 5:07 pm

Re: M340 PLC as Modbus gateway

Post by krishy »

Official answer is: there is no way to be a gateway, because in that case EGX would be unsellable.
So the solution: read all the data to %MW, then serve it on Modbus TCP.
The detection of serial transfer failure is still to be handled, since the client will only see the data without change. So maybe a timestamp can be useful updated at every successful query.