NTC thermistor temperature sensing


Closed Thread
Results 1 to 37 of 37

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    not much better ...

    Code:
     
    .
    .
    .
     
    AD_AN1_VALUE VAR WORD
    B0 VAR WORD
    B1 VAR WORD
    B2 VAR WORD
    B3 VAR WORD
    B3 = 100
    TRISA  = %11111111     
    .
    .
    .
     
    PAUSE 4000
    lp:
    ADCIN 1, AD_AN1_VALUE
    B0 = AD_AN1_VALUE*129   
    B1 = B0 - 8143
    B1 = B1 * B3                                      
    B2 = Div32 319
    PAUSE 100
    B0 = B2 / 100   ' we get integer part of temp
    B1 = B2 // 100  ' we get the decimal part x 100
     
    LCDOUT $fe,1
    LCDOUT #AD_AN1_VALUE
    Lcdout $fe,$c0,"Temp.: ",DEC (B0 DIG 1),DEC (B0 DIG 0),"." ,DEC (B1 DIG 1),DEC (B1 DIG 0),"°C"
    goto lp
    But with whisles and Bells ...

    Alain
    Thank you so much, it works flawlessly now. Very helpful.

    For mackrackit, I use the 18F26K20 (3.3V, 64MHz, 28-DIP), but I will switch to 18F4431 (because mine haven't enough I/O ports, and not enough hardware PWM ports).

  2. #2
    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
    Thank you so much, it works flawlessly now. Very helpful.

    For mackrackit, I use the 18F26K20 (3.3V, 64MHz, 28-DIP), but I will switch to 18F4431 (because mine haven't enough I/O ports, and not enough hardware PWM ports).

    Hi,

    IF you use a 18F series, it would be much better to make temp calculations with LONG types ... and then use 10 bits ADC result.

    you could easily get a .1°C resolution ( here it is .4°C ... I'm sure you had noticed ! )

    ...

    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 " !!!
    *****************************************

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