Panteltje's temp_pic page
Panteltje's temp_pic page
~
Here you find the asm source code for a Microchip PIC 12F629 program to measure temperature, without using any external parts.
This source was assembled with gpasm-0.13.5 beta, may not work with mplab.
The PIC measures temperature by counting the frequency of the watchdog timer oscillator, see Microchip application note AN720 for an explanation.
The PIC sends the temperature in degrees C via RS232 on pin 5, with 9600 Baud, 1 start bit 8 data bits, 1 stop bit.
There is a programmable temperature alarm level, when this level is exceeded, pin 2, normally tri-state, will go high.
You can use this to OR several of these PIC temp sensors together to for example shutdown a power supply in case of over-temperature.
You can also configure it to drive the ouput hard low and high, making it possible to directly drive a power MOSFET.
Click here to download temp_pic-0.7.4.asm
An example how to use the PIC as a temp probe, diagram, only 3 parts!!!:
Here is the test setup, the PIC and its decoupling capacitor will need to be made as low a thermal mass as possible so it reacts fast:
Here is an example how to use the RS232 output in Linux to start some program, say switch a heater via a script, using the awk program to parse the output.
You can replace the argument to the system() calls by something you want to do if temperature is lower or higher then a specified value.