comparison src/adc_lightsensor.asm @ 603:00b24fb4324d

second method to detect a full charge
author heinrichsweikamp
date Thu, 11 Oct 2018 21:06:29 +0200
parents b455b31ce022
children ca4556fb60b9
comparison
equal deleted inserted replaced
602:ab88a7e3de94 603:00b24fb4324d
62 62
63 WAITMS d'1' 63 WAITMS d'1'
64 64
65 btfsc CHRG_IN 65 btfsc CHRG_IN
66 return 66 return
67 ;cv_active: 67 charge_cv_active:
68 decfsz get_bat_volt_counter,F 68 decfsz get_bat_volt_counter,F
69 return 69 return
70 movlw .15 70 movlw .15
71 cpfsgt batt_voltage+1 ; Batt Voltage >= 16*256mV (4,096V)? 71 cpfsgt batt_voltage+1 ; Batt Voltage >= 16*256mV (4,096V)?
72 bra charge_cc_active ; No 72 bra charge_cc_active ; No
82 charge_cc_active: 82 charge_cc_active:
83 bsf cc_active 83 bsf cc_active
84 bsf LEDr ; Indicate charging 84 bsf LEDr ; Indicate charging
85 bcf CHRG_OUT 85 bcf CHRG_OUT
86 bsf TRISJ,2 ; Chrg-Out high impedance 86 bsf TRISJ,2 ; Chrg-Out high impedance
87 movlw .15
88 cpfsgt batt_voltage+1 ; Batt Voltage >= 16*256mV (4,096V)?
89 bra charge_cc_active2 ; No
90 movlw .81
91 cpfslt batt_voltage+0 ; Batt Voltage >= 80mV(+4096mV from batt_voltage+1)?
92 bra charge_cv_active ; Yes
93 charge_cc_active2:
87 movlw .10 94 movlw .10
88 movwf get_bat_volt_counter 95 movwf get_bat_volt_counter
89 return 96 return
90 97
91 get_battery_voltage1: 98 get_battery_voltage1: