Controlling Your World One Contact At A Time  

Differential Contacts

The DirectLogic instruction set adds what appears to be a very useful instruction. This is the Differential Contact. This contact is true for one time on the rising (STRPD, ANDPD, ORPD) or falling (STRND, ANDND, ORND) status of its reference. (Note that while three mnemonics are shown for each type, in the ladder diagram thee is no distinction other than position in a rung. In this note I will refer to all forms of these, positive and negative as DC – Differential Contact). And note that in this discussion I am NOT referring to the PD output.

I wish to refer to a thread which was generated on the AutomationDirect forum:

Differential Contact Thread

I also wish to especially refer you to an application note referred to in that thread:

PDF on Differential Contacts and Transition Memory

The thread and the application note make it clear that the use of the DC should be with care. I specifically recommend that it (the DC) be used only with inputs (X) unless you really read into the thread and the application note.

Let us review, using information from the application note, what is going on behind the scenes to make the DC work. The note shows that, at the end of each scan, the current status of all discrete memory types are copied to an area called 'Transition Memory'. When a DC is encountered in a rung the current status of the discrete memory reference is compared to its copy from the end of the previous scan. The Positive Differential contact is TRUE if the current status is TRUE and the status as stored in the 'Transition Memory' is FALSE. Likewise the Negative Differential contact is TRUE if the current status if FALSE and the status as stored in the 'Transition Memory' is TRUE.

So, how about an input (X)? Its use in a DC behaves pretty much as you would expect because the status remains the same through one scan. If the input is TRUE this scan and was FALSE on the previous then Positive Differential Contact produces a TRUE state.

But let's look at an output (Y). Let's say that at some point in a scan an output (let's say Y0) is turned on. Later in that same scan a Positive Differential Contact with Y0 is used. It would behave as your would normally expect. 

But let's now take a look at a DC which is before the rung which turns on Y0. On the scan which turns on Y0 you wouldn't expect the contact to be true because it is before the turn-on rung. But how about on the next scan. You think, “it's less than one full scan later, it should get a TRUE from a Positive Differential Contact of Y0”. BUT YOU DON'T . Why? Because at the end of the previous scan the now TRUE state of Y0 was stored to 'Transition Memory'. When this next scan reaches the Positive Differential Contact it sees the current state of Y0 at TRUE and it sees the 'Transition Memory' value of Y as also TRUE (as it was at the end of the previous scan). So the Positive Differential Contact does not yield a TRUE.

Thus any discrete memory value which can be changed within a scan can cause a problem.

So I encourage 3 levels of awareness of use:

  1. Least risky - Use the Differential Contacts only with inputs (X) – your shouldn't go wrong with this.

  2. More risky - Use Differential Contacts only with discrete memory items which are not affected by the ladder logic. An example would be bits affected by an HMI which are only changed outside of the scan. But note, if your ladder logic interacts with these, perhaps resetting a bit which was set by the HMI, then do not use them.

  3. Needs most caution - Use Differential Contacts as needed but ONLY AFTER all logic which can affect them has been completed in that scan. Use of the Differential Contact before changing logic will almost surely not behave as expected.

Happy programming!
Back To Introduction

Please email comments to me at the address below.

Copyright © 2005, 2006, 2007, 2008, 2009  Bernard Carlton