Bs2 Need to know how to display a character as a number
Statz
Posts: 28
just need to convert a to 97 and so on and so forth. How would I go about display these values in ascii
Comments
A = "a"
debug dec A·· ' This will display the number 97
That is, it's already 97.· No conversion needed.· The decimal number 97, and the character "a", are just different names for the same arrangement of ones and zeros in an eight-bit byte.
Before someone jumps on me for saying "eight-bit byte", I'll defensively point out that in the history of computing there have been bytes of other lengths than the now-standard 8 bits.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
· -- Carl, nn5i@arrl.net
like I want to write "If variable = 'a'" or something like that
Also you should keep in mind that when you're comparing things, upper-case "A" is not the same as lower-case "a".
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
· -- Carl, nn5i@arrl.net
Post Edited (Carl Hayes) : 11/27/2008 11:14:20 PM GMT
If I understand correctly, you want to use a IF...THEN command for a variable. correct?
If so, it should look something like the following:
IF variable = "a" THEN
some set of commands, or assignments
ENDIF
Good examples of how to use this command can be found in our educational text What's A Microcontroller and also the BASIC Stamp Syntax & Reference Manual; both of which can be downloaded for free
I hope this helps
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Joshua Donelson
www.parallax.com