//REV38.2 //cc 09-26-2014 add digital input range OFF/ON //cc 09-26-2014 add flash infomation for the hex file checking //REV38.1 //cc 08-11-2014 modify product infomation in flash_info.c //cc 11-28-2013 fixed Iterm summary error when go to coasting mode //cc 10-30-2013 modify Transducer mode, add transducer option to analog output function register // and if in transducer mode, extend input option, add AI1 to AI8, hum and co2 option //CC 10-16-2013 fixed relay reverse problem //CC 05-04-2013 use AI1 instead of AI0, then calculate temperature and filted, not direct translate to temperature. //REV 38.0 //cc 05-03-2013 //below is the changing for Jeff project //1. USE the "external temp sensor" for temperature readings, NOT the internal one. (we will attach a temp sensor to the "TEMP" connector and this is the temperature we want displayed and the one we want to use for the setpoint control) // - IF NO external sensor is connectedĄ­ please display "000" on the display. // - The internal sensor can be ignored. //2. When RELAY 1 is ON, please turn on the "COOL" indicator on the display. //3. When RELAY 2 is ON, please turn on the "FAN" indicator on the display. //REV 37.9 //cc 07-29-2014 add digital input range OFF/ON //cc 01-28-2013 changed interlock function for free cool function //cc 01-19-2013 rewrite run_special_function routine so can add new input function more easier. //cc 01-19-2013 fixed read_input_routine bug: when set output to manual mode, it will get internal thermister to manual too. //cc 01-07-2013 change free cooling //REV 37.8 //cc 09-19-2012 fixed PID2 analog output problem, variable "temp" in control logic routine has wrong define type, -- //--the PID2 valve table address is more than 255, so it will load a wrong value, which cause analog output go wrong //cc 09-18-2012 Note: this is only for Tstat5G, which has different hardware analog inout with other Tstat5 LED type, -- //-- fixed analog input1 and 2 exchange problem. //REV 37.7 //cc 09-13-2012 add universal output off table //cc 09-13-2012 fixed formular error when calculate setpoint in 6-button mode //REV 37.6 //Added shutdown interlock for all outputs and each input can be set as shutdown interlock //REV 37.5 //cc 05-04-2012 deleted new_read_eeprom() and replaced it with original read_eeprom(); //cc 11-25-2011 //add eeprom read/write check routine, when read eeprom, read twice and compare the result to avoid interrupt error; //when write eeprom, read it first and compare with target value, write only if changed. //MHF 11-25-2011 //Read E2 routine,when ever read ,will send full command to E2,from start signal,device address,data address //Short code in serial interrupt //Add stop signal in give_pic_ack routine in PIC.c //REV 37.4 //CC 11-22-2011 //Add deadmaster for each output //REV 37.3 //MHF 08-12-2011 The second bit of register 121 show the default temperature units setting. //REV 37.2 //MHF 28-09-2011 Add timer left for relay active delay //Rev37.1 //cc 05-22-2012 fixed relay reverse bug when change product model on manual mode. //REV 37.0 //MHF 1-09-2011 Fixed input get wrong value in manual mode bug //REV 36.9 //MHF 31-08-2011 Fixed delay ON to OFF and OFF to ON reversed bug //REV 36.8 //MHF 30-08-2011 Fixed analog input1 and analog input2 show wrong value in manual mode bug //REV 36.7 //MHF 16-08-2011 Restore multiple write as before //REV 36.6 //MHF 19-08-2011 Add a bit3 in register 309 to configure internal sensor in auto/manual mode //REV 36.5 //MHF 12-08-2011 Fixed restore data tofactory bug,there is bug when do restore data in degree F //REV 36.4 //MHF 1-08-2011 Put all relay output in one routines //REV 36.3 //MHF 17-12-2010 Add a new register to store real cooling setpoint //Fixed a bug can not restore parameters to user confiuration //REV 36.2 07-04-2011 BY CHARLEY disable ALE pin to reduce EMI //MHF 25-09-2010 Bit5 of register 184 used for serial port respond delay,0 = 2.5ms delay;1 = 10ms delay. // Bit6 of register 184 (base bit is 0)used for write device ID disable/enable.0 = enable // 1 = disable,can not change deice ID ,defualt is enable. //REV 36.1 //MHF 26-05-2010 Changed the minimum modbus address from 0 to 1,to limit the address not be 0 //REV 36.0 //MHF 16-04-2010 Clear iterm_sum in unoccupied mode //REV 35.9 //MHF 25-03-2010 Fixed HEAT1,HEAT2,HEAT3 not display problem,set this in led table. //REV 35.8 //MHF 02-03-2010 Each inputs be configed as tempature will has a status to show the sensor short or open //REV 35.7 //MHF 08-04-2009 The pterm is not related to deadband;CHange the change over mode same as ver 29.8 //REV 35.6 //MHF 06-09-2009 Display == 2,still need display setpoint and fan speed setting //REV 35.5 //MHF 03-30-2009 Get rid of trigering relay by PWM for 5G //MHF 05-30-2009 Fixed item2 for Display register(203),2 = blank the display except status LED //REV 35.4 //MHF 03-16-2009 Added inputs and outputs will be switch to auto mode in dead master time no communication between PC and tstat. //REV 35.3 //MHF 02-12-2009 Fixed floating valve control .Get rid of timer2 use emulator timer instead. //REV 35.2 //MHF 11-26-2008 Add limitation for write address,0 and 255 not allowed //REV 35.1 //MHF 11-18-2008 Change changeover sensor mode as an item of interlock,aaded a register to show current changeover sensor status //REV 35.0 //MHF 10-18-2008 Chanegd min free cool air output from 5% to 0% //REV 34.9 //MHF 09-23-2008 Added a register 374 to set 0.1 resolution setpoint,use this register instead of 135 since this version // Changed the way read/write value for hottest outside air,coldest air,hottest offset,coldest offsrt. // Write the value should plus 127,read the value should minus 127. //REV 34.8 //MHF 09-02-2008 Added free cooling and setpoint increse/decrease following outside temperature //REV 34.7 //MHF 08-21-2008 Added lock register 358.0 = lock,1 = no lock. //REV 34.6 //MHF 08-21-2008 Fixed serial number bug,changed serial number FLAG position in E2. //REV 34.5 //MHF 08-15-2008 Get floating feature back,delete it before because of code room problem, //REV 34.4 //MHF 08-01-2008 Add OFF table for analog output,the default for all stages is OFF(0V). //REV 34.3 //MHF 07-28-2008 Fixed interlock logic when set DI1 as interlock,reversed the logic. //REV 34.2 //MHF 07-09-2008 Fixed output logic when digital input set as interlock //REV 34.1 //MHF 05-23-2008 Fixed a bug regarding cooling stages more than 3.caculate current mode in a wrong logic when intend mode is cooling4 // Fixded LED dispaly.Before the default mode stage number is 3 for cooling and heating.It should be variable. // Fixed pid2 setpoint and value display,added decimal point. //REV 34.0 //MHF 05-21-2008 Added PWM output in pid2 mode //REV 33.9 //MHF 01-31-2008 Fixed PWM bug.Fixed occupancy mode for digital input1. // //REV 33.8 //MHF 01-29-2008 Fixed PWM bug. // //REV 33.7 //MHF 01-28-2008 Fixed PWM feature,only OUT4 and OUT5 can be set PWM output,user need assign the corresponding output as PWM // at range column of Outputs in T3000.There are for ranges canbe selected,0 = close,1 = open,2= 0-100%,3= 50-100% // 4 = 0-50%.Still use register 341 through 347 correspond to coasting stage,cooling1 ,cooling2...and the Msb4 bits correspong to // out4 range and LSB 4 bits correspong to out5 range. //REV 33.6 //MHF 12-25-2007 Fixed PWM feature,all outputs can be set PWM output and each stage has a fixed percent for all output //REV 33.5 //MHF 12-18-2007 Added a PWM feature,out4 and out5 can be set PWM output,added registetr 341 through 347 to assign each // stage out percetage,but the prolem is that the two outputs always have the same output.Never release this version. //REV 33.4 //MHF 11-23-2007 Get rid of 1 minute delay used for delay occupancy sensor trigger period. // Use fan speed AUTO instead of OFF when the previous fan speed mode is OFF,to make sure the tstat goes to on // when a trigger event come from occupancy sensor. // Fixed the bug regard with auto/manual features for output and input. //REV 33.3 //MHF 11-15-2007 Added ION LX feature for Mark Hunter,each relay controled by correspond button. //REV 33.2 //MHF 09-28-2007 Stopping look up not used register 105,113,116,117,130 to save time. // Get rid of a 5ms delay before response for all registers. //REV 33.1 //MHF 08-29-2007 Make sure the Tstat not go to OFF mode when power on. // The Tstat will not response any event from occupancy sensor in one minute after the Tstat has responsed one time. // Get rid of keypad lock when the value of default control register is bigger than 0 //REV 33.0 //MHF 08-24-2007 Fixed override timer routine to make the timer accurate // The POF total control override timer. // Fixed serial receive routine to solve communication stuck problem. //REV 32.9 //MHF 08-22-2007 Fixed the bug that the display switch frequently between tmep and PON/POF . // FIxed the tstat can not go to unoccupied mode after the override timer timeout. // Added a new register 340 for pir status.0 = pid disable,1 = enable pir. //REV 32.8 //MHF 08-15-2007 Changed the PON and POF as LON and LOF on the LED display for AUX button // Added the PON and POF on the LED display for PIR button // Fixed the code related to PIR function //REV 32.7 //MHF 08-09-2007 Changed the version number as 32.7 //REV 32.6 //MHF 08-07-2007 Added PON and POF on the LED display for PIR feature //MHF 07-23-2007 Added default setpoint feature,added two register .One for default setpoint and another for setpoint control. //REV 32.5 //MHF 07-23-2007 Fixed interlock timer bug,The timer_flag should be set according to interlock set up. //REV 32.4 //MHF 07-20-2007 Fixed the bug the relay with interlock will turn off after change the detpoint via serial port //REV 32.3 //MHF 07-18-2007 Fixed factory default ,now read data from flash when write 143 to register16. // Keep the c/f degree after write 143 to register 16,before fixed degree c. // Added a new keypad mode 6C for tstat with six buttons //REV 32.2 //MHF 07-04-2007 Fixed the temp flickering bug // Fixed the bug the tstat is unusable after loaded configuration file // Use gridpoint's output table as default output table after updated new firmware //REV 32.1 //MHF 07-03-2007 I Fixed the pid math to resolve the flick bug. //REV 31.9 //MHF 06-13-2007 Fixed the initilization when HC mode is keypad. //REV 31.8 //MHF 06-12-2007 Fixed timer interlock //REV 31.7 //MHF 06-06-2007 Get rid of the limitation for cooling deadband and heating deadband. //REV 31.6 //MHF 05-24-2007 The tstat will take effect after the button be released // Fixed the bug the menu still on even do not operate it in 5 seconds // The hold LED will turn on you press the up and down temp button simultaneously 5 seconds. // Added a timer for interlock output.Please configure the following registers before you use this feature. //REV 31.5 //MHF 05-15-2007 Delay the button take effect after be pressed // Short the time enter or and exit HOLD mode // Make sure the HOLD mode take effect after the button be released //REV 31.4 //MHF 04-29-2007 Fixed issues about C/F converting //REV 31.3 //MHF 04-25-2007 Fixed the setpoint bug when change the C to F or back. // Keep the SOP and C/F same with configuration file when the users go to FAC at keypad. //REV 31.2 //MHF 04-10-2007 Keep the value of UTIL register when change C to F or back. //REV 31.1 //MHF 04-06-2007 Added a limitation to make sure the tstat not go to EMER mode when register 118 = 3. // Changed the e2 chip read routine and serial port communication routine for fixing the read error bug. //REV 31.0 //MHF 04-05-2007 Fixed e2 chip read routine //REV 30.9 //MHF 04-03-2007 Fixed nothing except version number,Checked a new version number will erase E2 chip. //REV 30.8 //MHF 03-29-2007 Fixed the two configuration files not match between before load and after loaded //REV 30.7 //MHF 03-28-2007 Fixed bug that registet 310 can not show the right value. // Fixed the bug the cool and heat mode can not switch if be changed from serail port. //REV 30.6 //MHF 03-26-2007 The SOP has only two values can be selected,1 and 3. // The register 321 and 322 can be write and read,before the wo register are read only. // Added a new register 326 for e2 chip type,0 = old and small e2 chip,1 = new and big e2 chip. //REV 30.4 //MHF 03-20-2007 Added two register for address limitation for gridpoint,Added sop == 3 item to use two config //REV 30.3 //MHF 03-19-2007 Fixed the C/F converter bug. //REV 30.2 //MHF 03-16-2007 Fixed the bugs about util can not read by serial port,hold can not exit from kepad //REV 30.1 //MHF 03-14-2007 Added FAC item in the gridpoint menu.deleted two register 321 and 322 used in util mode. // Added a register 323 for hold mode,write and read.Fixed a bug in mode transition. //REV 30.0 //MHF 03-14-2007 Added advanced menu for grispoint.added util mode and hold mode. //REV 29.9 //MHF 03-08-2007 Fixed the mode register 106 to show coasting when the mode be set OFF by using keypad //REV 29.8 //MHF 03-07-2007 Added two register 321 322 to show fan mode and work mode;fixed the LED to show the work mode // immediately when the user adjut the mode using button //REV 29.7 //MHF 06-22-2007 Add a new keypad mode 2C,in 2C mode, only the lower two buttons be used as // adjust setpoint //REV 29.6 //MHF 06-06-2007 Get rid of the limitation for cooling deadband and heating deadband //REV 29.5 //MHF 02-28-2007 Fixed the min and max address register address,fixed the button function,fixed the write and read routin for e2 chip 24c08 //REV 29.4 //MHF 02-01-2007 Fixed the pid arithmetic.The coasting is not as a stage number when caculte pid's switching point // just use cooling stage number plus heating stage number to caculte switching point. // Fixed the analog output state to corespond to the T3000.the analog output 0-100% = 2, // 50 - 100% = 3 ,100% = 1. //REV 29.3 //MHF 02-01-2007 Clear the MSB 4 bits of register 184; Fixed the formula caculating the cooling stage value //REV 29.2 //MHF 01-30-2007 Make sure the cooling deadband and heating deadband less than the cooling_pterm/2. //REV 29.1 //MHF 01-26-2007 Fixed the PI's algorithm //REV 29.0 //MHF 01-19-2007 Added a new range OFF/ON for each input.Fixed the part use DI1 for interlock // In auomode,the register 311 will show the state of DI1 //REV 28.9 //MHF 12-20-2006 In occupied mode,the tstat will go to unocuupied mode after the duration override timer time // if the occupancy sensor input changed.The tstat also go to unoccupied mode after the duration when power up and // the fan speed bigger than zero. //REV 28.8 //MHF 12-09-2006 Fixed the occupied bit make sure the bit can show the right status. //REV 28.7 //MHF 12-05-2006 Fixed occupency sensor mode.In office mode,the tstat will go to occupied mode when the input changing //MHF 11-30-2006 Changed the resolution of valve travel time from 0.1 second to 1 second. //MHF 11-30-2006 Added the averaging sensor feature. A new function setting for a temperature sensor input, it // can be assigned to average with the internal sensor and external sensor then feed back to the PID. //REV 28.6 //MHF 11-21-2006 Delay the tomeout for serila port receive and reset the watch dog when reply mutiple write // //MHF 11-21-2006 Added three functions for analog1,2 input,move the function in register 190 to register 300. // the register 190 only use for digital range.Expanded the digital input function in menu and the parameter // be stored into register 300. //REV 28.5 //MHF 11-07-2006 added a 10 second delay when the mode of operation is decreased //REV 28.4 //MHF 10-26-2006 Initilize the pidoutput array to determine the digital output controlled by which output table. //REV 28.3 //MHF 10-25-2006 Fixed PID2 bug.Can not get the right pid to control the output when the user select min and max funtion in pid control //MHF 09-30-2006 Adjust the involatile data structure because the data has extended the size of E2 chip //REV 28.2 //MHF 09-26-2006 Fixed the pid bug .The Pid will get wrong value as temperature nearby setpoint if set the cool statge equals to zero //REV 28.1 //MHF 09-15-2006 Fixed the code of PID2 part.the PID2 also can work if the range of corresponding inputs is 10K thermistor . // Before the PID2 work only when the range of inputs is customer sensor. //rev28.1 Added sendZero() routine to reduce code space, used by several routines. //REV 28.0 //MHF 08-23-2006 Added register 317 to store the value which determine how long time the Tstat will go occupied mode // after power on and see no serial communication.The value range of the registeris 0 to 255 and the units is minute. // If 0 is assigne din the register means that disable dead mater feature. //MHF 08-28-2006 Added register 318 for rounding display.There are three possible settings. 0 means round off the display to the neares digit. // 1 means round to the nearest 1/10 unit, this is the default;5 means round to the nearest 1/2 unit. //MHF 08-29-2006 Fixed keypad press counter feature.Counting up the value of register 294 from 1 instead of from 0 after any combination of // keys is pressed twice. // //REV 27.9 //MHF 6-25-2006 Added config tool feature.The tstat will transfer the configuration itself to another tstat by pressing // the lower right button.we realized this feature by a define predefine comamnd.So if the user need this // feature ,they have to tell us before we programm tstat. //MHF 7-12-2006 Fixed the keypad 2A mode.Before the user hit the button only one time the tstat will from unoccuipied mode // to occupied mode. And the fan speed also from OFF to AUTO.Later we fixed that,from unoccupied mode to // occpied mode,the user can ajust the fan speed but not just fixed AUTO mode.But this conflict with keypad mode // 2A,because 2A mode can not change the fan speed.So now at 2A mode.From unocucpied mode to occupied mode,the // fan speed is fixed AUTO.At others keypad mode,from unoccupied mode to occupied mode ,the user can changre the // fan speed. //MHF 07-24-2006 Added five register to operate relays when the corresond relay is set to manu mode. // 1,open the relay;0,close the relay. //MHF 07-26-2006 Added a register 15 to select the base address.0,Protocol Address.1,PLC Address //MHF 08-17-2006 Fixed a bug that the Tstat can not go to Cooling stage3 in some cases. //REV 27.8 //MHF 7-12-2006 Fixed the occupancy sensor feature for ShragaThere are two modes about using the feature. // one mode is in office mode and another mode is in hotel mode.Now we have only way to change the // tstat go to occupied mode ,that is write 1 to register 184.Before the tstat go to occupied mode ifthe user // change the fan speed from 0 to a value bigger than 0.Now we change the fan speed whatever mfrom keypad or // serial port,tstat will reset the override timer. //REV 27.7 //MHF 4-27-2006 Added a function item for each input.the function include "normal","freeze protect","occupancy sensor" //MHF 4-27-2006 Added auto/manu control bit for each input and output //REV 27.6 //MHF 3-27-2006 Added freeze protect feature //MHF 3-27-2006 Added timer ON feature,The corespond relay will turn on several minutes after TSTAT run some time //REV27.5 //MHF 03-01-2006 Changed the value range of filter .The filter can be set from 0 to 100. //RL:06-02-16 update documents for hotel/office deadband. document information were flipped. Office is setpoint. Hotel is Deadband //REV27.4 //RL:06-02-09 added LED table option Stage_1-2-3 and Stage_2-3 //MHF: 06-02-14 added fan speed change for Kevin in keypad 2B settings //REV27.3 //MHF:06-01-20 Fixed trigger override timer mode ,any key be pressed the Tstat enter override timer mode //REV27.2 //MHF:06-01-20 Fixed the tempetature display mode on LEDs //REV27.1 //MHF:06-01-20 Clear item zero when the temperature in deadband area //REV27-0 //RL:06-01-05 removed EA=0 lines from the pic read function. reduced flicker to the display // note that pic was left unchanged. May be possible that there are less pic reads // in the future may observe pic reads not as fast... //RL:06-01-06 placed back the code which now only enables writing to hardware-rev and Product-Model only once //REV26.9 //MHF:12-26-05 Fixed pid algorithm.change the pid_error arithmetic when at coating // mode to make iterm decrease and increase fast //MHF:12-27-05 Fixed the protocol of scan.Now read and write register 10 not Modbus protocol. // Because added serialnumber data in the data packet //MHF:12-29-05 Fixed occupied_trigger_handler() and related to make bit3 ofregister 184 can show // Digital input1 status at any time and any case //REV26.8 //MHF:11-14-05 fixed pid bug .expanded pterm greater than night_cooling_db + night_heating_db //ron:11-14-05 added flash_info function at code 0x100 //MHF:11-24-05 Added a register for last key pressed timer //MHF:12-15-05 Added serialnumber data when reply modbus function 25 //REV26.7 //MHF 10/25/05 Fixed the value range of 107 MODBUS_MODE_OPERATION register for compatible backward.Now use the following value: // coasting 0 cooling1 1 cooling2 2 cooling3 3 cooling4 14 cooling5 15 cooling6 16 // coasting 0 heating1 4 heating2 5 heating3 6 heating4 17 heating5 18 heating6 19 //MHF:10/28/05 Fixed pid bug ,the PID was winding up past 100, taking too long to wind down. // Also in the deadband region, made sure the I term can decay but will not incease. //MHF:10/28/05 Added 0---50% item for output table to determin how much the valve open.now the EEP_VALVE_OPER_TABLE_BEGIN register every bit is defined like this: // bit 7 : '0' heating valve(output7)not select 0---50% ; '1' heating valve(output7)select 0-----50% // bit 6 : '0' cooling valve(output6)not select 0---50% ; '1' cooling valve(output6)select 0-----50% // bit 5 4 : floating valve ,the range of valve open // bit 3 2 : heating valve(output7), the range of valve open // bit 1 0 : cooling valve(output6),the range of valve open //MHF:10/31/05 After a load of the configuration file or new hex file of the same rev number, the occupied state is left unchanged. // (if the hex file is a major update requiring the flash to be erased, // then the occupied stat is lost after a hex file s sent. ) // changed file :serial.c // fixed some code when POM == 1, in this mode,only when fan_speed_usee ==0 do something // changed file :tstat.c //MHF:11-07-05 when tstat at unoccupied status ,recaculate cooling_db and heating_db to make PID work correctly // changed setpoint() and update_pid() function //MHF:11-09-05 Fixed calibration bug which if TSS = 0,could not calibrate //MHF:11-10-05 Fixed LED status,turn all leds off except OFF led when the tstat working in the OFF mode, the left vertical row of status leds. //MHF:11-11-05 Fixed occupied status in REG184,if the fan speed goes greater than 0 from the keypad, then the occupied bit goes to 1 (TRUE) // if Fan speed goes to zero from the keypad, the occupied bit is 0 (False). // at night, if the fan goes on to maintain the night setpoint, // then the occupied bit stays at 0. // //MHF:11-11-05 limit TSS less than 2 if the tstat is 5A or 5B ,because the tstat 5A and 5B only have // temperature chip and external thermostor //REV26.6 //MHF 9/23/05 Add DDC mode in AUTO_ONLY regiser to make the user can not change setpoint and ON/OFF mode from keypad. // The user only can change these things from serial port. //MHF 9/23/05 Add interlock for each output.Add seven registers 285 to 293 to store the interlock, connected to inputs only (for now). //MHF 9/27/05 Added a new register to adjust the setpoint increment as a user variable. We store it as a user defined variable // in a one byte register, minimum value is 0.1, the maximum value could be set at 1.0.Now cooling setpoitn and // heatinng setpoint are stored in the E2 chip by using two bytes.Whatever the setpoint be set by keypad or serial port // the setpoint value should multiply 10. //MHF 9/28/05 Tss register is left unchanged when the user changes C to F or F to C. //MHF 9/28/05 Added a new item DEF which store current configuration into flash as new default in the menu //MHF 10/5/05 Tstat displays "---" when the tstat can not detect the pic chip though there is a pic chip //MHF:10/24/05 if the tstat is working on OFF mode,turn off cool and heat LED, lower row of status leds. //REV26.5 //MHF 9/6/05 shorten the delay between chatacters when tstat response .the tstat response should have a pause between two characrers, // but the maximum allowed pause is 1.5 character times or .83 ms * 1.5 or 1.245 ms at 9600 baud. //MHF 9/21/05 The baudrate does not change after changed C to F or back. //MHF 9/22/05 Fixed bug in TSS register.Because the TSS can not be set to zero even that the tstat has internal teperature // sensor when update the tstat's software from before revision 26.4 to after revision 26.4 . //REV26.4 //MHF 8/18/05 Added "floating valve" feature.Added five registers from 280 to 284 to determine relay1 to relay5 output mode. // Relay 4 and relay5 be used to control valve by pulse mode if MODE_OUTPUT4 AND MODE_OUTPUT5 be set '1'. // in this mode,the relays not be controled by PWM. //REV26.3 //MHF 8/18/05 fixed the original PID's Pterm = cooling_db+heating_db+10 to avoid always staying coasting mode // because of the user set the Pterm less than cooling_db plus heating_db //REV26.2 //MHF 7/12/05 Added PWM to pin ENABLE_2003, for decrease the current by using pulse control relays. // TODO allow writes to registers 180, 181, 215, 216 - automatically adjust calibration values when writing to these registers. //REV26.1 // MDF 6/23/05 Fixed bug in EEP location of UPDATE_STATUS register.. // tstat.c, serial.c, define.h // MDF 6/30/05 Got rid of LED_Init_table and function. LED defaults now stored same as the rest of the b.eeprom registers. // tstat.c, serial.c, define.h // MDF 6/30/05 Set Flash-stored address to 0 whenever writing to EEPROM-stored address. This invalidates the address stored in Flash. // tstat.c, serial1.c // MDF 6/30/05 Reset factory defaults to 0 at startup. // tstat.c // MDF 6/30/05 Added a prevention measure so that 0 or 255 cannot be written to the address. // serial.c // tbd... ask ron about the address initialisation... i wanna add some code but doesn't seem to work out... //REV25.7 // MDF 4/30/05 Added MODBUS_OVERRIDE_TIMER_LEFT to hold the remaining value on the override timer. // serial1.c // MDF 4/30/05 Implemented display blank option by setting MODBUS_DISPLAY = 2. // display.c // MDF 5/01/05 Created calibration terms for both the Analog In2 and for the Internal Thermistor . // modbus.h, define.h, tstat.c, serial1.c, output.c // MDF 5/01/05 Created registers to show the internal temperature sensor IC and the internal thermistor value at all times. // modbus.h, define.h, serial1.c, // MDF 5/01/05 Combined CAL and CAE into one menu item, making it automatically adjust the correct calibration term based on the TSS.. // LibDisplay.h, tstat.c // MDF 5/19/05 Fixed bug. 5Bs were not reading the temperature chip because they do not have analog inputs.. // output.c // MDF 5/24/05 Fixed bug in filtering algorithm.. // output.c, temperature.c // MHF 5/25/05 Added partial menu lock.. // tstat.c // MDF 5/30/05 Fixed bug in calibration implementation regarding degrees F. // tstat.c, serial1.c // MDF 6/3/05 Set Flash-stored address to 0 whenever writing to EEPROM-stored address. This invalidates the address stored in Flash. // output.c, temperature.c //REV25.6 // MDF 4/19/05 Adjusted HC setting so that when the external sensor is hotter, we are in heating mode, not cooling mode.. // control_logic.c // MDF 4/20/05 Rearraged location of many RAM variables to free up space in the data memory. // control_logic.c // MDF 4/20/05 Gave serial interrupt priority to reduce communication errors // tstat.c // MDF 4/25/05 Added a prevention measure so that 0 or 255 cannot be written to the address. // serial.c // MDF 4/28/05 Reset factory defaults to 0 at startup. // tstat.c // MDF 4/28/05 Fixed factory defaults bug when setting defaults from keypad. // tstat.c //REV25.5 // MDF 4/05/05 Made TEMPERATURE FILTER a variable rather than a constant. Set up new menu item, FIL, to control this variable. // serial1.c, tstat.c, LibDisplay.h, Temco.h, define.h, temperature.c // MDF 4/07/05 Added support for the Tstat5B2 // tstat.c // MDF 4/08/05 Change plug_n_play address to register 10. // modbus.h // MDF 4/14/05 Fixed bug that caused the iterm to rollover from a positive to a negative number. // PID.c // MDF 4/14/05 Adjusted filter so that the temperature does not jump when the new reading is very different. // temperature.c // REV25.4 // RL 03/25/05 update_status missing in the ISP update routine in Ver25.3 // update_status variable was missing when writting through modbus, therefore no update was possible given Tstat did not reset // MDF 4/01/05 Fixed bug in check hardware and model regarding 5A with rev0 hardware // tstat.c, // MDF 4/01/05 Made change to auto_plug_and_play check_data() routine. Now tstat will not respond if randval != 1; // serial1.c, //REV25.2 // MDF 1/27/05 Fixed bug in PID. // pid.c, // MDF 1/28/05 Fixed bug that prevented tstat from jumping into ISP mode.. // serial.c, // MDF 3/23/05 Changed PID so that iterm will continue to influence the tstat even when the temperature is between the deadbands // pid.c, //REV25.1 // MDF 12/30/04 Changed the function of occupied/unoccupied. It no longer has a correlation to fan speed. The mode can // only be changed by the digital input or by a command from the modbus. // tstat.c, keypad.c, serial.c // MDF 1/6/05 If there is an E2 error, the tstat no longer freezes. instead it simply does not start up any of the timers. // the serial communications will still work. This is to allow you to adjust the // product model and hardware rev registers // tstat.c // MDF 1/11/05 Added 2 more button configurations - 2b and 4b. 2b is the same as 2, except cooling and heating mode // can only be controlled via the serial interface. In 4b, the lower left button switches between cooling // and heating mode, while the lower right button scrolls through the fan speeds - off, 1, 2, 3, auto. // tstat.c, serial.c, control_logic.c, temco.h // MDF 1/14/05 Implemented blinking display whenever setpoint or fan speed is changed via the serial interface. // serial.c, //REV25.0 // MDF 7/14/04 Added display_integer() to show integers better in the menu // tstat.c // MDF 8/2/04 analog input is now raw the look_up_table now gets applied when checking temperature // output.c, pic.c // MDF 8/4/04 Added code to display setpoint instead of temperature according to menu item, dIS // temperature.c, temperature.h, define.h, modbus.h, serial1.c // MDF 8/4/02 added code to check for an analog module on Tstat5C boards // tstat.c // MDF 8/5/04 Added code to allow tstat5c to do analog out functions // output.c // MDF 8/5/04 Changed extern_operation_default table so that OUT4 and OUT5 correspond to table. // Temco.h, Output.c // MDF 8/5/04 Added code so that an Analog Tstat can fuction as ON/OFF // output.c // MDF 8/16/04 Added code to automatically switch between displays depending on the // hardware revision. // tstat.c, libdisplay.h // MDF 8/17/04 Setup PRODUCT_MODEL and HARDWARE_REV registers to keep track of // the hardware and model. // tstat.c, Temco.h, revision.h, serial1.c, define.h // MDF 8/18/04 changed default sop1 table for Fan OFF to match AUTO // now that we have the occupied/unoccupied settings working correctly // control_logic.h // MDF 9/16/04 Changed the default valve setting table for Heating2 and Cooling2. // control_logic,h // MDF 9/21/04 Added short cycle and changeover delays for the mode of operation. // control_logic.c, tstat.c // MDF 9/21/04 Increased max temperature and setpoint to allow tstat to function with boilers. // if the temperature/setpoint goes over 100, the decimal point gets shift in order to display properly. // tstat.c, define.h, temperature.c // MDF 10/20/04 Added 15ms delay anytime a relay switches to avoid reading or writing to the EEPROM during a switch. // output.c // MDF 10/20/04 Setup system of registers to control the functionality of the LEDs // modbus.h, serial1.c, tstat.c // MDF 10/24/04 Setup bit1 of info_byte to reflect a watchdog reset. SRS will be displayed on power-up // tstat.c // MDF 10/24/04 Setup bit2 of info_byte to prevent reset during serial writes. // serial.c // MDF 10/12/04 Added code to control zero-voltage crossing based on External Interrupt 1 // output.c, tstat.c // MDF 10/12/04 Added Low voltage test to prevent writing to the E2 chip if the voltage gets too low // tstat.c, TH_ee.c // RL 18/11/04 // - added memory storage when doing ISP. NOw only has laddress in it. If more data... need to do memory allocation // MDF 12/01/04 added a 2nd query of PIC on startup incase first one was missed. // pic.c // MDF 12/01/04 Changed routines of PIC slightly to fix small bugs in I2C communication. // pic.c // MDF 12/06/04 Added feature to tSS and DI1 to allow for 2-pipe operation. // Temco.h, control_logic.c // MDF 12/06/04 Added Ort - OVERRIDE_TIMER to allow user to override the unoccupied mode of the clock // Temco.h, define.h, LibDisplay.h, tstat.c // MDF 12/07/04 Fixed bug with changing the address from the keypad menu // tstat.c // MDF 12/08/04 Changed units of output delays from 0.1 seconds to 1.0 seconds // tstat.c, output.c // MDF 12/08/04 Modified the update_status register to allow for a complete erase of the eeprom by writing 0x8F // tstat.c, serial.c // MDF 12/10/04 Users now allowed to write to the COOL_HEAT_MODE register if tstat is in 6-button mode. // serial.c // MDF 12/14/04 Fixed eeprom erase function triggered by writing to register 16.. // tstat.c // MDF 12/14/04 Fixed serial write to AUTO_ONLY. // serial.c //REV24.4 // MDF 6/29/04 Added code to switch between occupied and unoccupied mode // upon trigger of digital input // tstat.c, Temco.h // MDF 6/30/04 Added menu items, night heating setpoint, night cooling setpoint. // tstat.c, define.h, temco.h, LibDisplay.h, modbus.h // MDF 7/1/04 Added response_data() before reset on certain serial com items so that tstat replies // before resetting. // serial1.c // MDF 7/5/04 Moved the addition of the calibration term to after the temperature filtering. // temperature.c // MDF 7/5/04 Changed code so that AUT=0 allows manual fan speeds. AUT=1 only allows off and auto // tstat.c, serial1.c //REV24.3 // MDF 6/21/04 TXEN pin needs to be set low immediately. This will prevent interference // on the 485 bus in case of E2 failure // tstat.c // MDF 6/24/04 Now make sure that the fan does not increase above the allowed level set by FAN_MODE // control_logic.c, Temco.h, tstat.c // MDF 6/25/04 changed the timing of responses to valid and invalid packets. // 4ms needed to recover from invalid packet. 10ms delay when responding to a valid packet. // serial1.c, tstat.c, serial.h //REV24.2 // MDF 6/1/04 Increased the EVENT_QUEUE_SIZE from 3 to 6 // define.h // MDF 6/1/04 Changed display of nHS and nCS parameter to nHd and nCd // tstat.c // MDF 6/7/04 Added REVT define to specify for various differences in the new tstat // define.h, Temco.h // MDF 6/7/04 Added EXTERNAL_SENSOR_1 // define.h, modbus.h, serial1.c //REV24.1 // MDF 5/3/04 Changed LED_r to look better when displayed. // LibDisplay.h // MDF 5/7/04 Added register 180 - EXTERNAL_SENSOR_0 register. now // it is possible to always read the external sensor reading regardless of TEMP_SELECT. // modbus.h, define.h, serial.c, output.c // MDF 5/31/04 - Changed default night heating and cooling setbacks from 3 to 10 // temco.h // 4/5/04-Rev.24 Added code to initialize_eeprom() to set the address to 1 as a default. // MF 4/13/04 when an on/off module is detected, MUX pins will also be used to drive relay4 and relay5 // MDF 4/29/04 re-wrote modbus routines to comply with modbus standards and to reduce error rate // serial1.c, tstat.c - COMDEALWITH