keerthikampc
Newbie level 4

how to display the message of x in lcd,where x=a/98*100,a is the input
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;
sorry tahmid i cant catch u.i clearly explain u my project.im going to measure oxygen level in blood using spo2 sensor.measured value will be the input to pic18f4520.how to write a coding to display the different oxygen rate in lcd.please help meFirst get the value of x:
I'm assuming x is a 4-digit integer.Code:x=(a*100)/98;
Get the digits:
Then convert them to ASCII:Code:dig1 = x/1000; dig2 = (x/100) % 10; dig3 = (x/10) % 10; dig4 = x % 10;
You can get the digits and convert to ASCII in one line of code if you want.Code:dig1 = dig1 + 48; dig2 = dig2 + 48; dig3 = dig3 + 48; dig4 = dig4 + 48;
Then send the digits dig1, dig2, dig3, dig4 to LCD.
Hope this helps.
Tahmid.