Temperature with the LM34C


Closed Thread
Results 1 to 26 of 26

Hybrid View

  1. #1

    Default Temperature with the LM34C

    In the project by Reynolds Electronics here, what's a good size potentiometer to use for calibration?

    ~ Dave

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    That is a simple voltage divider. 5v supply /5k ohm = .001 Amp
    5v / 10k ohm = .0005 amp how much current do you want to waste ?
    Assuming zero current flow into the PIC (impossible I know) the voltage will be linear across either one. It gets less true as the PIC begins to load the voltage divider, and as this parasitic loss increases the more suitable the lower resistance becomes.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Look in your PIC datasheet in the analog to digital converter section. There you will find the maximum impedance you may use with your Specific PIC model.

    Usually a simple small trim-pot (single or multi-turn) work pretty well... You could also use a already made voltage reference, this doesnt require any calibration and tend to be more stable on the long run.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4


    Did you find this post helpful? Yes | No

    Default

    OK, I'm using a PIC16F877a instead of the PIC16F877. I have a 4 MHz ceramic osc and I'm using the direct connection as on the Rentron page. I don't know if I need to do this or not, but I have the VSS and VDD pins tied together, respectively. I checked the connections and tested the LM34 with 5 volts. The LM34 changes output voltage fine I don't know if I goofed the code up or not, but I'm getting nothing. Here's the code:

    Code:
    @ device  pic16F877A, xt_osc, wdt_off, lvp_off, protect_off
    
    DEFINE loader_used 1    ' Boot loader is being used
    DEFINE debug_mode  1    ' Debug sending Inverted serial data
    DEFINE debug_reg portc  ' Debug Port = PortC
    DEFINE debug_bit 6      ' Debug.bit = PortC.6
    DEFINE debug_baud 9600  ' Default baud rate = 9600
    DEFINE osc 4            ' We're using a 4 MHz oscillator
    DEFINE ADC_BITS 8       ' Set A/D for 8-bit operation
    DEFINE ADC_CLOCK 1      ' Set A/D clock Fosc/8
    DEFINE ADC_SAMPLEUS 50  ' Set A/D sampling time @ 50 uS
    samples VAR WORD        ' Multiple A/D sample accumulator
    sample  VAR BYTE        ' Holds number of samples to take
    temp    VAR BYTE        ' Temperature storage
    samples = 0             ' Clear samples accumulator on power-up
    
        TRISA = %11111111   ' Set PORTA to all input
        ADCON1 = %00000011  ' Set PORTA.0,1,2,5 = A/D, PortA.3 = +Vref
        PAUSE 500           ' Wait .5 second
    
    loop:
        FOR sample = 1 TO 20    ' Take 20 samples
            ADCIN 0, temp       ' Read channel 0 into temp variable
            samples = samples + temp ' Accumulate 20 samples
            PAUSE 250           ' Wait approximately 1/4 seconds per loop
        NEXT sample
        temp = samples/20
        DEBUG "Temperature is: ",DEC temp," Deg F",10,13
        samples = 0             ' Clear old sample accumulator
        GOTO loop               ' Do it forever
    
        END

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    What do you have connected to AN3? If nothing then try
    ADCON1 = %00000100
    Dave
    Always wear safety glasses while programming.

  6. #6


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    What do you have connected to AN3? If nothing then try
    ADCON1 = %00000100
    I have the wiper of a pot connected and set at 2.55 volts.

    ~ Dave

Similar Threads

  1. Replies: 10
    Last Post: - 17th February 2012, 07:19
  2. DS18S20 reading negative temperature
    By srob in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 28th December 2007, 21:21
  3. Conversion problem
    By eva in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 15th March 2007, 18:21
  4. Help for decimal conversion
    By eva in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 15th March 2007, 18:20
  5. Interrupt and Serial communication to PC.
    By obaskirt in forum mel PIC BASIC
    Replies: 2
    Last Post: - 17th June 2005, 20:01

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts