Folks
I can't see where I'm going wrong with my DS1307 project. The clock reports time very slow - about 40 secs reported for every actual min passed.
Here is a sketch of the circuit:
And here is the code. It's a 20X2 chip. I used the wizard under 'AXE110 Datalogger' to set the clock then ran the code below.
the impact was the same with both sertxd and debug used to monitor the time. I did notice tho' that the clock ran correctly when I took the power from the circuit and so the clock used its backup battery.
The value in pause affects the error. So I guess the interogation by hi2cin is upsetting the DS1307. I have checked the hardware for shorts and faulty connections with no obvious errors found - the various resistances all seem spot on.
The 5V comes from a 78L05 regulator with a 12V input. The 12V is from a switched mode power supply, but I checked using a 12V battery and it was the same.
There is an extra 1m on the download cable, I soldered a 3 core 1m lead to the circuit board then on the other end I soldered the stereo jack for the download cable .
I have not shown on the sketch an output I have ready on pin C.5, (that's 5th pin down from top left, 6th up from bottom). The pin is pulled down to ground with a 10K resistor and then is conected to the signal input of a FET (TRT003 - FET IRF520). There is nothing on the FET output.
Any suggestions welcomed
Cheers
Ed
I can't see where I'm going wrong with my DS1307 project. The clock reports time very slow - about 40 secs reported for every actual min passed.
Here is a sketch of the circuit:
And here is the code. It's a 20X2 chip. I used the wizard under 'AXE110 Datalogger' to set the clock then ran the code below.
Code:
symbol secs = b10
symbol mins = b11
symbol hours = b12
HI2CSETUP I2CMASTER, %11010000, I2CSLOW, I2CBYTE 'prog time ds1307
main:
hi2cin 0,(secs,mins,hours,b0,b1,b2,b3,b4)
LET secs = BCDTOBIN secs 'Time from ds1307 needs converting
LET mins = BCDTOBIN mins
LET hours = BCDTOBIN hours
sertxd ("DATA,DATE,TIME,", #hours,",", #mins, ",", #secs, ",", #b0, ",", #b1, ",", #b2, ",", #b3, ",", #b4, cr)
'debug b1
pause 1000
GOTO main
The value in pause affects the error. So I guess the interogation by hi2cin is upsetting the DS1307. I have checked the hardware for shorts and faulty connections with no obvious errors found - the various resistances all seem spot on.
The 5V comes from a 78L05 regulator with a 12V input. The 12V is from a switched mode power supply, but I checked using a 12V battery and it was the same.
There is an extra 1m on the download cable, I soldered a 3 core 1m lead to the circuit board then on the other end I soldered the stereo jack for the download cable .
I have not shown on the sketch an output I have ready on pin C.5, (that's 5th pin down from top left, 6th up from bottom). The pin is pulled down to ground with a 10K resistor and then is conected to the signal input of a FET (TRT003 - FET IRF520). There is nothing on the FET output.
Any suggestions welcomed
Cheers
Ed