Temperature with the LM34C


Closed Thread
Results 1 to 26 of 26

Hybrid View

  1. #1


    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

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    I don't know if I need to do this or not, but I have the VSS and VDD pins tied together, respectively.
    Dave, Vss is the ground or (zero volts) and Vdd is power or (+5Volts), from what you say it seems you have a short.

    Remove it and re-establish the corrected connections.

    Al.
    All progress began with an idea

  3. #3


    Did you find this post helpful? Yes | No

    Default

    There is no short. There are two VVS pins and two VDD pins. They are tied together respectively. In other words, the VVS pins are tied to each other; the VDD pins are also tied to each other.

    ~ Dave
    Last edited by StoneColdFuzzy; - 29th May 2009 at 01:09.

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


    Did you find this post helpful? Yes | No

    Default

    I had to set this up myself to find the problem.

    When you use "DEFINE" everything has to be upper case. It would not work until I made that change. Problem was so simple but hard to see.
    Code:
    <html>
    <body><!--StartFragment--><pre><code><font color="#000000">    <font color="#FF0000">DEFINE </font><font color="#0000FF">OSC </font>20
        @ <font color="#0000FF"><b>__config _HS_OSC </b></font>&amp; <font color="#0000FF"><b>_WDT_ON </b></font>&amp; <font color="#0000FF"><b>_LVP_OFF </b></font>&amp; <font color="#0000FF"><b>_CP_OFF
        </b></font><font color="#000080"><i>'DEFINE loader_used 1    ' Boot loader is being used
        </i></font><font color="#FF0000"><b>DEFINE </b></font><font color="#0000FF"><b>DEBUG_MODE  </b></font>1    <font color="#000080"><i>' Debug sending INVERTED serial data
        </i></font><font color="#FF0000"><b>DEFINE </b></font><font color="#0000FF"><b>DEBUG_REG PORTC  </b></font><font color="#000080"><i>' Debug Port = PortC
        </i></font><font color="#FF0000"><b>DEFINE </b></font><font color="#0000FF"><b>DEBUG_BIT </b></font>6      <font color="#000080"><i>' Debug.bit = PortC.6
        </i></font><font color="#FF0000"><b>DEFINE </b></font><font color="#0000FF"><b>DEBUG_BAUD </b></font>9600  <font color="#000080"><i>' Default baud rate = 9600
        </i></font><font color="#FF0000"><b>DEFINE </b></font><font color="#0000FF"><b>ADC_BITS </b></font>8       <font color="#000080"><i>' Set A/D for 8-bit operation
        </i></font><font color="#FF0000"><b>DEFINE </b></font><font color="#0000FF"><b>ADC_CLOCK </b></font>1      <font color="#000080"><i>' Set A/D clock Fosc/8
        </i></font><font color="#FF0000"><b>DEFINE </b></font><font color="#0000FF"><b>ADC_SAMPLEUS </b></font>50  <font color="#000080"><i>' Set A/D sampling time @ 50 uS
        </i></font><font color="#0000FF"><b>samples </b></font><font color="#FF0000"><b>VAR WORD        </b></font><font color="#000080"><i>' Multiple A/D sample accumulator
        </i></font><font color="#0000FF"><b>sample  </b></font><font color="#FF0000"><b>VAR BYTE        </b></font><font color="#000080"><i>' Holds number of samples to take
        </i></font><font color="#0000FF"><b>temp    </b></font><font color="#FF0000"><b>VAR BYTE        </b></font><font color="#000080"><i>' Temperature storage
        </i></font><font color="#0000FF"><b>samples </b></font>= 0             <font color="#000080"><i>' Clear samples accumulator on power-up
    
        </i></font><font color="#0000FF"><b>TRISA </b></font>= %11111111   <font color="#000080"><i>' Set PORTA to all input
        </i></font><font color="#0000FF"><b>ADCON1 </b></font>= %00000011  <font color="#000080"><i>' Set PORTA.0,1,2,5 = A/D, PortA.3 = +Vref
        </i></font><font color="#FF0000"><b>PAUSE </b></font>500           <font color="#000080"><i>' Wait .5 second
    
        </i></font><font color="#0000FF"><b>loop</b></font>:
        <font color="#FF0000"><b>FOR </b></font><font color="#0000FF"><b>sample </b></font>= 1 <font color="#FF0000"><b>TO </b></font>20    <font color="#000080"><i>' Take 20 samples
            </i></font><font color="#FF0000"><b>ADCIN </b></font>0, <font color="#0000FF"><b>temp       </b></font><font color="#000080"><i>' Read channel 0 into temp variable
            </i></font><font color="#0000FF"><b>samples </b></font>= <font color="#0000FF"><b>samples </b></font>+ <font color="#0000FF"><b>temp </b></font><font color="#000080"><i>' Accumulate 20 samples
            </i></font><font color="#FF0000"><b>PAUSE </b></font>250           <font color="#000080"><i>' Wait approximately 1/4 seconds per loop
        </i></font><font color="#FF0000"><b>NEXT </b></font><font color="#0000FF"><b>sample
        temp </b></font>= <font color="#0000FF"><b>samples</b></font>/20
        <font color="#FF0000"><b>DEBUG </b></font><font color="#00FF00"><b><i>&quot;Temperature is: &quot;</i></b></font>,<font color="#FF0000"><b>DEC </b></font><font color="#0000FF"><b>temp</b></font>,<font color="#00FF00"><b><i>&quot; Deg F&quot;</i></b></font>,10,13
        <font color="#0000FF"><b>samples </b></font>= 0             <font color="#000080"><i>' Clear old sample accumulator
        </i></font><font color="#FF0000"><b>GOTO </b></font><font color="#0000FF"><b>loop               </b></font><font color="#000080"><i>' Do it forever
        </i></font><font color="#FF0000"><b>END
    </b></font></code></pre><!--EndFragment--></body>
    </html>
    Last edited by mackrackit; - 29th May 2009 at 08:11.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    When you use "DEFINE" everything has to be upper case.
    That's only true when using MPASM.
    Since Bruce's program had @ device, the program was written for PM.exe, and is therefore not case sensitive.

    Frankly, looking for a problem with one of Bruce's programs seems futile.

    There's something wrong with the hardware. Connected to the wrong pins, grounds not connected across the breadboard, etc.
    <br>
    DT

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    That's only true when using MPASM.
    Since Bruce's program had @ device, the program was written for PM.exe, and is therefore not case sensitive.
    Bruce did not have @ anything, but the OP did. So yes, the OP must be using PM.
    Frankly, looking for a problem with one of Bruce's programs seems futile.
    Agreed!!! I was just trying to find something obvious that the OP could be doing and thought I did.
    There's something wrong with the hardware. Connected to the wrong pins, grounds not connected across the breadboard, etc.
    <br>
    Must be.
    Dave
    Always wear safety glasses while programming.

  7. #7


    Did you find this post helpful? Yes | No

    Default

    I didn't think that I changed Bruce's code, except for direct serial, but it's good to get more than one set of eyes on it. I'll keep checking connections; it's got to be the hardware. Thanks again y'all!

    ~ Dave

Similar Threads

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