The above works fine if that is the only function the cai board is performing. If you want cai to do other functions more than once every 2 hours it won't work since the program basically "hangs" during the delay.
You could use the CAI clock function to keep the cai program interface free to do other stuff.
Please note, I haven't tested this and I did it kind of quick.
It starts with a test to see if cai has just been turned on. In that case ram1 will be 0. It set ram2 to the current hour and sets ram1 to 1 so that subroutine never gets run again.
Then it test to see if the current hour equals ram2. If yes, it toggles the output and increases ram2 by 2 hours. Then two hours later it runs the toggle subroutine again and turns it off. It resets the clock when it gets above 23 hours.
This program will turn the output on for somewhere between 1 and 2 hours when you first turn cai on. After that, it will do 2 hours on, 2 hours off with the change occuring at the top of the hour.
START
TESTEQ RAM1 0
CALLSUB STRTUP
TESTEQ RAM2 CH
CALLSUB TOGGLE
TESTGT RAM2 23
SUB RAM2 24 RAM2
END
TOGGLE:
TESTEQ OP1 0
GOTO ON
SET OP1 0
ADD RAM2 2 RAM2
RET
ON:
SET OP1 1
ADD RAM2 2 RAM2
RET
STRTUP:
SET RAM1 1
SET RAM2 CH
RET