I want to be able to set a time period using a DS1307 where a condition is matched and an action (value ) is changed. EG between time A and time B value x=25, bur between time B and time A value X =32.
Here's the section of code I have that displays the time on the LCD
Code:
'
' Display Time on Line 1
' ----------------------
LCDOut $FE,$80
If RTCHour.6=1 then
' Work-Out 12 or 24 hour Display for Hours
CounterA=(RTCHour>>4)&$01
else
CounterA=(RTCHour>>4)&$03
endif
CounterA=CounterA*10+(RTCHour&$0F)
If RTCHour.6=1 then
' Display Hours appropriately for 12 or 24 hour Mode
LCDOut #CounterA
else
LCDOut #CounterA Dig 1,#CounterA Dig 0
endif
LCDOut ":",#(RTCMin>>4)&$0F,#RTCMin&$0F,":"
LCDOut #(RTCSec>>4)&$0F,#RTCSec&$0F," "
IF RTCHour.6=1 then
If RTCHour.5=1 then
LCDOut "PM"
else
LCDOut "AM"
endif
endif
'
From this it seems that CounterA dig0 and dig1 represent the hour and RTCMin the minutes. Is it a simple case of using a variable to match these and then toggle another variable that holds value X, something like
if CounterA dig0 + CounterA dig1 => 1 then tempset=26
if CounterA dig0 + CounterA dig1 => 6 then tempset=32
Or is there a better way (simpler?) to do this ?
Bookmarks