Ok I finally set my clock and it is running. I can see the time as well (I gave up on the date and day for now)
Here is my last issue to solve. The display flashes between the correct time and ??:??:??. If I set the setfreq to M32 I can make out the time inbetween the ??.
What I think happens is that when the i2c bus is switched to read the next time in the variables i nthe bdctoascii become indeterminate or some such thing.
HEre is my question. What command makes the display stay put until I tell it to update again when I call the i2cslave command again?
Here is my last issue to solve. The display flashes between the correct time and ??:??:??. If I set the setfreq to M32 I can make out the time inbetween the ??.
What I think happens is that when the i2c bus is switched to read the next time in the variables i nthe bdctoascii become indeterminate or some such thing.
HEre is my question. What command makes the display stay put until I tell it to update again when I call the i2cslave command again?
Code:
'ANALOG CLOCK WITH LCD September 23, 2012
'Marc Rubin
'Set Clock
#picaxe 18m2
#no_data
setfreq m32
Pause 500
Symbol seconds = b0
Symbol mins = b1
Symbol hour = b2
Symbol day = b3
Symbol date = b4
Symbol month = b5
Symbol year = b6
Symbol control = b7
#rem
Let day = $01
Let year = $12
Let month = $09
Let date = $30
Let hour = $17
Let mins = $07
Let seconds = $00
Let control = %00010000 ; Enable output at 1Hz
#endrem
'Write to Clock on I2C Bus
'hi2csetup i2cmaster, %11010000, i2cslow,i2cbyte
'writei2c 0, (seconds, mins, hour, day, date, month, year, control)
Main:
'Readout Clock on I2C Bus
i2cslave %11010000, i2cslow_32,i2cbyte
readi2c 0, (seconds, mins, hour, day, date, month, year, control)
'BCD to ASCII Conversion
BCDTOASCII hour, b8,b9
BCDTOASCII mins, b10,b11
BCDTOASCII seconds, b12,b13
BCDTOASCII month, b14,b15
BCDTOASCII date, b16,b17
BCDTOASCII year, b18,b19
'Send to LCD
i2cslave $C6,i2cslow_32,i2cbyte
hi2cout 0,($FE,$80,b8,b9,":",b10,b11,":",b12,b13,255)
goto main