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

LM35DZ reading
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Ttelmah



Joined: 11 Mar 2010
Posts: 19540

View user's profile Send private message

PostPosted: Fri Jan 13, 2023 8:00 am     Reply with quote

To get 0.1C readability, you would need to use an external Vref of say
3.072v and add an op-amp amplifier to the output of the sensor giving
*3 gain. You'd then have a step size on the ADC of

3.072/1024 = 3mV/step

and an output from the amplified sensor of 30mV/C
temtronic



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

View user's profile Send private message

PostPosted: Fri Jan 13, 2023 9:10 am     Reply with quote

You'll need to take several readings and average them, that's why I suggested the 'Olympic averaging' method. it's easy to implement and fast. There are 100's of ways to get 'precise' readings but 'temperature' is generally a 'slow' moving measurement, so you can take 10 readings and consider them 'one' reading. My energy control systems did this, once every 15 seconds THEN took whatever action was needed. You do NOT want to rely upon only one reading !
A lot depends upon the 'project' and the 'goals' of what is required. The LM35 a reliable, stable, slow response devices, which should have a 'calibration' done if you want 'accuracy'. (ie: that 21*C read IS the actual 21*C room temperature). Each LM35 is slightly different response,even within 'batches' of them. Connect 2 to the PIC's ADC and sample 1000 times displaying the raw data (ADC bits), they will NOT be identical....
MCUprogrammer



Joined: 08 Sep 2020
Posts: 221

View user's profile Send private message

PostPosted: Fri Jan 13, 2023 10:33 am     Reply with quote

What I don't understand is if VREF_1v024 doesn't work, isn't it unreasonable for them to put it as a feature inside the processor? Here I solved the problem. It didn't work because I made an installation mistake. It's working fine now.
_________________
Best Regards...
MCUprogrammer
_______________________________
Work Hard
Ttelmah



Joined: 11 Mar 2010
Posts: 19540

View user's profile Send private message

PostPosted: Fri Jan 13, 2023 10:49 am     Reply with quote

Multiple things here.

All ADC's have minimum working voltages for their full resolution. In the
case of the older PIC ADC's (yours is an old chip), this is typically about 2.5v.
So pointless to even think about working with a 1.024v reference.
Many of the newer chips support a range down to about 2v, and a few
support down to perhaps 1.5v. However I don't think any will work down
to 1.024v.

Second thing though you could get a step size 1/4 the existing ADC, by
switching to a chip with a 12bit ADC. Some of the very oldest chips have
these and a lot of the newer chips.

Third thing though you can't have an option to specify the ADC Vref in
your chip, since it does not have a built in Vref to give this. You can't
specify a reference voltage, since there is not a reference to give
this. You can only select the supply, or an external Vref.

Even on chips that do have a reference, you would not get the accuracy
needed, since the internal Vref will not be that accurate. Understand that
really accurate Vref's are expensive chips. They need a huge amount of
laser trimming as part of the manufacture. Not economic to build such
a device into a cheap chip like a PIC. A 0.05% Vref, will typically cost
at least five times what a PIC costs.

PIC ADC's in general are 'general purpose' ADC's not high precision
devices.

Have a look at some prices for the LTZ1000, if you want to see a Vref
suitable for say a 14bit ADC. The reason it is wire leaded is otherwise
mechanical stresses into the unit will degrade the accuracy.
MCUprogrammer



Joined: 08 Sep 2020
Posts: 221

View user's profile Send private message

PostPosted: Fri Jan 13, 2023 12:53 pm     Reply with quote

Ttelmah and temtronic are very important to me. I take them all seriously. And I will try.
_________________
Best Regards...
MCUprogrammer
_______________________________
Work Hard
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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