yes sure, I changed "0" to 48 and everything works fine.
The question is, from where it took "0", is there any programming language that can make ASCII to decimal conversion that way?
yes sure, I changed "0" to 48 and everything works fine.
The question is, from where it took "0", is there any programming language that can make ASCII to decimal conversion that way?
In every language "0" is equal to 48 dec. or "1" equal to 49, etc.
Ioannis
What do you mean you changed "0" to 48 and it worked? I'm sure it worked fine with "0".
You must stop mixing up the interpreted ZX BASIC with PBP.
In PBP lingo
48
$30
%00110000
"0"
are all representing the exact same thing, just differently for human readability.
If you were to connect to 8 LEDs to PortB of your PIC and then do PortB = x where x is any of the above they would all result in the exact same thing being displayed on the LEDs.
So, in your specific example subtracting "0" will subtract the numeric value 48 from the numeric value of the ASCII code for the digit question. This will result a numeric value equal to that of 'the digit'.
nearly all can do that, except that in C,C++ etc it would be '0' not "0" [single quotes is a chr 'literal' double quote is a null terminated "string" c-str]The question is, from where it took "0", is there any programming language that can make ASCII to decimal conversion that way?
Warning I'm not a teacher
I'm not mixing, but with PBP
X-"0" gives syntax error while compiling.
I am pretty sure it does not. Compiles just fine because "0" is in fact 48. So if X-48 compiles it will also compile X-"0".
If course to have correct results you should not mix 0 (zero) with O (capital letter O) because they have different ascii value. But all compile fine.
Ioannis
Bookmarks