Minimum off time/Minimum on time

I’m trying to write some code to control minimum off time which also applies to minimum on times. I attached a snipping tool, screen capture…see attachment.

I’m using a T3-BB, Firmware: mini_arm_rev47.2_6.1.hex

Something that I’m doing with the timer is causing the test digital output to toggle.
if I REM out the line so it won’t execute then the output doesn’t toggle. Maybe I just can’t use the TIME-OFF the way I am?

The other thing I’m having trouble with is getting the GOTO statements to work?

Any advice or schooling will be much appreciated.

Please see attachment for more details…

Bret

I noticed I forgot to correct a comment after I added remarks to the code above.
Line 120 REM * should say sent from line 50 instead of line 40. :slight_smile:
Bret

Bret, really nice to see this kind of discussion going on here. I will study up and reply in more detail tomorrow. Cheers.

[Edit]: Lots of gotos there, try restructuring to get rid of those. Let the program flow with higher precedence logic overriding earlier statements simply by placing them lower in the program. More coming tomorrow.

MD

This is the actual code without the remarks so it’s easier to see.
In the first post I have a second goto but was just using it to determine code line execution because I didn’t think that the timer goto was working.

Thanks for your help.

Bret

Hello again Brett, the programs all seem OK actually. I am wondering if the variables, like TESTIN or TESTDO are duplicated somewhere in the system or have some conflict with the range settings, ie On-Off versus 0-100%. Send on that program file and I’ll check it over.

General notes from looking over the programs:

As you did in the first program, line 50 is just what you’d want to do:
50 IF TIME-OFF( OUTPUTX ) < 00:02:00 THEN (jump past the lines that turn the pump on)

And as you did in the second program, line 20 should be good.
20 IF TIME-OFF( OUTPUTX ) < 0:10:00 THEN (jump past the lines that turn the pump on)

For debugging, you could create another variable which shows the time-off of the output and see that its incrementing as expected, set the range units for this variable as ‘TIME’.

100 VAR10 = TIME-OFF( OUTPUTX ).

And use the variable in your program to see if that helps:

20 IF VAR10 < 0:02:00 THEN GOTO 50

Thanks for looking into to this for me Maurice. I’m out of town but I will get you the information requested and will also try your suggestions when I get done with travels.
Bret