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 CCS Technical Support

ADC

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



Joined: 02 May 2013
Posts: 5

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

ADC
PostPosted: Thu May 02, 2013 11:00 am     Reply with quote

Hi to all, my project measure the temperature of fridges and give a audible alarm when the temperature passes a set point.
I should use 3 LM35 sensors. How to configure to use 3 ports, AN0, AN1 and AN2 ? And also how to set VREF+ VREF- voltage to convert negative value to negative temperature eg -55 ° C --->-550mV ?
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Thu May 02, 2013 11:54 am     Reply with quote

Hi,

You need to start here first: http://www.ccsinfo.com/forum/search.php

John
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu May 02, 2013 12:31 pm     Reply with quote

You should always post which PIC you're going to use.

Also using LM35s requires a buffer opamp for signal conditioning,along with 'level shifting' to get -ve temps(well, that's one way....). You should use shielded cable to the LM35s, though runs under say 100 ft., you'll be ok.

Given the option, I'd use the DS18b20 series of temp sensors. Easier to use (just 2 wires) and though cost more that LM35s, by the time you add up opamps,resistors,caps,etc. (plus YOUR time !) they are cheaper/better in the long run.

Your project could be implemented with an 8 pin PIC....

This from a guy who's used LM35s for the past 20 years !

hth
jay
wahid



Joined: 02 May 2013
Posts: 5

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

PostPosted: Thu May 02, 2013 5:12 pm     Reply with quote

PIC16F877, and my problem is configuring A/D converter with digital vref+ and vref- and port number to use. In this case is using 3 A/D pins with PIC compiler.
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Fri May 03, 2013 12:58 am     Reply with quote

There is no 'digital Vref'.
Pin Vref inputs are analog inputs into which you can external circuitry to feed a voltage to set the working range of the ADC.
However there are limitations on the voltages you can use. Vref+ cannot be more than 0.3v above AVdd, or 2.5v below Avdd. Vref- cannot for more than 0.3v below AVss, or 2v above it, and there must be a minimum of 2v between Vref- and Vref+.
You have to build your hardware to input the voltage required...

However for a low accuracy application, and assuming you have a well regulated supply, most people would just use the supply rails as Vref+, and Vref-, and then scale the reading from the ADC to give the required value. However all of this involves +ve voltages into the PIC, which is all it can handle.

Temtronic has already pointed out the biggest problem. You are not going to read -ve temperatures with an LM35, without quite a bit of external circuitry. First you are going to need a -ve supply rail. Second a buffer amplifier and level shifter.

You can run the LM335 (note the extra digit - important....). to measure temperature with a PIC, without external circuitry (except a resistor). Using 5v as Vref+, and 0v as Vref-. Or the AD590, can make it really easy, allowing you to choose the resistor to give the count required. There are literally dozens of other temperature sensors, all of which are better/easier with the PIC, for the range of temperatures you require (the LM35, is relatively easy for _positive_ temperatures only). The DS18B20, is particularly easy to use (library here in the group), and gives easy connection, less noise, and covers the temperature range you want....

Best Wishes
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Fri May 03, 2013 7:43 am     Reply with quote

I wrote this "driver" some time ago:
http://www.ccsinfo.com/forum/viewtopic.php?t=48525

it might help you.

How ever I agree with others, there are simpler sensors out there.
They cost more but, unless you are mass producing, it really does not amout to more than 1 or 2 dollars more.



G.
_________________
CCS PCM 5.078 & CCS PCH 5.093
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