Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
March 28, 2024, 12:51:27 12:51


Login with username, password and session length


Pages: [1]
Print
Author Topic: Help with 10 bits ADC  (Read 8207 times)
0 Members and 1 Guest are viewing this topic.
spurs21
Cracking Team
Active Member
****
Offline Offline

Posts: 152

Thank You
-Given: 35
-Receive: 50



« on: October 16, 2008, 04:49:04 16:49 »

Hi friends, i need a little help from you  Cheesy. I wanna built a digital thermometer wich have a 10 bits resolution ADC. I have built one with 8 bits and it works perfect, now i want to make it but with 10 bits resolution, have any body a sample??. And i have another question, my thermomether is using the lm35 sensor, and the Vo is wired with pin2 of PIC16F877A directly, but in in other schematic a op amp is used, so how can i write a code in PBP with the 10 bits ADC and use the same circuit wich is using the op amp?, I let u below the proteus simulation and the code compiled. I have another code but in asm wich is used with the circuit that contain the op amp, i put below the proteus simulation using the asm code and i let u herethe code on pbp that i want to adapt for it works in the same circuit. By the way i want to show the degrees Celcius with floating point. Regards and thanks in advance:

Code:
DEFINE LCD_DREG PORTB 
DEFINE LCD_DBIT 0   
DEFINE LCD_RSREG PORTD
DEFINE LCD_RSBIT 6     
DEFINE LCD_EREG PORTD
DEFINE LCD_EBIT 7     
DEFINE LCD_BITS 8     
DEFINE LCD_LINES 4     

DEFINE ADC_BITS 8     'I know that here must be a 10 number for the 10 bits resolution, but what another changes?
DEFINE ADC_CLOCK 3   
DEFINE ADC_SAMPLEUS 50


Res Var Word
Conv con 19
Temp1 Var WORD
TRISA = %11111111
TRISB = 0
TRISC = 0
PAUSE 500

ADCON1 = 0

ADCON0 = %11000001

LCDOUT $FE, 1
lcdout "T"
PAUSE 384
lcdout "E"
PAUSE 384
lcdout "M"
PAUSE 384
lcdout "P"
PAUSE 384
lcdout "E"
PAUSE 384
lcdout "R"
PAUSE 384
lcdout "A"
PAUSE 384
lcdout "T"
PAUSE 384
lcdout "U"
PAUSE 384
lcdout "R"
PAUSE 384
lcdout "A"
PAUSE 384
lcdout " o"
PAUSE 384
lcdout "C"
PAUSE 384


AGAIN:

ADCON0.2 = 1

ADCIN 0, Res
Temp1 = 2*Res

pause 100
LCDOUT $FE,$C0,DEC2 Temp1, ",00" ' here instead of 00 i'll wish to show the floating point


GOTO AGAIN

END
Logged
junaid_766
Newbie
*
Offline Offline

Posts: 24

Thank You
-Given: 10
-Receive: 1


« Reply #1 on: October 18, 2008, 03:45:02 03:45 »

can u plz send me the proteus simulatable model of lm35

Logged
DTiziano
Active Member
***
Offline Offline

Posts: 104

Thank You
-Given: 41
-Receive: 168


« Reply #2 on: October 18, 2008, 08:33:43 08:33 »

The LM35 has 10 mV/°C output, without any help the 10bit ADC (with 5V reference) can read 5/0.01 = 500 °C (LM35 melt before) with 500/1023 = 0.488 °C resolution.
The LM35 can work till 150°C, so you can increase the resolution by reducing the reference or amplifier the signal. The circuit with OP use the second way. To read it you do the same, just take care in the calculation that the value is not 10 mV/°C, but higher.
If the OP amplify x4 you have 40mV/°C = full scale at 125 °C, 0.1222 °C/bit resolution. The °C display out is = ADC read x 0.1222.
But I think there is a bettor and simpler solution, with much higer resolution.

Some year ago I built a multi point thermometer, and I found that a very good solution is the LM92 from National. It has hight resolution, is DIGITAL, no analog, non OP, no reference, no noise, just read it by I2 bus. The interface is very simple.
The IC is a SMD device, so put a SMD 0.1 uF capacitor directly on IC's pins.
In my solution the sensor was glued with thermo plastic tube and a 4 wire small cable.

http://cache.national.com/ds/LM/LM92.pdf
Logged
spurs21
Cracking Team
Active Member
****
Offline Offline

Posts: 152

Thank You
-Given: 35
-Receive: 50



« Reply #3 on: October 20, 2008, 04:02:56 04:02 »

Hi DTiziano, firstly thanks for your reply, and it will help me friend  Cheesy. and the option that u have mentioned is interesting, i'll try with it jeje. Best regards...
Logged
Mainul
Newbie
*
Offline Offline

Posts: 15

Thank You
-Given: 30
-Receive: 5


« Reply #4 on: December 12, 2008, 01:59:23 13:59 »

Maximum resolution can be derived  from  LM35 device is 0.1 degree.  To display this on LCD with a 10 Bit ADC no extra device is needed.  A precision reference voltage of 1.024 is required, which is not very hard to achieve.  After spending several days on the net and serching datasheet of many devices I found nothing that generates this voltage.  It is below the range of TL431 programmable zener. However, a well calculated ‘resitor devider ‘ (a pot in series is even more helpful) gave me the solution (which is reliable and extremely low cost as well).    The proteous model  and basic code is attached for anyone interested. 

The LM35 in proteous library lacks  this 0.1 degree resolution.   So I have replaced it with a pot.  When you will assemble the circuit you will face another difficulty in temperature stability in the display.  But that can be very easily handled in software.  Well, that’s different discussion…………….
Logged
DTiziano
Active Member
***
Offline Offline

Posts: 104

Thank You
-Given: 41
-Receive: 168


« Reply #5 on: December 12, 2008, 03:38:08 15:38 »

The reference ideas basically is not bad, but unfortunately there are some points to consider:
- there is a minumum value (should be 2.5 V for the 877)
- the impedence of the reference (the input carrent change in the time)
- a good reference is not cheap

Logged
Mainul
Newbie
*
Offline Offline

Posts: 15

Thank You
-Given: 30
-Receive: 5


« Reply #6 on: December 13, 2008, 08:07:40 08:07 »

- there is a minumum value (should be 2.5 V for the 877)

For an external reference voltage I have not found any lower range limit in the data sheet (or have I missed it?).  I have practically used 1.024 V as reference in several of my circuits designed with 16F676, 16F876A, 16F877A and 16F88. All are working fine for years.  Well, there is limitation in internal reference voltage generator, but here we are not using that.

-the impedence of the reference (the input carrent change in the time)

Once the input pin is declared as reference pin it reaches the highest possible impedance,  and it is designed to be used in that way.

- a good reference is not cheap

We are designing the reference voltage with lowest priced components, only few resistors – much lower than a precision temperature sensor with the accuracy of  two digits after decimal point.

This will definitely be NOT usable for Medical or similar equipments but one can still find it useful for a lot of projects. 

The most interesting part is stabilizing the result on the display. Everything is done in software but I shall be waiting for others experience 
Logged
DTiziano
Active Member
***
Offline Offline

Posts: 104

Thank You
-Given: 41
-Receive: 168


« Reply #7 on: December 13, 2008, 09:25:48 21:25 »

Sorry but there is a limit and the impedance change, see the annex.
Simple resistor divider is tipically not used as a DAC reference, due to the impedence change.
You can use of course , but if the finial circuit is out of specification, the result is not a 10 bit, but lower. You loose count or even bits.

« Last Edit: December 14, 2008, 12:58:25 12:58 by DTiziano » Logged
Mainul
Newbie
*
Offline Offline

Posts: 15

Thank You
-Given: 30
-Receive: 5


« Reply #8 on: December 17, 2008, 06:09:52 06:09 »

IF you have access to  "Interfacing PIC Micontrollers Embedded design by interactive simulation" by Martin Bates, you will find lot of good examples of using resistor deviders as ADC reference voltage. Those are really nice examples.  This book can be downloaded from this forum, I have seen a link somewhere.  And for the lower limit of reference voltage -  I can just refer to my test results for now.  But may be, I shal come back with more results and references.
« Last Edit: December 17, 2008, 10:25:26 10:25 by Mainul » Logged
Biggles
Junior Member
**
Offline Offline

Posts: 47

Thank You
-Given: 15
-Receive: 23



« Reply #9 on: December 17, 2008, 08:45:53 20:45 »

You can use yout original 8 bit thermometer to get a 10 bit resolution through oversampling. No extra parts, but more code and a chance to learn some good techniques. In my recent project I used my 10 bit ADC on the PIC to achieve 12 bit resolution. I sampled 16 times, add together and then shifted right by 2. I do that 20 times then average all results.  Very good.  See the Amtel information sheet  AVR121 for more information on enhancing ADC resolution by oversampling. This technique is excellent for your thermal signal.

Direct link:

http://anonym.to/?http://www.atmel.com/dyn/resources/prod_documents/doc8003.pdf               118k PDF.
Logged

Man who act in haste, repent at leisure.
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC