Help with AND statement

Very good point
I am trying to set op8 to 1 for 3 seconds at 18:27 each day.
so, now I have to see how to get out of loop

Rainer
 
rfeyer said:
Very good point
I am trying to set op8 to 1 for 3 seconds at 18:27 each day.
so, now I have to see how to get out of loop

Rainer
 
Haven't checked this.... but something like this might do it....
 
START
 (optional extra code to do other things here)
   mod cts 86400 ram1     # What is the current "second of today"
   tsteq ram1 66420          # is it 18:27:00 ??
   set op1 1                      # Yes - turn on op1
   tsteq ram1 66423         # is it 18:27:03 ??
   set op1 0                       # yes - turn off op1
 (optional extra code to do other things here)
END
 
Hello rossw - TY for example!
 
So, I don't see any MOD command nor CTS (there is a CS, most likely same thing)? I have WC8 (I have been reading WC32 manual to get extra info and realized it does have more commands in PLC language).
 
Also, getting something to start and stop between START and END I have been able to do, but for some reason I can not get out of a SUBROUTINE. In other languages I am used to something like DO...WHILE, can't figure out how to do it here.
And, this is my second attempt to understand non-binding timed commands (tried back in May as you probably remember) and still am not understanding how to make best use of it.
WIll spend some time reading through LarrylLix's sample to see where my mind is going wrong after I fix my hot water heating system which sounds like a screaming hyena.  
I think in my code, I have to change the use of the timed command:
From SET OP8[3000] 1
To     TSTEQ OP8[3000] 1
and have the next statement somehow get out of the loop, hopefully by being able to change the RAM1 flag - not sure what gets out of the loop.

Rainer
 
CS is Current Second, that range from 0 to 59
CTS is Current Total Seconds since 1/1/1970 in our latest firmware, same as UTC
 
Can I ask if anyone can tel me how to get out of a loop statement as in my code above? I have tried and tried variations and can't get it

Rainer
 
Holy Molly,
I think I figured it out!
 
The LOOP: command is actually not a command, as I am used to in other languages where you have to actually give a 'exit loop' command, but it is simply a subroutine!
I changed the code in the loop:
LOOP:
 SET OP8 1
 TSTEQ OP8[3000]
 SET OP8 0
 TSTEQ OP8 1
 GOTO LOOP
 SET RAM1 2
RET
 
And it works
 
Rainer
 
Back
Top