Feb 6, 2014 #1 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????
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????
Feb 6, 2014 #2 barry Advanced Member level 7 Joined Mar 31, 2005 Messages 6,333 Helped 1,194 Reputation 2,400 Reaction score 1,389 Trophy points 1,393 Location California, USA Activity points 34,483 You can't. ASCII is 8 bits. Do you want to create a 2-byte ASCII representation of your 10-bit number?
You can't. ASCII is 8 bits. Do you want to create a 2-byte ASCII representation of your 10-bit number?
Feb 6, 2014 #3 mrcube_ns Advanced Member level 1 Joined Apr 10, 2002 Messages 452 Helped 48 Reputation 96 Reaction score 34 Trophy points 1,308 Location Europe Activity points 3,813 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
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