pic adc on lcd
I think the spliting part and converting part is going in this part of coding
No! What you do in that part of the code is just a bit masking in which you isolate a symbol in the hexadecimal numeration system (0h - Fh, equivalent to 0 - 15 in the decimal system). A digit is, per definition, a number from 0 to 9 in the decimal numeration system.
I was afraid this would boil down to a discussion involving the words “binary”, “hex”, “decimal”, “number”, “ASCII” etc., because their meanings are best explained in school and understood via [hard] work. There’s no good substitution for that.
I can easily write your code for you, but we’ll both lose: me valuable time, and you the point with all of it!
So let me show it to you one more time instead (for a maximum of 3-digit number, say 137):
Code:
char d0, d1, d2;
d2 = bin % 10; /* d2 <-- 7 */
d1 = (bin / 10) % 10; /* d1 <-- 3 */
d0 = ((bin / 10) / 10) % 10; /* d0 <-- 1 */
/* continue like this for even more digits */
/* convert digit (numbers) to ASCII (text characters) */
d0 += ‘0’; /* same as d0 = d0 + ‘0’ same as d0 = d0 | 0x30 */
d1 += ‘0’;
d2 += ‘0’;
/* send ASCII chars to port */
/* ... */
You could do this nicer, you could do it a little more efficiently, but for you to understand I wanted to show all the little steps that you’ve missed and also to suggest how the digits can be extracted recursively, but that’s your homework.
So this will do the conversion for you, but I’m sill not convinced that what you’ll see is temperature since there’s nothing in your program that resemble a “volt to degree” conversion, unless you’ve chosen such a voltage reference that your ADC will actually do it for you.
Arthur