Nov 30, 2012 #1 K 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
Nov 30, 2012 #2 Tahmid Advanced Member level 6 Joined Jun 17, 2008 Messages 4,756 Helped 1,798 Reputation 3,588 Reaction score 1,656 Trophy points 1,413 Location Berkeley, California Activity points 30,584 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.
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.
Nov 30, 2012 #3 K 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 Tahmid said: 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. Click to expand... 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 me
Tahmid said: 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. Click to expand... 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 me