part 3 ...
now let’s tackle the second scenario from the original post by skyfox ...
RUNG#0 MOMENTARY_SWITCH_44-------[ONS1]-----------LIGHT_1_ON[L]
RUNG#33 MOMENTARY_SWITCH_17------[ONS1]-----------LIGHT_5_ON[L]
Is this possible or is it a no-no.
it’s a definite no-no ... this one can be even more confusing - since you have two separate switches this time ... but let’s go through it – at least part way ...
(71) suppose that MOMENTARY_SWITCH_44 has been turned “OFF” out in the field for a long time ...
(72) the bit/box for MOMENTARY_SWITCH_44 thus contains a 0 ...
(73) also suppose that MOMENTARY_SWITCH_17 has been turned “OFF” out in the field for a long time ...
(74) the bit/box for MOMENTARY_SWITCH_17 thus contains a 0 ...
(75) now suppose that the CLX processor begins its next pass through the ladder logic ...
(76) on Rung #0, the XIC instruction for MOMENTARY_SWITCH_44 tells the processor to “go look for a 1” in the bit/box for MOMENTARY_SWITCH_44 ...
(77) the processor does NOT find a 1 – and so the XIC is evaluated as “FALSE” ...
(78) now the processor comes to the ONS with “FALSE” logic ...
(79) whenever the ONS is executed with “FALSE” logic, “FALSE” logic flows downstream from the ONS ... (translation: no “fire” this time) ... AND the processor also resets the ONS bit/box to a 0 status ... (translation: it “reloads” the ONS) ...
(80) now the processor comes to the OTL (Latch) instruction with “FALSE” logic ...
(81) whenever the OTL instruction is executed with “FALSE” logic, the processor takes NO action ... (translation: the status of LIGHT_1 remains unchanged) ...
(82) on Rung #33, the XIC instruction for MOMENTARY_SWITCH_17 tells the processor to “go look for a 1” in the bit/box for MOMENTARY_SWITCH_17 ...
(83) the processor does NOT find a 1 – and so the XIC is evaluated as “FALSE” ...
(84) now the processor comes to the ONS with “FALSE” logic ...
(85) whenever the ONS is executed with “FALSE” logic, “FALSE” logic flows downstream from the ONS ... (translation: no “fire” this time) ... AND the processor also resets the ONS bit/box to a 0 status ... (translation: it “reloads” the ONS) ...
(86) now the processor comes to the OTL (Latch) instruction with “FALSE” logic ...
(87) whenever the OTL instruction is executed with “FALSE” logic, the processor takes NO action ... (translation: the status of LIGHT_5 remains unchanged) ...
(88) and around and around we go – until something changes ...
(89) now suppose that someone turns MOMENTARY_SWITCH_44 “ON” out in the field ...
(90) the bit/box for MOMENTARY_SWITCH_44 now contains a 1 ...
(91) suppose that MOMENTARY_SWITCH_17 still remains “OFF” out in the field ...
(92) the bit/box for MOMENTARY_SWITCH_17 still contains a 0 ...
(93) now suppose that the CLX processor begins its next pass through the ladder logic ...
(94) on Rung #0, the XIC instruction for MOMENTARY_SWITCH_44 tells the processor to “go look for a 1” in the bit/box for MOMENTARY_SWITCH_44 ...
(95) the processor DOES find a 1 – and so the XIC is evaluated as “TRUE” ...
(96) now the processor comes to the ONS with “TRUE” logic ...
(97) whenever the ONS is executed with “TRUE” logic, the processor first checks the status of the ONS bit/box ... (translation: it needs to see if the ONS has already been “fired”) ...
(98) in this case, the processor finds a 0 in the ONS bit/box ... (translation: since it found a 0, the processor now knows that the ONS has NOT already been fired) ...
(99) whenever the processor executes the ONS with “TRUE” logic – AND the ONS bit/box contains a 0 – “TRUE” logic flows downstream from the ONS ... (translation: the ONS was “loaded” and now it gets “fired”) ... AND the processor sets the value of the ONS bit/box to a 1 ... (translation: the processor marks the ONS as “fired”) ...
(100) now the processor comes to the OTL (Latch) instruction with “TRUE” logic ...
(101) whenever the OTL instruction is executed with “TRUE” logic, the processor “goes and writes a 1” into the bit/box for LIGHT_1 ... (translation: the processor sets the status of LIGHT_1 to a 1) ...
(now here’s a VERY tricky part) ...
(102) on Rung #33, the XIC instruction for MOMENTARY_SWITCH_17 tells the processor to “go look for a 1” in the bit/box for MOMENTARY_SWITCH_17 ...
(103) the processor does NOT find a 1 – and so the XIC is evaluated as “FALSE” ...
(104) now the processor comes to the ONS with “FALSE” logic ...
(105) whenever the ONS is executed with “FALSE” logic, “FALSE” logic flows downstream from the ONS ... (translation: no “fire” this time) ... AND the processor also resets the ONS bit/box to a 0 status ... OOOPS! ... (translation: it “reloads” the ONS) ...
(106) now the processor comes to the OTL (Latch) instruction with “FALSE” logic ...
(107) whenever the OTL instruction is executed with “FALSE” logic, the processor takes NO action ... (translation: the status of LIGHT_5 remains unchanged) ...
(108) and now we go around again – with the same switch conditions ... specifically, MOMENTARY_SWITCH_44 is “ON” out in the field ... MOMENTARY_SWITCH_17 is “OFF” out in the field ...
(109) suppose that MOMENTARY_SWITCH_44 is still “ON” out in the field ...
(110) the bit/box for MOMENTARY_SWITCH_44 still contains a 1 ...
(111) suppose that MOMENTARY_SWITCH_17 still remains “OFF” out in the field ...
(112) the bit/box for MOMENTARY_SWITCH_17 still contains a 0 ...
(113) now suppose that the CLX processor begins its next pass through the ladder logic ...
(114) on Rung #0, the XIC instruction for MOMENTARY_SWITCH_44 tells the processor to “go look for a 1” in the bit/box for MOMENTARY_SWITCH_44 ...
(115) the processor DOES find a 1 – and so the XIC is evaluated as “TRUE” ...
(116) now the processor comes to the ONS with “TRUE” logic ...
(117) whenever the ONS is executed with “TRUE” logic, the processor first checks the status of the ONS bit/box ... (translation: it needs to see if the ONS has already been “fired”) ...
(118) in this case, the processor finds a 0 in the ONS bit/box ... (translation: since it found a 0, the processor now knows – or at least it THINKS! - that the ONS has NOT already been fired) ... (IMPORTANT! notice that the status of the ONS has been “hijacked” by that other ONS instruction down on Rung #33) ...
(119) whenever the processor executes the ONS with “TRUE” logic – AND the ONS bit/box contains a 0 – “TRUE” logic flows downstream from the ONS ... (translation: the ONS was “loaded” and now it gets “fired” – AGAIN!) ... AND the processor sets the value of the ONS bit/box to a 1 ... (translation: the processor marks the ONS as “fired”) ...
(120) now the processor comes to the OTL (Latch) instruction with “TRUE” logic ...
(121) whenever the OTL instruction is executed with “TRUE” logic, the processor “goes and writes a 1” into the bit/box for LIGHT_1 ... (translation: the processor sets the status of LIGHT_1 to a 1) – AGAIN! ...
(again - here’s the same VERY tricky part) ...
(122) on Rung #33, the XIC instruction for MOMENTARY_SWITCH_17 tells the processor to “go look for a 1” in the bit/box for MOMENTARY_SWITCH_17 ...
(123) the processor does NOT find a 1 – and so the XIC is evaluated as “FALSE” ...
(124) now the processor comes to the ONS with “FALSE” logic ...
(125) whenever the ONS is executed with “FALSE” logic, “FALSE” logic flows downstream from the ONS ... (translation: no “fire” this time) ... AND the processor also resets the ONS bit/box to a 0 status ... OOOPS! ... (translation: it “reloads” the ONS – AGAIN!) ...
(126) now the processor comes to the OTL (Latch) instruction with “FALSE” logic ...
(127) whenever the OTL instruction is executed with “FALSE” logic, the processor takes NO action ... (translation: the status of LIGHT_5 remains unchanged) ...
(128) and now we go around again ...
(129) so in this setup, the logic of Rung #0 will be executed (with “TRUE” logic) over and over again on each and every scan – REGARDLESS of the presence of the ONS instruction ...
and that’s enough for now ... anyone who wants to work through the “what if?” conditions with the other switch positions is welcome to my nightmare ...
going further ... when you finally get a chance to try this out on a working processor, I’d suggest that you set up something EXACTLY like the example that my distinguished colleague MikeB suggested in Post #7 ... you’ll find that the ADD instructions will make it a LOT easier to see what’s going on than the OTL and OTU instructions that you used in your original post ...
and now on to the next post where the SERIOUS fun begins ....