Getting started: Thermistor and LM34
It has been years since I played with my Basic Stamp 2, but I have a project it would be perfect for and I need some help getting started.
The project will involve monitoring the temperature of both water (30deg F - 40deg F) and air (40deg F to 110deg F).
I have ordered some LM34s but as I'm waiting for delivery, I found some Radio Shack 10k-Ohm Thermistors 271-110A.
My research of the site has lead me to http://www.parallax.com/Portals/0/Downloads/appnt/stamps/bs1Appnotes.pdf page 33 (using a thermistor) and I wanted to give it a go.
I loaded the code into the editor, but I get a syntax error
"Expected ':' or end-of-line"
at this point
"Symbol co0 = 162"
I'm guessing this has to do with this code being for a BS1 and not a BS2, but I'm having trouble figuring out what is causing it.
Thanks in advance for the help.
JM
The project will involve monitoring the temperature of both water (30deg F - 40deg F) and air (40deg F to 110deg F).
I have ordered some LM34s but as I'm waiting for delivery, I found some Radio Shack 10k-Ohm Thermistors 271-110A.
My research of the site has lead me to http://www.parallax.com/Portals/0/Downloads/appnt/stamps/bs1Appnotes.pdf page 33 (using a thermistor) and I wanted to give it a go.
I loaded the code into the editor, but I get a syntax error
"Expected ':' or end-of-line"
at this point
"Symbol co0 = 162"
I'm guessing this has to do with this code being for a BS1 and not a BS2, but I'm having trouble figuring out what is causing it.
Thanks in advance for the help.
JM

Comments
I removed the keyword Symbol but I get the same error.
and found the [ code ] [ / code ] tags
http://forums.parallax.com/misc.php?do=bbcode#code
I got the code to output some data to the debug window by adding 'DEBUG DEC W0' the DEC was missing.
Now all I get are 000000 in the window.
Any thoughts on how to figure out what is going on?
' {$STAMP BS2} ' {$PBASIC 2.0} ' Program THERM.BAS ' This program reads a thermistor with the BASIC ' pot command, computes the temperature using a ' power-series polynomial equation, and reports ' the result to a host PC via the Stamp cable ' using the debug command. ' Symbol constants represent factored portions of ' the coefficients C0, C1, and C2. "Top" and "btm" ' refer to the values' positions in the fractions; ' on top as a multiplier or on the bottom as a ' divisor. co0 VAR Word co0 = 162 co1top VAR Word co1top = 255 co1btm VAR Word co1btm = 2125 co2bt1 VAR Word co2bt1 = 25 co2top VAR Word co2top = 3 co2btm VAR Word co2btm = 50 ' Program loop. Check_temp: RCTIME 1,46,W0 ' 46 is the scale factor. ' Remember that Stamp math is computed left to ' right--no parentheses, no precedence of ' operators. W1 = W0*W0/co2bt1*co2top/co2btm W0 = W0*co1top/co1btm+W0 W0 = co0+W1-W0 'DEBUG W0 PAUSE 1000 DEBUG DEC W0 PAUSE 1000 ' Wait 1 second for next GOTO Check_temp ' temperature reading.I'm a bit confused on what wiring to use, and then there is the math to convert the output to temp....
I could use a good example that someone knows works on the BS2.