I know I'm thinking about this wrong -- too many decades of procedural and event-driven programming and only a few months of PLC ST programming......
I've created a visualization with a button that when pushed calls a method.
I want the method to take a pressure reading, wait one minute and then take another pressure reading. I'm looking for leaks. I'm using TON for the delay.
It seems like what is happening is that the method gets called once and it takes the first reading and starts the TON. But then execution continues, leaves that method call, and the second reading never happens. I can force the method to keep running until the whole thing is done with a While loop, but I understand that is considered BAD in PLC programming. If it push the button again to call the method again, it picks up where it left off and if the timer is complete then it runs the remaining code.
How do I keep that method running until it is complete with just one call without using a while loop that ties up the PLC for a minute?
Thanks!
-Farren
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I know I'm thinking about this wrong -- too many decades of procedural and event-driven programming and only a few months of PLC ST programming......
I've created a visualization with a button that when pushed calls a method.
I want the method to take a pressure reading, wait one minute and then take another pressure reading. I'm looking for leaks. I'm using TON for the delay.
It seems like what is happening is that the method gets called once and it takes the first reading and starts the TON. But then execution continues, leaves that method call, and the second reading never happens. I can force the method to keep running until the whole thing is done with a While loop, but I understand that is considered BAD in PLC programming. If it push the button again to call the method again, it picks up where it left off and if the timer is complete then it runs the remaining code.
How do I keep that method running until it is complete with just one call without using a while loop that ties up the PLC for a minute?
Thanks!
-Farren