upper and lower temperatures have been entered. If both flags are set; that is, if both temperatures have been entered, we can establish the calibration equation. Then we can display temperature instead of cycle times. We will adhere to using the same keys as for Listing 10-6; Alt-X to quit the program, up arrow to enter an upper temperature, and down arrow to enter a lower temperature.
Temperature |
HiCount - LoCount |
|
HiTemp |
|
HiTemp - LoTemp
Temp
LoTemp
LoCount |
i |
HiCount |
Period in Counts |
Figure 10-7 Typical curve - Thermistor circuit/VCO output (calibration).
The program steps can be listed as follows:
1.Initialise a counter to zero.
2.Repeatedly check the signal level until a change is detected.
3.Repeatedly check the signal level until the second change is detected while incrementing the counter after each read.
4.Repeatedly check the signal level until the third change is detected while incrementing the counter after each read.
5.Check if the calibration temperature for upper temperature and lower temperature has been entered (respective flags are both set).
If they are both entered, use the calibration equation and display the temperature, else display the cycle time.
6.Check if a key has been pressed. If no key has been pressed return to step 1.
7.If the pressed key is Alt-X, exit the program.
8.If the up arrow key is pressed, read upper temperature. Return to step 1.
9.If the down arrow key is pressed, read lower temperature. Return to step 1.
Some of these steps can be expanded further as shown below:
8.1Ask user to enter the upper temperature and store value entered.
8.2Store the cycle time.
8.3Set the flag confirming the upper calibration temperature has been read.