comparison src/adc_lightsensor.asm @ 207:f5d909e03f52

charge indicator on surface screen
author heinrichsweikamp
date Sat, 06 Dec 2014 21:04:27 +0100
parents 93085f540746
children 8fbd8c5ac51f
comparison
equal deleted inserted replaced
206:031d875200ca 207:f5d909e03f52
30 btfss cr_hardware 30 btfss cr_hardware
31 bra get_battery_voltage1 ; Normal ostc3 hardware 31 bra get_battery_voltage1 ; Normal ostc3 hardware
32 32
33 call lt2942_get_accumulated_charge 33 call lt2942_get_accumulated_charge
34 call lt2942_get_voltage 34 call lt2942_get_voltage
35 bcf cv_active
36 bcf cc_active
35 bcf LEDr 37 bcf LEDr
36 bcf TRISJ,2 ; Chrg-Out output 38 bcf TRISJ,2 ; Chrg-Out output
37 bsf CHRG_OUT 39 bsf CHRG_OUT
38 40
39 btfss CHRG_IN 41 btfss CHRG_IN
40 bra cc_active 42 bra charge_cc_active
41 43
42 bcf CHRG_OUT 44 bcf CHRG_OUT
43 bsf TRISJ,2 ; Chrg-Out high impedance 45 bsf TRISJ,2 ; Chrg-Out high impedance
44 46
45 WAITMS d'1' 47 WAITMS d'1'
46 48
47 btfsc CHRG_IN 49 btfsc CHRG_IN
48 return 50 return
49 ;cv_active: 51 ;cv_active:
52 bsf cc_active
53 bsf cv_active
50 bsf LEDr ; Indicate charging 54 bsf LEDr ; Indicate charging
51 call lt2942_charge_done ; Reset accumulating registers to 0xFFFF 55 call lt2942_charge_done ; Reset accumulating registers to 0xFFFF
52 WAITMS d'10' 56 WAITMS d'10'
53 bcf LEDr ; Indicate charging 57 bcf LEDr ; Indicate charging
54 return 58 return
55 59
56 cc_active: 60 charge_cc_active:
61 bsf cc_active
57 bsf LEDr ; Indicate charging 62 bsf LEDr ; Indicate charging
58 bcf CHRG_OUT 63 bcf CHRG_OUT
59 bsf TRISJ,2 ; Chrg-Out high impedance 64 bsf TRISJ,2 ; Chrg-Out high impedance
60 return 65 return
61 66