PLC Messaging Toggling Bits for Ack/Handshake Messages?

theColonel26

Lifetime Supporting Member
Join Date
Feb 2014
Location
West Michigan
Posts
785
Does anyone else toggle bits, or increment words as a messaging technique?


To start a sequence or process I will hold a bit true (To avoid accidental starts), but usually for statuses and the complete confirmations (Acks) I uses a changing value (toggle a bool) and watch for it to change.

I do this to avoid race conditions, or at least greatly reduce my risk of race conditions.

I know a lot of people just use a timer to hold a bit true for like 5 seconds at the end of sequences for a complete signal, but that to be is not a solution is is just a cheap band-aid.

With toggling bools you can still run in to race conditions but in most situations it is not an issue are fine. I have started using incremented INT/DINTs in some places now. That is the most race condition proof technique I can think off. but it also uses a lot more data.


Lastly I always put timeouts on a sequence to alert the User that something went wrong and then let them reset and try again.



Thoughts?
 
Yes, and depending on the process, I might do a state machine. No race conditions when doing that. If you signed up for ICC 2021 there was actually a short webinar that discussed this.

I typically use words as triggers, that way if I timeout and want to try again I just increment, easier than toggling.
 
Not really. More and more I've used EQU and MOV for Sequences even for bog standard simple things, we got a young apprentice and it's easy to display whats going on.

Or if it's a momentary from the HMI, it unlatches that bit when it's started to do what it needs to do.

EDIT: Should of read what you had written properly. Yes I do.
 
Last edited:
Does anyone else toggle bits, or increment words as a messaging technique?
Yes, I did for a long time. I ran into problems with a difficult customer who wouldn't admit his missed the toggle.


I also use to use ACK bits but that too is a problem if someone sends you a message and they look for the ACK bit immediately before the message is received and clears the ACK bit while the message is being processed. If you can get the other device to wait for a rising edge on the ACK bit then everything will work fine.


Thoughts?
The problems occurred when the bit got toggled off and then on again but the other device did not see the toggle.
Now I/we use TNS ( transaction sequence numbers ). This is much more reliable because then you know what message is being acknowledged.
 
Honestly a good idea, Peter. I could use an errant sequence number to determine and accumulate missed message counts.
 
The problems occurred when the bit got toggled off and then on again but the other device did not see the toggle.

The other device should be in a holding pattern waiting for it, it should know to look for it. While I'm not a fan of discrete handshakes, if done correctly they will work. It sounds like in your case it wasn't done correctly. Because, the sender turns the bit on, the receiver turns it off, nothing to miss in that case. You could have a terrible network, and it still work.
 
Yes, I prefer it. Incrementing a INT/DINT for interlocking / messaging instead of just a bit adds an extra level of confidence. Replying with the same INT-DINT value seals the loop.
 

Similar Topics

Hey guys. Got a strange one. Was sent to a site where the VNC access is very poor. The IT has assisted and a Wireshark report shows data...
Replies
7
Views
325
Hello everyone. I have a question about Rockwell PLC communication. Now I have a PLC5/30 and a Guardlogix 1756-L71S rack with 1756-DHRIO In my PLC...
Replies
4
Views
1,421
Hello Everyone, I am trying to set up messaging instructions between these two PLC. PLC 1 = 1769L32E Compact Logix 5332E Controller V17 of...
Replies
4
Views
2,091
I am having trouble messaging from a Control Logix L61 (Version V18) CPU over Ethernet to a PLC5/40E "Series F" (RJ45 on-board) Processor - which...
Replies
15
Views
3,362
Hi Guys, I have a project that requires a M340 PLC to communicate with a PM5340 power meter over Modbus TCP. I have previously used the same type...
Replies
3
Views
3,310
Back
Top Bottom