How do I detect and report loss of connection to an RS-485 device?

I have a Flexy 205 that acts as a gateway between a PLC (via Ethernet) and a Dispenser (via an RS485 port). From time to time, the dispenser is powered off and it (obviously) loses communication with the Flexy.

How can I program a script in the Flexy to report the status of that connection back to the PLC, with 0 being bad and 1 being good? It seems like the quality value in the Flexy keeps that information in a similar way, but I’m not sure how to acquire the value of quality for a port and assign that to a tag in the Flexy for a particular port. Thoughts?

What is the protocol that the dispenser uses to communicate with the Flexy, modbus?

Yes. Modbus, two topics (A and B). Both ports (topics) are powered up together and are either both active or both are inactive.

In that case, you could use the Status tag:

The tag almost lines up with what you are looking for (0=bad 1=good) with the exception that 2 is also bad. If having the 2 messes you up, you could create a new tag and write a script where 2 also equals 0.

I will need to pass this status back to my PLC (EtherNet/IP) via a tag, so I assume that I’ll have to write a script to access this STATUS tag. I have the periodic routine to check for other comm faults. What does the syntax look like to accomplish this for the RS485 Port?

PLC_STATUS_TAG@ = ???

You should be able to setup an ONCHANGE for the status tag then write that value to a tag you have setup on the PLC.

That’s a good idea, but what is the address for the first port on a RS485 Serial Module? Where can I find out what the addresses are for all the different ports on a Flexy? Is there a list?

Hi @mitchell.hein,

How are you talking to the rs485 device currently? Is it a modbus device? You should be able to look at the address used for other tags for the device.