hai all
i am doing a project using 89c51,adc0804,lm35d and 16x1 lcd
now my problem is that how can i convert the hexadecimal value from the adc to ascii code so that i can display that on the lcd.it reads from 0'c to 150'c.i made te connection in such a way that i will get the exat value,ie.for 30'c i will get the output as 00011110 (1Eh) = the hexa dicimal code for 30.so if i can convert this directly to ascii,i can display that on the lcd.pls explain me how to convert the hex value to ascii.if possible pls give me a program in assembly so that i can enderstand it better.
mov b,#100 ;set to divide by 100
div ab ;divide acc by 100
mov r3,a ;move the hundreds digit into r3
mov a,b ;move remainder into acc
mov b,#10 ;set to divide by 10
div ab ;divide acc by 10
mov r4,a ;move the tens digit into r4
mov r5,b ;move the ones digit into r5
Now each converted digit must be translated to ASCII value to be properly displayed by LCD.
You must add 30h to each digit before sending to LCD.
Code:
mov a, r3
add a, #30h
lcall send_2_LCD
and so on with r4 and r5
you can test before sending in order to not display ADC value 00000011 as "003" (remove the leading zero if you want)