Is getting a steady result from Analogin possible?
I decided to try a different route with the temperature sensor and test the resistance between both leads of the sensor using the ANALOGIN command. If there is a better approach to reading the resistance, please let me know! Right now, I cannot get a steady reading and I am wondering what I can do to stabilize it. Currently, the readings are jumping between 57 and 61 within 1 second. At 70°, the resistance of the sensor is roughly 20K. For hotter temps, the resistance goes up. I am wanting to take that value and convert the ANALOGIN results to display the temperature on 3 7 segment displays. I have RC.0 and RC.1 wired like the ANALOGIN example but I changed the 10k to a 100k which seemed to give a wider range and the cap is a .001uf.

Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Shawn Lowe
When all else fails.....procrastinate!
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"The welfare of the people in particular has always been the alibi of tyrants." ~ Camus
www.iElectronicDesigns.com
·
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"The welfare of the people in particular has always been the alibi of tyrants." ~ Camus
www.iElectronicDesigns.com
·
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"The welfare of the people in particular has always been the alibi of tyrants." ~ Camus
www.iElectronicDesigns.com
·
here is my code :
DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX FREQ 4_000_000 ID "Temp" InPin PIN RC.0 DigCtrl PIN RA Segs PIN RB MaxDigit CON 4 a VAR Word digPntr VAR Byte display VAR Byte(MaxDigit) digit VAR WORD digit1 VAR WORD tmpB1 VAR Byte tmpB2 VAR Byte tmpB3 VAR Byte tmpB4 VAR Byte INTERRUPT 200 ISR_Start: Next_Digit: INC digPntr ' point to next digit IF digPntr = MaxDigit THEN ' check pointer digPntr = 0 ' wrap if needed ENDIF Update_Segs: Segs = %00000000 ' blank segments READ DigMap + digPntr, DigCtrl ' update digit control Segs = display(digPntr) ' output new segments ISR_Exit: RETURNINT PROGRAM Start Start: DigCtrl = %1111 ' disable all digits TRIS_A = %0000 ' make dig pins outputs TRIS_B = %00000000 Segs = %00000000 Main: HIGH InPin ' charge capacitor PAUSEUS 250 ' for 250 usecs RCTIME InPin, 1, a ' read pot (2 us units) tmpB2 = a_LSB / 100 ' get hundreds digit tmpB1 = __REMAINDER ' save 10's and 1's READ SegMap + tmpB2, display(2) ' get segment map 100's tmpB2 = tmpB1 / 10 ' get 10's digit tmpB1 = __REMAINDER ' save 1's READ SegMap + tmpB2, display(1) ' get segment map for 10's READ SegMap + tmpB1, display(0) ' get segment map for 1's GOTO Main SegMap: ' segments maps DATA %00111111 ' 0 DATA %00000110 ' 1 DATA %01011011 ' 2 DATA %01001111 ' 3 DATA %01100110 ' 4 DATA %01101101 ' 5 DATA %01111101 ' 6 DATA %00000111 ' 7 DATA %01111111 ' 8 DATA %01100111 ' 9 DigMap: ' digit select map DATA %11111110 DATA %11111101 DATA %11111011 DATA %11110111Why not just use a digital temperature sensor ? Like the DS1620, these return the temperature directly in digital format.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"The welfare of the people in particular has always been the alibi of tyrants." ~ Camus
www.iElectronicDesigns.com
·
Post Edit -- A current regulator/source, which can be made from·components·available from RS (a resistor and an LM317 or a 7805, or a transistor and a couple of resistors), would be beneficial but not essential.· Noise, poor regulation, questionable construction and so on·will result in shakey readings [noparse][[/noparse]G-I-G-O].·
Post Edited (PJ Allen) : 12/21/2008 6:49:12 PM GMT
This may be time consuming but I got around a similar situation by building a cross-reference table. I compared what my test thermometer said to what a lab thermometer said and entered the readings in a table. When reading the temp. it would get the info. from the table and display it. If you gather readings in cold temp, warm temp. and· hot temp. Enter the lab Thermometers reading in a table. When you see how the curve behaves it is fairly easy to fill in the gaps in the missing areas. When it was done it was very reliable. There are mathematical formulas that you can use but this way it is customized to you particular part. Also, I'm not a good programmer to work the formula into a routine. A cross-reference table is the way that worked best for me.
Hope this helps,
Jim W.
For instance http://www.ecircuitcenter.com/Circuits/therm_ckt1/therm_ckt1.htm is a good starting point.
There is also an article here:
http://www.science-logic.net/renneberg-lehmann-ecctd07.pdf
Massimo
--- assuming the reading is returned in a byte, add them up to a word value
>> mov loop_value 256
>> get_reading
>> add your_answer to low_byte
>> if no carry, skip the next line
>> inc high_byte
>> dec loop_value and if not zero jump back up to get_reading
your high_byte is now the average of 256 readings.· no actual division is required.· the low_byte is ignored. your answer will still not be rock-steady: ·my thermometer changes every thirty seconds or so, but never jumps two degrees.· your·display will be very much closer to what you were expecting.
tommy
·