Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/adc_rtc.asm @ 703:39e02673db4c
some cleanup
author | heinrichsweikamp |
---|---|
date | Sun, 17 Mar 2013 13:33:17 +0100 |
parents | e6ff73e88e45 |
children | 4452837aff37 |
comparison
equal
deleted
inserted
replaced
702:e6ff73e88e45 | 703:39e02673db4c |
---|---|
90 ; Continue with rest of routine | 90 ; Continue with rest of routine |
91 | 91 |
92 get_battery_voltage4: | 92 get_battery_voltage4: |
93 ; check if the battery control memory needs to be initialised! | 93 ; check if the battery control memory needs to be initialised! |
94 bcf initialize_battery1 ; clear check-flag | 94 bcf initialize_battery1 ; clear check-flag |
95 | 95 clrf EEADRH |
96 read_int_eeprom d'40' ; get lowest battery voltage seen in mV | 96 read_int_eeprom d'40' ; get lowest battery voltage seen in mV |
97 movff EEDATA,sub_b+0 | 97 movff EEDATA,sub_b+0 |
98 read_int_eeprom d'41' | 98 read_int_eeprom d'41' |
99 movff EEDATA,sub_b+1 | 99 movff EEDATA,sub_b+1 |
100 | 100 |
101 movlw LOW d'2000' ; must be greater then 2000mV... | 101 movlw LOW d'2000' ; must be greater then 2000mV... |
102 movwf sub_a+0 | 102 movwf sub_a+0 |
103 movlw HIGH d'2000' | 103 movlw HIGH d'2000' |
104 movwf sub_a+1 | 104 movwf sub_a+1 |
105 call subU16 ; sub_c = sub_a - sub_b | 105 call subU16 ; sub_c = sub_a - sub_b |
106 btfss neg_flag ; neg_flag=1 if eeprom40:41 < 2000 | 106 btfsc neg_flag ; neg_flag=1 if eeprom40:41 < 2000 |
107 bsf initialize_battery1 ; battery need to be initialised | 107 bsf initialize_battery1 ; battery need to be initialised |
108 | 108 |
109 movlw LOW d'4500' ; must be lower then 4500mV... | 109 movlw LOW d'4500' ; must be lower then 4500mV... |
110 movwf sub_a+0 | 110 movwf sub_a+0 |
111 movlw HIGH d'4500' | 111 movlw HIGH d'4500' |
112 movwf sub_a+1 | 112 movwf sub_a+1 |
113 call subU16 ; sub_c = sub_a - sub_b | 113 call subU16 ; sub_c = sub_a - sub_b |
114 btfsc neg_flag ; neg_flag=1 if eeprom40:41 < 4500 | 114 btfss neg_flag ; neg_flag=1 if eeprom40:41 < 4500 |
115 bsf initialize_battery1 ; battery need to be initialised | 115 bsf initialize_battery1 ; battery need to be initialised |
116 | 116 |
117 btfss initialize_battery1 ; battery need to be initialised? | 117 btfss initialize_battery1 ; battery need to be initialised? |
118 bra get_battery_no_init ; No, we have already valid values, just check for new extremas | 118 bra get_battery_no_init ; No, we have already valid values, just check for new extremas |
119 | 119 |
245 bsf PIE1, TMR1IE ; Enable clock int | 245 bsf PIE1, TMR1IE ; Enable clock int |
246 return | 246 return |
247 | 247 |
248 reset_battery_stats: | 248 reset_battery_stats: |
249 bcf uart_reset_battery_stats ; Clear flag | 249 bcf uart_reset_battery_stats ; Clear flag |
250 clrf EEADRH | |
250 bcf PIE1,RCIE ; no interrupt for UART | 251 bcf PIE1,RCIE ; no interrupt for UART |
251 call rs232_get_byte ; Get Byte | 252 call rs232_get_byte ; Get Byte |
252 bcf PIR1,RCIF ; clear flag | 253 bcf PIR1,RCIF ; clear flag |
253 | 254 |
254 btfsc rs232_recieve_overflow ; Byte received? | 255 btfsc rs232_recieve_overflow ; Byte received? |