annotate src/sleepmode.asm @ 586:06642f6ffe59

2.97 release
author heinrichsweikamp
date Thu, 01 Mar 2018 11:12:47 +0100
parents b455b31ce022
children ca4556fb60b9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
3 ; File sleepmode.asm Version 2.98
0
heinrichsweikamp
parents:
diff changeset
4 ;
heinrichsweikamp
parents:
diff changeset
5 ; Sleepmode
heinrichsweikamp
parents:
diff changeset
6 ;
heinrichsweikamp
parents:
diff changeset
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
8 ;==============================================================================
0
heinrichsweikamp
parents:
diff changeset
9 ; HISTORY
heinrichsweikamp
parents:
diff changeset
10 ; 2011-08-12 : [mH] moving from OSTC code
heinrichsweikamp
parents:
diff changeset
11
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
12 #include "hwos.inc" ; Mandatory header
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
13 #include "shared_definitions.h" ; Mailbox from/to p2_deco.c
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
14 #include "surfmode.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
15 #include "tft.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
16 #include "isr.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
17 #include "start.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
18 #include "adc_lightsensor.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
19 #include "math.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
20 #include "ms5541.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
21 #include "wait.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
22 #include "eeprom_rs232.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
23 #include "external_flash.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
24 #include "ghostwriter.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
25 #include "i2c.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
26 #include "mcp.inc"
0
heinrichsweikamp
parents:
diff changeset
27
133
939f1e83c4c2 BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents: 123
diff changeset
28
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
29 extern vault_decodata_into_eeprom
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
30
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
31
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
32 ;---- Private local variables -------------------------------------------------
133
939f1e83c4c2 BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents: 123
diff changeset
33
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
34 CBLOCK local1 ; max size is 16 Byte !!!
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
35 sm_temp1 ; sleepmode temporary 1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
36 sm_temp2 ; sleepmode temporary 2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
37 sm_timer1 ; timer for pressure check every 10 seconds
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
38 sm_timer2 ; timer for 10 minutes tasks (updating of tissues)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
39 sm_timer3 ; timer for 15 minutes tasks (updating of surface pressure)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
40 ENDC ; used: 5 byte, remaining: 11 byte
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
41
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
42
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
43 gui CODE
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
44
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
45 ;==============================================================================
0
heinrichsweikamp
parents:
diff changeset
46
heinrichsweikamp
parents:
diff changeset
47 global sleeploop
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
48 sleeploop: ; enter sleepmode!
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
49 call disable_ir_s8 ; IR/S8 off
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
50 call mcp_sleep
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
51 bcf LEDg
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
52 bcf LEDr
0
heinrichsweikamp
parents:
diff changeset
53 call TFT_Display_FadeOut
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
54 call TFT_DisplayOff ; display off
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
55 bcf enable_screen_dumps ; =1: Ignore vin_usb, wait for "l" command (Screen dump)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
56 call disable_rs232 ; USB off
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
57 call vault_decodata_into_eeprom ; store deco data
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
58 call ext_flash_enable_protection ; enable write protection for external flash
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
59 call update_battery_registers ; update battery registers into EEPROM
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
60 clrf sm_temp1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
61 clrf sm_temp2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
62 clrf sm_timer1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
63 clrf sm_timer2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
64 clrf sm_timer3
0
heinrichsweikamp
parents:
diff changeset
65 call speed_normal
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
66 bsf no_sensor_int ; No sensor interrupt
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
67 clrf ADCON0 ; Power-Down ADC Module
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
68
490
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
69 sleeploop_pre:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
70 bcf deep_sleep ; Normal sleepmode
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
71 call I2C_sleep_accelerometer
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
72 call I2C_sleep_compass
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
73 btfss analog_switches
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
74 bra sleeploop_loop ; no analog switches
490
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
75
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
76 bsf power_sw1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
77 btfss power_sw1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
78 bra $-4
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
79 bsf power_sw2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
80 btfss power_sw2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
81 bra $-4
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
82 movlw .4 ; Wait for button circuity
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
83 movwf sm_temp1 ; Used as temp
490
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
84 bcf onesecupdate
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
85
490
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
86 sleeploop_pre1:
491
66b9b8c082a9 minor new sleepmode fix
heinrichsweikamp
parents: 490
diff changeset
87 rcall sleepmode_sleep
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
88 btfss onesecupdate ; Wait 1 second
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
89 bra sleeploop_pre1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
90 bcf onesecupdate
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
91 decfsz sm_temp1,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
92 bra sleeploop_pre1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
93 movlw .32 ; Wait for button circuity
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
94 movwf sm_temp1 ; Used as temp
490
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
95
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
96 sleeploop_pre2:
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
97 call get_analog_switches
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
98 decfsz sm_temp1,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
99 bra sleeploop_pre2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
100
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
101 bcf PIR1,TMR1IF
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
102 bcf INTCON,INT0IF
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
103 bcf INTCON3,INT1IF
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
104 bcf PIR5,TMR7IF
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
105 bcf switch_left
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
106 bcf switch_right
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
107 bcf analog_sw2_pressed
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
108 bcf analog_sw1_pressed
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
109 bsf PIE1,0 ; (Re)Start Timer 1 Interrupt
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
110 bsf PIE2,1 ; (Re)Start Timer 2 Interrupt
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
111 bsf PIE5,3 ; (Re)Start Timer 7 Interrupt
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
112 bsf INTCON,4 ; (Re)Start INT0 Interrupt
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
113 bsf INTCON3,3 ; (Re)Start INT1 Interrupt
490
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
114
0
heinrichsweikamp
parents:
diff changeset
115 sleeploop_loop:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
116 btfsc onesecupdate ; one second in sleep?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
117 rcall onesec_sleep ; check switches, check pressure sensor, etc.
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
118
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
119 btfss sleepmode ; wake up? (This bit will be set in other routines)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
120 goto restart ; yes
0
heinrichsweikamp
parents:
diff changeset
121
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
122 btfsc deep_sleep ; Enter deep sleep?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
123 bra deepsleep ; Yes
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
124
491
66b9b8c082a9 minor new sleepmode fix
heinrichsweikamp
parents: 490
diff changeset
125 no_deepsleep:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
126 rcall sleepmode_sleep ; Wait at least 35ms (every 62,5ms Timer7 wakeup)
0
heinrichsweikamp
parents:
diff changeset
127
heinrichsweikamp
parents:
diff changeset
128 ; Any button pressed in sleep?
490
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
129 ; btfsc switch_left
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
130 ; rcall onesec_sleep1a
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
131 ; btfsc switch_right
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
132 ; rcall onesec_sleep1a
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
133 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
134 ; btfss sleepmode ; wake up? (This bit will be set in other routines)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
135 ; goto restart ; yes
0
heinrichsweikamp
parents:
diff changeset
136
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
137 bra sleeploop_loop ; do loop until something happens
0
heinrichsweikamp
parents:
diff changeset
138
490
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
139 deepsleep:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
140 btfss analog_switches
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
141 bra no_deepsleep ; no analog switches, no deep sleep required
490
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
142
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
143 bcf PIE1,0 ; Stop Timer 1 Interrupt
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
144 bcf PIE2,1 ; Stop Timer 2 Interrupt
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
145 bcf PIE5,3 ; Stop Timer 7 Interrupt
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
146 bcf INTCON,4 ; Stop INT0 Interrupt
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
147 bcf INTCON3,3 ; Stop INT1 Interrupt
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
148 bcf power_sw1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
149 bcf power_sw2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
150 rcall deepsleep_get_accel ; Read accelerometer into WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
151 movwf sm_temp1 ; Store init value
490
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
152
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
153 deepsleep_loop:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
154 btfsc onesecupdate ; one second in sleep?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
155 rcall onesec_deepsleep ; check accelerometer
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
156
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
157 btfsc onesecupdate ; one second in sleep?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
158 rcall onesec_sleep ; check switches, check pressure sensor, etc.
490
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
159
491
66b9b8c082a9 minor new sleepmode fix
heinrichsweikamp
parents: 490
diff changeset
160 rcall sleepmode_sleep
490
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
161
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
162 btfss deep_sleep ; Enter normal sleepmode?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
163 bra sleeploop_pre ; Yes
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
164
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
165 bra deepsleep_loop ; do loop until something happens
490
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
166
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
167 onesec_deepsleep:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
168 rcall deepsleep_get_accel ; Read accelerometer into WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
169 subwf sm_temp1,W ; sm_temp1 - accel_DZ+0 -> WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
170 btfsc STATUS,N ; Result negative?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
171 negf WREG ; Yes, negate it
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
172 movwf sm_temp2 ; change of acceleration in Z-axis
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
173 movlw .50 ; Threshold (mg)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
174 cpfslt sm_temp2 ; bigger then the threshold?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
175 bcf deep_sleep ; Yes!
490
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
176
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
177 ; extern piezo_config_tx
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
178 ; movff sm_temp1,WREG
490
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
179 ; call piezo_config_tx
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
180 ; movff accel_DZ+0,WREG
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
181 ; call piezo_config_tx
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
182 ; movff sm_temp2,WREG
490
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
183 ; call piezo_config_tx
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
184
490
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
185 return
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
186
490
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
187 deepsleep_get_accel:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
188 call I2C_init_compass ; required for compass1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
189 call I2C_init_accelerometer ; required for compass2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
190 call I2C_RX_accelerometer ; read Accelerometer
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
191 call I2C_sleep_compass ; required for compass1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
192 call I2C_sleep_accelerometer ; required for compass2
490
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
193 movff accel_DZ+0,WREG
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
194 return
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
195
134
4574aed5cd4c Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents: 133
diff changeset
196 onehour_sleep:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
197 call update_battery_registers ; update battery registers into EEPROM
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
198 call vault_decodata_into_eeprom ; update deco data
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
199 bcf onehourupdate ; all done
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
200 return
0
heinrichsweikamp
parents:
diff changeset
201
heinrichsweikamp
parents:
diff changeset
202 onemin_sleep:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
203 btfsc onehourupdate ; one hour in sleep?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
204 rcall onehour_sleep ; Yes
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
205
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
206 btfsc battery_gauge_available
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
207 call get_battery_voltage ; Check for charger
198
c511dc403d7e (Slightly) reduce current consumption in Eco and sleep mode
heinrichsweikamp
parents: 134
diff changeset
208
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
209 ;---- update tissues and CNS every 10 minutes when gradient factor is 0 (no supersaturation in any tissue any more)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
210 movff int_O_gradient_factor+0,WREG ; get gradient factor, only the lower byte is used for the value
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
211 tstfsz WREG ; gradient factor = 0?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
212 bra onemin_sleep1 ; NO - continue with air pressure compensation
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
213 incf sm_timer2,F ; count-up...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
214 movlw d'9' ; ...to 9
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
215 cpfsgt sm_timer2 ; 10 minutes over?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
216 bra onemin_sleep1 ; NO - continue with air pressure compensation
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
217 clrf sm_timer2 ; reset counter
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
218 SAFE_2BYTE_COPY amb_pressure, int_I_pres_respiration ; copy pressure to deco routine
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
219 call deco_calc_dive_interval_10min ; calculate 10 minutes under surface conditions
0
heinrichsweikamp
parents:
diff changeset
220 banksel common
heinrichsweikamp
parents:
diff changeset
221
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
222 onemin_sleep1:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
223 ;---- adjust air pressure compensation any 15 minutes
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
224 incf sm_timer3,F ; count-up...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
225 movlw d'14' ; ...to 14
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
226 cpfsgt sm_timer3 ; 15 minutes over?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
227 bra onemin_sleep2 ; NO - continue with every-minute-tasks
0
heinrichsweikamp
parents:
diff changeset
228
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
229 ; Tasks every 15 minutes in sleep
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
230 bsf deep_sleep ; enter deep-sleep mode
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
231 clrf sm_timer3 ; reset counter
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
232
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
233 SAFE_2BYTE_COPY last_surfpressure_15min, last_surfpressure_30min ; save older air pressure
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
234 SAFE_2BYTE_COPY amb_pressure, last_surfpressure_15min ; save new air pressure
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
235
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
236 movlw LOW max_surfpressure
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
237 movff WREG,sub_a+0 ; max. "allowed" air pressure in mbar
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
238 movlw HIGH max_surfpressure
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
239 movff WREG,sub_a+1 ; max. "allowed" air pressure in mbar
0
heinrichsweikamp
parents:
diff changeset
240 movff last_surfpressure_15min+0,sub_b+0
heinrichsweikamp
parents:
diff changeset
241 movff last_surfpressure_15min+1,sub_b+1
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
242 call subU16 ; sub_c = sub_a - sub_b
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
243 btfss neg_flag ; Is 1080mbar < amb_pressure ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
244 bra onemin_sleep2 ; NO: current air pressure is lower then "allowed" air pressure, ok!
0
heinrichsweikamp
parents:
diff changeset
245
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
246 ; not ok! Overwrite with max. "allowed" air pressure
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
247 movlw LOW max_surfpressure
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
248 movff WREG,last_surfpressure_15min+0 ; max. "allowed" air pressure in mbar
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
249 movlw HIGH max_surfpressure
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
250 movff WREG,last_surfpressure_15min+1 ; max. "allowed" air pressure in mbar
0
heinrichsweikamp
parents:
diff changeset
251
heinrichsweikamp
parents:
diff changeset
252 onemin_sleep2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
253 ; Tasks every minute in sleep
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
254
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
255 ;---- update tissues and CNS every minute when gradient factor is >0 (supersaturation in at least one tissue)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
256 movff int_O_gradient_factor+0,WREG ; get gradient factor, only the lower byte is used for the value
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
257 tstfsz WREG ; gradient factor = 0?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
258 bra onemin_sleep3 ; NO - do tissue update on 1 minute schedule
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
259 bra onemin_sleep4 ; YES - tissue update is done on 10 minutes schedule
0
heinrichsweikamp
parents:
diff changeset
260
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
261 onemin_sleep3:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
262 SAFE_2BYTE_COPY amb_pressure, int_I_pres_respiration ; copy pressure to deco routine
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
263 call deco_calc_dive_interval_1min ; calculate 1 minute under surface conditions
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
264 banksel common
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
265
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
266 onemin_sleep4:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
267 bcf oneminupdate ; all done
0
heinrichsweikamp
parents:
diff changeset
268 return
heinrichsweikamp
parents:
diff changeset
269
heinrichsweikamp
parents:
diff changeset
270 onesec_sleep:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
271 btfsc oneminupdate ; one minute in sleep?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
272 rcall onemin_sleep ; do one-minute tasks, e.g. calculate desaturation
198
c511dc403d7e (Slightly) reduce current consumption in Eco and sleep mode
heinrichsweikamp
parents: 134
diff changeset
273
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
274 btfsc battery_gauge_available
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
275 call get_battery_voltage ; Check for charger
120
e2f04bb2539c battery check in sleep
heinrichsweikamp
parents: 50
diff changeset
276
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
277 incf sm_timer1,F ; counts to #test_pressure_in_sleep (10)
490
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 448
diff changeset
278 movlw d'10'
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
279 cpfsgt sm_timer1 ; here: temp variable
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
280 bra onesec_sleep1 ; #test_pressure_in_sleep not done yet
0
heinrichsweikamp
parents:
diff changeset
281
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
282 clrf sm_timer1 ; clear counter
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
283 rcall pressuretest_sleep_fast ; Gets pressure without averaging (faster!)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
284 ; compare current ambient pressure with wake_up_from_sleep
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
285 movlw LOW wake_up_from_sleep
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
286 movwf sub_a+0 ; power on if ambient pressure is greater threshold
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
287 movlw HIGH wake_up_from_sleep
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
288 movwf sub_a+1 ; power on if ambient pressure is greater threshold
0
heinrichsweikamp
parents:
diff changeset
289 SAFE_2BYTE_COPY amb_pressure, sub_b
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
290 call subU16 ; Is (1160mbar - averaged(amb_pressure)) < 0 ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
291 btfsc neg_flag ; Wake up from Sleep?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
292 bra onesec_sleep1a ; Yes, skip button checks, wake up!
0
heinrichsweikamp
parents:
diff changeset
293
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
294 btfsc battery_gauge_available
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
295 bra onesec_sleep1 ; No wake-up with cR hardware
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
296 btfsc vusb_in ; USB plugged in?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
297 bra onesec_sleep1a ; Yes, skip button checks, wake up!
0
heinrichsweikamp
parents:
diff changeset
298
heinrichsweikamp
parents:
diff changeset
299 onesec_sleep1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
300 bcf onesecupdate ; all done.
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
301 ; Check switches
0
heinrichsweikamp
parents:
diff changeset
302 btfsc switch_left
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
303 bra onesec_sleep1a
0
heinrichsweikamp
parents:
diff changeset
304 btfsc switch_right
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
305 bra onesec_sleep1a
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
306
0
heinrichsweikamp
parents:
diff changeset
307 ; No button pressed
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
308 ; bcf INTCON,INT0IF ; Clear flag
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
309 ; bcf INTCON3,INT1IF ; Clear flag
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
310
0
heinrichsweikamp
parents:
diff changeset
311 return
heinrichsweikamp
parents:
diff changeset
312
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
313 onesec_sleep1a: ; At least one button pressed or amb_pressure > wake_up_from_sleep
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
314 ; bcf INTCON,INT0IF ; Clear flag
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
315 ; bcf INTCON3,INT1IF ; Clear flag
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
316 bcf sleepmode ; wake up!
0
heinrichsweikamp
parents:
diff changeset
317 SAFE_2BYTE_COPY last_surfpressure_30min, amb_pressure ; copy for compatibility
heinrichsweikamp
parents:
diff changeset
318 movlw .0
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
319 movff WREG,sensor_state_counter ; Reset sensor state counter
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
320 bcf no_sensor_int ; normal sensor interrupt mode
0
heinrichsweikamp
parents:
diff changeset
321 return
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
322
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
323 pressuretest_sleep_fast: ; Get pressure without averaging (Faster to save some power in sleep mode)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
324 banksel isr_backup ; Back to Bank0 ISR data
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
325 clrf amb_pressure_avg+0 ; pressure average registers
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
326 clrf amb_pressure_avg+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
327 clrf temperature_avg+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
328 clrf temperature_avg+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
329 call get_temperature_start ; and start temperature integration (73,5us)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
330 banksel common
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
331 rcall sleepmode_sleep ; Wait at least 35ms (every 62,5ms Timer7 wakeup)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
332 rcall sleepmode_sleep ; Wait at least 35ms (every 62,5ms Timer7 wakeup)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
333 banksel isr_backup ; Back to Bank0 ISR data
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
334 call get_temperature_value ; State 1: Get temperature
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
335 call get_pressure_start ; Start pressure integration.
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
336 banksel common
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
337 rcall sleepmode_sleep ; Wait at least 35ms (every 62,5ms Timer7 wakeup)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
338 rcall sleepmode_sleep ; Wait at least 35ms (every 62,5ms Timer7 wakeup)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
339 banksel isr_backup ; Back to Bank0 ISR data
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
340 call get_pressure_value ; State2: Get pressure (51us)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
341 call calculate_compensation ; calculate temperature compensated pressure (27us)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
342 banksel common
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
343 SAFE_2BYTE_COPY amb_pressure_avg, amb_pressure ; copy for compatibility
0
heinrichsweikamp
parents:
diff changeset
344 return
heinrichsweikamp
parents:
diff changeset
345
heinrichsweikamp
parents:
diff changeset
346 sleepmode_sleep:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
347 banksel 0xF16 ; Addresses, F16h through F5Fh, are also used by SFRs, but are not part of the Access RAM.
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
348 clrf T7GCON ; Reset Timer7 Gate Control register
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
349 movlw b'10001101' ; 1:1 Prescaler -> 2seconds@32768Hz, not synced
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
350 movwf T7CON
0
heinrichsweikamp
parents:
diff changeset
351 sleep
198
c511dc403d7e (Slightly) reduce current consumption in Eco and sleep mode
heinrichsweikamp
parents: 134
diff changeset
352 sleep
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
353 clrf T7GCON ; Reset Timer7 Gate Control register
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
354 movlw b'10001001' ; 1:1 Prescaler -> 2seconds@32768Hz, synced
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
355 movwf T7CON
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
356 banksel common ; Bank1
0
heinrichsweikamp
parents:
diff changeset
357 return
heinrichsweikamp
parents:
diff changeset
358
heinrichsweikamp
parents:
diff changeset
359 END