Sign in to follow this  
Followers 0
robert_

OSR instruction in ST language

4 posts in this topic

Hi, I'm new in ST language and looking for information at internet, i found the bellow code, but i don´t understand why the OSR instruction appear denied "NOT" ONS_trig:= start_stop AND NOT Rising_ONS; ON_OFF:=(ONS_trig AND NOT ON_OFF) OR (ON_OFF AND NOT ONS_trig); Rising_ONS:= start_stop;

Share this post


Link to post
Share on other sites
There is no OSR instruction in that code. What you're seeing is tags with "ONS" as part of the tag name. In the first line, the tag ONS_trig turns on if start_stop on on and Rising_ONS is off. In the last line, Rising_ONS is set equal to start_stop. Here's what happens: First scan, start_stop is OFF - ONS_trig is set to OFF; Rising_ONS is set to OFF Second scan, start_stop is ON - ONS_trig is set to ON (because Rising_ONS is still OFF); Rising_ONS is set to ON Third scan, start_stop is ON - ONS_trig is set to OFF; Rising_ONS stays ON Fourth scan, start_stop is OFF - ONS_trig stays OFF; Rising_ONS is set to OFF The ONS_trig is therefore on for one scan. So the middle line only reacts to the rising edge of the start_stop. This looks to me like code for a flip-flop. Each time the start_stop button is pressed, the ON_OFF tag changes state.

Share this post


Link to post
Share on other sites
ST has a built in FB called F_TRIG and R_TRIG. You must instantiate an instances of F_TRIG or R_TRIG for every one shot.

Share this post


Link to post
Share on other sites
thank you very much JROSS, I really have been very useful reply

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0