Binary to ASCII Ahhhhh!

Status
Not open for further replies.

dons21

New Member
I am trying to get my head around converting a binary number to ASCii characters for an LCD display.

I am currently converting a 10 bit number into ones,tens,hundreds,thousands. Then using a lookup table to find the correct number in ASCii then forward it to the display.

What is the formula to convert binary to ascii?

Thanks
 

hi,
If you are using assembler, look at Nigels tutorials link near my signature on this post

EDIT:
Or this option.
 

Attachments

  • Bin2Ascii.asm
    1.2 KB · Views: 356
Last edited:
If you're coding in ASM, why not just use -

movlw a'insert ascii value here'

Say you want to load character "N" into W -

movlw a'N'
 
Hi thanks for all your replies,
If you're coding in ASM, why not just use -

movlw a'insert ascii value here'

Say you want to load character "N" into W -
I am coding in ASM and have used the above example for displaying text. I as I am displaying numbers I have realised I can
add 48 to the digit I wish to display.

so 0+48 =48(0 in ascii) or 4+48=52 (4 in ascii)

thanks again
 
You assembler should accept;

0 + '0'
which is the same as
0 + 48

But is much easier to understand what is going on.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…