comparison src/adc_lightsensor.asm @ 260:e1cd6848863d

increase immunity against false Qi data
author heinrichsweikamp
date Tue, 24 Mar 2015 19:48:17 +0100
parents e2ea74646127
children 6a1ac89e2098
comparison
equal deleted inserted replaced
259:151148e2281f 260:e1cd6848863d
53 btfsc CHRG_IN 53 btfsc CHRG_IN
54 return 54 return
55 ;cv_active: 55 ;cv_active:
56 decfsz safety_stop_countdown,F 56 decfsz safety_stop_countdown,F
57 return 57 return
58 movlw .16
59 cpfslt batt_voltage+1 ; Batt Voltage more then 16*256mV (4,096V)?
60 bra charge_cc_active ; No
58 bsf cc_active 61 bsf cc_active
59 bsf cv_active 62 bsf cv_active
60 bsf LEDr ; Indicate charging 63 bsf LEDr ; Indicate charging
61 call lt2942_charge_done ; Reset accumulating registers to 0xFFFF 64 call lt2942_charge_done ; Reset accumulating registers to 0xFFFF
62 WAITMS d'10' 65 WAITMS d'10'
67 charge_cc_active: 70 charge_cc_active:
68 bsf cc_active 71 bsf cc_active
69 bsf LEDr ; Indicate charging 72 bsf LEDr ; Indicate charging
70 bcf CHRG_OUT 73 bcf CHRG_OUT
71 bsf TRISJ,2 ; Chrg-Out high impedance 74 bsf TRISJ,2 ; Chrg-Out high impedance
72 movlw .5 75 movlw .10
73 movwf safety_stop_countdown 76 movwf safety_stop_countdown
74 return 77 return
75 78
76 get_battery_voltage1: 79 get_battery_voltage1:
77 bsf adc_running ; =1: The ADC is in use 80 bsf adc_running ; =1: The ADC is in use
475 return 478 return
476 479
477 global reset_battery_pointer 480 global reset_battery_pointer
478 reset_battery_pointer: ; Resets battery pointer 0x07-0x0C and battery_gauge:5 481 reset_battery_pointer: ; Resets battery pointer 0x07-0x0C and battery_gauge:5
479 extern lt2942_charge_done 482 extern lt2942_charge_done
480 call lt2942_charge_done ; Reset accumulating registers to 0xFFFF 483 btfsc rechargeable ; Something to reset?
484 call lt2942_charge_done ; Yes, reset accumulating registers to 0xFFFF
481 clrf EEADRH 485 clrf EEADRH
482 clrf EEDATA ; Delete to zero 486 clrf EEDATA ; Delete to zero
483 write_int_eeprom 0x07 487 write_int_eeprom 0x07
484 write_int_eeprom 0x08 488 write_int_eeprom 0x08
485 write_int_eeprom 0x09 489 write_int_eeprom 0x09