Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Convert Hexadecimal value to ASCII value manually

Status
Not open for further replies.

Fan174

Member level 2
Member level 2
Joined
Mar 27, 2018
Messages
51
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
413
How to convert Hexadecimal value to ASCII value Manually

For example, Value = 0x6B

If I send 0x6B to LCD. It should show 0x6B not k on the screen.
 

If you send 0x6B to the LCD, you're sending the ASCII code for “k”.

If you want to display “0x6B“, you need to send 4 ASCII characters. 0x6B==>0x30, 0x78, 0x36, 0x38.
 
If you send 0x6B to the LCD, you're sending the ASCII code for “k”.

If you want to display “0x6B“, you need to send 4 ASCII characters. 0x6B==>0x30, 0x78, 0x36, 0x38.
Thanks how did you know that 4 ASCII characters have to be sent ? What's the logic behind this ?
Why magical numbers 0x30, 0x78, 0x36, 0x38.? What's the logic behind this ?
 

Thanks how did you know that 4 ASCII characters have to be sent ? What's the logic behind this ?
Why magical numbers 0x30, 0x78, 0x36, 0x38.? What's the logic behind this ?

... because you expect the display to show 4 characters.

The display works with ASCII coded characters. In C you have to use a "string" as variable.
0x6B (barry accidentally misread the "B" as "8". I´ve corrected this here)
are 4 characters "0x6B":
0: has the ASCII code 0x30, or "0" as string or '0' as single character
x: has the ASCII code 0x78 , or "x" as string or 'x' as single character
6: has the ASCII code 0x36, or ... see above
B: has the ASCII character 0x42, or ... see above

Please do an internet search for "ASCII table".
While ASCII is a standard, your display may use non standard codes.
Thus even better: read the datasheet of your display. (we professionals have to do this, too)

There are libraries for every language that do this for you.

Klaus
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top