marzan
Senior Member
Hello. I am trying to get a PCF8583 RTC to send data to an SAA1064.
Here is the code:
It does the tenths ok (as far as I can tell) but the seconds go from 1 to 9 and then to 16. I guess it is an issue with displaying hex instead of binary. Can anyone point out where I have gone wrong ?
Marz.
Here is the code:
Code:
PAUSE 1000
i2cslave $A0, i2cslow, i2cbyte 'Initialize RTC
writei2c 0,(%00000100)
writei2c 8,(%00000010) ; alarm control registers and clock mode
;bit7 enable alarm interrupt
;bit6 timer alarm
;bit5/4 clock alarm 00= no clock alarm
;bit3 timer interrupt enable
;bit2/1/0 timer function 001= hundredths of a second
writei2c 2,(%00000000) ;reset minutes
writei2c 1,(%00000000) ;reset milliseconds
writei2c 3,(%00000000) ;reset milliseconds
DO
i2cslave $A0, i2cslow, i2cbyte 'Initialize RTC
readi2c 0,(b1,b2,b3,b4,b5)
debug
i2cslave $70, i2cslow, i2cbyte
b21 = b2//10
b22 = b3/10
b23 = b3//10
LOOKUP b21, ($3F,$06,$5B,$4F,$66,$6D,$7D,$07,$7F,$6F),b7
LOOKUP b23, ($BF,$86,$DB,$CF,$E6,$ED,$FD,$87,$FF,$EF),b8 ;DP
LOOKUP b22, ($3F,$06,$5B,$4F,$66,$6D,$7D,$07,$7F,$6F),b9
LOOKUP b4, ($BF,$86,$DB,$CF,$E6,$ED,$FD,$87,$FF,$EF),b11 ;DP
writei2c $00, (%00010111,b11,b9,b8,b7)
LOOP
Marz.