Micro P Report
Micro P Report
Micro P Report
Group Members: 1. Tan Gar Meng, Alvin 2. Chai Soon Peng 3. Kang Ching Yew 4. Lim Chuan Yik 5. Muhammad Akmal Section: 03A Lecturer: Fairuz bin Abdullah
1
TABLE OF CONTENTS
Title
1. Introduction
Page 3
2. Flow Chart
3. Programming
4. Circuit Diagram
5. Conclusion
10
Introduction Battery charger is an important tool to ensure the functioning of our electronic devices in our everyday life. What it does is that it is used to put energy into a secondary cell or rechargeable battery by forcing an electric current through it. A charger works by supplying a constant DC power source to a battery being charged. Everyone of us sure experienced a situation where we overcharge our handphone. Whenever overcharging happens, the lifespan of the battery decreases and it minimizes the maximum time a battery can last. So, what we came up with is the idea of using a charger kill switch. A charger kill switch checks the voltage of the battery on a regular basis and cut the current flow when the voltage is higher than the desired voltage. In other words, by using charger kill switch, the lifespan of the battery wont decrease and we can save electricity too.
Flow Chart
1. 2. 3.
Charger is connected to a circuit board then connect to a device that needs to be charged Start charging the device Set timer delay to 10 minutes Measure the present voltage (measure voltage) of the battery Check whether the measured voltage is bigger than the required voltage every 10 minutes If the measured voltage is bigger than the required voltage, the current supplied to the battery will be cut off
4.
5.
6.
7.
If the measured voltage is smaller than the required voltage, repeat step 2 to 7
Programming #include switch_0 macro clrf clrf endm switch_1 macro movlw movwf movlw movwf endm switch_2 macro movlw movwf movlw movwf endm switch_3 macro movlw movwf movlw movwf endm TESTH TESTL SWITCH set org goto set set 0x02 0x00 start
6
<p18F452.inc> ;initialize test voltage value as 0V TBLPTRH TBLPTRL ;initialize test voltage value as 3.5V 0x2 TBLPTRH,F,A 0xCC TBLPTRL,F,A ;initialize test voltage value as 4.0V 0x3 TBLPTRH,F,A 0x32 TBLPTRL,F,A ;initialize test voltage value as 4.5V 0x3 TBLPTRH,F,A 0x99 TBLPTRL,F,A 0x00 0x01
org retfie org retfie start clrf setf clrf tmr_start minute second movlw movwf movlw movwf movlw movwf movlw movwf movlw movwf bcf wait_tmr btfss bra decfsz bra decfsz bra movff check_0 clrf cpfseq bra switch_0 bra check_1 incf
0x08 0x18 TRISB,A TRISD,A PORTB,A 0x0A PRODH,A 0x3C PRODL,A 0x67 TMR0H,A 0x68 TMR0L,A 0x87 T0CON,A INTCON,TMR0IF,A INTCON,TMR0IF,A ;wait for the 1 second delay wait_tmr PRODL,A second PRODH,A minute PORTD,SWITCH WREG,A SWITCH,A check_1 ADC WREG,A ;check for value of switch = 0x1
7
;loop 1 minute 10 times ;loop 1 second 60 times ;initialize timer0 for 1 second delay
cpfseq bra switch_1 bra check_2 incf cpfseq bra switch_2 bra check_3 incf cpfseq bra switch_3 bra ADC movlw movwf movlw movwf bsf wait_con btfsc bra movff movff movf cpfsgt bra movf cpfsgt bra bsf bra
SWITCH,A check_2 ADC WREG,A SWITCH,A check_3 ADC WREG,A SWITCH,A check_0 ADC 0xCF ADCON1,A 0x81 ADCON2,A ADCON0,GO,A ADCON0,DONE,A wait_con ADRESH,TESTH ADRESL,TESTL TBLPTRH,W,A TESTH,A tmr_start TBLPTRL,W,A TESTL,A tmr_start PORTB,0,A tmr_start
8
;check for value of switch = 0x3 ;recheck if all values are incorrect
;select channel AN0 and enable A/D ;use AN3 and AN2 as reference voltage ;select FOCS/64 as conversion clock ;start A/D conversion
end
Circuit Diagram
The supply voltage to the circuit is 240V. The full wave rectifier will convert ac to dc voltage. Then we reduce the voltage by using step down transformer to 10V. The resistor R1 and R2 react as voltage divider. The 5V zener diod will be used as voltage regulator. The function of voltage regulator is to maintain voltage level. The we got capacitor C1 to store the voltages. The capacitor C1 is also used to differentiate the voltages that entering PIC18 and the voltage before entering amplifier circuit. The circuit has two switch, switch 1 and switch 2. These switch has 3 option to choose, 4.5V, 4V, and 3.5V. We can choose any three of it.
If the measured voltage is smaller than the required voltage, the current will flow and charging the battery. If the measured voltage is bigger than the required voltage, the current supplied to the battery will be cut off.
Conclusion This program is only made possible through the combinations of various techniques and tools learned throughout the Microprocessor System class. The program consists of modules such as timer, analog-digital convertor and macros. The implementation of such a device on every charger circuit will ensure longer lasting batteries on our electronic devices.
10