Number Conversion Formatters with IF-THEN statements?
Falcon
Posts: 191
Hello,
I'm trying to repeat an action (V-Stamp audio Alert) between 9:00 PM and 9:03 PM if a switch is not closed using the following code
The switch is represented by "current1.bit1", and 0 is the not-closed state.
First I update the Date and Time and send it to the monitor using this:
Then I tried this as an argument to go into a loop. The bit is checked within the loop so it should exit when mins >3
I also tried the HEX2 Conversion Formatter that worked with the DEBUG statements like this but it also did not work
How can I write this line to GOTO REPEAT when the switch is NOT CLOSED between 9:00 PM and 9:03 PM?
falcon
I'm trying to repeat an action (V-Stamp audio Alert) between 9:00 PM and 9:03 PM if a switch is not closed using the following code
The switch is represented by "current1.bit1", and 0 is the not-closed state.
First I update the Date and Time and send it to the monitor using this:
HIGH DS1302 ' Select DS1302 SHIFTOUT DataIO, Clock, LSBFIRST, [RdBurst] SHIFTIN DataIO, Clock, LSBPRE, [secs, mins, hrs, date, month, day, year] LOW DS1302 ' Deselect DS1302 DEBUG CRSRXY, 0, 5, HEX2 month, "/", HEX2 date, "/", HEX2 year," ", HEX2 hrs, ":", HEX2 mins, ":", HEX2 secs, " "That part works fine.
Then I tried this as an argument to go into a loop. The bit is checked within the loop so it should exit when mins >3
IF current1.BIT1 = 0 AND hrs = 19 AND mins < 03 THEN GOTO REPEATThat did not initiate the loop.
I also tried the HEX2 Conversion Formatter that worked with the DEBUG statements like this but it also did not work
IF current1.BIT1 = 0 AND HEX2 hrs = 19 AND HEX2 mins < 03 THEN GOTO REPEAT
How can I write this line to GOTO REPEAT when the switch is NOT CLOSED between 9:00 PM and 9:03 PM?
falcon
Comments
I'll try that when I get home this afternoon.
And thanks for pointing out the 9:00 PM vs. 7:00 PM issue. Ultimately my code loop will trigger at 9:00 PM but I was trying this around 7:00 PM so that is what I used while testing. And my RTC is set to use a 24 hour clock to eliminate the AP-PM issue.
falcon