integer to ASCII object?
Jonathan
Posts: 1,023
Hi All,
I googled and searched the obex but didn't find an integer to ascii converter. I did see reference to there being something of the sort in PASM in fullduplexserial and similar, but not being a ASM guy I couldn't figure it out.
Before I start trying to write one, does anyone have one handy?
Thanks!
Jonathan
I googled and searched the obex but didn't find an integer to ascii converter. I did see reference to there being something of the sort in PASM in fullduplexserial and similar, but not being a ASM guy I couldn't figure it out.
Before I start trying to write one, does anyone have one handy?
Thanks!
Jonathan
Comments
The "Numbers" object in the Propeller Library has methods to format numbers as characters in a string.
I like to use the object "StrFmt.spin" when converting variable to characters. There's a copy of the object in my GitHub "EddieFirmware" repository.
Jonathan
Also, FYI, "j"=0-j" can be written as "-j". When the variable is by itself the minus sign negates the variable's value. Dave's "number := -number" could also be reduced to "-number".
I have spent the last while reading and boy, my ignorance is amazing. For starters, I wasn't really asking the right question. I think I'll start a more appropriately titled thread.
@Jonathan - that is a useful snip. I'll need that. Thanks.
It does not take in to account that Spin variables are signed and can be negative, maybe I update that.
Very cool.
I've wondered about reading messages directly in PASM. I'm pretty sure manipulating characters in Spin is a bottleneck in many of my programs.
Thanks for posting your code Tony.