Decimal to String
Hello,
Is it possible to convert a decimal (like 2348) to a string ("2348")·without using an IF THEN ELSEIF command.· I have numbers (coming from an encoder) that I need to display on an LCD,· LCD's only display strings.· Thanks.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
NerdMaster
For
Life
Is it possible to convert a decimal (like 2348) to a string ("2348")·without using an IF THEN ELSEIF command.· I have numbers (coming from an encoder) that I need to display on an LCD,· LCD's only display strings.· Thanks.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
NerdMaster
For
Life
Comments
example:
30 + 0 = 30 = ASCII '0'
30 + 1 = 31 = ASCII '1'
etc.
Rodney
Just to clarify Rodney's answer that would be hex 30 or decimal 48.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike
BTW, I'm starting to give my age in hex as people don't seem to question the $ [noparse]:o[/noparse])
Rodney
Heck I'm only $27 years old...
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
Don't mistake experience for intelligence. And vis-vera.
·
That would help a lot, only problem is I have a range of·decimals -2500 through 2500 that I need to convert to the·same number, only in string format instead of decimal.· I'm probable going to switch this project to·a BS2.· I'm more familliar with PBASIC that SX/B.· But if anyone knows how to do this in SX/B, please speak up.
Thanks a lot.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
NerdMaster
For
Life
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike
Post Edited (Mike Cook) : 10/10/2006 12:26:39 PM GMT
As soon as I get my serial cable back from my dad, I'll try that. It doesn't look like it will be to difficult to modify for 4 digits. Thanks Again.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
NerdMaster
For
Life
Probably the best fit is this one:
http://www.sxlist.com/techref/ubicom/lib/math/radix/b2a-16b5a-rl_sx.htm which is 16 bits in and 5 digits out.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
---
James Newton, Host of SXList.com
james at sxlist,com 1-619-652-0593 fax:1-208-279-8767
SX FAQ / Code / Tutorials / Documentation:
http://www.sxlist.com Pick faster!
Post Edited (James Newton) : 10/10/2006 6:49:08 PM GMT
TX_DEC3 150
correct?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
NerdMaster
For
Life
idx = 150
TX_DEC3 idx
Also to use the SUB you will need to define it, take a look at the attached file.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike