Mercurial > public > hwos_code
comparison src/sleepmode.asm @ 646:5b7fe7777425
3.16 release
author | heinrichs weikamp |
---|---|
date | Thu, 14 Oct 2021 12:03:24 +0200 |
parents | 8c1f1f334275 |
children | bc214815deb2 |
comparison
equal
deleted
inserted
replaced
642:a9a0188091e4 | 646:5b7fe7777425 |
---|---|
77 ENDIF | 77 ENDIF |
78 | 78 |
79 bsf sleepmode ; flag being in sleep mode | 79 bsf sleepmode ; flag being in sleep mode |
80 bsf block_sensor_interrupt ; suspend ISR from executing sensor interrupts | 80 bsf block_sensor_interrupt ; suspend ISR from executing sensor interrupts |
81 | 81 |
82 bcf i2c_error_flag ; clear any I2C errors | |
83 | |
82 call disable_ir_s8_analog ; power-down IR/S8/analog interface | 84 call disable_ir_s8_analog ; power-down IR/S8/analog interface |
83 call mcp_sleep ; power-down RX power supply | 85 call mcp_sleep ; power-down RX power supply |
84 | 86 |
85 clrf ADCON0 ; power-down ADC module | 87 clrf ADCON0 ; power-down ADC module |
86 call disable_rs232 ; power-down USB | 88 call disable_rs232 ; power-down USB |
231 rcall one_min_sleep ; YES - do the every minute tasks | 233 rcall one_min_sleep ; YES - do the every minute tasks |
232 | 234 |
233 btfsc trigger_full_hour ; one hour in sleep? | 235 btfsc trigger_full_hour ; one hour in sleep? |
234 rcall one_hour_sleep ; YES - do the every hour tasks | 236 rcall one_hour_sleep ; YES - do the every hour tasks |
235 | 237 |
238 ; sleepmode pressure sampling for new sensor is done here | |
239 btfss press_sensor_type ; New sensor found? | |
240 return ; No, done. | |
241 | |
242 btfsc ms5837_state ; =0: result of temperature is in the ADC | |
243 bra one_sec_sleep_3 | |
244 call I2C_get_temp_val_MS5837 ; (Will set ms5837_state) | |
245 return | |
246 one_sec_sleep_3: | |
247 call I2C_get_press_val_MS5837 ; (Will clear ms5837_state) | |
236 return ; done | 248 return ; done |
237 | 249 |
238 | 250 |
239 ;----------------------------------------------------------------------------- | 251 ;----------------------------------------------------------------------------- |
240 ; Helper Function - Tasks every 10 Seconds in Sleep Mode | 252 ; Helper Function - Tasks every 10 Seconds in Sleep Mode |
392 ; faster method to save some power in sleep mode | 404 ; faster method to save some power in sleep mode |
393 ; | 405 ; |
394 pressuretest_sleep_fast: | 406 pressuretest_sleep_fast: |
395 banksel isr_backup ; select bank ISR data | 407 banksel isr_backup ; select bank ISR data |
396 | 408 |
397 CLRI pressure_abs_avg ; clear pressure average register | 409 clrf pressure_abs_avg+0 ; clear pressure average register |
410 clrf pressure_abs_avg+1 | |
411 clrf pressure_abs_avg+2 | |
412 | |
398 CLRI temperature_avg ; clear temperature average register | 413 CLRI temperature_avg ; clear temperature average register |
399 | 414 |
400 call get_temperature_start ; start temperature integration (73.5 us) | 415 call get_temperature_start ; start temperature integration (73.5 us) |
401 | 416 |
402 rcall sleepmode_sleep ; sleep for 62.5...125 ms | 417 rcall sleepmode_sleep ; sleep for 62.5...125 ms |
403 rcall sleepmode_sleep ; sleep for 62.5...125 ms | 418 rcall sleepmode_sleep ; sleep for 62.5...125 ms |
404 | 419 |
405 call get_temperature_value ; state 1: get temperature | 420 call get_temperature_value ; get temperature... (May return in bank common) |
421 banksel isr_backup ; select bank ISR data | |
406 call get_pressure_start ; start pressure integration | 422 call get_pressure_start ; start pressure integration |
407 | 423 |
408 rcall sleepmode_sleep ; sleep for 62.5...125 ms | 424 rcall sleepmode_sleep ; sleep for 62.5...125 ms |
409 rcall sleepmode_sleep ; sleep for 62.5...125 ms | 425 rcall sleepmode_sleep ; sleep for 62.5...125 ms |
410 | 426 |
411 call get_pressure_value ; state2: get pressure (51 us) | 427 call get_pressure_value ; state2: get pressure (51 us)(May return in bank common) |
428 banksel isr_backup ; select bank ISR data | |
412 call calculate_compensation ; calculate temperature compensated pressure (27 us) | 429 call calculate_compensation ; calculate temperature compensated pressure (27 us) |
413 | 430 |
414 MOVII pressure_abs_avg,pressure_abs ; get result, bypassing the averaging | 431 MOVII pressure_abs_avg,pressure_abs ; get result, bypassing the averaging |
415 | 432 |
416 banksel common ; back to bank common | 433 banksel common ; back to bank common |