Using the HT46R48 in a Gas Water Heater Application D/: HA0134E Introduction This forced exhaust gas water heater uses a Holtek HT46R48 MCU as the controlling device. It includes many safety features during fault conditions, such as flame extinguishing and shutting of the gas supply. The characteristics are listed below: Temperature measurement error within ±1 degree Output high voltage 12KV Igniter frequency 8~18 times per second Flame sense time 1S Flame detection sensitivity 3.3M Gas valve intake close voltage 3V, Gas valve holding 3.5V±0.3V HT46R48 Characteristics Operating Voltage: f SS = 4MHz at 2.2V~5.5V; f SS = 8MHz at 3.3V~5.5V Up to 15 bi-directional I/O pins External Interrupt pin shared with I/O pin 8-bit programmable Timer/Event Counter with overflow and 7-stage prescaler Internal crystal and RC oscillator circuit Watchdog timer 2048x14 capacity Program Memory 64x8 capacity Data Memory PFD function can generate audio frequencies HALT and wake-up instruction to reduce power consumption 8 MHz system clock at 5V operating voltage 0.5us instruction cycle 6-level stack 4-channel 9-bit resolution A/D converter Single channel 8-bit PWM output pin shared with I/O pin 1
Bit manipulation instruction Look up table instruction 14 bit long table data 63 instructions Instructions executed within 1 or 2 cycles Low voltage reset function 20-pin DIP/SOP package Water Heater Functional Description Power-cut protection When power is applied the controller first checks for water flow and the heater will not be activated Fan Pressure Switch Protection Fan pressure switch Off/On Circuit Protection: if the fan does not operate or if the fan controller circuit has malfunctioned and the fan cannot rotate normally or if the smoke exhaust channel is blocked which will cause the fan pressure switch to not close correctly, then the heater will not operate. Fan pressure switch short circuit protection: If the fan fails to rotate after the machine starts (open the tap), and if the switch has been detected to already be closed (except for fan inertia), then the heater will not operate. Flame circuit fault protection Valve leakage protection: Ignition before valve opening is detected by a flame signal, in which case the heater will stop operation. The fan will operate until the flame signal ceases. Ignition and gas circuit fault protection: if ignition does not occur or if a fault occurs in extinguishing, the water heater will turn off Temperature Sensor Fault Protection Temperature Sensor Fault Protection (open circuit or short circuit) then operation will stop Over Temperature Protection When the water temperature is detected to be over 85 degrees the controller will switch off the magnetic valve and the water heater will stop operation Over-temperature Protection Controls the temperature interface, if the temperature is too high then the temperature controller will switch off and the controller will switch off the gas valve. Fixed machine on time Switches the machine on for 20 minutes, after the machine is switched off an En is displayed Displays actual water temperature and working status Here the water temperature means the present post-heater water temperature, the working status indicates various error conditions. 2
Pre-cleaning Before the controller activates ignition, the fan motor is run for a period of time to clear out any smoke residues from the ventilation channel Post-cleaning After the heater has switch off, the fan motor will be run for a period of time to clear out any smoke residues and to cool down the machine Hardware Block Diagram HT46R48 20 minute off control PB4 PB5 PA4~PA7 Display Flame detect PB2 PA2 Igniter control Water pressure switch manitoring PB3 PA0/PA1 Gas value control Fan switch monitoring PB1 PA3 Buzzer driver Temperature monitoring PB0 PD0 Fan control 3
Hardware Circuit Description Using the HT46R48 in a Gas Water Heater Application Igniter Control Gas value control Buzzer Temperature protection switch Water value switch Fan switch 20 minute Times switch Temperature checking circuit Flame detect circuit Oscillator Spark voltage circuit Display interface Fan control connection Reset Circuit Figure 1 Main Board Circuit Diagram 4
Figure 2 Power Supply and Fan Motor Control Circuit Circuit Description The igniter circuit uses PA2 and Q2 for its control. T1 and C4 form an oscillator, T2 is a high voltage output for the flame ignition. Flame detecting circuit: when there is a flame, the detection pin will generate an ionizing current which will pull PB2 low, the A/D is used to detect if there is a flame signal Magnetic valve activation circuit: PA0 and PA1 and the two transistors Q3 and Q4 control the magnetic valve. After being on for 0.5 the gas valve will close and it and the valve will enter a hold on situation where it will use less power. Switch detection circuit and temperature detection circuit: S1: temperature control switch, will automatically switch off if temperature is too high, and will close the magnetic valve S2: Water Pressure Switch, when the water valve is opened, this switch will close, and PB3 is used to check if the water valve is opened. S3: Fan Pressure Switch, when the fan motor is activated it will close, and PB1 is sued to determine if it is closed S4: Timer switch: PB4 is used to determine if the 20-minute motor off function has been selected. PB0 is the A/D converter input; this port is used to check for temperature changes. 5
Software Design Flowchart and Description START TO=0? Reset? Initialise RAM and I/O, Setup flags 55H/AAH Initialise I/O Display E0, Power protect SET F_FAILURE Water Control Switch closed or not? Setup flags 55H/AAH are correct? POLLIG_EVET Call Temperature Display Routine Display Temperature Water Control Switch closed? Turn on water? MOV A,R_PROGRAMC AD A,0FH ADDM A,PCL (jump to related subroutine) PROC0 PROC1 PROC2 PROC3 PROC4 PROC5 PROC6 PROC7 PROC8 PROC9 PROC10 PROC11 6
PROC0 Fan Pressure switch closed? IC R_PROGRAMC R_TEMP[2]=A7 R_PROGRAMC=0 F_FAILURE=1 Display Error E7 POLLIG_EVET PROC1 SET P_CSB_PD0 Start Fan R_TIMER_COUTER4 =4 IC R_PROGRAMC R_TIMER_COUTER3=00H R_TIMER_COUTER4 =00H POLLIG_EVET 7
PROC2 Fan Pressure switch closed?? R_TIMER_COUTER4 =12 IC R_PROGRAMC R_TIMER_COUTER3=00H R_TIMER_COUTER4 =00H R_TEMP[2]=A6 R_PROGRAMC =0 F_FAILURE=1 Display Error E6 POLLIG_EVET PROC3 Flame Signal Present? R_TEMP[2]=A1 R_PROGRAMC=0 F_FAILURE=1 Display Error E1 IC R_PROGRAMC R_TIMER_COUTER3=00H R_TIMER_COUTER4 =00H POLLIG_EVET 8
PROC4 CLR PA.2 CLR P_CSB_PD0 Activate Igniter, Switch off Fan Flame Signal Present? R_TEMP[2]=A2 R_PROGRAMC =0 F_FAILURE=1 SET PA.2 Display Error E2 IC R_PROGRAMC CLR PA.0 CLR PA.1 Open Gas Valve R_TIMER_COUTER3=00H R_TIMER_COUTER4 =00H POLLIG_EVET PROC5 Flame Signal Present? R_TIMER_COUTER4 =16 R_TEMP[2]=A3 H R_PROGRAMC=0 F_FAILURE=1 SET PA.2 Display Error E3 IC R_PROGRAMC R_TIMER_COUTER3=00H R_TIMER_COUTER4 =00H POLLIG_EVET 9
PROC6 R_TIMER_COUTER3 =100 SET PA.0 0.5s Close ValveR_TIMER_COUTER3=0 R_TIMER_COUTER4 =2 SET PA.2 after 1S switch off igniter IC R_PROGRAMC R_TIMER_COUTER3=00H R_TIMER_COUTER4 =00H POLLIG_EVET PROC7 F_WATER_STREAM =1 Flame Signal Present? IC R_PROGRAMC R_TIMER_COUTER3 =200 POLLIG_EVET R_TEMP[2]=A3 H F_FAILURE=1 Display Error E3 PROC11 10
PROC8 Fan Pressure Switch closed? IC R_PROGRAMC R_TIMER_COUTER3=00H R_TIMER_COUTER4=00H R_TIMER_COUTER4=4 POLLIG_EVET R_TEMP[2]=A6 H F_FAILURE=1 Display Error E6 PROC11 PROC9 Temperature exceeds 85 C IC R_PROGRAMC R_TIMER_COUTER3=00H R_TIMER_COUTER4 =00H R_TIMER_COUTER4=6 POLLIG_EVET R_TEMP[2]=A5 H F_FAILURE=1 Display Error E5 PROC11 11
PROC10 Temperature switch closed? R_PROGRAMC=7 R_TIMER_COUTER3=00H R_TIMER_COUTER4 =00H R_TIMER_COUTER7=20 POLLIG_EVET R_TEMP[2]=AB H F_FAILURE=1 Display E PROC11 PROC11 SET P_CSB_PD0 R_PROGRAMC=0BH SET PA.0 SET PA.1 Start Fan - Close Magnetic Valve R_TIMER_COUTER4=20 CLR F_GASGATEOPE CLR R_PROGRAMCT CLR P_CSB_PD0 POLLIG_EVET 12
TIMER Interrrupt Routine PUSH R_TIMER_COUTER1=14H? SET F_5ms SET F_5000us Setup 5ms flag R_TIMER_COUTER2=C8H? Obtain F_500ms (0.5s) flag POP RETI 13
Flowchart Description The main program at the start will determine if the reset is a power-on reset or a WDT overflow reset. If it is a power-on reset then the Data Memory and I/O pins will be initialised. Then the water control switch will be examined to see if it is closed. If the switch is closed then an error flag will be set and an EO will be displayed and jump to the main loop program. If the switch is open then directly enter the main loop program. If it is determined that the WDT has overflowed and reset the I/Os, then check if the registers flags R_ORMAL_FLAG1 and R_ORMAL_FLAG2 are equal to 55H and 0AAH, if the flags are normal, then jump to the main loop program, if not then it is a cold start and jump to the reset program. The main loop program subroutine SBR_SHOWPROCEDURE includes temperature detection subroutine and the LED display program uses a 5ms Timer to adjust the display program (scanning frequency = 66.66Hz),if an error flag is set then do not adjust the temperature measuring subroutine, normal or waiting condition is 5ms temperature checking. The temperature checking subroutine uses the A/D converter and obtains the average of 8 values to obtain a value and then a conversion table to obtain the related temperature. SBR_WATERSWICH_CHECK: according to whether there is a water flow signal or not, set this flag to determine if the program should continue running. L_PROCEDURE0: After the water is turned on determine whether the fan pressure switch is closed. If closed then set error flag indicates E7, clear the software counter R_PROGRAMCT, otherwise add 1 to the R_PROGRAMCT and the program continues. L_PROCEDURE1: start the fan motor, extend time by 2S L_PROCEDURE2: check fan pressure switch for 6S to see if it is closed, if closed then add 1 to R_PROGRAMCT and the program continues. If open then set the error flag and display E6 and clear the counter R_PROGRAMCT. L_PROCEDURE3: check for the presence of a flame signal, if present then set error flag and display E1 and clear the counter R_PROGRAMCT, if not present then add 1 to R_PROGRAMCT and the program continues. 14
L_PROCEDURE4: Switch off the fan motor and activate the igniter, within 1S look for the presence of a flame signal. If a signal is present then set error flag and display E2 and clear counter R_PROGRAMCT, if no signal is present then add 1 to R_PROGRAMCT and program continues running. L_PROCEDURE5: Open and hold valve, after 0.5S the valve will close, within 8S to check for a flame signal, if one exists then add 1 to R_PROGRAMCT and the program continues running, if not then set the error flag and display E3 and the program jumps to L_PROCEDURE11. L_PROCEDURE6: activate fan and after 1S stop the ignition L_PROCEDURE7: after ignition, determine within 1S if the flame has been extinguished erroneously, if so then set the error flag and display E3 and the program will jump to L_PROCEDURE11, if not then add 1 to R_PROGRAMCT and the program continues. L_PROCEDURE8: Check continuously for 2S if the fan pressure switch is open, if so then set the error flag and display E6 and the program jumps to L_PROCEDURE11, if not then add 1 to R_PROGRAMCT and the program continues running. L_PROCEDURE9: Check continuously for 3S if the temperature is over 85C, if so then set the error flag E5 and the program jumps to L_PROCEDURE11, if not then add 1 to R_PROGRAMCT and the program continues running. L_PROCEDURE10: determines if the fixed time for motor shut off is selected. If so then checks if a time of 20 minutes has elapsed, if so then set the error flag and display E and the program jumps to L_PROCEDURE11. If not then set R_PROGRAMCT=7 and the program starts to cycle from L_PROCEDURE7. L_PROCEDURE11: Start fan, close the gas valve, after extended time of 20S switch off the fan, clear the counter register R_PROGRAMCT. 15
oise Reduction Techniques Using the HT46R48 in a Gas Water Heater Application oise Source The sources of noise in this example are transmitted via the PCB tracks and as radiated noise through space. The main factors which will influence the reliability and safety come both from the internal system and external electrical machinery noise. Internal oise Internally the greatest noise comes from the system s own high voltage pulse spark igniter. When operating, the igniter will generate a voltage pulse in excess of 12kV to overcome the air resistance and create an electrical arc to ignite the gas. This high voltage electrical arc is a major noise source for the MCU and can cause the program to jump to spurious locations. ext is the distributed noise on the PCB, inter component magnetic interference, circuit feedback coupling noise and stray signal noise etc. External oise The main source of external noise is from the A.C power supply. Because the power control system requires direct current supply it is supplied by an A.C power supply via a transformer, rectifier, filter and regulator. Therefore the power network various noise sources will enter the controller system. (The power network system noise main sources are the following types: magnetic coupling, capacitive coupling, radiation coupling, common resistive coupling etc.) ext is the electrical system operating environment noise such as the high frequency radiation and other equipment magnetic noise etc. Measures to combat noise are shown below: Use the IC internal watchdog timer. Activating the IC internal Low Voltage Reset circuit, will reset the device if the power supply voltage falls below a certain value. Software trap: when the program jumps to illegal areas, remaining instructions will have no effect. By using software traps to catch erroneous jumps, the program can be led to specific places from where debug handling can be implemented and the program returned to normal operation. System fault handling, auto reset program: when because of noise interference the MCU system is reset or if power is lost, should implement a fault interrupt and automatically return the system to a normal operating point before the error condition. The software design must therefore mange different types of hardware reset, software reset, watchdog timer error reset and abnormal power on reset etc must be able to check and distinguish them, and for important information and parameters implement a 16
backup, (for example system operating condition, entry values, previous input and output values etc) to make the MCU automatically return to the original operating condition when noise conditions occur. PCB Layout Main Controller PCB Diagram 17
Power Supply PCB Diagram Igniter Control Board Description Main Control Board and Display Board Power plug Display Fan switch Flame sensor Temperature Plug Magnetic value connection Buzzer connection 12kV Igniter Water control switch 18