DS1302 3 pushbuttons 2x16 LCD BS2P40
Hi guys, I have a small problem with displaying time on my backlit 2x16 lcd (#27977), what happens is after I write time to DS1302 chip and try to display it on LCD I am getting value above 59 when I am in dec mode and values above 9 in hex
I suspect that my problem is within writing time to ds1302 chip but im not exactly where as the minutes on the lcd do change every 60 seconds but they go over their legal limits
Thanks
I suspect that my problem is within writing time to ds1302 chip but im not exactly where as the minutes on the lcd do change every 60 seconds but they go over their legal limits
Thanks

Comments
In this mode you can read and write which ever Register you want
····························································································································
You· must read and write in this way when in the burst mode
Set_Time: ' DS1302 Burst Write HIGH CS1302 ' Select DS1302 SHIFTOUT DataIO, Clock, LSBFIRST, [noparse][[/noparse]WrBurst] SHIFTOUT DataIO, Clock, LSBFIRST, [noparse][[/noparse]secs, mins, hrs, date, month, day, year, 0] LOW CS1302 ' Deselect DS1302 RETURN·Here is one way if you want·to save something in RAM and read from RAM
reg = $FE HIGH Timer SHIFTOUT DataIO, Clock,LSBFIRST, [noparse][[/noparse]reg] SHIFTOUT DataIO, Clock, LSBFIRST, [noparse][[/noparse]A.HIGHBYTE,A.LOWBYTE,B.HIGHBYTE, B.LOWBYTE,C.HIGHBYTE,C.LOWBYTE ,D,E,F] LOW Timer RETURN ReadRam : 'Routine to Read Data from DS1302 Time Chip reg = $FF HIGH Timer SHIFTOUT DataIO, Clock, LSBFIRST, [noparse][[/noparse]reg] SHIFTIN DataIO, Clock, LSBPRE, [noparse][[/noparse]A.HIGHBYTE,A.LOWBYTE,B.HIGHBYTE, B.LOWBYTE,C.HIGHBYTE,C.LOWBYTE ,D,E,F ] LOW Timer DEBUG HOME, "Product = ",DEC5 A," DEC5 B ", DEC5 C, CR, CR, DEC5 D, DEC5 E,CR RETURNThis· [noparse][[/noparse]A.HIGHBYTE,A.LOWBYTE]· = a WORD
This· [noparse][[/noparse]D] = BYTE or less
·I hope this help
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·Now wanting to learn Spin· Thanks for any·
·
·
·
·
Sam
Post Edited (sam_sam_sam) : 4/19/2010 5:37:29 AM GMT
this command solved the issue
bcdNum = (decNum / 10 << 4) + (decNum // 10) ' Decimal To BCD
decNum = (bcdNum.NIB1 * 10) + bcdNum.NIB0 ' BCD To Decimal
Many thanks to Chris Savage (Parallax) who posted that command
Here is what happened I was testing my clock and had it running for few hours (I guess around 12) when I noticed that the LCD display froze and the time was stuck, as I unplug the debug serial cable it was working again.
My question is do I need to pull-down the serial cable interface pins of BS2P or is my problem related to something else? I would like to mention that the clock was working for several hours before i notice this happened