C H A P T E R A
80 | REM | * * * * | * | * * * | * | * * * * * STEIN1 * * * * * * * * * * * * * * * |
90 | REM |
|
|
|
|
|
92 | REM | Rev: | 3 | 11 87 |
|
|
94 | REM | T is | expressed | in Kelvins. |
100 | REM | Least squares | fit program | to find the thermistor coefficients |
110 | REM | C1 and C2 in the following equation: | ||
120 | REM |
|
|
|
130 | REM | 1/T | = C1 + C2 * | (ln R) |
140REM
200REM
210REM Variables:
220REM
230 | REM | T[i], R[i] | temperature and resistance data values. | |||
240 | REM |
|
|
|
| |
250 | REM | Y[i] = 1/T[i] | the dependent variable (depends on R[i]) | |||
260 | REM |
|
| in the Steinhart | Hart equation (above). | |
270 | REM |
|
|
|
| |
280 | REM | X[i] = ln(R[I]) | the value of the ith function of the independent | |||
290 | REM |
|
| variable ln(R) (natural log of resistance) | ||
330 | REM |
|
|
|
| |
1000 | DEFDBL A Z |
|
|
| ||
1010 | DEFINT I, J, K, L |
|
| |||
1020 | DIM R[400], T[400], Y[400], X[400] |
| ||||
1030 | PRINT "What is the data file name"; : INPUT D$ | |||||
1040 | OPEN "i", 1, D$ |
|
| |||
1050 | REM | **** read and echo T(i), R(i) from the data file **** | ||||
1060 | REM |
| (terminate read on R= 1) | |||
1070 | I=0 |
|
|
|
| |
1080 | PRINT "Data:" |
|
|
| ||
1090 | G$="Point | Temperature (Celsius) | Resistance (ohms)" | |||
1100 | H$=" ### | #####.## | ########.##" | |||
1110 | PRINT G$ |
|
|
| ||
1120 |
|
|
|
| ||
1130 | I=I+1 |
|
|
|
| |
1140 | INPUT #1, T(I), R(I) |
|
| |||
1150 | IF R(I)<0 THEN GOTO | 1180 |
|
30