if it bleeds, we can kill it ...
well, my goodness ...
first of all, let me say that MOST of the recent questions could be answered by carefully viewing the series of videos available from the Sample Lessons page of my website ... video number 11 is actually the one that specifically covers the "Retentive" instructions – but I'll absolutely GUARANTEE that the material it contains will make a LOT more sense to most people if they would watch the entire series all the way through IN ORDER ...
there are also some very helpful ideas in those two links that I provided way back in Post #9 of this thread ...
anyway ...
I'm pretty sure that in Post #42 jstolaruk didn't mean that ALL of those rungs should be used at the same time ... more likely he intended to show a side-by-side comparison of the two programming approaches ...
but then again, since the stone has been turned (so to speak) let's go ahead and run through a quick analysis of the "program" shown in the figure below ... once again, this is NOT a recommended way to write the program – just a simplified attempt to look under the hood of the PLC and try to get a handle on the confusion ...
notice the figure attached below ... I've included a "truth table" to show the four possible conditions of the two field inputs X and Y – and the resulting status of a real-world field output device ... many (MOST?) people confuse the relationships between the output INSTRUCTIONS in the rungs - and the BIT/BOXES in the processor's memory – and the output DEVICES located in the field ... to cut down as much as possible on that sort of confusion, I've decided to replace the internal bit B3/1 in jstolaruk's original program with a real-world output device – a LAMP ...
and so ... what follows is a SIMPLIFIED breakdown of what's going on as the processor executes the rungs ...
CONDITION A ... on rung 0000, the XIC for Y is FALSE ... the OTE writes a ZERO into the lamp's bit/box ... on rung 0001, the XIC for X is FALSE ... the OTL does nothing ... on rung 0002, the XIC for Y is FALSE ... the OTU does nothing ... so at the end of each pass through the ladders, the bit/box for the lamp contains a status of ZERO ... in condition A, the LAMP device in the field will be turned OFF ...
CONDITION B ... on rung 0000, the XIC for Y is TRUE ... but the XIC for X and the XIC for the lamp are both FALSE ... the OTE writes a ZERO into the lamp's bit/box ... on rung 0001, the XIC for X is FALSE ... the OTL does nothing ... on rung 0002, the XIC for Y is TRUE ... the OTU writes a ZERO into the lamp's bit/box ... so at the end of each pass through the ladders, the bit/box for the lamp contains a status of ZERO ... in condition B, the LAMP device in the field will be turned OFF ...
CONDITION C ... on rung 0000, the XIC for Y is FALSE ... the OTE writes a ZERO into the lamp's bit/box ... on rung 0001, the XIC for X is TRUE ... the OTL writes a ONE into the lamp's bit/box ... on rung 0002, the XIC for Y is FALSE ... the OTU does nothing ... so at the end of each pass through the ladders, the bit/box for the lamp contains a status of ONE ... in condition C, the LAMP device in the field will be turned ON ...
CONDITION D ... on rung 0000, the XIC for Y is TRUE ... the XIC for X is TRUE ... the OTE writes a ONE into the lamp's bit/box ... on rung 0001, the XIC for X is TRUE ... the OTL writes a ONE into the lamp's bit/box ... on rung 0002, the XIC for Y is TRUE ... the OTU writes a ZERO into the lamp's bit/box ... so at the end of each pass through the ladders, the bit/box for the lamp contains a status of ZERO ... in condition D, the LAMP device in the field will be turned OFF ...
summary: condition C (highlighted) is the only setup that will "turn on" the LAMP in the field ... and incidentally, condition C is the setup shown in the figure below ...
disclaimer: the description above is intended for Allen-Bradley processors in the PLC-5, SLC-500, and MicroLogix platforms ... the description would be DIFFERENT for a ControlLogix or CompactLogix system ... as for Siemens, etc. – well I have ZERO experience with those – so I'll leave that subject open for discussion ...
and finally:
Ron Beaufort has some excellent posts covering this.
thank you, mellis ... I appreciate the kind compliment ...
party on, folks ...