Jump to content

Modbus RTU Slave Watchdog


Recommended Posts

Is there a system integer or bit that is set when a Modbus RTU SLAVE has received a command from a master?

I would like the make a watchdog on my slave device to to notify the operator if communications is lost and to pause the process as it is working with stale data.

Link to comment
Share on other sites

  • MVP 2023

In crucial operations I have a deliberate time check on data being updated correctly.  Every nominated time period, I place a number well outside the normal range in a register, having the system ignore it for that small time, and then see if it gets changed.  If it doesn't get changed within a given delay, the alerts come up.

This is actually a very easy thing to implement as you only need to check one piece of data, not a full vector, and isn't based on any reads of system stuff that Alex has rightly suggested.  It is based on actual results.  You could do it to an entire vector if you felt it needed...I've never found it necessary.

I should mention that all my slaves are routinely called in a varying sequence, with a given maximum time between calls, which you definitely have to relate to the slave's checking time periods.

cheers, Aus

Link to comment
Share on other sites

12 hours ago, AlexUT said:

See SDW 37 description.

And SI 274, 275, 276.

 

SDW 37 was just what I wanted. I simply check if it hasn't changed and allow the watchdog to run, every change will reset the counter.

4 hours ago, Ausman said:

In crucial operations I have a deliberate time check on data being updated correctly.  Every nominated time period, I place a number well outside the normal range in a register, having the system ignore it for that small time, and then see if it gets changed.  If it doesn't get changed within a given delay, the alerts come up.

This is actually a very easy thing to implement as you only need to check one piece of data, not a full vector, and isn't based on any reads of system stuff that Alex has rightly suggested.  It is based on actual results.  You could do it to an entire vector if you felt it needed...I've never found it necessary.

I should mention that all my slaves are routinely called in a varying sequence, with a given maximum time between calls, which you definitely have to relate to the slave's checking time periods.

cheers, Aus

I do a similar thing on the master to guarantee sane data or generate errors. The slaves though I was using a "heartbeat bit" but SWD 37 is essentially that and simpler.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.