... and yet another "prescan" post ...
rsdoran said:
Even if you use the examples offered...on startup why would an output be on?
first of all ... on startup an output might be ON because we purposefully “latched” its bit ON in our program ... and here’s why I used the Recirculation Pump for my example ... suppose that this particular recirculation pump is necessary to keep our nuclear reactor cool ... now if we were to foolishly use the seal-in approach to program its control, then every time the plant power flickered, we’d need to remember to go over and press the start button to bring the pump back on again ... but the latches are “retentive” ... they “retain” their ON status when the processor is power-cycled ... so a latched-on construction would definitely be a better way to program our recirculation pump ...
and please, folks, don’t jump on my case about how to REALLY control a nuclear power plant ... we all know that I’m just trying to come up with some interesting examples to illustrate these programming concepts ...
a basically true story ... suppose that a customer has programmed his lumber mill using seal-in rungs to help the processor “remember” where the logs are located ... so when a log moves past Limit Switch A, he seals-in bit B3/22 ... this means there is a log in position A ... when the log moves past Limit Switch B, he unseals bit B3/22 ... this means that Position A is empty and ready for the hydraulic ram to feed in another log ... now suppose that the ram has just shoved a log into Position A ... so bit B3/22 is set (1) ... but then the power to the plant flickers ... what happens to B3/22? ... since he’s using a seal-in rung construction, B3/22 gets reset (0) during prescan ... oops! ... the PLC thinks that Position A is empty ... the hydraulic ram shoves in an extra log and does about $4,000 damage to the saw ...
this would have been a good place to have used a latched-in type rung construction ...
back to rsdoran’s question ...
JSR or not...if the rung isnt used and the device is not ON..cant be on if machine is OFF..can it?
I’m not 100% sure that I understand what you’re asking ... but I am 100% sure that you do know your way around PLC’s ... regardless of that, I’m going to take the liberty of answering your question in very basic terms ... even if you personally don’t need this level of detail, then I’m sure that there are some readers out there who will ...
first let’s make sure that we all know that there is a BIG difference between the “device” ... meaning the actual electrical equipment out in the field ... and the “bit” ... which is really just a “box” inside the processor’s memory ... now consider my prescan example ... we ended up with three rungs of interest ... one rung had an OTL (Output Latch) instruction for bit O:6/0 ... another rung had an OTU (Output Unlatch) instruction for bit O:6/0 ... the third rung had an OTE (Output Energize) instruction for bit O:6/0 ... keep in mind that there is ONLY ONE bit (that is, one BOX) with the address O:6/0 ... if you want to see the bit (in other words, the BOX) with the address O:6/0, then go to the output data table and find it ... you’ll see that the bit contains either a one (1) or a zero (0) ... now let’s think about that word “instruction” that I’m using ... the word literally means that we (the programmers) are issuing an INSTRUCTION in order to tell the PLC (that little man inside the processor) what we want him to do for us ...
soapbox time:
here is a very popular MISconception: that little ----( )- doodad thingy at the end of the rung is a “bit” ... friends and neighbors, that is the WRONG way to look at this ... the little ----( )- doodad thingy at the end of the rung is NOT a “bit” ... actually it is an “INSTRUCTION” which tells the processor what we want him to do TO THE BIT ... when the processor scans (or “reads”) the instruction, then the processor jolly well goes and does just EXACTLY what the instruction tells him to do ... now in our example there IS a bit involved ... bit O:6/0 ... but that bit is NOT located at the end of the rung ... instead the actual bit is located back inside the processor’s memory ... it is literally and actually a little BOX that can hold either a one or a zero ...
now let’s look at the logic of the prescan example again ... making sure that we use this perception of program “instructions” which manipulate a “bit/box” back inside the processor’s memory ...
the LATCH rung literally says: “if the conditions are TRUE, then go put a ONE in the bit/box” ... else if the conditions are FALSE, then do NOTHING ...
the UNLATCH rung literally says: “if the conditions are TRUE, then go put a ZERO in the bit/box” ... else if the conditions are FALSE, then do NOTHING ...
the regular old everyday OTE rung literally says: “if the conditions are TRUE, then go put a ONE in the bit/box” ... else if the conditions are FALSE, then go put a ZERO in the bit/box” ...
now in my prescan example, the third (OTE) rung was NOT BEING USED ... specifically, that particular rung was located in an old “junk” subroutine which was NEVER EVER intended to be scanned by the processor ...
now the fact that the RUNG was not being used does NOT mean that the DEVICE (the Recirculation Pump out in the field) was not being used ... and the fact that the RUNG was not being used does NOT mean that the BIT (the little O:6/0 box in the processor’s memory) was not being used ... what the fact that the RUNG was not being used DOES mean is that the processor was NEVER EVER expected to read that little OTE instruction again ...
but we can still use the O:6/0 bit/box ... we can certainly use the Latch instruction to tell the processor to go put a one into that box ... and we can certainly use the Unlatch instruction to tell the processor to go put a zero into that box ... and at the end of the processor’s scan, whatever (either a one or a zero) that happens to be in that O:6/0 bit/box will be sent over the PLC’s backplane to the output module ... if a one gets sent to the output module, then the output module will turn the DEVICE (the recirculation pump) ON ... if a zero gets sent to the output module, then the output module will turn the DEVICE (the recirculation pump) OFF ...
and that’s what happens in the day-to-day execution of our program ... specifically, we use the OTL (Output Latch) rung to turn the Pump ON ... we use the OTU (Output Unlatch) rung to turn the Pump OFF ... and we do NOT use the OTE (Output Energize) rung at all ... it just lurks there ... lying in wait ... looking for a chance to confuse us ...
now suppose that this is a normal workday and that we’ve got the Pump running ... so bit/box O:6/0 must contain a one ... the Latch rung is false ... so it is NOT affecting the bit/box right now ... the Unlatch rung is false ... so it is NOT affecting the bit/box right now ... the old Output Energize rung back in “junk” file 3 is not even a part of the picture ... the processor isn’t even concerned with it at all ... it certainly does NOT affect the bit/box right now ...
now suppose that the processor is powered down ... while the power remains off, what do you suspect is stored in bit/box O:6/0? ... answer: there is still a ONE stored in that bit/box ... the processor’s battery power maintains that bit/box in its current status ... and it’s still there ... and it’s still there ... and it’s still there ... but then all of a sudden the power comes back on ... the processor wakes up and does that confusing “prescan” routine ...
let’s consider what happens to our three rungs during prescan ... the prescan does not affect the Latch rung ... so nothing happens to the status of bit/box O:6/0 yet ... so we’ve still got a one in there ...
next, the prescan does not affect the Unlatch rung ... so nothing happens to the status of bit/box O:6/0 yet ... so we’ve still got a one in there ...
finally, the prescan DOES affect the Output Energize rung ... BINGO! ... just because it’s an OTE instruction, during prescan the processor goes to the bit/box and it puts a zero into it ... it changes the status of bit/box O:6/0 ... EVEN THOUGH the Ladder File 3 has NO JSR to “call” it ... during prescan the processor still finds that “unused” OTE back there in our old “junk” file ... and so NOW all of sudden we’ve got a zero stored in our O:6/0 bit/box ... so now we’re at the end of the scan ... and look what gets sent over the backplane to the output module ... a zero ... and that turns the device (the Pump out in the field) OFF ...
rsdoran said:
I will read this post a hundred times or more AND will look for data at AB to verify it...nothing personal just my way to know.
no personal offense taken ... but may I make a friendly suggestion? ... don’t take my word for any of this ... or AB’s word either for that matter ... instead run your own experiments ... now that the “prescan” genie is out of the bottle, you’ll eventually come up with all sorts of questions to ask and answer ...