annotate src/ostc3.asm @ 172:df449e5b1c81

BUGFIX: Future TTS in sensor mode
author heinrichsweikamp
date Tue, 30 Sep 2014 19:19:53 +0200
parents e2f04bb2539c
children a004b482604a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
heinrichsweikamp
parents:
diff changeset
3 ; File ostc3.asm
heinrichsweikamp
parents:
diff changeset
4 ;
heinrichsweikamp
parents:
diff changeset
5 ; Definition of the ostc3 dive computer platform.
heinrichsweikamp
parents:
diff changeset
6 ;
heinrichsweikamp
parents:
diff changeset
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
heinrichsweikamp
parents:
diff changeset
8 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
9 ; HISTORY
heinrichsweikamp
parents:
diff changeset
10 ; 2011-05-24 : [jDG] Cleanups from initial Matthias code.
heinrichsweikamp
parents:
diff changeset
11 ; 2011-06-24 : [MH] Added clock speeds.
heinrichsweikamp
parents:
diff changeset
12 #include "ostc3.inc"
heinrichsweikamp
parents:
diff changeset
13
heinrichsweikamp
parents:
diff changeset
14 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
15 ;----------------------------- CONFIG ---------------------------------
1
heinrichsweikamp
parents: 0
diff changeset
16 CONFIG RETEN = OFF ;Disabled - Controlled by SRETEN bit
heinrichsweikamp
parents: 0
diff changeset
17 CONFIG SOSCSEL = HIGH ;High Power SOSC circuit selected
heinrichsweikamp
parents: 0
diff changeset
18 CONFIG XINST = OFF ;Code won't excute in extended mode...
heinrichsweikamp
parents: 0
diff changeset
19 CONFIG FOSC = INTIO2 ;Internal RC oscillator, no clock-out
heinrichsweikamp
parents: 0
diff changeset
20 CONFIG PLLCFG = OFF
heinrichsweikamp
parents: 0
diff changeset
21 CONFIG IESO = OFF ;Disabled
heinrichsweikamp
parents: 0
diff changeset
22 CONFIG PWRTEN = OFF ;Disabled, because incompatible with ICD3 (Ri-400)
heinrichsweikamp
parents: 0
diff changeset
23 CONFIG BOREN = ON ;Controlled with SBOREN bit
heinrichsweikamp
parents: 0
diff changeset
24 CONFIG BORV = 2 ;2.0V
heinrichsweikamp
parents: 0
diff changeset
25 CONFIG BORPWR = MEDIUM ;BORMV set to medium power level
heinrichsweikamp
parents: 0
diff changeset
26 CONFIG WDTEN = ON ;WDT controlled by SWDTEN bit setting
heinrichsweikamp
parents: 0
diff changeset
27 CONFIG WDTPS = 128 ;1:128
heinrichsweikamp
parents: 0
diff changeset
28 CONFIG RTCOSC = SOSCREF ;RTCC uses SOSC
heinrichsweikamp
parents: 0
diff changeset
29 CONFIG MCLRE = ON ;MCLR Enabled, RG5 Disabled
heinrichsweikamp
parents: 0
diff changeset
30 CONFIG CCP2MX = PORTBE ;RE7-Microcontroller Mode/RB3-All other modes
0
heinrichsweikamp
parents:
diff changeset
31 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
32 boot CODE
heinrichsweikamp
parents:
diff changeset
33 global init_ostc3
heinrichsweikamp
parents:
diff changeset
34
heinrichsweikamp
parents:
diff changeset
35 init_ostc3:
heinrichsweikamp
parents:
diff changeset
36 banksel common ; Bank1
heinrichsweikamp
parents:
diff changeset
37 ;init oscillator
heinrichsweikamp
parents:
diff changeset
38 movlw b'01110010'
heinrichsweikamp
parents:
diff changeset
39 movwf OSCCON ; 16MHz INTOSC
heinrichsweikamp
parents:
diff changeset
40 movlw b'00001000'
heinrichsweikamp
parents:
diff changeset
41 movwf OSCCON2 ; Secondary Oscillator running
heinrichsweikamp
parents:
diff changeset
42 movlw b'00000000'
heinrichsweikamp
parents:
diff changeset
43 movwf OSCTUNE ; 4x PLL Disable (Bit6) - only works with 8 or 16MHz (=32 or 64MHz)
heinrichsweikamp
parents:
diff changeset
44 bcf RCON,SBOREN ; Bown-Out off
heinrichsweikamp
parents:
diff changeset
45 bcf RCON,IPEN ; Priority Interrupts off
heinrichsweikamp
parents:
diff changeset
46
heinrichsweikamp
parents:
diff changeset
47 ; I/O Ports
heinrichsweikamp
parents:
diff changeset
48 banksel 0xF16 ; Addresses, F16h through F5Fh, are also used by SFRs, but are not part of the Access RAM.
heinrichsweikamp
parents:
diff changeset
49
heinrichsweikamp
parents:
diff changeset
50 clrf REFOCON ; No reference oscillator active on REFO pin
heinrichsweikamp
parents:
diff changeset
51 clrf ODCON1 ; Disable Open Drain capability
heinrichsweikamp
parents:
diff changeset
52 clrf ODCON2 ; Disable Open Drain capability
heinrichsweikamp
parents:
diff changeset
53 clrf ODCON3 ; Disable Open Drain capability
heinrichsweikamp
parents:
diff changeset
54
heinrichsweikamp
parents:
diff changeset
55 movlw b'11000000' ; ANSEL, AN7 and AN6 -> Analog inputs, PORTA is digital.
heinrichsweikamp
parents:
diff changeset
56 movwf ANCON0
113
heinrichsweikamp
parents: 77
diff changeset
57 movlw b'00000111' ; ANSEL, AN8, AN9, AN10 -> Analog in
0
heinrichsweikamp
parents:
diff changeset
58 movwf ANCON1
heinrichsweikamp
parents:
diff changeset
59 movlw b'00000010' ; ANSEL, AN17 -> Analog input
heinrichsweikamp
parents:
diff changeset
60 movwf ANCON2
heinrichsweikamp
parents:
diff changeset
61
heinrichsweikamp
parents:
diff changeset
62 banksel common
heinrichsweikamp
parents:
diff changeset
63
heinrichsweikamp
parents:
diff changeset
64 movlw b'00000000' ; 1= Input -> Data TFT_high
heinrichsweikamp
parents:
diff changeset
65 movwf TRISA
heinrichsweikamp
parents:
diff changeset
66 movlw b'00000000' ; Init port
heinrichsweikamp
parents:
diff changeset
67 movwf PORTA
heinrichsweikamp
parents:
diff changeset
68
113
heinrichsweikamp
parents: 77
diff changeset
69 movlw b'00000011' ; 1= Input, (RB0, RB1) -> Switches, RB2 -> Power_MCP, RB3 -> s8_npower, RB4 -> LED_green, RB5 -> /TFT_POWER
0
heinrichsweikamp
parents:
diff changeset
70 movwf TRISB
113
heinrichsweikamp
parents: 77
diff changeset
71 movlw b'00101000' ; Init port
0
heinrichsweikamp
parents:
diff changeset
72 movwf PORTB
heinrichsweikamp
parents:
diff changeset
73
heinrichsweikamp
parents:
diff changeset
74 movlw b'10011010' ; 1= Input, (RC0, RC1) -> SOSC, RC2 -> TFT_LED_PWM, (RC3,RC4) -> I²C, RC5 -> MOSI_MS5541, (RC6, RC7) -> UART1
heinrichsweikamp
parents:
diff changeset
75 movwf TRISC
heinrichsweikamp
parents:
diff changeset
76 movlw b'00000000' ; Init port
heinrichsweikamp
parents:
diff changeset
77 movwf PORTC
heinrichsweikamp
parents:
diff changeset
78
heinrichsweikamp
parents:
diff changeset
79 movlw b'00100000' ; 1= Input, RD0 -> TFT_NCS, RD1 -> TFT_RS, RD2 -> TFT_NWR, RD3 -> TFT_RD, RD4 -> MOSI_Flash, RD5 -> MISO_Flash, RD6 -> CLK_Flash, RD7 -> TFT_NRESET
heinrichsweikamp
parents:
diff changeset
80 movwf TRISD
heinrichsweikamp
parents:
diff changeset
81 movlw b'00000000' ; Init port
heinrichsweikamp
parents:
diff changeset
82 movwf PORTD
heinrichsweikamp
parents:
diff changeset
83
heinrichsweikamp
parents:
diff changeset
84 movlw b'00000000' ; 1= Input, RE1 -> Power_IR, RE2 -> CS_MCP, RE3 -> LED_blue, RE4 -> power_sw1,
heinrichsweikamp
parents:
diff changeset
85 movwf TRISE
heinrichsweikamp
parents:
diff changeset
86 movlw b'00010000' ; Init port
heinrichsweikamp
parents:
diff changeset
87 movwf PORTE
heinrichsweikamp
parents:
diff changeset
88
113
heinrichsweikamp
parents: 77
diff changeset
89 movlw b'00111110' ; 1= Input, (RF1, RF2, RF3, RF4, RF5) -> Analog
0
heinrichsweikamp
parents:
diff changeset
90 movwf TRISF
heinrichsweikamp
parents:
diff changeset
91 movlw b'00000000' ; Init port
heinrichsweikamp
parents:
diff changeset
92 movwf PORTF
heinrichsweikamp
parents:
diff changeset
93
113
heinrichsweikamp
parents: 77
diff changeset
94 movlw b'00001110' ; 1= Input, <7:6> not implemented, RG0 -> TX3_PIEZO_CFG, RG2 -> RX2, RG3 -> AN17_RSSI, RG4 -> SOSC_OUT, RG5 -> /RESET
0
heinrichsweikamp
parents:
diff changeset
95 movwf TRISG
113
heinrichsweikamp
parents: 77
diff changeset
96 movlw b'00000001' ; Init port
0
heinrichsweikamp
parents:
diff changeset
97 movwf PORTG
heinrichsweikamp
parents:
diff changeset
98
heinrichsweikamp
parents:
diff changeset
99 movlw b'00000000' ; 1= Input -> Data TFT_low
heinrichsweikamp
parents:
diff changeset
100 movwf TRISH
heinrichsweikamp
parents:
diff changeset
101 movlw b'00000000' ; Init port
heinrichsweikamp
parents:
diff changeset
102 movwf PORTH
heinrichsweikamp
parents:
diff changeset
103
120
e2f04bb2539c battery check in sleep
heinrichsweikamp
parents: 113
diff changeset
104 movlw b'10011011' ; 1= Input, RJ4 -> vusb_in, RJ5 -> power_sw2, RJ6 -> CLK_MS5541, RJ7 -> MISO_MS5541
0
heinrichsweikamp
parents:
diff changeset
105 movwf TRISJ
heinrichsweikamp
parents:
diff changeset
106 movlw b'00100000' ; Init port
heinrichsweikamp
parents:
diff changeset
107 movwf PORTJ
heinrichsweikamp
parents:
diff changeset
108
heinrichsweikamp
parents:
diff changeset
109
heinrichsweikamp
parents:
diff changeset
110 ; Timer 0
28
heinrichsweikamp
parents: 1
diff changeset
111 movlw b'00000001' ; Timer0 with 1:4 prescaler
heinrichsweikamp
parents: 1
diff changeset
112 ; movlw b'00001000' ; Timer0 with 1:1 prescaler
0
heinrichsweikamp
parents:
diff changeset
113 movwf T0CON
heinrichsweikamp
parents:
diff changeset
114
heinrichsweikamp
parents:
diff changeset
115 ; Timer 1 - Button hold-down timer
heinrichsweikamp
parents:
diff changeset
116 movlw b'10001100' ; 32768Hz clock source, 1:1 Prescaler -> ; 30,51757813µs/bit in TMR1L:TMR1H
heinrichsweikamp
parents:
diff changeset
117 movwf T1CON
heinrichsweikamp
parents:
diff changeset
118
heinrichsweikamp
parents:
diff changeset
119 banksel 0xF16 ; Addresses, F16h through F5Fh, are also used by SFRs, but are not part of the Access RAM.
heinrichsweikamp
parents:
diff changeset
120
heinrichsweikamp
parents:
diff changeset
121 ; RTCC
heinrichsweikamp
parents:
diff changeset
122 movlw 0x55
heinrichsweikamp
parents:
diff changeset
123 movwf EECON2
heinrichsweikamp
parents:
diff changeset
124 movlw 0xAA
heinrichsweikamp
parents:
diff changeset
125 movwf EECON2
heinrichsweikamp
parents:
diff changeset
126 bsf RTCCFG,RTCWREN ; Unlock sequence for RTCWREN
heinrichsweikamp
parents:
diff changeset
127 bsf RTCCFG,RTCPTR1
heinrichsweikamp
parents:
diff changeset
128 bsf RTCCFG,RTCPTR0
heinrichsweikamp
parents:
diff changeset
129 bsf RTCCFG,RTCEN ; Module enable
heinrichsweikamp
parents:
diff changeset
130 bsf RTCCFG,RTCOE ; Output enable
heinrichsweikamp
parents:
diff changeset
131 movlw b'00000100' ; 32768Hz SOCS on RTCC pin (PORTG,4) Bit7-5: Pullups for Port D, E and J
heinrichsweikamp
parents:
diff changeset
132 movwf PADCFG1
heinrichsweikamp
parents:
diff changeset
133 movlw b'11000100'
heinrichsweikamp
parents:
diff changeset
134 movwf ALRMCFG ; 1 second alarm
heinrichsweikamp
parents:
diff changeset
135 movlw d'1'
heinrichsweikamp
parents:
diff changeset
136 movwf ALRMRPT ; Alarm repeat counter
heinrichsweikamp
parents:
diff changeset
137 movlw 0x55
heinrichsweikamp
parents:
diff changeset
138 movwf EECON2
heinrichsweikamp
parents:
diff changeset
139 movlw 0xAA
heinrichsweikamp
parents:
diff changeset
140 movwf EECON2
heinrichsweikamp
parents:
diff changeset
141 bcf RTCCFG,RTCWREN ; Lock sequence for RTCWREN
heinrichsweikamp
parents:
diff changeset
142
heinrichsweikamp
parents:
diff changeset
143 banksel common
heinrichsweikamp
parents:
diff changeset
144 ; A/D Converter
heinrichsweikamp
parents:
diff changeset
145 movlw b'00011000' ; power off ADC, select AN6
heinrichsweikamp
parents:
diff changeset
146 movwf ADCON0
heinrichsweikamp
parents:
diff changeset
147 movlw b'00100000' ; 2.048V Vref+
heinrichsweikamp
parents:
diff changeset
148 movwf ADCON1
heinrichsweikamp
parents:
diff changeset
149 movlw b'10001101' ; Right justified
heinrichsweikamp
parents:
diff changeset
150 movwf ADCON2
heinrichsweikamp
parents:
diff changeset
151
heinrichsweikamp
parents:
diff changeset
152
heinrichsweikamp
parents:
diff changeset
153 ;init serial port1 (TRISC6/7)
heinrichsweikamp
parents:
diff changeset
154 movlw b'00001000' ; BRG16=1
heinrichsweikamp
parents:
diff changeset
155 movwf BAUDCON1
heinrichsweikamp
parents:
diff changeset
156 movlw b'00100100' ; BRGH=1, SYNC=0
heinrichsweikamp
parents:
diff changeset
157 movwf TXSTA1
heinrichsweikamp
parents:
diff changeset
158 movlw .34 ; SPBRGH:SPBRG = .34 : 114285 BAUD @ 16MHz (+0,79% Error to 115200 BAUD)
heinrichsweikamp
parents:
diff changeset
159 movwf SPBRG1 ; SPBRGH:SPBRG = .207 : 19230 BAUD @ 16MHz (-0,16% Error to 19200 BAUD)
heinrichsweikamp
parents:
diff changeset
160 clrf SPBRGH1 ;
heinrichsweikamp
parents:
diff changeset
161 movlw b'10010000'
heinrichsweikamp
parents:
diff changeset
162 movwf RCSTA1
heinrichsweikamp
parents:
diff changeset
163
heinrichsweikamp
parents:
diff changeset
164 ;init serial port2 (TRISG2)
heinrichsweikamp
parents:
diff changeset
165 banksel BAUDCON2
113
heinrichsweikamp
parents: 77
diff changeset
166 movlw b'00100000' ; BRG16=0 ; inverted for IR
0
heinrichsweikamp
parents:
diff changeset
167 movwf BAUDCON2
heinrichsweikamp
parents:
diff changeset
168 movlw b'00100000' ; BRGH=0, SYNC=0
heinrichsweikamp
parents:
diff changeset
169 movwf TXSTA2
heinrichsweikamp
parents:
diff changeset
170 movlw .102 ; SPBRGH:SPBRG = .102 : 2403 BAUD @ 16MHz
heinrichsweikamp
parents:
diff changeset
171 movwf SPBRG2
heinrichsweikamp
parents:
diff changeset
172 clrf SPBRGH2
heinrichsweikamp
parents:
diff changeset
173 movlw b'10010000'
heinrichsweikamp
parents:
diff changeset
174 movwf RCSTA2
heinrichsweikamp
parents:
diff changeset
175 banksel common
heinrichsweikamp
parents:
diff changeset
176
heinrichsweikamp
parents:
diff changeset
177 ; Timer3 for IR-RX Timeout
heinrichsweikamp
parents:
diff changeset
178 clrf T3GCON ; Reset Timer3 Gate Control register
heinrichsweikamp
parents:
diff changeset
179 ; movlw b'10001101' ; 1:1 Prescaler -> 2seconds@32768Hz, not synced
heinrichsweikamp
parents:
diff changeset
180 movlw b'10001001' ; 1:1 Prescaler -> 2seconds@32768Hz, synced
heinrichsweikamp
parents:
diff changeset
181 ; 30,51757813µs/bit in TMR3L:TMR3H
heinrichsweikamp
parents:
diff changeset
182 movwf T3CON
heinrichsweikamp
parents:
diff changeset
183
heinrichsweikamp
parents:
diff changeset
184 ; SPI Module(s)
heinrichsweikamp
parents:
diff changeset
185 ; SPI2: External Flash
heinrichsweikamp
parents:
diff changeset
186 movlw b'00110000'
heinrichsweikamp
parents:
diff changeset
187 movwf SSP2CON1
heinrichsweikamp
parents:
diff changeset
188 movlw b'00000000'
heinrichsweikamp
parents:
diff changeset
189 movwf SSP2STAT
heinrichsweikamp
parents:
diff changeset
190 ; ->0,25MHz Bit clock @1MHz mode (Eco)
heinrichsweikamp
parents:
diff changeset
191 ; -> 4MHz Bit clock @16MHz mode (Normal)
heinrichsweikamp
parents:
diff changeset
192 ; -> 16MHz Bit clock @64MHz mode (Fastest)
heinrichsweikamp
parents:
diff changeset
193
heinrichsweikamp
parents:
diff changeset
194 ; MSSP1 Module: I2C Master
heinrichsweikamp
parents:
diff changeset
195 movlw b'00101000' ; I2C Master Mode
heinrichsweikamp
parents:
diff changeset
196 movwf SSP1CON1
heinrichsweikamp
parents:
diff changeset
197 movlw b'00000000'
heinrichsweikamp
parents:
diff changeset
198 movwf SSP1CON2
heinrichsweikamp
parents:
diff changeset
199 movlw 0x27
heinrichsweikamp
parents:
diff changeset
200 movwf SSP1ADD ; 100kHz @ 16MHz Fosc
heinrichsweikamp
parents:
diff changeset
201
heinrichsweikamp
parents:
diff changeset
202 ; PWM Module(s)
heinrichsweikamp
parents:
diff changeset
203 ; PWM1 for LED dimming
heinrichsweikamp
parents:
diff changeset
204 movlw b'00001100'
heinrichsweikamp
parents:
diff changeset
205 movwf CCP1CON
heinrichsweikamp
parents:
diff changeset
206 movlw b'00000001'
heinrichsweikamp
parents:
diff changeset
207 movwf PSTR1CON ; Pulse steering disabled
heinrichsweikamp
parents:
diff changeset
208 movlw d'255'
heinrichsweikamp
parents:
diff changeset
209 movwf PR2 ; Period
heinrichsweikamp
parents:
diff changeset
210 ; 255 is max brightness (300mW)
heinrichsweikamp
parents:
diff changeset
211 clrf CCPR1L ; Duty cycle
heinrichsweikamp
parents:
diff changeset
212 clrf CCPR1H ; Duty cycle
heinrichsweikamp
parents:
diff changeset
213 movlw T2CON_NORMAL
heinrichsweikamp
parents:
diff changeset
214 movwf T2CON
heinrichsweikamp
parents:
diff changeset
215
heinrichsweikamp
parents:
diff changeset
216 ; Timer5 for ISR-independent wait routines
heinrichsweikamp
parents:
diff changeset
217 clrf T5GCON ; Reset Timer5 Gate Control register
heinrichsweikamp
parents:
diff changeset
218 ; movlw b'10001101' ; 1:1 Prescaler -> 2seconds@32768Hz, not synced
heinrichsweikamp
parents:
diff changeset
219 movlw b'10001001' ; 1:1 Prescaler -> 2seconds@32768Hz, synced
heinrichsweikamp
parents:
diff changeset
220 ; 30,51757813µs/bit in TMR5L:TMR5H
heinrichsweikamp
parents:
diff changeset
221 movwf T5CON
heinrichsweikamp
parents:
diff changeset
222
heinrichsweikamp
parents:
diff changeset
223 ; Timer7 for 62,5ms Interrupt (Sensor states)
heinrichsweikamp
parents:
diff changeset
224 banksel 0xF16 ; Addresses, F16h through F5Fh, are also used by SFRs, but are not part of the Access RAM.
heinrichsweikamp
parents:
diff changeset
225 clrf T7GCON ; Reset Timer7 Gate Control register
heinrichsweikamp
parents:
diff changeset
226 ; movlw b'10001101' ; 1:1 Prescaler -> 2seconds@32768Hz, not synced
heinrichsweikamp
parents:
diff changeset
227 movlw b'10001001' ; 1:1 Prescaler -> 2seconds@32768Hz, synced
heinrichsweikamp
parents:
diff changeset
228 movwf T7CON
heinrichsweikamp
parents:
diff changeset
229 clrf TMR7L
heinrichsweikamp
parents:
diff changeset
230 movlw .248
heinrichsweikamp
parents:
diff changeset
231 movwf TMR7H ; -> Rollover after 2048 cycles -> 62,5ms
heinrichsweikamp
parents:
diff changeset
232
heinrichsweikamp
parents:
diff changeset
233 banksel common
heinrichsweikamp
parents:
diff changeset
234 ; Interrupts
50
ec4d8503ec45 NEW: user-selectable color schemes
heinrichsweikamp
parents: 28
diff changeset
235 movlw b'11010000'
0
heinrichsweikamp
parents:
diff changeset
236 movwf INTCON
77
131e6dd9e201 BUGFIX: Potential bug to freeze the OSTC3 after battery change or update
heinrichsweikamp
parents: 58
diff changeset
237 movlw b'00001000' ; BIT7=1: Pullup for PORTB disabled
0
heinrichsweikamp
parents:
diff changeset
238 movwf INTCON2
77
131e6dd9e201 BUGFIX: Potential bug to freeze the OSTC3 after battery change or update
heinrichsweikamp
parents: 58
diff changeset
239 movlw b'00000000'
0
heinrichsweikamp
parents:
diff changeset
240 movwf INTCON3
heinrichsweikamp
parents:
diff changeset
241 movlw b'00000001' ; Bit0: TMR1
heinrichsweikamp
parents:
diff changeset
242 movwf PIE1
heinrichsweikamp
parents:
diff changeset
243 movlw b'00000010' ; Bit1: TMR3
heinrichsweikamp
parents:
diff changeset
244 movwf PIE2
heinrichsweikamp
parents:
diff changeset
245 movlw b'00000000' ; Bit1: TMR5
heinrichsweikamp
parents:
diff changeset
246 movwf PIE5
heinrichsweikamp
parents:
diff changeset
247 movlw b'00100001' ; Bit0: RTCC, Bit5: UART2
heinrichsweikamp
parents:
diff changeset
248 movwf PIE3
heinrichsweikamp
parents:
diff changeset
249 movlw b'00001000' ; Bit3: TMR7
heinrichsweikamp
parents:
diff changeset
250 movwf PIE5
heinrichsweikamp
parents:
diff changeset
251
heinrichsweikamp
parents:
diff changeset
252 bsf power_sw1
58
c4876e4b3563 startup with 1.6 hardware
heinrichsweikamp
parents: 50
diff changeset
253 btfss power_sw1
c4876e4b3563 startup with 1.6 hardware
heinrichsweikamp
parents: 50
diff changeset
254 bra $-4
0
heinrichsweikamp
parents:
diff changeset
255 bsf power_sw2
58
c4876e4b3563 startup with 1.6 hardware
heinrichsweikamp
parents: 50
diff changeset
256 btfss power_sw2
c4876e4b3563 startup with 1.6 hardware
heinrichsweikamp
parents: 50
diff changeset
257 bra $-4
0
heinrichsweikamp
parents:
diff changeset
258
heinrichsweikamp
parents:
diff changeset
259 return
heinrichsweikamp
parents:
diff changeset
260
heinrichsweikamp
parents:
diff changeset
261 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
262 global speed_eco
heinrichsweikamp
parents:
diff changeset
263 speed_eco:
heinrichsweikamp
parents:
diff changeset
264 movlw d'1'
heinrichsweikamp
parents:
diff changeset
265 movff WREG,speed_setting ; Bank-independent
heinrichsweikamp
parents:
diff changeset
266 ; Done in ISR
heinrichsweikamp
parents:
diff changeset
267 return
heinrichsweikamp
parents:
diff changeset
268 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
269 global speed_normal
heinrichsweikamp
parents:
diff changeset
270 speed_normal:
heinrichsweikamp
parents:
diff changeset
271 movlw d'2'
heinrichsweikamp
parents:
diff changeset
272 movff WREG,speed_setting ; Bank-independent
heinrichsweikamp
parents:
diff changeset
273 ; Done in ISR
heinrichsweikamp
parents:
diff changeset
274 return
heinrichsweikamp
parents:
diff changeset
275 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
276 global speed_fastest
heinrichsweikamp
parents:
diff changeset
277 speed_fastest:
heinrichsweikamp
parents:
diff changeset
278 movlw d'3'
heinrichsweikamp
parents:
diff changeset
279 movff WREG,speed_setting ; Bank-independent
heinrichsweikamp
parents:
diff changeset
280 ; Done in ISR
heinrichsweikamp
parents:
diff changeset
281 return
heinrichsweikamp
parents:
diff changeset
282 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
283
heinrichsweikamp
parents:
diff changeset
284 END