convert a decimal variable to a string
Hello.
This is probably a very simple question, but i cant seem to get it to work.
I have an LCD driver, that only takes null terminated strings, and it works great.
But i want to interface the ds1302 with it, and it puts out decimal values. I have tried to use simplenumbers, dec function, but no go.
example:
This is probably a very simple question, but i cant seem to get it to work.
I have an LCD driver, that only takes null terminated strings, and it works great.
But i want to interface the ds1302 with it, and it puts out decimal values. I have tried to use simplenumbers, dec function, but no go.
example:
rtc.readTime( @hour, @minute, @second )
LCD.Goto(0, 0)
SN.decstr(second)
LCD.writestring(second)
waitcnt (30_000_000 +cnt)

Comments
oh sorry, i uploaded the wrong routine, that one is a private routine inside of serial numbers, it should be just SN.dec..
Thanks for your reply, though, didnt work either..
ie:
12 will be
1
2
Maybe this will help. Replace the PST with the LCD object.
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 VAR long ptrNum OBJ pst : "Parallax Serial Terminal" nums : "Simple_Numbers" PUB Main | myNum pst.start(115200) Pause(500) myNum := 12345 ptrNum := nums.dec(myNum) pst.str(String("Number to String: ")) pst.str(ptrNum) pst.char(13) PRI Pause(Duration) waitcnt(((clkfreq / 1_000 * Duration - 3932) #> 381) + cnt) returnand i had also difined the variable wrong, stupid stupid
Thank you mike for your help!