Mercurial > public > hwos_code
comparison src/isr.asm @ 113:f3062a611eef
Merge
author | heinrichsweikamp |
---|---|
date | Mon, 23 Jun 2014 16:14:33 +0200 |
parents | ec4d8503ec45 |
children | e3ac5b2021bc |
comparison
equal
deleted
inserted
replaced
112:a24581f0b372 | 113:f3062a611eef |
---|---|
34 | 34 |
35 HighInt: | 35 HighInt: |
36 movff PRODL,isr_prod+0 | 36 movff PRODL,isr_prod+0 |
37 movff PRODH,isr_prod+1 | 37 movff PRODH,isr_prod+1 |
38 | 38 |
39 ; Pressure sensor and others | |
40 btfsc PIR5,TMR7IF ; Timer 7 | |
41 rcall isr_tmr7 ; Every 62,5ms | |
42 | |
43 ; Buttons | 39 ; Buttons |
44 btfsc PIR1,TMR1IF ; Timer1 INT (Button hold-down Timer) | 40 btfsc PIR1,TMR1IF ; Timer1 INT (Button hold-down Timer) |
45 rcall timer1int | 41 rcall timer1int |
46 btfsc INTCON,INT0IF ; Buttons | 42 btfsc INTCON,INT0IF ; Buttons |
47 rcall isr_switch_right | 43 rcall isr_switch_right |
48 btfsc INTCON3,INT1IF ; Buttons | 44 btfsc INTCON3,INT1IF ; Buttons |
49 rcall isr_switch_left | 45 rcall isr_switch_left |
50 | 46 |
51 ; IR-Link | 47 ; IR-Link |
48 btfsc PIR3,RC2IF ; UART2 | |
49 rcall isr_uart2 ; IR-Link | |
52 btfsc PIR2,TMR3IF ; Timer 3 | 50 btfsc PIR2,TMR3IF ; Timer 3 |
53 rcall isr_timer3 ; IR-Link Timeout | 51 rcall isr_timer3 ; IR-Link Timeout |
54 btfsc PIR3,RC2IF ; UART2 | 52 |
55 rcall isr_uart2 ; IR-Link | 53 ; Pressure sensor and others |
54 btfsc PIR5,TMR7IF ; Timer 7 | |
55 rcall isr_tmr7 ; Every 62,5ms | |
56 | |
57 ;; IR-Link (again) | |
58 ; btfsc PIR3,RC2IF ; UART2 | |
59 ; rcall isr_uart2 ; IR-Link | |
56 | 60 |
57 ; RTCC | 61 ; RTCC |
58 btfsc PIR3,RTCCIF ; Real-time-clock interrupt | 62 btfsc PIR3,RTCCIF ; Real-time-clock interrupt |
59 rcall isr_rtcc ; May return in bank common! | 63 rcall isr_rtcc ; May return in bank common! |
60 | 64 |
103 movwf ir_buffer+.13 | 107 movwf ir_buffer+.13 |
104 dcfsnz isr1_temp,F | 108 dcfsnz isr1_temp,F |
105 movwf ir_buffer+.14 | 109 movwf ir_buffer+.14 |
106 dcfsnz isr1_temp,F | 110 dcfsnz isr1_temp,F |
107 movwf ir_buffer+.15 | 111 movwf ir_buffer+.15 |
112 dcfsnz isr1_temp,F | |
113 movwf ir_buffer+.16 | |
114 dcfsnz isr1_temp,F | |
115 movwf ir_buffer+.17 | |
116 | |
108 clrf TMR3L ; Preload timer | 117 clrf TMR3L ; Preload timer |
109 movlw .253 | 118 movlw .253 |
110 movwf TMR3H | 119 movwf TMR3H |
111 bsf T3CON,TMR3ON ; (Re)Start Timeout counter | 120 bsf T3CON,TMR3ON ; (Re)Start Timeout counter |
112 return | 121 return |
113 | 122 |
114 isr_timer3: ; IR-Link Timeout | 123 isr_timer3: ; IR-Link Timeout |
115 bcf T3CON,TMR3ON ; Stop Timer3 | 124 bcf T3CON,TMR3ON ; Stop Timer3 |
125 movff ir_counter,char_I_extra_time | |
116 banksel isr_backup ; Select Bank0 for ISR data. | 126 banksel isr_backup ; Select Bank0 for ISR data. |
117 movlw .15 | 127 movlw .15 |
118 cpfseq ir_counter ; Got exact 15bytes? | 128 cpfseq ir_counter ; Got exact 15bytes? |
119 bra isr_timer3_1 ; No, test for 16bytes | 129 bra isr_timer3_1 ; No, test for 16bytes |
120 bra isr_timer3_2 ; Got 15 bytes, compute local checksum | 130 bra isr_timer3_ir ; Got 15 bytes, compute local checksum |
121 isr_timer3_1: | 131 isr_timer3_1: |
122 movlw .16 | 132 movlw .16 |
123 cpfseq ir_counter ; Got exact 16bytes? | 133 cpfseq ir_counter ; Got exact 16bytes? |
124 bra isr_timer3_exit ; No, exit | 134 bra isr_timer3_2 ; No, test for 17bytes |
125 tstfsz ir_buffer+.15 ; Last byte=0x00 | 135 tstfsz ir_buffer+.15 ; Last byte=0x00 |
126 bra isr_timer3_exit ; No, exit | 136 bra isr_timer3_exit ; No, exit |
127 | 137 bra isr_timer3_ir ; Got 16 bytes, compute local checksum |
128 isr_timer3_2: | 138 isr_timer3_2: |
139 movlw .17 | |
140 cpfseq ir_counter ; Got exact 17bytes? | |
141 bra isr_timer3_exit ; No, exit | |
142 bra isr_timer3_s8 ; S8 data | |
143 | |
144 isr_timer3_ir: ; IR input | |
129 movff ir_buffer+.0,PRODL | 145 movff ir_buffer+.0,PRODL |
130 clrf PRODH | 146 clrf PRODH |
131 movf ir_buffer+.1,W | 147 movf ir_buffer+.1,W |
132 rcall isr_timer3_checksum | 148 rcall isr_timer3_checksum |
133 movf ir_buffer+.2,W | 149 movf ir_buffer+.2,W |
187 addwf PRODL,F | 203 addwf PRODL,F |
188 movlw .0 | 204 movlw .0 |
189 addwfc PRODH,F | 205 addwfc PRODH,F |
190 return | 206 return |
191 | 207 |
208 isr_timer3_s8: ; IR input | |
209 movff ir_buffer+.0,PRODL | |
210 clrf PRODH | |
211 movf ir_buffer+.1,W | |
212 rcall isr_timer3_checksum | |
213 movf ir_buffer+.2,W | |
214 rcall isr_timer3_checksum | |
215 movf ir_buffer+.3,W | |
216 rcall isr_timer3_checksum | |
217 movf ir_buffer+.4,W | |
218 rcall isr_timer3_checksum | |
219 movf ir_buffer+.5,W | |
220 rcall isr_timer3_checksum | |
221 movf ir_buffer+.6,W | |
222 rcall isr_timer3_checksum | |
223 movf ir_buffer+.7,W | |
224 rcall isr_timer3_checksum | |
225 movf ir_buffer+.8,W | |
226 rcall isr_timer3_checksum | |
227 movf ir_buffer+.9,W | |
228 rcall isr_timer3_checksum | |
229 movf ir_buffer+.10,W | |
230 rcall isr_timer3_checksum | |
231 movf ir_buffer+.11,W | |
232 rcall isr_timer3_checksum | |
233 movf ir_buffer+.12,W | |
234 rcall isr_timer3_checksum | |
235 movf ir_buffer+.13,W | |
236 rcall isr_timer3_checksum | |
237 movf ir_buffer+.14,W | |
238 rcall isr_timer3_checksum | |
239 | |
240 ; Compare checksum | |
241 movf ir_buffer+.15,W | |
242 cpfseq PRODL ; Checksum ok? | |
243 bra isr_timer3_exit ; No, exit | |
244 movf ir_buffer+.16,W | |
245 cpfseq PRODH ; Checksum ok? | |
246 bra isr_timer3_exit ; No, exit | |
247 | |
248 ; Checksum OK, copy results | |
249 movff ir_buffer+.3,hud_status_byte | |
250 movff ir_buffer+.13,hud_battery_mv+0 | |
251 movff ir_buffer+.14,hud_battery_mv+1 | |
252 | |
253 banksel common | |
254 bsf new_s8_data_available ; set flag | |
255 banksel ir_timeout | |
256 | |
257 movlw ir_timeout_value ; multiples of 62,5ms | |
258 movwf ir_timeout ; Reload timeout | |
259 bra isr_timer3_exit ; Exit | |
260 | |
261 | |
192 ;============================================================================= | 262 ;============================================================================= |
193 | 263 |
194 isr_tmr7: ; each 62,5ms | 264 isr_tmr7: ; each 62,5ms |
195 bcf PIR5,TMR7IF ; clear flag | 265 bcf PIR5,TMR7IF ; clear flag |
196 banksel 0xF16 ; Addresses, F16h through F5Fh, are also used by SFRs, but are not part of the Access RAM. | 266 banksel 0xF16 ; Addresses, F16h through F5Fh, are also used by SFRs, but are not part of the Access RAM. |
209 | 279 |
210 movlw ir_timeout_value ; multiples of 62,5ms | 280 movlw ir_timeout_value ; multiples of 62,5ms |
211 movwf ir_timeout ; Reload timeout | 281 movwf ir_timeout ; Reload timeout |
212 | 282 |
213 banksel common | 283 banksel common |
284 btfss c3_hardware | |
285 bra isr_tmr7_1a ; Always with normal ostc3 hardware | |
286 btfss s8_digital | |
287 bra isr_tmr7_2 ; only when digital | |
288 isr_tmr7_1a: | |
214 clrf o2_mv_sensor1+0 | 289 clrf o2_mv_sensor1+0 |
215 clrf o2_mv_sensor1+1 | 290 clrf o2_mv_sensor1+1 |
216 clrf o2_mv_sensor2+0 | 291 clrf o2_mv_sensor2+0 |
217 clrf o2_mv_sensor2+1 | 292 clrf o2_mv_sensor2+1 |
218 clrf o2_mv_sensor3+0 | 293 clrf o2_mv_sensor3+0 |