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.

Displaying 10-bit value on LCD. How to convert it to ASCII ?

Status
Not open for further replies.

vicky29

Member level 4
Joined
Feb 5, 2005
Messages
75
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,288
Activity points
750
10-bit value to LCD

hi friends,
i'm having a 10-bit value in two 8-bit registers R1 & R2. let's say it is 1017 (in decimal). i need to display this value on 16x2 LCD. can anyone please advise me a code which can show convert this 10-bit value in ASCII. for 1017d, R1=03h & R2=0F9h. I'm using 89c51 microcontroller.

thanks a lot.
 

Re: 10-bit value to LCD

Here you can find code for convertig 16-bit (2-byte) number to 5-digit BCD:
**broken link removed**
After conversion simply add 30h to every digit and you will have its ASCII code representation. For example, if a digit is 08h (or 8d) after adding 30h you will have 38h, what is ASCII code for 8d
Now you can send these digits to LCD display.
Regards,
IanP
 

Re: 10-bit value to LCD

If u r using a 'C' compiler, you can directly use the following algorithm:

1) Value = ((High order byte) * 256 ) + (Low Order byte)
2) Create a 16 bytes buffer array in the uC RAM area
3) Use the sprintf() function to format the result and send it to your RAM buffer.
4) Send the buffer contents to your LCD service routine. This buffer will be of(ASCII Codes) ready to be displayed onto your LCD.

Hope this helps u.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top