I can’t remember who but someone told me I should have a wait in each program so the processor doesn’t keep going through the program over and over so fast that it uses all the processor power or jam it up or something like that. Is this true at all?
I try to stay away from waits as much as possible, let the program run from the top line to the last line in a continuous way. No gotos and no waits. If there are delays in your logic use a variable with the units of TIME, (not seconds, minutes, hours, days). Then the program logic is very easy to read.
Here’s a simple example without the timer variable.
10 IF TEMP > SETPT THEN START PUMP1
20 IF TEMP < SETPT - 2 THEN STOP PUMP1
30 IF TIME-ON( PUMP1 ) > 0:0:10 THEN START PUMP2
40 IF TIME-OFF( PUMP1 ) > 0:0:10 THEN STOP PUMP2
And if the delay is longer and more complicated then use a separate VAR for the delay, this way you can see the timer, place it on displays and debug with it:
10 IF TEMP > SETPT THEN START PUMP1
20 IF TEMP < SETPT - 2 THEN STOP PUMP1
30 P1ONT = TIME-ON( PUMP1 )
40 P1OFFT = TIME-ON( PUMP1 )
50 IF P1ONT > 0:01:00 AND …OTHER LOGIC… THEN START PUMP2
60 IF P1OFFT > 0:01:00 AND …OTHER LOGIC… THEN STOP PUMP2