Controlling Your World One Contact At A Time
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:
I also wish to especially refer you to an application note referred to in that thread:
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:
Please email comments to me at the address below.