Panteltje's hcs_pic page
Panteltje's hcs_pic page
~
Here you find the listing for a PIC 16F690 to function as a temperature controller with RS232 interface: hcs-0.2.asm
I have written a small temperature controller for PIC16F690
It uses 2 LM135 or similar Kelvin sensors, one for inside temperature, and one for outside temperature.
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,
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
GnnnENTER sets clock calibration, timer1 reload low byte, use 175 for nominal, is saved in EEPROM
g displays clock calibration (timer1 reload low byte)
I calibrate inside temp sensor, use 17 as default, 16 is one degree Celsius higher, 18 one lower, value is saved in EEPROM
i print inside calibration value
O calibrate outside temp sensor, use 17 as default, 16 is one degree Celsius higher, 18 one lower, value is saved in EEPROM
o print outside calibration value
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 minute, this is the default.
The above commands exit the control loop (control loop is on by default on power on).
H starts control loop (again).
At first power up (directly after programming) the EEPROM is set with the default values for I(17), O(17), G(175), and t(21).
Very precise control of room temperature is achieved by doing a 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.
Code is for gpasm (part of gputils), may need some modification for MPLAB.
Click here for some other programs I make available under the GPL.