Jump to content

IMPORTANT Sub-Routine Advice (updated)


Recommended Posts

  • MVP 2023

Hi all,  if you are new to Vision and Visilogic, one thing that constantly crops up on the forum is the correct use of subroutines.

This is discussed in depth at point 11 in  https://forum.unitronics.com/topic/6229-ongoing-20-topics-almost-worth-pinning/  but a quick overview is here to alert you in the first place.

If you STOP calling a sub, then everything in it will remain exactly the way the sub was setting things on the scan when the conditional call stops.  They do NOT change state at all when the call ceases, until different areas of the ladder that are still active work on the operands/elements involved.  If the sub turns a MB on, it remains ON when the sub ceases to be called.  It is very easy to think along the lines of if the power is not supplied to the sub, because the power rail supplying the MB has gone off, the MB will go OFF if it was ON.  This is not true and is a very important thing to understand.

The ongoing list is a good thing to go through completely anyway.  And another topic that explains things well:

https://forum.unitronics.com/topic/7081-subroutines/

cheers, Aus

Link to comment
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
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.