So, I get sent a heartbeat, an int that goes from 0-9 every second and then restarts, I need to detect if it stops after 3 secs. Any simple way without a bunch of comparators and timers? Using Siemens S7 5.5 in LAD
Move the heartbeat int into a register, and start a timer. After the timer expires compare the heartbeat int to the saved register value. If it is the same you have a communication error.
If the value is different then start the process again.
So, I get sent a heartbeat, an int that goes from 0-9 every second and then restarts, I need to detect if it stops after 3 secs. Any simple way without a bunch of comparators and timers? Using Siemens S7 5.5 in LAD
You can use the heartbeat to pulse a counter. You should be able to compare the counter acc (Rockwell) and the pulse integer every scan cycle. Use a compare instruction, if there are not equal to start a timer for the allotted time.
In any platform with a real time clock I've always just read the seconds register as a heartbeat. Move the seconds value to the contiguous data block in the slave containing my values read by the master. In the master compare the new value to the old value. If they are the same set an alarm or start the alarm delay timer. If they are different move the ew value to the old value, reset the alarm timer. Repeat.
Move the heartbeat int into a register, and start a timer. After the timer expires compare the heartbeat int to the saved register value. If it is the same you have a communication error.
If the value is different then start the process again.
To make sure the heart is beating on the other side of the communication link. Think of it as the 4mA in the analog current loop. If the heartbeat stops it's possibly two things, a communication fault for some reason like a cable cut, or the plc on the other side is in stop mode and the data being received isn't actually being updated.
Some PLC's nowadays will tell you if a node is present on a network with diagnostic functions or function returns, but very seldomly do you actually know if the CPU on the other side is running.
A good example of this is the PUT/GET instructions in the Siemens PLCs where you can PUT or GET a value from a PLC even if it is in stop mode.