NTC thermistor temperature sensing


Closed Thread
Results 1 to 37 of 37

Hybrid View

  1. #1
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Hi,

    I'm somewhat affraid ...
    ADCIN 1,tb0
    tb1=tb0-16170
    tb1=tb1*tb3
    tb2=Div32 634
    tb0=tb2/100
    tb1=tb2//100
    0 < Tb0 < 1024 ... ok ?

    1024 - 16170 = ??? - 15146 !!!
    so, tb1 is NEGATIVE ...

    and PBP do not deal with negative numbers .... but " read " it as 65536 -15146 = ???

    a hole in the somewhere ???

    Alain
    Last edited by Acetronics2; - 15th January 2011 at 14:30.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Hi,

    I'm somewhat affraid ...


    0 < Tb0 < 1024 ... ok ?

    1024 - 16170 = ??? - 15146 !!!
    so, tb1 is NEGATIVE ...

    and PBP do not deal with negative numbers .... but " read " it as 65536 -15146 = ???

    a hole in the somewhere ???

    Alain
    Well, the ADC range is not 0-1024, but 0-65535...
    (verified with a display of the raw ADC value).

  3. #3
    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 pxidr84 View Post
    Well, the ADC range is not 0-1024, but 0-65535...
    (verified with a display of the raw ADC value).
    Alain never said the ADC range was 0 - 65535.
    He was telling you how the value would be acted on.
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by pxidr84 View Post
    Well, the ADC range is not 0-1024, but 0-65535...
    (verified with a display of the raw ADC value).
    You should place a patent on this one ...

    Hurry up !!!

    Alain

    PS you do not display Tb0 ( as the ADC result ) , but Tb0 ( after - false - calculations done ! ) ....
    Last edited by Acetronics2; - 15th January 2011 at 15:01.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    You should place a patent on this one ...
    In case you are wondering why, the ADC is 10 bit, so clearly you can't have 16 bit result from the ADC
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  6. #6


    Did you find this post helpful? Yes | No

    Default



    It's weird. I got a 16-bit result. Why? Code :

    Code:
    define OSC 20
    DEFINE ADC_BITS 10
    DEFINE ADC_CLOCK 3  
    DEFINE ADC_SAMPLEUS 10
    DEFINE LCD_DREG PORTC
    DEFINE LCD_RSREG PORTC
    DEFINE LCD_EREG PORTC
    DEFINE LCD_EBIT 5 
    DEFINE LCD_COMMANDUS 10000'Command delay time in us 
    DEFINE LCD_DATAUS 1000 'Data delay time in us
     
    ntc VAR WORD
    
    TRISA=%11111111     
    ADCON1=%10000010   
    
    PAUSE 4000
    
    lp:
    
    ADCIN 1,ntc
     
    PAUSE 100
     
    Lcdout $fe,$c0,#ntc
    
    goto lp
    you do not display Tb0 ( as the ADC result ) , but Tb0
    And what are the differences between Tb0 and Tb0? I didn't understand your answer.
    Last edited by pxidr84; - 15th January 2011 at 15:36.

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


    Did you find this post helpful? Yes | No

    Default

    Never trust a sim.
    Try it in real life and come back.
    Dave
    Always wear safety glasses while programming.

  8. #8
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    ADCIN 1,tb0
    tb1=tb0-16170
    tb1=tb1*tb3
    tb2=Div32 634
    tb0=tb2/100
    tb1=tb2//100
    see any difference between Tb0 value @ line 1 and Tb0 Value @ line 5 ???

    really no ?

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  9. #9
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    Never trust a sim.
    But this time I think the sim is correct. I think you ment to set ADCON2, not ADCON1. ADCON 2 sets right or left justified. Default is left justified.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

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