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.
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
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.