Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to convert hex to ascii and display it on LCD ?

Status
Not open for further replies.

microlab

Full Member level 5
Joined
Mar 4, 2006
Messages
309
Helped
44
Reputation
88
Reaction score
35
Trophy points
1,308
Activity points
3,253
hex to ascii

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.

ml
 

Re: hex to ascii

Load Acc with data from ADC
Code:
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)
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top