NTC thermistor temperature sensing


Closed Thread
Results 1 to 37 of 37

Hybrid View

  1. #1
    Join Date
    Oct 2010
    Posts
    27


    Did you find this post helpful? Yes | No

    Default

    I'm not seeing what "DEC" and "dig" offers over my ver.....
    Please enlighten me!

  2. #2
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Oops, sorry Picguy (I thought you were the original poster....
    Last edited by ScaleRobotics; - 14th January 2011 at 21:18. Reason: Trying to get my foot out of my mouth.
    http://www.scalerobotics.com

  3. #3
    Join Date
    Oct 2010
    Posts
    27


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by scalerobotics View Post
    Oops, sorry Picguy (I thought you were the original poster....
    I appreciate you saying that, thank you. But my questions stand, AND I have read the manual. My version SEEMS more succinct than the dig / dec version. However, I assume there are advantages to that style, I'm just not seeing them.

    Please point them out to me.

  4. #4
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Plcguy View Post
    My version SEEMS more succinct than the dig / dec version. However, I assume there are advantages to that style, I'm just not seeing them.
    As for me, I missed your earlier post first, hence my foot in my mouth. But now that I look closer at it, if your //100 remainder is 9, then you will print out xx.9. In Alain's example dig 1 will be 0, dig 0 will be 9, so his result will be xx.09.

    Walter
    http://www.scalerobotics.com

  5. #5
    Join Date
    Oct 2010
    Posts
    27


    Did you find this post helpful? Yes | No

    Default

    You're right, thank you!
    I have an app in test right now that needs to be fixed!
    Nothing like a second set of eyes.

  6. #6
    Join Date
    Oct 2010
    Posts
    27


    Did you find this post helpful? Yes | No

    Default

    I also asked earlier about B0.
    Isn't that a special word in BS2?
    And since that is a PBasic off shoot, I'd think it's bad here???
    I looked in the manual and they use B0 as a byte in examples, but it may just be convenient.

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


    Did you find this post helpful? Yes | No

    Default

    Not sure what you mean about offshoot?

    B0 is just a variable here.
    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

    Quote Originally Posted by Plcguy View Post
    I'm not seeing what "DEC" and "dig" offers over my ver.....
    Please enlighten me!
    Hi, PlcGuy

    The Goal here is to offer solutions showing the differents uses of PBP and try to make people understand what they do ... not to show as-is the - so called - " best " solution.

    Pxidr84 had chosen this way of displaying its numbers ... no need to change it, as long as he understands what he does. - I perfectly know it is not the shorter or easier or smarter or .... way of doing it. And we do not talk about Walter's # 12 post ...

    The question was about scaling a value ... whithout knowing the Pic type, I showed the DIV 32 use ... which is the simpler for him.

    Darrel posted about "BIG Numbers" operations ... and it is the way to get more decimals here ... but not so simple - for a newbee !!!

    Now, We Know it is a Pic 18F ... the use of LONGs becomes obvious. It still is easy to use.

    I see in your example you just display the ADC input voltage, and not the required temp value, what could raise more questions than offer ideas, for a PBP "newbee" as our friend, as you didn't tell him it doesnt give the awaited result ...
    but was just an example.

    Not so easy to give a useful and usable answer to a post ... don't you think ???

    Alain

    PS: for B0, B1 .... absolutely no problem till you do not use the BS1 or 2 to include " compatibility files " ...
    Last edited by Acetronics2; - 15th January 2011 at 09:17.
    ************************************************** ***********************
    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


    Did you find this post helpful? Yes | No

    Default

    Okay, I've rectified the code for use the 10-bit ADC. Now I get more accurate temperature measurement.
    I've also modified the temperature formula (the bin->voltage conversion is now "integrated" within), so I don't need anymore the bin->voltage calculation effetued by the PIC.

    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 
    
    tb0 VAR WORD
    tb1 VAR WORD
    tb2 VAR WORD
    tb3 VAR WORD
    tb3=100
    
    TRISA=%11111111     
    ADCON1=%10000010   
    
    PAUSE 4000
    
    lp:
    
    ADCIN 1,tb0
    tb1=tb0-16170
    tb1=tb1*tb3                                      
    tb2=Div32 634
    tb0=tb2/100   
    tb1=tb2//100    
               
    PAUSE 100
     
    Lcdout $fe,$c0,"IGBT t.: ",DEC (tb0 DIG 1),DEC (tb0 DIG 0),".",DEC (tb1 DIG 1),"°C"
    
    goto lp

  10. #10
    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 " !!!
    *****************************************

  11. #11


    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).

  12. #12
    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.

  13. #13
    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 " !!!
    *****************************************

  14. #14
    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!

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