keerthikampc
Newbie level 4
- Joined
- Sep 24, 2012
- Messages
- 7
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,320
how to display the message of x in lcd,where x=a/98*100,a is the input
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
x=(a*100)/98;
dig1 = x/1000;
dig2 = (x/100) % 10;
dig3 = (x/10) % 10;
dig4 = x % 10;
dig1 = dig1 + 48;
dig2 = dig2 + 48;
dig3 = dig3 + 48;
dig4 = dig4 + 48;
First get the value of x:
Code:x=(a*100)/98;
I'm assuming x is a 4-digit integer.
Get the digits:
Code:dig1 = x/1000; dig2 = (x/100) % 10; dig3 = (x/10) % 10; dig4 = x % 10;
Then convert them to ASCII:
Code:dig1 = dig1 + 48; dig2 = dig2 + 48; dig3 = dig3 + 48; dig4 = dig4 + 48;
You can get the digits and convert to ASCII in one line of code if you want.
Then send the digits dig1, dig2, dig3, dig4 to LCD.
Hope this helps.
Tahmid.