CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

measure Resistance

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
nina



Joined: 20 Apr 2007
Posts: 111

View user's profile Send private message Send e-mail

measure Resistance
PostPosted: Fri Jun 22, 2007 9:26 am     Reply with quote

hi

How can I display the resistence value over a LCD?
The reading of ADC do not mean resistence.
Does anyone here can explain how work it?

Thanks

NIna
arunb



Joined: 08 Sep 2003
Posts: 492
Location: India

View user's profile Send private message Send e-mail

RE:
PostPosted: Fri Jun 22, 2007 9:42 am     Reply with quote

If you know the current flowing through the resistance then the resistance can be easily determined...

V=I/R

You must pass a constant current through the resistance, then read the ADC voltage, and use the above formula to calculate the resistance..

thanks
arunb
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Fri Jun 22, 2007 12:05 pm     Reply with quote

First you need to understand Ohm's law. Then realize that the A/D only measures voltages. Then it will all make sense.
_________________
The search for better is endless. Instead simply find very good and get the job done.
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Fri Jun 22, 2007 1:41 pm     Reply with quote

Hey Arunb, V=I*R not V=I/R
nina



Joined: 20 Apr 2007
Posts: 111

View user's profile Send private message Send e-mail

R
PostPosted: Sat Jun 23, 2007 6:32 am     Reply with quote

sorry...let me explain better my doubt.
when we use a LM35 we need write a formula to convert input ADC to temperature. I would like know how can I do for a potentiometer.
After conect a pot 1k and a lcd over pic, it show the values
1,102,205,307,409,511,614,716,818,921,1022.
I using this line to write over lcd
printf(lcd_putc, "Pot = %f",pot);
where pot is reading from ADC

tks

nina
arunb



Joined: 08 Sep 2003
Posts: 492
Location: India

View user's profile Send private message Send e-mail

RE:
PostPosted: Sat Jun 23, 2007 4:50 pm     Reply with quote

oops sorry, you are right treitmey, I gues I was thinking of something else.. thanks for pointing out the mistake..

But the method was right I suppose ??

thanks
arunb
nina



Joined: 20 Apr 2007
Posts: 111

View user's profile Send private message Send e-mail

pot
PostPosted: Mon Jun 25, 2007 5:11 am     Reply with quote

Does anyone here had already this problem?

tks nina
jma_1



Joined: 08 Feb 2005
Posts: 147
Location: Wisconsin

View user's profile Send private message

PostPosted: Mon Jun 25, 2007 7:04 am     Reply with quote

WHY DOES THIS THIS SAY SPAM WHEN IT IS POSTED?!! I HAVE NEVER POSTED ANYTHING OBJECTIONABLE.

Greetings,

The LM35 is a temperature sensor which produces an output voltage which is 10mV / degree C. The formula is in the datasheet of the LM35. Please describe your setup in more detail. What resistance? Why?

Cheers,
JMA
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Mon Jun 25, 2007 8:04 am     Reply with quote

Google is your friend.
Google:LM35 temperature formula
http://www.google.com/search?rls=GGGL%2CGGGL%3A2005-09%2CGGGL%3Aen&hl=en&q=LM35+temperature+formula&btnG=Google+Search
first hit
http://forum.microchip.com/printable.aspx?m=182644
This shows some formulas and some steps you will encounter in
making this work
inservi



Joined: 13 May 2007
Posts: 128

View user's profile Send private message

PostPosted: Mon Jun 25, 2007 8:27 am     Reply with quote

Hello Nina,

if you connect you pot between VDD and Gnd (+5v and 0v), and the ADC is 10 bits resolutions, the results are between 0 for 0v and 1023 for 5V.
So the results you get are normal!

For convert to volts, you need to devide the result by 1024*5, or simply by 204.

If you need to mesure a resistor then you can use a know resistor connected between pin of the ADC and VDD, the resistor to measure between the pin and 0v. then if R1 is the know resistor connected to VDD, R2 is the unknow resistor, U is VDD, U2 is the voltage mesured, then:

R2=R1 / ( ( U / U2 ) -1 )

You can use the value measured directly without convert it to voltage.

example for a R1 = 1K, U=1024, U2=512 then

R2 = 1000 / ( ( 1024 / 512) -1 ) = 1000

Best regards,
dro.
_________________
in médio virtus
nina



Joined: 20 Apr 2007
Posts: 111

View user's profile Send private message Send e-mail

lcd y pot
PostPosted: Tue Jun 26, 2007 5:28 am     Reply with quote

great...its working now..

I changed pot by MPX4250 and there is a difference between MPX4250 and LCD.
IS this difference the offset?
Can I decrease this difference using numeric calculus or just changed the PIc by another whit higher ADC?

tks

nina
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group