Help !
I'm struggling with the conversion bit, and would appreciate some assistance.
To keep things simple I'm going to restrict the alarm values to just hours, so I have one Alarm variable called AlarmH1 which I'm trying to match to the RTCHour.
The I2C statement is thus
Code:
I2CRead SDApin,SCLpin,$D0,$00,[RTCSec,RTCMin,RTCHour,RTCWDay,RTCDay,RTCMonth,RTCYear,RTCCtrl]
I'll now post the part of the code I'm using for testing in it's current state (sorry it's somewhat messy)
Code:
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," "
LCDOut $FE, $D4,"value = ", #RTCHour;dec CounterA ;Dig 1,#CounterA Dig 0
alarmhour = 25
if alarmhour = rtchour then
alarmled=1
endif
The LCD is used to display the time and date, with line 4 used to "debug" what's happening with whatever I choose to display, eg as you can see dig1 and 0 og CounterA, ascii value of RTCHour, even tried DEC RTCHour etc. In the above example the LCD gives an ascii value of 25 for RTCHour hence the value for alarmhour. I've also tried using something like if DEC alarmhour = DEC RTChour but that still fails...
Can someone (Mel ?) point me in the right direction on how I convert the value stored in the RTCHour register into some usable format (decimal say ) that I can use. I'm hoping to use a repeat of the set up routine to allow me to set the on hour and off hour, but that will come later. For now I just need to find the best way to match the value....
Bookmarks