comparison src/adc_lightsensor.asm @ 218:8fbd8c5ac51f

1.71beta start
author heinrichsweikamp
date Fri, 19 Dec 2014 17:56:40 +0100
parents f5d909e03f52
children effd7259f5a5
comparison
equal deleted inserted replaced
217:3f169eff873c 218:8fbd8c5ac51f
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
36 btfsc divemode
37 return ; Not in divemode
38
35 bcf cv_active 39 bcf cv_active
36 bcf cc_active 40 bcf cc_active
37 bcf LEDr 41 bcf LEDr
38 bcf TRISJ,2 ; Chrg-Out output 42 bcf TRISJ,2 ; Chrg-Out output
39 bsf CHRG_OUT 43 bsf CHRG_OUT
47 WAITMS d'1' 51 WAITMS d'1'
48 52
49 btfsc CHRG_IN 53 btfsc CHRG_IN
50 return 54 return
51 ;cv_active: 55 ;cv_active:
56 decfsz safety_stop_countdown,F
57 return
52 bsf cc_active 58 bsf cc_active
53 bsf cv_active 59 bsf cv_active
54 bsf LEDr ; Indicate charging 60 bsf LEDr ; Indicate charging
55 call lt2942_charge_done ; Reset accumulating registers to 0xFFFF 61 call lt2942_charge_done ; Reset accumulating registers to 0xFFFF
56 WAITMS d'10' 62 WAITMS d'10'
57 bcf LEDr ; Indicate charging 63 bcf LEDr ; Indicate charging
64 bsf safety_stop_countdown,0 ; =1
58 return 65 return
59 66
60 charge_cc_active: 67 charge_cc_active:
61 bsf cc_active 68 bsf cc_active
62 bsf LEDr ; Indicate charging 69 bsf LEDr ; Indicate charging
63 bcf CHRG_OUT 70 bcf CHRG_OUT
64 bsf TRISJ,2 ; Chrg-Out high impedance 71 bsf TRISJ,2 ; Chrg-Out high impedance
72 movlw .5
73 movwf safety_stop_countdown
65 return 74 return
66 75
67 get_battery_voltage1: 76 get_battery_voltage1:
68 bsf adc_running ; =1: The ADC is in use 77 bsf adc_running ; =1: The ADC is in use
69 movlw b'00100000' ; 2.048V Vref+ -> 1LSB = 500µV 78 movlw b'00100000' ; 2.048V Vref+ -> 1LSB = 500µV