Navyguy

MrPLC Member
  • Content count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Navyguy

  • Rank
    Hi, I am New!

Profile Information

  • Country Canada
  1. Thanks Guys, appreciate your responses. I acknowledge that on this small program, the scan time issue is not relevant (think I mentioned that initially).  Again looking at "best practices" and code organization and thought this would be a simple one for the apprentices.  I will just focus on a different scenario, perhaps a Pack, Clean, Maintain that has three distinct functions that can be conditional with a selector switch or something. Cheers John
  2. Hi Joe E. Thanks for your response. I have read a lot regarding opinions on conditional / unconditional sub-routines.  Perhaps it is my inexperience, but I do find it interesting that there is a trend to put in unconditional sub-routines just for the purposes of organizing the code (which I agree it can be easier to look at things); but if the sub-routines run all the time or every time, there is no savings on PLC resources, which to me is the fundamental reason for having sub-routines in the first place. I am going to try to use some unconditional sub-routines to get this going, but it does seem illogical to call for sub-routines that are not required in the overall scope of things. Can you confirm that this is a limitation of the software? Cheers John
  3. Good Day All It has been a while since I have done any serious programming with PLCs; having said that I feel pretty comfortable with the older AB series of PLC.  I am currently working with some apprentices and I have given them the task of programming the classic “Alternating Pump” scenario.  I think we all know the scenario… The premise is Pump A is activated and will run for a max 15 minutes or until max pressure / level reached.  Pump B is activated on the next call for low pressure / level or when Pump A runs for 15 minutes; Pump B will run for 15 minutes max. Pump A will then be recalled and run until level / pressure reached or will continue to run for 15 minutes; Pump A continues to run and Pump B will start (after a total of 45 minutes single run time) until pressure / level reached.  Note that this could be the opposite order based on what pump was called first in the alternating cycle. If there is a call from the "extra low" level / pressure at any point, then both pumps run until the level / pressure is reached and then the alternating cycle is returned to normal. The alternating pump, and timers, the calls and recalls, etc is all pretty straight forward from my perspective.  Where I am struggling with is a I want to add conditional sub-routines to this to teach the apprentices how to keep the program(s) organized and ultimately to learn in larger programs to reduce scan time and memory resources.  I acknowledge that this small program; it is unlikely it would be necessary to use sub-routines, but I am interested in teaching the good programming principles. What I have tried to do is create several sub-routines essentially calling them Pump_1, Pump_2, Pump 1_2.  The issue I am having is I cannot get the pump to turn off in the sub-routine when the program exits early (reaches maintain level before timer expires as an example, or where it is switched from Auto to Hand) the OTE remains true.  I am able to use move bits to reset the .acc bits on the timers and counters and I have use B3 bits to keep the “real world” OTE in the main program, but obviously I am missing something here very simple. I have not taught the apprentices the One-Shot instruction, but I am not sure if this is where I need to go, and I am not a proponent of the OTL, OTU instructions (perhaps I should be?). I understand that the instructions in the JSR will stay in their last state upon exiting, but I, for some reason, can’t figure out how to change the condition of the OTE (either real world of B3) in the sub-routine before exiting.  I have done a fair amount of research and am wondering if it is an issue with the AB RSlogix Lite that I am using with the apprentices. I appreciate you taking the time to read my very long first post and offering any suggestions. Cheers John