coding for pic 18f4520

Status
Not open for further replies.

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
 

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.
 


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
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…