Sign in to follow this  
Followers 0
darrenj

subroutines in logix

3 posts in this topic

Sorry guys but i am back again! Just to clarify...If i create a new rotine under the main routine it will not do anything unless i "jump" to that routine? I have a subroutine now that does all my math. However it wont do anything unless i write a line in my main program that jumps to that routine.. Now if i add a line like this -------------------------------------------------JSR---- Routine= Main math Is there any problems? It works but.... I also dont have a return anywhere also if i create more that one routine the second routine dosnt seem to work.. I know i am not explaing myself very well but does any one get what i am talking about? PS if anyone is in the ottawa area i would pay for a refresher course on the control logix... Thanks Darren

Share this post


Link to post
Share on other sites
ControlLogix: For each task, there will be an assigned main routine (this appears to have a no. 1 on its icon), this task is scanned continuously. For each further subroutine under the main routine, these must be called by the use of the JSR function. You have one JSR for each subroutine in the program, it is usual to call them all from the main routine, though you can call a subroutine from a subroutine. If you want the entire subroutine to be scanned, there is no real need to put a return instruction in, when the program gets to the end instruction of a subroutine, it will jump back to the place it was called from

Share this post


Link to post
Share on other sites
Download this example program: http://forums.mrplc.com/index.php?act=Downl...&CODE=02&id=359 it uses subroutines, and you can get an idea of how they are called. Ken

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