cactusface
Senior Member
Hi,
Having just got my Picaxe TestBed up and running.. I can't get the RTC output on to the LCD in the right format, sure I need to convert it, will BCDTOASCII do the job, looks like it might..
I pinched this code off the forum it was a reply that worked for someone, but for me the lines between****************** give syntax errors, ie. & not reconized, etc. I can't say I understand most of it, I see there's some masking off of nibbles, but what does +"0" do??
TIME: i2cslave %11010000, i2cslow, i2cbyte
readi2c 0, (seconds,mins,hour,day,date,month,year)
pause 10
i2cslave $C6,i2cslow,i2cbyte 'set up i2cslave for LCD
********************************
b1 = mins & $0F + "0"
b0 = mins / 10 + "0"
b3 = hour & $0F + "0"
b2 = hour / 12 + "0"
b5 = date & $0F + "0"
b4 = date / 17 + "0"
b7 = month & 4 + "0"
b6 = month / 0 + "0"
********************************
writei2c 0,(254,134,255) 'move to line 1 position 8
pause 10
writei2c 0,("TIME",255) 'output text
pause 10
writei2c 0,(254,193,255) 'move to line 2 position 2
pause 10
writei2c 0,(b2,b3,":",b0,b1," ",b4,b5,"/",b6,b7,255)
goto time
but for me it just gives errors when I try running it, my LCD is via the serial firmware chip, so changed the i2c commands to serout, but no good. My serial is on c.1 of 40x2 picaxe.
Come on brainybots someone must know, thanks for you help.
Regards
Mel.
Having just got my Picaxe TestBed up and running.. I can't get the RTC output on to the LCD in the right format, sure I need to convert it, will BCDTOASCII do the job, looks like it might..
I pinched this code off the forum it was a reply that worked for someone, but for me the lines between****************** give syntax errors, ie. & not reconized, etc. I can't say I understand most of it, I see there's some masking off of nibbles, but what does +"0" do??
TIME: i2cslave %11010000, i2cslow, i2cbyte
readi2c 0, (seconds,mins,hour,day,date,month,year)
pause 10
i2cslave $C6,i2cslow,i2cbyte 'set up i2cslave for LCD
********************************
b1 = mins & $0F + "0"
b0 = mins / 10 + "0"
b3 = hour & $0F + "0"
b2 = hour / 12 + "0"
b5 = date & $0F + "0"
b4 = date / 17 + "0"
b7 = month & 4 + "0"
b6 = month / 0 + "0"
********************************
writei2c 0,(254,134,255) 'move to line 1 position 8
pause 10
writei2c 0,("TIME",255) 'output text
pause 10
writei2c 0,(254,193,255) 'move to line 2 position 2
pause 10
writei2c 0,(b2,b3,":",b0,b1," ",b4,b5,"/",b6,b7,255)
goto time
but for me it just gives errors when I try running it, my LCD is via the serial firmware chip, so changed the i2c commands to serout, but no good. My serial is on c.1 of 40x2 picaxe.
Come on brainybots someone must know, thanks for you help.
Regards
Mel.