diff 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
line wrap: on
line diff
--- a/src/adc_lightsensor.asm	Mon Aug 27 09:40:31 2018 +0200
+++ b/src/adc_lightsensor.asm	Thu Oct 11 21:06:29 2018 +0200
@@ -64,7 +64,7 @@
 
 	btfsc	CHRG_IN
 	return
-	;cv_active:
+charge_cv_active:
 	decfsz	get_bat_volt_counter,F
 	return
 	movlw	.15
@@ -84,6 +84,13 @@
 	bsf		LEDr							; Indicate charging
 	bcf		CHRG_OUT
 	bsf		TRISJ,2							; Chrg-Out high impedance
+	movlw	.15
+	cpfsgt	batt_voltage+1					; Batt Voltage >= 16*256mV (4,096V)?
+	bra	charge_cc_active2				; No
+	movlw	.81
+	cpfslt	batt_voltage+0					; Batt Voltage >= 80mV(+4096mV from batt_voltage+1)?
+	bra	charge_cv_active    				; Yes
+charge_cc_active2:
 	movlw	.10
 	movwf	get_bat_volt_counter
 	return