marzan
Senior Member
Hi all. I am trying to get time from an RTC displayed on an oled using an axe133. The numbers jump from 9 to 16, so i guess its something to do with displaying hex. I am running this on a 28X2.
Thanks for looking ![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Marz
Code:
symbol slvAddrWR = $A0 ' I2C write address
MAIN:
PAUSE 1000
i2cslave slvAddrWR, i2cslow, i2cbyte 'Initialize I2C-7SEG
writei2c 0,(%00000100) ;timer function to 99 seconds
;to enable %xx0xx1xx
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
serout b.7,n2400,(254,1) ;clear screen
pause 30
serout b.7,n2400,(254,148) ;move to line 3
serout b.7,n2400,("TIME: ")
writei2c 2,(%00000000) ;reset minutes
writei2c 1,(%00000000) ;reset milliseconds
writei2c 3,(%00000000) ;reset milliseconds
DO
readi2c 0,(b0,b1,b2,b3)
serout b.7,n2400,(254,16) ;cursor left
;debug
serout b.7,n2400,(254,153)
serout b.7,n2400,(#b3,":",#b2,":",#b1)
LOOP
Marz