LED Maestro
Senior Member
Hi. A while ago i sucessfully built a binary clock using the DS1307 RTC and a pic 28X2. One problem I had whilst compiling the code to run the display is that the seconds, hours and minutes would come on at the same time. I managed to solve this and got the clock working. Now, about 4 months later, I am having the same problem. the seconds work on their own but as soon as i introduce the minutes and hours, it goes to pot. I have included the code and a video to help explain.
http://www.youtube.com/watch?v=F2q0kriN2fo
Code:
#Picaxe 28x2
symbol secs = b0
symbol mins = b1
symbol hour = b2
symbol control = b7
let dirsb = %01111111
i2cslave %11010000, i2cslow,i2cbyte
let secs = bcdtobin secs
let mins = bcdtobin mins
let hour = bcdtobin hour
main:
readi2c 0, (secs,mins,hour)
seconds:
high c.0
let pinsb = secs
;switch on secs
low c.0
let pinsb = control
goto main
minutes:
high c.1
let pinsb = mins
;switch off secs, switch on mins
low c.1
let pinsb = control
hours:
high c.2
let pinsb = hour
;switch off mins, switch on hour
low c.2
let pinsb = control
goto main