Thermistor based temperature reading short code required


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Mar 2014
    Location
    Pakistan
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: Thermistor based temprature reading short code required

    thermitor value is 10k,and i am loading datasheet also,the problem is that value of thermistor does not change with same proportion with every c degree
    Attached Images Attached Images

  2. #2
    Join Date
    Apr 2011
    Location
    Welches, Oregon
    Posts
    198


    Did you find this post helpful? Yes | No

    Default Re: Thermistor based temprature reading short code required

    Quote Originally Posted by asifiqbal View Post
    thermitor value is 10k, and i am loading datasheet also,the problem is that value of thermistor does not change with same proportion with every c degree
    You are, precisely, correct; however, the curve of resistance values is very close to a logarithmic curve and this may be precise enough - provided you can easily implement a log function. I do not know of a method to do this, so it may be that one of the other two methods, or Alain's suggestion of using LOOKDOWN2, may be better for your purpose - or perhaps you someone in the forum will know of a way. Or, it may be that this method is not accurate enough for your purpose.

    The point is that always there are these types of issues to solve and these choices to make. If you are trying to minimize resources used, then one answer may be better, if you are optimizing for accuracy another approach may meet your need... there is no "best" way and no "perfect" answer. Look at the three general methods I have suggested, weight their relative merit in your application - does the PIC you're using have EEPROM? How much? Are you using it for something else or is it available for this task? It is clear from your OP that you have put a great deal of work into making this work - it is with the greatest of respect for this effort that I offer you these choices rather than dictate how I would complete MY project.

    All that said...

    If I was to do this and I had determined that my EEPROM was available, and I needed the accuracy of precise, stored values, then I would write the corresponding TEMPERATURE value to the EEPROM location of each ADC reading. If the ADC reading for -20 Celsius is 26 and the reading for -19 is 27... DATA @ 26, -20, -19; I would continue in this manner (duplicating temperature readings where necessary to maintain the pattern). Then, I would read the DATA location of the ADC value, like so:

    ADCIN 1, ADC
    READ ADC, TEMP

    I would then write a subroutine to display the information:

    Gosub DISPLAY_LCD

    and wrap the subroutine in a label and return:

    DISPLAY_LCD:
    lcdout $fe,$80, "SENSOR ",dec3 t
    lcdout $FE,$C0, "TEMPRATURE: ", DEC TEMP, 223, " C" 'ASCII 223 is DEGREE SYMBOL
    RETURN

    and then put all this in a loop, so that it displayed continuously every second:

    MAIN:
    ADCIN 1, ADC
    READ ADC, TEMP
    Gosub DISPLAY_LCD
    PAUSE 1000
    GOTO MAIN

    DISPLAY_LCD:
    lcdout $fe,$80, "SENSOR ",dec3 t
    lcdout $FE,$C0, "TEMPRATURE: ", DEC TEMP, 223, " C" 'ASCII 223 is DEGREE SYMBOL
    RETURN

    DATA @ 26, -20, -19...

    END

    I'd then go back and add some more code to handle out of range values...

    MAIN:
    ADCIN 1, ADC
    READ ADC, TEMP
    IF ADC < 26 then GOTO MAIN 'LEAVE DISPLAY ALONE IF ITS TOO COLD - JUST KEEP READING
    IF ADC > 25 and ADC < 196 THEN Gosub DISPLAY_LCD 'FOR NORMAL VALUES
    IF ADC > 195 GOSUB DISPLAY_HOT 'FOR OVER RANGE
    PAUSE 1000
    GOTO MAIN

    DISPLAY_LCD:
    lcdout $fe,$80, "SENSOR ",dec3 t
    lcdout $FE,$C0, "TEMPRATURE: ", DEC TEMP, 223, " C" 'ASCII 223 is DEGREE SYMBOL
    RETURN

    DISPLAY_HOT:
    lcdout $fe,$80, "SENSOR ",dec3 t
    lcdout $FE,$C0, "HOLY COW IS IT HOT IN HERE OR WHAT?"
    RETURN

    DATA @ 26, -20, -19...

    END

    Last, I think I'd double check my negative values to make sure they display correctly, then determine how to fix them.

  3. #3
    Join Date
    Mar 2014
    Location
    Pakistan
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: Thermistor based temprature reading short code required

    thankyou,amaque, i m really greatful to u

Similar Threads

  1. Reading temperature using multi DS18B20
    By KVLV in forum Code Examples
    Replies: 16
    Last Post: - 3rd November 2017, 20:48
  2. NTC thermistor temperature monitering
    By Divinci in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 15th December 2012, 01:54
  3. NTC thermistor temperature sensing
    By pxidr84 in forum mel PIC BASIC Pro
    Replies: 36
    Last Post: - 16th January 2011, 09:56
  4. help required regarding reading binary files
    By shaiqbashir in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th March 2008, 23:30
  5. Sensor reading Program Help Required
    By shaiqbashir in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 3rd May 2006, 17:05

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