ickel Cadmium and ickel Hydride Battery Charging Applications Using the HT48R062 ickel Cadmium and ickel Hydride Battery Charging Applications Using the HT48R062 D/: HA0126E Introduction This application note utilises the HT48R062 8-bit MCU as the central unit of a simple charger for ickel Hydride and ickel Cadmium batteries. The MCU uses an RC oscillator as its system oscillator and controls the charging time. The 10 timer charging time should be controlled to within 30 mintes. H/W Block Diagram PB.0 & PB.1 Outputs to Control Battery Charging Battery PA0, PA1 Detect HT48R062 PB.2: Waveform Output Check Hardware Block Diagram Description Main controller - HT48R062 PA0 and PA1 are used to determine if a battery has been placed in the battery box. PB0 and PB1 are used to control if the battery should be charged or not. PB2 is used to output a pulse of 16ms period which is used to implement an MCU working frequency calibration. 1
ickel Cadmium and ickel Hydride Battery Charging Applications Using the HT48R062 Application Circuit H/W Operating Principle The P1 input is 9V. C7 and C3 are used as decoupling capacitors on the 7805 pin 1 input. The output pin 3 of the 7805 is 5V. C1, C4, C5, R1 and R2 form the MCU reset circuit. C2 and R3 are the MCU RC oscillator components. PA0 and PA1 are input pins and directly connected to the battery positive terminal. If no battery has been inserted, because there is a pull high resistor connected, the pin will be at a high level. When a battery is inserted, the input pin will assume the same potential as the battery, which will generally be less than 1.5V. As the I/O pin low voltage range has a value of 0 to 0.3VDD, and because VDD is equal to 5V, the PA input will assume a low level. By therefore reading the input line it can be determined if a battery has been inserted or not. R4 and R5 are used to adjust the charging current value. DS1 and DS2 are indicator LEDs, which will illuminate during charging. PB0 and PB1 are used to control the charging on/off process. When PA determines that a battery has been inserted, the corresponding PB pin will output a duty cycle of 1:1 at a frequency of 62.Hz. The drive transistor will then start to charge the battery. The charging current of the battery is about 150mA. 2
ickel Cadmium and ickel Hydride Battery Charging Applications Using the HT48R062 S/W Flowchart Software Flowchart START A B Initial RAM and IO Battery0 in charge mode? Clear Time and the flag for battery in charge mode PA0=0? Battery0 charge time end? Battery0 in charge mode? OP for delay Battery0 stop charge OP for delay Initial Time for battery0 charge Battery1 in charge mode? Clear Time and the flag for battery in charge mode PA1=0? Battery1 charge time end? Battery0 in charge mode? OP for delay Battery1 stop charge OP for delay Initial Time for battery0 charge B OP for delay OP for Error repair A 3
ickel Cadmium and ickel Hydride Battery Charging Applications Using the HT48R062 Software Description Intialise Data Memory and setup the I/O to their correct input or output condition. Determine if a battery has been placed into the batter holder by checking if PA0 and PA1 are low. If there is no battery placement then use OP instructions to implement a timing delay. If a battery has been placed then setup a 10 hour charge time period. The PB output is a 62.5Hz frequency with a 1:1 duty cycle waveform. Execute OP instructions to implement a time delay function. Determine if the battery is being charged, if so then determine if the 10 hour charging period has elapsed. If the time has not yet elapsed, then return to to the point where the check is made for battery placement and start the next loop. If the setup time has elapsed then the charging operation should be stopped. Because the MCU uses an RC oscillator, the system frequency will be subject to considerable variation due to environmental conditions. As a result the setup time of 10 hours will be subject to an error. Prior to use, the user needs to adjust the program to implement a calibration to ensure that the 10 hour setup time is completed. The calibration method is: Method 1: After power on, use an oscilloscope to check the waveform on pin PB.2. The program sets up a loop of 500us duration, and every 16 loops will change the output condition of pin PB.2. Therefore under normal conditions the waveform on the PB.2 output will have a period of 16ms. However if it is discovered that after an interval of 7880us the waveform inverts, then use equation 1: (500<single loop standard time> +26 < compensated time) * 16 < number of loops> 8416us. (The example program after each standard 500us will add a further compensatory 26us, the reason for the +26us in the equation) Equation 2: 7880 / 8416 = 0.9363us (This value is the MCU actual instruction period) Equation 3: 500us (single loop standard time)/ 0.9363 = 534 Then 534 is the number of instructions needed to be executed at this frequency, also the number of compensatory OP instructions required is equal to 534 500 = 34. After calculation, the user can, after the Part for Error repair themselves add additional OP instructions from the original 26 to 34 to complete the frequency calibration operation. 4
ickel Cadmium and ickel Hydride Battery Charging Applications Using the HT48R062 Method 2: A potentiometer can be used to replace the RC oscillator R3 resistor. By adjusting the value of the potentiometer resistance, and at the same time monitoring the PB.2 output waveform for a 16ms period waveform, and then recording the value of the potentiometer, a precision resistor of the same resistance value can then be used to replace the potentiometer to complete the frequency calibration procedure. PCB Layout 5
ickel Cadmium and ickel Hydride Battery Charging Applications Using the HT48R062 BOM 6