| ??? 04/12/01 15:22 Read: times |
#10759 - RE: Displaying voltage to lcd using aduc812 |
Hello Karen,
Here is a quick and dirty solution to your problem. I presume the 12 bits are right justified in a 16 bit number. If not, do that yourself first (shift right 4 times). Set a counter to 0, subtract 1000 from your sample value as often as you can, while incrementing the counter everytime you can. In the end you will have the 1000 digit in your counter. Add the ASCII value for the character 0 to it (30h) and you will have your first digit. Now reset the counter, subtract 100 from the rest of your value as often as you can while incrementing the counter every time. This will give you your second digit, converting it to ASCII by adding 30h to it. Now reset the counter again, subtract 10 from the rest of your value as often as you can while incrementing the counter every time. This will give you your 3d digit, converting it to ASCII by adding 30h to it. The rest value is your 4th and final digit. Simply add 30h to it and it is ASCII again. Happy programming |
| Topic | Author | Date |
| Displaying voltage to lcd using aduc812 | 01/01/70 00:00 | |
| RE: Displaying voltage to lcd using aduc812 | 01/01/70 00:00 | |
| RE: Displaying voltage to lcd using aduc812 | 01/01/70 00:00 | |
| RE: Displaying voltage to lcd using aduc | 01/01/70 00:00 | |
| RE: Displaying voltage to lcd using aduc812 | 01/01/70 00:00 | |
| RE: Displaying voltage to lcd using aduc812 | 01/01/70 00:00 | |
| RE: Displaying voltage to lcd using aduc812 | 01/01/70 00:00 | |
Routine to convert 16bit numberto ASCII | 01/01/70 00:00 |



