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

  • Ausman changed the title to IMPORTANT Sub-Routine Advice (updated)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...