Symbol AD = b2 'data returned by A/D command Symbol OPT = b3 'MUX/option switch settings Symbol C = b4 'temperature in degres C Symbol F = w4 'temperature in degrees F 'I made F a WORD variable to allow for larger numbers in the math Symbol TF = bit0 'temperature flag 1=minus degrees 0=positive degrees Symbol DEL = 2 'Overshoot temperature abount to prevent chattering Symbol ST = b7 'variable holding temperature setpoint Symbol OS = b0 'variable holding overshoot temperature ;333333333333333333333333333333333333333333333333333333333333333333333333 ;3 3 ;3 TEMPERATURE CONTROLLER with 5 PRESETS 3 ;3 3 ;333333333333333333333333333333333333333333333333333333333333333333333333 MON: Gosub MUX Lookup OPT,(38,85,99,110,145),ST ' ST=38 for minimum heat in shop/shack when used for an extended low range thermostat ' ST=85 for quartz crystal oven temperature for stabalizing crystal oscillators ' ST=99 for incubation temperature of chicken eggs ' ST=110 for optimum bath temp for pcb etchant ' ST=156 for melting point for Wood's Metal OS = ST + DEL CNTNU:Gosub TEMP 'get the temperature If TF=1 then HEAT 'temperature is minus go apply some heat... If F127 then BLO0 'temperature below 0? TF=0 'clear TempFlag bit for + temperatures Goto CNVRT BLO0: C=C-128 'strip minus sign flag (bit7) TF=1 'set TempFlag bit for - temperatures CNVRT:F = 9 * C/5 +32 'turn it into Deg.F Return 'we are done here... ; ;MUX SWITCH INPUT ; This subroutine reads an analog voltage on logical pin 2. ; The 4 MUX DIP switches are used to create an analog voltage ; based on which switch is closed. Each switch controls a weighted ; resistor to create 4 unique voltage readings for the 4 switches. ; The max reading is 255 (8 bits) so dividing the reading by 52 ; will produce a whole number between 0 and 4 based on which switch ; is closed... MUX: ReadADC 2,AD 'read the MUXed switch voltage (8 bits) OPT = AD/52 'normalize it to 5 readings Return 'we are done!