Confusion with OSR

arnabbanik

Member
Join Date
Jan 2014
Location
NY
Posts
27
Hi All,

thanks for such a wonderful forum. I am a beginner and I was playing around with instructions. I just randomly built the attached logic.

My questions is :-

On rung 3, if I am toggling the left switch, why is it not allowing me to latch on the right side?Shouldn't it be true, as if left is true, it should be true on the right?

If anyone can give me an insight, I will highly appreciate.

Thanks,
Arnab
 
you unlatch your coil right after on rung4.

(B3.0 3 is true one scan, so it will latch B3.0 2. On next scan B3.0. 3 is false, so it will unlatch B3.0 2.)

What is purpuse of rung 5?
 
The latch in rung 3 (B3:0/2) will latch for one scan only as on the following scan will 'turn off' B3:0/3 in rung 2 causing it to unlatch B3:0/2 in rung 4 this will all happen so fast your screen update speed will probably not catch it.

Steve

Note to self 'must learn to type faster'
 
Scan 1, Rung 2 - B3:0/5 is FALSE - since the input to the OSR is FALSE it passes FALSE to B3:0/3. The OSR stores the FALSE status in B3:0/6 (its 'memory' bit). Rungs 3/4 - since B3:0/3 is FALSE then B3:0/2 is Unlatched

Somehow B3:0/5 is turned TRUE

Scan 2, Rung 2 - B3:0/5 is TRUE - The OSR, since its input is TRUE and its 'memory' bit is FALSE it passes TRUE to B3:0/3. The OSR stores the TRUE input status in its 'memory' bit. Rungs 3/4 - since B3:0/3 is TRUE then B3:0/2 is Latched On

Scan 3, Rung 2 - B3:0/5 is still TRUE - the OSR, since its input is TRUE but its 'memory' bit is also TRUE it passes FALSE to B3:0/3. Rungs 3/4 - since B3:0/3 is FALSE it Unlatches B3:0/2

Somehow B3:0/5 is turned FALSE

Scan 4, Rung 2 - B3:0/5 is FALSE - since the input to the OSR is FALSE it passes FALSE to B3:0/3. The OSR stores the FALSE status in B3:0/6 (its 'memory' bit). Rungs 3/4 - since B3:0/3 is FALSE then B3:0/2 is Unlatched.

An OSR passes TRUE if its input is TRUE and its 'memory' bit (from the previous scan) is FALSE. Under all other conditions it passes FALSE.

[ OK, so I'm a bit 'wordy' ]
 
Last edited:
you unlatch your coil right after on rung4.

(B3.0 3 is true one scan, so it will latch B3.0 2. On next scan B3.0. 3 is false, so it will unlatch B3.0 2.)

What is purpuse of rung 5?

Hi Lare, thanks for the quick reply.If what you are saying is true, then what is happening at rungs 1 and 2 ? Isn't it the same logic , latch and unlatch? I was suspecting something is happening on rung 2 because of OSR, which I don't understand. I am attaching another screenshot here. You can see here, now it works as it is supposed to? Last rung is just an add on , as I was playing around and wanted to add another line,no purpose other than that.

If you can explain further, will be very helpful.

thanks!

Capture.jpg
 
Because on rungs 1 and 2 you latch and unlatch with XIC and XIO inscructions (examine if true / false)

So when you bit B3.0/0 is true you latch bit B3.0/1 and when bit B3.0/0 is false you unlatch bit B3.0/1.

You can do same with much less code with, no need to use latche/unlatch (set/reset):


input output
---| |-------------------( )




on rung 3 you make oneshot of bit B3.0/0 to bit B3.0/3, with is true only one plc scan (some 5-20ms maybe).

When you use this bit (B3.0/3) for both latch and unlatch -> bit b3.0.2 is also true one plc scan.

Change unlatch command to work from differen bit or oneshot on code. (like you have 2 different pushbuttons, one for setting bit on and other for setting bit off).

OSR inscructions are not allways even needed, but sometimes you need them sometimes not.
You also need to think, which one is stronger if both latch and unlatch inscructions are sametime on, usually unlath bit have to be stronger.

If you try do so called alternator which changes state from one pushbutton (off-on-off-on...), then go to downloads section, there is Lancie's example how you can do it many different ways... (under Allen Bradley)
 
Last edited:
Thanks a lot Bernie and Lare. I am going through the examples of Lancie. It really helps a lot to understand the difference.

One stupid question though, how many times exactly plc will scan my program? I was under the impression that, every time I toggle a switch it scans the process. But it seems ,my understanding is definitely flawed.

Thanks again for your time!
 
One stupid question though, how many times exactly plc will scan my program? I was under the impression that, every time I toggle a switch it scans the process. But it seems ,my understanding is definitely flawed.

Thanks again for your time!


Usually hundred or several hundred times per second, basically by default PLC scan it is not tied to anything on your code. If PLC is at run mode, it will execute code allways.
(with few exceptions, you can have ex. subroutines which are only scanned if some criterias are meeted. But even that time some code/program sections is allways executed on PLC (main code))

You need to check you plc scan time from your PLC, it can be freewheeling (executed so fast as possible) or cyclical (executes with time period like 20ms or 50ms).
if PLC have scan time 100ms-500ms, then I would say plc to slow or you have pretty big coding.
Usally scan time is less than 50ms maybe?
 
Last edited:
I was under the impression that, every time I toggle a switch it scans the process.
To say it another way, every time you toggle a switch, the PLC will scan your switch (and everything else). But the PLC scanning is not CAUSED by you toggling a switch.* As long as your PLC is in RUN mode, it will be doing a scan of all the active logic rungs in order from first to last, left to right. That is how it responds very quickly to changes anywhere in the logic.

* There are always exceptions, and there are special Immediate instructions in some PLCs that cause an immediate scan of an input.
 

Similar Topics

Hello, all, I am new here and pretty new to PLC'S. Closest thing I have to PLC experience is with avionics. At my new job I am a welding engineer...
Replies
4
Views
787
I am working on some documentation in preparation for updating firmware around our plant. On one particular PLC, the point IO has two different...
Replies
5
Views
690
When enabling a FOR instruction does the index set to the initial value before the first execution of the Called Routine? e.g. Initial Value = 6...
Replies
4
Views
1,460
Hello, My apologies in advance if this is a stupid question. I have done a fair amount of work in Factorytalk View machine edition, and I am...
Replies
2
Views
1,218
I'm looking to purchase either GX works2 or works3 for a Q series rack I purchased off of ebay. Now the confusion comes from either purchasing...
Replies
2
Views
1,358
Back
Top Bottom