Hi
I have a pic 18m2 wired up to the DS1307 time chip via I2C. As an output, I have two 7 segment displays connected to two 4026 chips. So a pulse out of B.5 will increment the value on the 7 segment displays and a pulse out of B.6 will reset the displays back to 00.
I would like to made a program that reads the seconds value on the DS1307 and outputs that onto the displays.
I attempted to do it like this
The issue is, I get weird results that are over 60 seconds. I presume this is due to me reading a BCD number from the clock chip and looping the decimal equivalent of that number.
Do any of you know how I could make this work properly?
Thanks
I have a pic 18m2 wired up to the DS1307 time chip via I2C. As an output, I have two 7 segment displays connected to two 4026 chips. So a pulse out of B.5 will increment the value on the 7 segment displays and a pulse out of B.6 will reset the displays back to 00.
I would like to made a program that reads the seconds value on the DS1307 and outputs that onto the displays.
I attempted to do it like this
Code:
pause 1000
i2cslave %11010000,i2cslow, i2cbyte ;setup device as slave
readi2c 0, (b0) ;read seconds value from it into b0
for b1 =0 to b0 ;loop amount of seconds in b1
pulsout b.5,1 ;increment number on 7 seg
next ;finish loop
end
Do any of you know how I could make this work properly?
Thanks