The verbal description of this program is this:
- Configure the display
- Read the temperature from the LM34
- Display the temperature on the LED display
- If the temperature set point is below the current temp, then perform a PWM command and turn on the Peltier device. The amount of drive is proportional to the error between the set point and current temp.
- If the temperature set point is above the current temp, then turn the PWM off.
- If at any point, the temperature set point button is pressed, flash the set point LED and enter the set temp mode. Read the temperature set point from the potentiometer. Press and release the button quickly to exit the set temp mode.
- Keep looping.
Some points within the program that may not be so obvious. First, when we read the temperature from the LM34, the picaxe reads the analog voltage and converts it to a digital value with ten bits of resolution. This means that the value has 2^10 or 1024 divisions. The digital value can then be calculated back into a voltage in mV within our program. The ADC is converting based on a 5V range, or 5000 mV. This means that a digital value of 0 is equal to 0 mV and a digital value of 1024 is equal to 5000 mV. Taking this further, each digital division is equivalent to 5000/1024, or 4.88 mV. By the way, 4.88 mV is the same as 0.488 deg F, so the resolution of our program is ~0.5 deg F. You can see from the program that when we mulitply the digital value by 4.88, we will in essence be calculating the temperature in deg F mulitplied by ten. Since the temperature is read in tens of millivolts, the actual whole number value of the temperature can be read once we divide TE_Temp_10 by 10.I will update this discussion of my code at a later time, hopefully the code will speak for itself. Enjoy!
