nailing down the OSR ...
Greetings Sportster,
first things first ... let me assure you that I don’t mean to be offensive - but maybe we need to talk about the way an OSR works ... now you might - in fact you PROBABLY DO - know everything about these little critters ... if so, I’m about to waste a few minutes of your time ... but ... the way that you have phrased some of your comments about the operation of the OSRs makes me think that a quick review might be a good thing ... if nothing else, this should at least get us all “on the same page” with the terms we’re using to describe your program’s operation ...
first let’s take a simple rung ... this is basically just a “big counter” ... one which will go much higher than a standard CTU counter ...
let’s run through a couple of program scans ...
first suppose that the input device (a part sensor) is OFF in the field ... when the processor comes to the XIC for the part sensor, it finds that the sensor is OFF ... so the XIC is evaluated as FALSE ... the processor then comes to the OSR with FALSE logic ... when FALSE logic comes to an OSR, two things happen ... first, the processor writes a ZERO into the OSR’s bit/box ... we usually call this “reloading” the OSR ... specifically, the OSR is now ready to fire when - and if - TRUE logic ever does come in ... the second thing that happens when FALSE logic comes to an OSR is that FALSE logic flows out ...
nailing this down: when FALSE logic reaches an OSR, the OSR is reloaded and ready to fire ... and FALSE logic flows out ...
continuing on ... FALSE logic reaches the ADD instruction ... the ADD instruction does nothing when FALSE logic comes in ... so the number stored at F8:0 remains unchanged ...
time marches on ... the processor makes many, many scans ... as long as the field device (part sensor) remains OFF, the OSR will have a ZERO stored in its bit/box ... and the ADD will not increase the value stored at F8:0 ...
now suppose that the input device (the part sensor) comes ON in the field ... when the processor comes to the XIC for the part sensor, it finds that the sensor is ON ... so the XIC is evaluated as TRUE ... the processor then comes to the OSR with TRUE logic ... when TRUE logic comes to an OSR, the processor checks the OSR’s bit/box to see if there is a ZERO stored there ... if the processor finds a ZERO, then he knows that the OSR has not already been fired ... next, the processor writes a ONE into the OSR’s bit/box ... we usually call this “marking” the OSR ... specifically, the processor is writing himself a little note that he is firing the OSR ... next, TRUE logic flows out of the OSR ... we usually call this “firing” the OSR ...
nailing this down: when TRUE logic FIRST reaches an OSR, the OSR is marked as fired (by writing a ONE in its bit/box) ... and TRUE logic flows out ...
continuing on ... TRUE logic reaches the ADD instruction ... the ADD instruction increases the number stored at F8:0 by one ...
time marches on ... on the next scan, the part sensor is still ON ...
when the processor comes to the XIC for the part sensor, it finds that the sensor is still ON ... so the XIC is evaluated as TRUE ... the processor then comes to the OSR with TRUE logic ... when TRUE logic comes to an OSR, the processor checks the OSR’s bit/box to see if there is a ZERO stored there ... this time the processor finds a ONE stored in the OSR’s bit/box ... this tells him that the OSR has already been fired ... next, the processor leaves the ONE in the OSR’s bit/box ... and FALSE logic flows out of the OSR ... specifically, the OSR is now FALSE - EVEN THOUGH THERE IS A ONE STORED IN ITS BIT/BOX ... many people miss this idea ... you may - in fact you probably do - already understand this ... but even so, this basic information might come in handy for others in the future ...
nailing this down: when TRUE logic reaches an OSR that has already been fired, the OSR stays marked as fired (by leaving a ONE in its bit/box) ... and FALSE logic flows out ...
side trip: in the PLC-5 processor, the nearest thing to an OSR is an ONS instruction ... this animal actually HIGHLIGHTS IN GREEN whenever there is a ONE stored in its bit/box ... this is EXTREMELY confusing to most maintenance techs who have repeatedly been told that “green means true” ... that ain’t so with an ONS ... it’s only TRUE for one scan ... EVEN THOUGH the screen paints it green ...
so that’s the rundown on the behind the scenes operation of an OSR ...
(continued in next post) ...