This might not have been the easiest IC to jump into trying out I2C with!
The circuit is very simple, just an 08M2 to a DS3232, powered by batteries at 3.6V. The problem is that when i look at the values being fetched from the RTC using debug, they're all set at 255/$FF and never change. The DS3232 datasheet is here- DS3232.pdf. I have the DS3232 connected at V+, 0V and Vbat connected to ground, SDA to picaxe pin C.1 and SCL to pin C.2.
My code is adapted off of the DS1307 code in the picaxe manual, but I think the control registers in the DS3232 are in a different place (page 10 of datasheet)
So b0 to b7 are always set to 255/$FF (everything I read in is set to 255, if i add the line 'hi2cin $11, (b10, b11)' to read the internal temperature gauge, that reads 255 in debug too)
Any ideas? The eventual plan is to have the DS3232 creating interrupts via one of the alarms, every half hour. Just need to be a bit cleverer when it comes to understanding data sheets!
The circuit is very simple, just an 08M2 to a DS3232, powered by batteries at 3.6V. The problem is that when i look at the values being fetched from the RTC using debug, they're all set at 255/$FF and never change. The DS3232 datasheet is here- DS3232.pdf. I have the DS3232 connected at V+, 0V and Vbat connected to ground, SDA to picaxe pin C.1 and SCL to pin C.2.
My code is adapted off of the DS1307 code in the picaxe manual, but I think the control registers in the DS3232 are in a different place (page 10 of datasheet)
Code:
symbol control = b9
main:
hi2csetup i2cmaster, %1101000, i2cslow, i2cbyte
pause 100
let control = %00000100
hi2cout $0E, (control) ;set control registers
hi2cout 0, ($00, $59, $11, $03, $25, $12, $03)
lop:
high C.4 ;flashy led, because I like flashy LEDs
pause 1000
low C.4
hi2cin 0,(b0,b1,b2,b3,b4,b5,b6,b7) ;read the time
debug
goto lop
Any ideas? The eventual plan is to have the DS3232 creating interrupts via one of the alarms, every half hour. Just need to be a bit cleverer when it comes to understanding data sheets!