I am trying to do the most simple of things.....talk to a ds1307 via I2C and read from it. I have the axe033 fitted with the clock chip I set the jumper to I2C. I can send a message to the lcd no problem..... I am using the 28x2 chip as I need 3 PWM from this. (doing the analog meter clock thing but also adding sunrise and sunset leds to meter faces)
I can't seem to write to the ds1307 or read back from it. Here is the code I was using to debug. What am I doing wrong. I spent over 20 hours on this.
Once I get the read write to the ds1307 done I got the rest. Thanks for any suggestions.
I can't seem to write to the ds1307 or read back from it. Here is the code I was using to debug. What am I doing wrong. I spent over 20 hours on this.
Once I get the read write to the ds1307 done I got the rest. Thanks for any suggestions.
Code:
hi2csetup i2cmaster, %11010000, i2cslow, i2cbyte 'setup ds1307
pause 100 'wait just to make sure it is ready
hi2cout 0, ($00,$01,$02,$03,$04,$05,$06,$07) 'send a string to adresses starting at 0 sending dtat for clock (or should it be $00. tried both ways) also tried writeI2C command here
hi2csetup i2cmaster, %11010000, i2cslow, i2cbyte 'Refresh setup
pause 100 'wait again just make sure I don't introduce problems
readi2c 0, (b0,b1,b2,b3,b4,b5,b6,b7) 'read out the data I saved to the DS1307
b8=b2 & $f0/16 + $30 'Convert the data from BCD to ASCII
b9=b2 & $0f+$30
b10=b1 & $f0/16 + $30
b12=b1 & $0f+$30
b13=b3 & $f0/16 + $30
b14=b3 & $0f+$30
b15=b6 & $f0/16 + $30
b16=b6 & $0f+$30
b17=b5 & $f0/16 + $30
b18=b5 & $0f+$30
b19=b7 & $f0/16 + $30
b20=b7 & $0f+$30
hi2csetup i2cmaster, $C6, i2cslow, i2cbyte 'setup the LCD (This part works fine only the variables are all garbage data)
pause 300
hi2cout 0, (254,128,255)
hi2cout 0, (b8,b9,":",b10,b11,":",b13,b14,255)
hi2csetup i2cmaster, $C6, i2cslow, i2cbyte
pause 100
hi2cout 0, (254,192,255)
hi2cout 0, (b15,b16,"/",b17,b18,"/",b19,b20,255)
Last edited: