PDA

View Full Version : Hex to Binary Conversion



Squibcakes
- 5th September 2006, 04:00
Hi want some help with this.

If store a Byte, (say "A") into the internal eerom, it is stored as 41(Hex value)

Now I want to work on this value bit wise.

I know that the value of "A" = 10 (Decimal )or %1010 (binary).....

But reading it back in has the value of "%01000001".

Why is this? and how can I convert $A to %1010?

I guess what I am trying to do is convert 7bit ascii to 4 bitascii.. But I could be wrong.

Cheers
J

###########

Ok I figured it out just after posting! Always the way. I was saving the letter "A" as an ascii char rather than a Hex Char

Dave
- 5th September 2006, 11:59
Squibcakes , The Ascii value of "A" equals hex 41 but the value of 10 decimal equals "A" hex. Do you want to convert the ascii value of "a" to hex?

Dave Purola,
N8NTA

BigWumpus
- 5th September 2006, 21:25
OK,

if you don't convert the value into hexadecimal ASCII-Characters before writing them to EEPROM, you read them back as usual binary value.

If you convert it to ASCII before writing you must convert it back after reading !

Easy:
Don't translate it to chinese if you don't want to read Chinese !