ftp://panteltje.com/pub/hcs.asm
I have written a small temperature controller for PIC16F690 It uses LM135 or similar Kelvin sensors. It is quite universal as it also displays voltage. It has a real time clock (as long as it has power), runs from the PIC internal 8MHz oscillator, and seems quite accurate, flipped over to 2008:
23:50 outside 558 2757mV 2C inside 595 2940mV 21C
23:51 outside 558 2757mV 2C inside 594 2935mV 20C
23:52 outside 557 2752mV 2C inside 594 2935mV 20C
23:53 outside 557 2752mV 2C inside 595 2940mV 21C
23:54 outside 558 2757mV 2C inside 594 2935mV 20C
23:55 outside 557 2752mV 2C inside 594 2935mV 20C
23:56 outside 557 2752mV 2C inside 595 2940mV 21C
23:57 outside 557 2752mV 2C inside 594 2935mV 20C
23:58 outside 557 2752mV 2C inside 594 2935mV 20C
23:59 outside 557 2752mV 2C inside 594 2935mV 20C
0:0 outside 557 2752mV 2C inside 595 2940mV 21C
0:1 outside 557 2752mV 2C inside 594 2935mV 20C
0:2 outside 558 2757mV 2C inside 594 2935mV 20C
0:3 outside 557 2752mV 2C inside 595 2940mV 21C
0:4 outside 558 2757mV 2C inside 594 2935mV 20C
For you Americans, 0 Celsius is freezing, it is cold outside here.
The soft has a serial 19200 Baud, 8 bits no parity interface, and accepts the following commands:
unnENTER sets hour mnnENTER sets minute tnnnENTER sets temperature set point in Celsius, is saved in EEPROM annENTER displays AD channel nn count vnnENTER displays AD channel nn converted to voltage cnnENTER displays AD channel nn converted to Celsius s displays temp set point The above commands exit the control loop (control loop is on by default on power on).
H starts control loop (again) h help message tells you to read README, there is no README yet :-) F loops as fast as ADC can be read (for test). f ADC is read once per second, this is the default.
Very precise control of room temperature is achieved by doing an test against set point every 60 seconds, this is ONLY intended to switch an electric heater (via a triac optocoupler), probably too fast for something that runs on oil or gas.
There is a LED output 'frost alarm' (so you can tap the water if needed).
This control is a bit more pleasant then the normal bi-metal thermostats in the electric heaters, those have an hysteresis of several degrees C, this less then one. I have enabled 2 analog channels here only, AN5 and AN7. If you need more analog inputs you need to set the related bits in TRISA / TRISB / TRISC, and ANSEL and ANSELH (about line 902 in the code). There are too many banksel instructions, and I likely forgot some. The math is done in integer, the floating point lib (copyright Microchip) is defined out.
ASM file is here: ftp://panteltje.com/pub/hcs.asm This was actually just a programming test for the 16F690, as I need the routines for some other project, but may be of interest to some.
Happy new year.