Here is what I do with the DS1337. I have not used the one you have.
Setup:
Code:
SecReg CON $00
DS_SCL VAR PORTD.1
DS_SDA VAR PORTD.0
RTC CON %11010000
sec VAR BYTE ' seconds
MINs VAR BYTE ' minutes
hr VAR BYTE ' hours
day VAR BYTE ' day
date VAR BYTE ' date
mon VAR BYTE ' month
yr VAR BYTE ' year
Then when I want to read the RTC:
Code:
I2CRead DS_SDA, DS_SCL, RTC, SecReg, [sec,MINs,hr,day,date,mon,yr]
PAUSE 100
Serout2 PORTC.6, 16572, [ "TIME ", HEX2 hr, ":", HEX2 MINs, ":", HEX2 sec,$d, $a]
Serout2 PORTC.6, 16572, [ "DATE ", HEX2 mon,"-",HEX2 date,"-",HEX2 yr,$d, $a]
Maybe this can be adapted to yours.
Bookmarks