[PIC] How to convert the ADC 10 bit Hex result to ASCII value

Status
Not open for further replies.

ecaits

Member level 4
Joined
Jan 16, 2014
Messages
76
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
579
How can I convert the result of 10 bit hex ADC to ASCII in pic16F877 using hi-tech c compiler???

I mean how many methods or logics are there????
 

You can't.

ASCII is 8 bits.

Do you want to create a 2-byte ASCII representation of your 10-bit number?
 

It is relatively easy.

10bit -> 0000 - 1023
Numers - ASCII
0dec - 30hex (48dec)
1dec - 31hex (49dec)
...
9dec - 39hex (57dec)


This mean that number you get from ADC e.g. 0876, you have to split to numbers 0 - 8 - 7 - 6 and then your ASCII message will be 30h - 38h - 37h - 36h (or in decade number format 48 - 56 - 55 - 54)

See more about ascii table on: https://en.wikipedia.org/wiki/ASCII


Best regards,

Mr.Cube
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…