annotate src/i2c.asm @ 125:53409476a05f

minor
author heinrichsweikamp
date Sun, 29 Jun 2014 14:21:23 +0200
parents f3062a611eef
children 683321c09cfa
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 i2c.asm
heinrichsweikamp
parents:
diff changeset
4 ;
heinrichsweikamp
parents:
diff changeset
5 ; I2C Interface to HMC5883L and MMA8452Q
heinrichsweikamp
parents:
diff changeset
6 ;
heinrichsweikamp
parents:
diff changeset
7 ; HMC5883L's read address (8-Bit): 0x3D
heinrichsweikamp
parents:
diff changeset
8 ; HMC5883L's write address (8-Bit): 0x3C
heinrichsweikamp
parents:
diff changeset
9 ;
heinrichsweikamp
parents:
diff changeset
10 ; MMA8452Q's read address (8-Bit): 0x39
heinrichsweikamp
parents:
diff changeset
11 ; MMA8452Q's write address (8-Bit): 0x38
heinrichsweikamp
parents:
diff changeset
12 ;
heinrichsweikamp
parents:
diff changeset
13 ; Copyright (c) 2012, JD Gascuel, HeinrichsWeikamp, all right reserved.
heinrichsweikamp
parents:
diff changeset
14 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
15 ; HISTORY
heinrichsweikamp
parents:
diff changeset
16 ; 2012-08-22 : [mH] Creation
heinrichsweikamp
parents:
diff changeset
17
heinrichsweikamp
parents:
diff changeset
18
heinrichsweikamp
parents:
diff changeset
19 #include "ostc3.inc" ; Mandatory header
heinrichsweikamp
parents:
diff changeset
20 #include "wait.inc"
113
heinrichsweikamp
parents: 20
diff changeset
21 #include "math.inc"
heinrichsweikamp
parents: 20
diff changeset
22
heinrichsweikamp
parents: 20
diff changeset
23 #DEFINE battery_offset .27302 ; 65536-(3,25Ah/0,085mAh)
heinrichsweikamp
parents: 20
diff changeset
24 #DEFINE battery_devider .382 ; 3,25Ah/0,085mAh/100 [%]
0
heinrichsweikamp
parents:
diff changeset
25
heinrichsweikamp
parents:
diff changeset
26 i2c CODE
heinrichsweikamp
parents:
diff changeset
27
heinrichsweikamp
parents:
diff changeset
28 WaitMSSP:
heinrichsweikamp
parents:
diff changeset
29 decfsz i2c_temp,F ; check for timeout during I2C action
heinrichsweikamp
parents:
diff changeset
30 bra WaitMSSP2
heinrichsweikamp
parents:
diff changeset
31 bra I2CFail ; timeout occured
heinrichsweikamp
parents:
diff changeset
32 WaitMSSP2:
heinrichsweikamp
parents:
diff changeset
33 btfss PIR1,SSPIF
heinrichsweikamp
parents:
diff changeset
34 bra WaitMSSP
heinrichsweikamp
parents:
diff changeset
35 clrf i2c_temp
heinrichsweikamp
parents:
diff changeset
36 bcf PIR1,SSPIF
heinrichsweikamp
parents:
diff changeset
37 nop
heinrichsweikamp
parents:
diff changeset
38 return
heinrichsweikamp
parents:
diff changeset
39
heinrichsweikamp
parents:
diff changeset
40 I2C_WaitforACK:
heinrichsweikamp
parents:
diff changeset
41 btfss SSPCON2,ACKSTAT ; checks for ACK bit from slave
heinrichsweikamp
parents:
diff changeset
42 return
heinrichsweikamp
parents:
diff changeset
43 I2CFail:
heinrichsweikamp
parents:
diff changeset
44 rcall I2CReset ; I2C Reset
heinrichsweikamp
parents:
diff changeset
45 bcf PIR1,SSPIF
heinrichsweikamp
parents:
diff changeset
46 clrf i2c_temp
heinrichsweikamp
parents:
diff changeset
47 return
heinrichsweikamp
parents:
diff changeset
48
heinrichsweikamp
parents:
diff changeset
49 I2CReset: ; Something went wrong (Slave holds SDA low?)
heinrichsweikamp
parents:
diff changeset
50 clrf SSP1CON1 ; wake-up slave and reset entire module
heinrichsweikamp
parents:
diff changeset
51 clrf SSP1CON2
heinrichsweikamp
parents:
diff changeset
52 clrf SSP1STAT
heinrichsweikamp
parents:
diff changeset
53 bcf TRISC,3 ; SCL OUTPUT
heinrichsweikamp
parents:
diff changeset
54 bsf TRISC,4 ; SDA Input
heinrichsweikamp
parents:
diff changeset
55 bcf PORTC,3
heinrichsweikamp
parents:
diff changeset
56 movlw d'9'
heinrichsweikamp
parents:
diff changeset
57 movwf i2c_temp ; clock-out 9 clock cycles manually
heinrichsweikamp
parents:
diff changeset
58 I2CReset_1:
heinrichsweikamp
parents:
diff changeset
59 bsf PORTC,3 ; SCL=1
heinrichsweikamp
parents:
diff changeset
60 nop
heinrichsweikamp
parents:
diff changeset
61 nop
heinrichsweikamp
parents:
diff changeset
62 nop
heinrichsweikamp
parents:
diff changeset
63 nop
heinrichsweikamp
parents:
diff changeset
64 btfsc PORTC,4 ; SDA=1?
heinrichsweikamp
parents:
diff changeset
65 bra I2CReset_2 ; =1, SDA has been released from slave
heinrichsweikamp
parents:
diff changeset
66 bcf PORTC,3 ; SCL=0
heinrichsweikamp
parents:
diff changeset
67 nop
heinrichsweikamp
parents:
diff changeset
68 nop
heinrichsweikamp
parents:
diff changeset
69 bcf PORTC,3
heinrichsweikamp
parents:
diff changeset
70 nop
heinrichsweikamp
parents:
diff changeset
71 nop
heinrichsweikamp
parents:
diff changeset
72 decfsz i2c_temp,F
heinrichsweikamp
parents:
diff changeset
73 bra I2CReset_1 ; check for nine clock cycles
heinrichsweikamp
parents:
diff changeset
74 I2CReset_2:
heinrichsweikamp
parents:
diff changeset
75 bsf TRISC,3 ; SCL Input
heinrichsweikamp
parents:
diff changeset
76 clrf SSP1CON1 ; setup I²C Mode
heinrichsweikamp
parents:
diff changeset
77 WAITMS d'10' ; Reset-Timeout for I2C devices
heinrichsweikamp
parents:
diff changeset
78 movlw b'00000000' ; with slew rate control
heinrichsweikamp
parents:
diff changeset
79 movwf SSPSTAT
heinrichsweikamp
parents:
diff changeset
80 movlw b'00101000'
heinrichsweikamp
parents:
diff changeset
81 movwf SSP1CON1
heinrichsweikamp
parents:
diff changeset
82 movlw b'00000000'
heinrichsweikamp
parents:
diff changeset
83 movwf SSP1CON2
heinrichsweikamp
parents:
diff changeset
84 movlw 0x27
heinrichsweikamp
parents:
diff changeset
85 movwf SSP1ADD
heinrichsweikamp
parents:
diff changeset
86 return
heinrichsweikamp
parents:
diff changeset
87
heinrichsweikamp
parents:
diff changeset
88 I2C_TX:
heinrichsweikamp
parents:
diff changeset
89 movwf SSP1BUF
heinrichsweikamp
parents:
diff changeset
90 rcall WaitMSSP
heinrichsweikamp
parents:
diff changeset
91 bra I2C_WaitforACK ; Returns...
heinrichsweikamp
parents:
diff changeset
92
heinrichsweikamp
parents:
diff changeset
93 I2C_TwoBytesRX_div16: ; Get two bytes and devide lo:hi/16 (signed)
heinrichsweikamp
parents:
diff changeset
94 rcall I2C_OneByteRX ; Get one byte
heinrichsweikamp
parents:
diff changeset
95 movff SSP1BUF,hi ; Data Byte
heinrichsweikamp
parents:
diff changeset
96 rcall I2C_OneByteRX ; Get one byte
heinrichsweikamp
parents:
diff changeset
97 movff SSP1BUF,lo ; Data Byte
heinrichsweikamp
parents:
diff changeset
98 I2C_TwoBytesRX_div16_2: ; devide lo:hi/16 (signed) only
heinrichsweikamp
parents:
diff changeset
99 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
100 btfsc hi,7 ; Copy sign bit to carry
heinrichsweikamp
parents:
diff changeset
101 bsf STATUS,C
heinrichsweikamp
parents:
diff changeset
102 rrcf hi ; /2
heinrichsweikamp
parents:
diff changeset
103 rrcf lo
heinrichsweikamp
parents:
diff changeset
104 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
105 btfsc hi,7 ; Copy sign bit to carry
heinrichsweikamp
parents:
diff changeset
106 bsf STATUS,C
heinrichsweikamp
parents:
diff changeset
107 rrcf hi ; /4
heinrichsweikamp
parents:
diff changeset
108 rrcf lo
heinrichsweikamp
parents:
diff changeset
109 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
110 btfsc hi,7 ; Copy sign bit to carry
heinrichsweikamp
parents:
diff changeset
111 bsf STATUS,C
heinrichsweikamp
parents:
diff changeset
112 rrcf hi ; /8
heinrichsweikamp
parents:
diff changeset
113 rrcf lo
heinrichsweikamp
parents:
diff changeset
114 bcf STATUS,C
heinrichsweikamp
parents:
diff changeset
115 btfsc hi,7 ; Copy sign bit to carry
heinrichsweikamp
parents:
diff changeset
116 bsf STATUS,C
heinrichsweikamp
parents:
diff changeset
117 rrcf hi ; /16
heinrichsweikamp
parents:
diff changeset
118 rrcf lo
heinrichsweikamp
parents:
diff changeset
119 return
heinrichsweikamp
parents:
diff changeset
120
heinrichsweikamp
parents:
diff changeset
121 global I2C_RX_accelerometer
heinrichsweikamp
parents:
diff changeset
122 I2C_RX_accelerometer:
heinrichsweikamp
parents:
diff changeset
123 bsf SSP1CON2,SEN ; Start condition
heinrichsweikamp
parents:
diff changeset
124 rcall WaitMSSP
heinrichsweikamp
parents:
diff changeset
125 movlw 0x38 ; address
heinrichsweikamp
parents:
diff changeset
126 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
127 movlw 0x01
heinrichsweikamp
parents:
diff changeset
128 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
129 bsf SSP1CON2,RSEN ; Repeated start condition (!)
heinrichsweikamp
parents:
diff changeset
130 rcall WaitMSSP
heinrichsweikamp
parents:
diff changeset
131 movlw 0x39 ; address
heinrichsweikamp
parents:
diff changeset
132 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
133
heinrichsweikamp
parents:
diff changeset
134 ; Chip orientation on the PCB requires
heinrichsweikamp
parents:
diff changeset
135 ; Original = Corrected
heinrichsweikamp
parents:
diff changeset
136 ; x = -x
heinrichsweikamp
parents:
diff changeset
137 ; y = -y
heinrichsweikamp
parents:
diff changeset
138 ; z = -z
heinrichsweikamp
parents:
diff changeset
139
heinrichsweikamp
parents:
diff changeset
140
heinrichsweikamp
parents:
diff changeset
141 rcall I2C_TwoBytesRX_div16 ; Get two bytes and devide /16 (signed)
heinrichsweikamp
parents:
diff changeset
142 comf hi ; 16bit sign change.
heinrichsweikamp
parents:
diff changeset
143 negf lo
heinrichsweikamp
parents:
diff changeset
144 btfsc STATUS,C ; Carry to propagate ?
heinrichsweikamp
parents:
diff changeset
145 incf hi,F ; YES: do it.
heinrichsweikamp
parents:
diff changeset
146 movff lo,accel_DX+0
heinrichsweikamp
parents:
diff changeset
147 movff hi,accel_DX+1 ; Copy result
heinrichsweikamp
parents:
diff changeset
148
heinrichsweikamp
parents:
diff changeset
149 rcall I2C_TwoBytesRX_div16 ; Get two bytes and devide /16 (signed)
heinrichsweikamp
parents:
diff changeset
150 comf hi ; 16bit sign change.
heinrichsweikamp
parents:
diff changeset
151 negf lo
heinrichsweikamp
parents:
diff changeset
152 btfsc STATUS,C ; Carry to propagate ?
heinrichsweikamp
parents:
diff changeset
153 incf hi,F ; YES: do it.
heinrichsweikamp
parents:
diff changeset
154 movff lo,accel_DY+0
heinrichsweikamp
parents:
diff changeset
155 movff hi,accel_DY+1 ; Copy result
heinrichsweikamp
parents:
diff changeset
156
heinrichsweikamp
parents:
diff changeset
157 rcall I2C_OneByteRX ; Get one byte
heinrichsweikamp
parents:
diff changeset
158 movff SSP1BUF,hi ; Data Byte
heinrichsweikamp
parents:
diff changeset
159 bsf SSP1CON2, RCEN ; Enable recieve mode
heinrichsweikamp
parents:
diff changeset
160 rcall WaitMSSP
heinrichsweikamp
parents:
diff changeset
161 ; According to datasheet there should be no Master Acknowlegde for the last Byte (accel_DZ+0)...
heinrichsweikamp
parents:
diff changeset
162 movff SSP1BUF,lo ; Data Byte
heinrichsweikamp
parents:
diff changeset
163
heinrichsweikamp
parents:
diff changeset
164 rcall I2C_TwoBytesRX_div16_2; devide lo:hi/16 (signed) only
heinrichsweikamp
parents:
diff changeset
165 comf hi ; 16bit sign change.
heinrichsweikamp
parents:
diff changeset
166 negf lo
heinrichsweikamp
parents:
diff changeset
167 btfsc STATUS,C ; Carry to propagate ?
heinrichsweikamp
parents:
diff changeset
168 incf hi,F ; YES: do it.
heinrichsweikamp
parents:
diff changeset
169 movff lo,accel_DZ+0
heinrichsweikamp
parents:
diff changeset
170 movff hi,accel_DZ+1 ; Copy result
heinrichsweikamp
parents:
diff changeset
171
heinrichsweikamp
parents:
diff changeset
172 bsf SSP1CON2,PEN ; Stop condition
heinrichsweikamp
parents:
diff changeset
173 rcall WaitMSSP
heinrichsweikamp
parents:
diff changeset
174 return
heinrichsweikamp
parents:
diff changeset
175
heinrichsweikamp
parents:
diff changeset
176 I2C_OneByteRX:
heinrichsweikamp
parents:
diff changeset
177 bsf SSP1CON2, RCEN ; Enable recieve mode
heinrichsweikamp
parents:
diff changeset
178 rcall WaitMSSP
heinrichsweikamp
parents:
diff changeset
179 bsf SSP1CON2,ACKEN ; Master acknowlegde
heinrichsweikamp
parents:
diff changeset
180 rcall WaitMSSP
heinrichsweikamp
parents:
diff changeset
181 return
heinrichsweikamp
parents:
diff changeset
182
heinrichsweikamp
parents:
diff changeset
183 global I2C_RX_compass
heinrichsweikamp
parents:
diff changeset
184 I2C_RX_compass:
heinrichsweikamp
parents:
diff changeset
185 bsf SSP1CON2,SEN ; Start condition
heinrichsweikamp
parents:
diff changeset
186 rcall WaitMSSP
heinrichsweikamp
parents:
diff changeset
187 movlw 0x3C ; address
heinrichsweikamp
parents:
diff changeset
188 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
189 movlw 0x03
heinrichsweikamp
parents:
diff changeset
190 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
191 bsf SSP1CON2,PEN ; Stop condition
heinrichsweikamp
parents:
diff changeset
192 rcall WaitMSSP
heinrichsweikamp
parents:
diff changeset
193
heinrichsweikamp
parents:
diff changeset
194 bcf PIR1,SSPIF
heinrichsweikamp
parents:
diff changeset
195 bsf SSP1CON2,SEN ; Start condition
heinrichsweikamp
parents:
diff changeset
196 rcall WaitMSSP
heinrichsweikamp
parents:
diff changeset
197 movlw 0x3D ; address
heinrichsweikamp
parents:
diff changeset
198 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
199
heinrichsweikamp
parents:
diff changeset
200 ; Compass IC sends data in following order:
heinrichsweikamp
parents:
diff changeset
201 ; x MSB
heinrichsweikamp
parents:
diff changeset
202 ; x LSB
heinrichsweikamp
parents:
diff changeset
203 ; z MSB
heinrichsweikamp
parents:
diff changeset
204 ; z LSB
heinrichsweikamp
parents:
diff changeset
205 ; y MSB
heinrichsweikamp
parents:
diff changeset
206 ; y LSB
heinrichsweikamp
parents:
diff changeset
207
heinrichsweikamp
parents:
diff changeset
208 ; Chip orientation on the PCB requires
heinrichsweikamp
parents:
diff changeset
209 ; Original = Corrected
heinrichsweikamp
parents:
diff changeset
210 ; x = -y
heinrichsweikamp
parents:
diff changeset
211 ; z = z
heinrichsweikamp
parents:
diff changeset
212 ; y = x
heinrichsweikamp
parents:
diff changeset
213
heinrichsweikamp
parents:
diff changeset
214 rcall I2C_OneByteRX ; Get one byte
heinrichsweikamp
parents:
diff changeset
215 movff SSP1BUF,compass_DY+1; Data Byte
heinrichsweikamp
parents:
diff changeset
216 rcall I2C_OneByteRX ; Get one byte
heinrichsweikamp
parents:
diff changeset
217 movff SSP1BUF,compass_DY+0; Data Byte
heinrichsweikamp
parents:
diff changeset
218 banksel compass_DY
heinrichsweikamp
parents:
diff changeset
219 comf compass_DY+1 ; 16bit sign change.
heinrichsweikamp
parents:
diff changeset
220 negf compass_DY+0
heinrichsweikamp
parents:
diff changeset
221 btfsc STATUS,C ; Carry to propagate ?
heinrichsweikamp
parents:
diff changeset
222 incf compass_DY+1,F ; YES: do it.
heinrichsweikamp
parents:
diff changeset
223 banksel common
heinrichsweikamp
parents:
diff changeset
224 rcall I2C_OneByteRX ; Get one byte
heinrichsweikamp
parents:
diff changeset
225 movff SSP1BUF,compass_DZ+1; Data Byte
heinrichsweikamp
parents:
diff changeset
226 rcall I2C_OneByteRX ; Get one byte
heinrichsweikamp
parents:
diff changeset
227 movff SSP1BUF,compass_DZ+0; Data Byte
heinrichsweikamp
parents:
diff changeset
228 rcall I2C_OneByteRX ; Get one byte
heinrichsweikamp
parents:
diff changeset
229 movff SSP1BUF,compass_DX+1; Data Byte
heinrichsweikamp
parents:
diff changeset
230 bsf SSP1CON2, RCEN ; Enable recieve mode
heinrichsweikamp
parents:
diff changeset
231 rcall WaitMSSP
heinrichsweikamp
parents:
diff changeset
232 movff SSP1BUF,compass_DX+0; Data Byte
heinrichsweikamp
parents:
diff changeset
233 bsf SSP1CON2,PEN ; Stop condition
heinrichsweikamp
parents:
diff changeset
234 rcall WaitMSSP
heinrichsweikamp
parents:
diff changeset
235 return
heinrichsweikamp
parents:
diff changeset
236
heinrichsweikamp
parents:
diff changeset
237 global I2C_init_compass
heinrichsweikamp
parents:
diff changeset
238 I2C_init_compass:
heinrichsweikamp
parents:
diff changeset
239 bsf SSP1CON2,SEN ; Start condition
heinrichsweikamp
parents:
diff changeset
240 rcall WaitMSSP
heinrichsweikamp
parents:
diff changeset
241 movlw 0x3C ; address
heinrichsweikamp
parents:
diff changeset
242 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
243 movlw 0x00
heinrichsweikamp
parents:
diff changeset
244 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
245 ; movlw b'01101001' ; ConfigA: 3Hz, 8 Samples averaged, Test Mode (Positive Bias)
heinrichsweikamp
parents:
diff changeset
246 movlw b'01101000' ; ConfigA: 3Hz, 8 Samples averaged
heinrichsweikamp
parents:
diff changeset
247 rcall I2C_TX
20
9b7dd3103545 minor cleanup
heinrichsweikamp
parents: 18
diff changeset
248 bra I2C_init_compass_common
9b7dd3103545 minor cleanup
heinrichsweikamp
parents: 18
diff changeset
249
9b7dd3103545 minor cleanup
heinrichsweikamp
parents: 18
diff changeset
250 global I2C_init_compass_fast
9b7dd3103545 minor cleanup
heinrichsweikamp
parents: 18
diff changeset
251 I2C_init_compass_fast:
9b7dd3103545 minor cleanup
heinrichsweikamp
parents: 18
diff changeset
252 bsf SSP1CON2,SEN ; Start condition
9b7dd3103545 minor cleanup
heinrichsweikamp
parents: 18
diff changeset
253 rcall WaitMSSP
9b7dd3103545 minor cleanup
heinrichsweikamp
parents: 18
diff changeset
254 movlw 0x3C ; address
9b7dd3103545 minor cleanup
heinrichsweikamp
parents: 18
diff changeset
255 rcall I2C_TX
9b7dd3103545 minor cleanup
heinrichsweikamp
parents: 18
diff changeset
256 movlw 0x00
9b7dd3103545 minor cleanup
heinrichsweikamp
parents: 18
diff changeset
257 rcall I2C_TX
9b7dd3103545 minor cleanup
heinrichsweikamp
parents: 18
diff changeset
258 movlw b'00111000' ; ConfigA: 75Hz, 2 Samples averaged
9b7dd3103545 minor cleanup
heinrichsweikamp
parents: 18
diff changeset
259 ; movlw b'00111001' ; ConfigA: 75Hz, 2 Samples averaged, Test Mode (Positive Bias)
9b7dd3103545 minor cleanup
heinrichsweikamp
parents: 18
diff changeset
260 rcall I2C_TX
9b7dd3103545 minor cleanup
heinrichsweikamp
parents: 18
diff changeset
261 I2C_init_compass_common:
18
4e3f133dfbf4 add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents: 0
diff changeset
262 movff opt_compass_gain,i2c_temp ; 0-7 (230LSB/Gauss to 1370LSB/Gaus)
4e3f133dfbf4 add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents: 0
diff changeset
263 swapf i2c_temp,F
4e3f133dfbf4 add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents: 0
diff changeset
264 comf i2c_temp,F
4e3f133dfbf4 add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents: 0
diff changeset
265 bcf STATUS,C
4e3f133dfbf4 add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents: 0
diff changeset
266 rlcf i2c_temp
4e3f133dfbf4 add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents: 0
diff changeset
267 movf i2c_temp,W
4e3f133dfbf4 add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents: 0
diff changeset
268 clrf i2c_temp
0
heinrichsweikamp
parents:
diff changeset
269 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
270 movlw b'00000000' ; Continous Mode
heinrichsweikamp
parents:
diff changeset
271 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
272 bsf SSP1CON2,PEN ; Stop condition
heinrichsweikamp
parents:
diff changeset
273 rcall WaitMSSP
heinrichsweikamp
parents:
diff changeset
274 bsf compass_enabled
heinrichsweikamp
parents:
diff changeset
275 return
heinrichsweikamp
parents:
diff changeset
276
heinrichsweikamp
parents:
diff changeset
277 global I2C_sleep_compass
heinrichsweikamp
parents:
diff changeset
278 I2C_sleep_compass:
heinrichsweikamp
parents:
diff changeset
279 bsf SSP1CON2,SEN ; Start condition
heinrichsweikamp
parents:
diff changeset
280 rcall WaitMSSP
heinrichsweikamp
parents:
diff changeset
281 movlw 0x3C ; address
heinrichsweikamp
parents:
diff changeset
282 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
283 movlw 0x00
heinrichsweikamp
parents:
diff changeset
284 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
285 movlw b'01101000' ; ConfigA
heinrichsweikamp
parents:
diff changeset
286 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
287 movlw b'00100000' ; ConfigB
heinrichsweikamp
parents:
diff changeset
288 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
289 movlw b'00000010' ; Idle Mode
heinrichsweikamp
parents:
diff changeset
290 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
291 bsf SSP1CON2,PEN ; Stop condition
heinrichsweikamp
parents:
diff changeset
292 rcall WaitMSSP
heinrichsweikamp
parents:
diff changeset
293 bcf compass_enabled
heinrichsweikamp
parents:
diff changeset
294 return
heinrichsweikamp
parents:
diff changeset
295
heinrichsweikamp
parents:
diff changeset
296
heinrichsweikamp
parents:
diff changeset
297 global I2C_init_accelerometer
heinrichsweikamp
parents:
diff changeset
298 I2C_init_accelerometer:
heinrichsweikamp
parents:
diff changeset
299 rcall I2C_sleep_accelerometer ; Regs can only be changed in St.By mode
heinrichsweikamp
parents:
diff changeset
300
heinrichsweikamp
parents:
diff changeset
301 bsf SSP1CON2,SEN ; Start condition
heinrichsweikamp
parents:
diff changeset
302 rcall WaitMSSP
heinrichsweikamp
parents:
diff changeset
303 movlw 0x38 ; address
heinrichsweikamp
parents:
diff changeset
304 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
305 movlw 0x0E ; XYZ_DATA_CFG
heinrichsweikamp
parents:
diff changeset
306 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
307 movlw b'00000000' ; High pass Filter=0 , +/- 2g range
heinrichsweikamp
parents:
diff changeset
308 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
309 bsf SSP1CON2,PEN ; Stop condition
heinrichsweikamp
parents:
diff changeset
310 rcall WaitMSSP
heinrichsweikamp
parents:
diff changeset
311
heinrichsweikamp
parents:
diff changeset
312
heinrichsweikamp
parents:
diff changeset
313 bsf SSP1CON2,SEN ; Start condition
heinrichsweikamp
parents:
diff changeset
314 rcall WaitMSSP
heinrichsweikamp
parents:
diff changeset
315 movlw 0x38 ; address
heinrichsweikamp
parents:
diff changeset
316 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
317 movlw 0x2A ; CTRL_REG1
heinrichsweikamp
parents:
diff changeset
318 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
319 ; movlw b'00110000' ; CTRL_REG1: 160ms data rate, St.By Mode
heinrichsweikamp
parents:
diff changeset
320 movlw b'00110100' ; CTRL_REG1: 160ms data rate, St.By Mode, reduced noise mode
heinrichsweikamp
parents:
diff changeset
321 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
322 movlw b'00000010' ; CTRL_REG2: High Res in Active mode
heinrichsweikamp
parents:
diff changeset
323 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
324 bsf SSP1CON2,PEN ; Stop condition
heinrichsweikamp
parents:
diff changeset
325 rcall WaitMSSP
heinrichsweikamp
parents:
diff changeset
326
heinrichsweikamp
parents:
diff changeset
327 bsf SSP1CON2,SEN ; Start condition
heinrichsweikamp
parents:
diff changeset
328 rcall WaitMSSP
heinrichsweikamp
parents:
diff changeset
329 movlw 0x38 ; address
heinrichsweikamp
parents:
diff changeset
330 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
331 movlw 0x2A ; CTRL_REG1
heinrichsweikamp
parents:
diff changeset
332 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
333 ; movlw b'00110001' ; CTRL_REG1: 160ms data rate, Active Mode
heinrichsweikamp
parents:
diff changeset
334 movlw b'00110101' ; CTRL_REG1: 160ms data rate, St.By Mode, reduced noise mode, Active Mode
heinrichsweikamp
parents:
diff changeset
335 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
336 bsf SSP1CON2,PEN ; Stop condition
heinrichsweikamp
parents:
diff changeset
337 rcall WaitMSSP
heinrichsweikamp
parents:
diff changeset
338
heinrichsweikamp
parents:
diff changeset
339 return
heinrichsweikamp
parents:
diff changeset
340
heinrichsweikamp
parents:
diff changeset
341 global I2C_sleep_accelerometer
heinrichsweikamp
parents:
diff changeset
342 I2C_sleep_accelerometer:
heinrichsweikamp
parents:
diff changeset
343 bsf SSP1CON2,SEN ; Start condition
heinrichsweikamp
parents:
diff changeset
344 rcall WaitMSSP
heinrichsweikamp
parents:
diff changeset
345 movlw 0x38 ; address
heinrichsweikamp
parents:
diff changeset
346 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
347 movlw 0x2A ; CTRL_REG1
heinrichsweikamp
parents:
diff changeset
348 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
349 movlw b'00000000' ; St. By Mode
heinrichsweikamp
parents:
diff changeset
350 rcall I2C_TX
heinrichsweikamp
parents:
diff changeset
351 bsf SSP1CON2,PEN ; Stop condition
heinrichsweikamp
parents:
diff changeset
352 rcall WaitMSSP
heinrichsweikamp
parents:
diff changeset
353 return
heinrichsweikamp
parents:
diff changeset
354
113
heinrichsweikamp
parents: 20
diff changeset
355 global lt2942_init
heinrichsweikamp
parents: 20
diff changeset
356 lt2942_init: ; Setup Control register B
heinrichsweikamp
parents: 20
diff changeset
357 clrf i2c_temp
heinrichsweikamp
parents: 20
diff changeset
358 movlw 0x01 ; Point to control reg B
heinrichsweikamp
parents: 20
diff changeset
359 call I2C_TX_GAUGE
heinrichsweikamp
parents: 20
diff changeset
360 movlw b'11111000' ; Automatic conversion every two seconds
heinrichsweikamp
parents: 20
diff changeset
361 movff WREG, SSP1BUF ; Data Byte
heinrichsweikamp
parents: 20
diff changeset
362 rcall WaitMSSP
heinrichsweikamp
parents: 20
diff changeset
363 rcall I2C_WaitforACK
heinrichsweikamp
parents: 20
diff changeset
364 bsf SSP1CON2,PEN ; Stop condition
heinrichsweikamp
parents: 20
diff changeset
365 rcall WaitMSSP
heinrichsweikamp
parents: 20
diff changeset
366 return
heinrichsweikamp
parents: 20
diff changeset
367
heinrichsweikamp
parents: 20
diff changeset
368 global lt2942_get_status
heinrichsweikamp
parents: 20
diff changeset
369 lt2942_get_status: ; Read status register
heinrichsweikamp
parents: 20
diff changeset
370 bcf c3_hardware ; Clear flag
heinrichsweikamp
parents: 20
diff changeset
371 clrf i2c_temp
heinrichsweikamp
parents: 20
diff changeset
372 movlw 0x00 ; Point to Status reg
heinrichsweikamp
parents: 20
diff changeset
373 call I2C_TX_GAUGE
heinrichsweikamp
parents: 20
diff changeset
374 call I2C_RX_GAUGE
heinrichsweikamp
parents: 20
diff changeset
375 movff SSP1BUF,WREG
heinrichsweikamp
parents: 20
diff changeset
376 btfss WREG,7 ; 2942 found?
heinrichsweikamp
parents: 20
diff changeset
377 bsf c3_hardware ; Yes, set flag
heinrichsweikamp
parents: 20
diff changeset
378 bsf SSP1CON2,PEN ; Stop condition
heinrichsweikamp
parents: 20
diff changeset
379 rcall WaitMSSP
heinrichsweikamp
parents: 20
diff changeset
380 return
heinrichsweikamp
parents: 20
diff changeset
381
heinrichsweikamp
parents: 20
diff changeset
382
heinrichsweikamp
parents: 20
diff changeset
383 global lt2942_get_voltage
heinrichsweikamp
parents: 20
diff changeset
384 lt2942_get_voltage: ; Read battery voltage registers
heinrichsweikamp
parents: 20
diff changeset
385 clrf i2c_temp
heinrichsweikamp
parents: 20
diff changeset
386 movlw 0x08 ; Point to voltage registers
heinrichsweikamp
parents: 20
diff changeset
387 call I2C_TX_GAUGE
heinrichsweikamp
parents: 20
diff changeset
388 call I2C_RX_GAUGE
heinrichsweikamp
parents: 20
diff changeset
389 bsf SSP1CON2,ACKEN ; Master acknowlegde
heinrichsweikamp
parents: 20
diff changeset
390 rcall WaitMSSP
heinrichsweikamp
parents: 20
diff changeset
391 movff SSP1BUF,xA+1
heinrichsweikamp
parents: 20
diff changeset
392 bsf SSP1CON2, RCEN ; Enable recieve mode
heinrichsweikamp
parents: 20
diff changeset
393 rcall WaitMSSP
heinrichsweikamp
parents: 20
diff changeset
394 movff SSP1BUF,xA+0
heinrichsweikamp
parents: 20
diff changeset
395 bsf SSP1CON2,PEN ; Stop condition
heinrichsweikamp
parents: 20
diff changeset
396 rcall WaitMSSP
heinrichsweikamp
parents: 20
diff changeset
397
heinrichsweikamp
parents: 20
diff changeset
398 ; banksel common
heinrichsweikamp
parents: 20
diff changeset
399 ; xA:2 loaded with raw values
heinrichsweikamp
parents: 20
diff changeset
400 movlw LOW .6000
heinrichsweikamp
parents: 20
diff changeset
401 movwf xB+0
heinrichsweikamp
parents: 20
diff changeset
402 movlw HIGH .6000
heinrichsweikamp
parents: 20
diff changeset
403 movwf xB+1
heinrichsweikamp
parents: 20
diff changeset
404 call mult16x16 ;xA*xB=xC
heinrichsweikamp
parents: 20
diff changeset
405
heinrichsweikamp
parents: 20
diff changeset
406 ; devide xC (32bit)/65535 for result in mV (16bit)
heinrichsweikamp
parents: 20
diff changeset
407 movlw .16
heinrichsweikamp
parents: 20
diff changeset
408 movwf i2c_temp
heinrichsweikamp
parents: 20
diff changeset
409 lt2942_get_voltage2:
heinrichsweikamp
parents: 20
diff changeset
410 bcf STATUS,C
heinrichsweikamp
parents: 20
diff changeset
411 rrcf xC+3,F
heinrichsweikamp
parents: 20
diff changeset
412 rrcf xC+2,F
heinrichsweikamp
parents: 20
diff changeset
413 rrcf xC+1,F
heinrichsweikamp
parents: 20
diff changeset
414 rrcf xC+0,F
heinrichsweikamp
parents: 20
diff changeset
415 decfsz i2c_temp,F
heinrichsweikamp
parents: 20
diff changeset
416 bra lt2942_get_voltage2
heinrichsweikamp
parents: 20
diff changeset
417
heinrichsweikamp
parents: 20
diff changeset
418 ; Update battery voltage in mV
heinrichsweikamp
parents: 20
diff changeset
419 movff xC+1,batt_voltage+1
heinrichsweikamp
parents: 20
diff changeset
420 movff xC+0,batt_voltage+0
heinrichsweikamp
parents: 20
diff changeset
421 return
heinrichsweikamp
parents: 20
diff changeset
422
heinrichsweikamp
parents: 20
diff changeset
423 ; global lt2942_get_temperature
heinrichsweikamp
parents: 20
diff changeset
424 ;lt2942_get_temperature: ; Read temperature registers
heinrichsweikamp
parents: 20
diff changeset
425 ; clrf i2c_temp
heinrichsweikamp
parents: 20
diff changeset
426 ; movlw 0x0C ; Point to temperature registers
heinrichsweikamp
parents: 20
diff changeset
427 ; call I2C_TX_GAUGE
heinrichsweikamp
parents: 20
diff changeset
428 ; call I2C_RX
heinrichsweikamp
parents: 20
diff changeset
429 ; bsf SSP1CON2,ACKEN ; Master acknowlegde
heinrichsweikamp
parents: 20
diff changeset
430 ; rcall WaitMSSP
heinrichsweikamp
parents: 20
diff changeset
431 ; movff SSP1BUF,xA+1
heinrichsweikamp
parents: 20
diff changeset
432 ; bsf SSP1CON2, RCEN ; Enable recieve mode
heinrichsweikamp
parents: 20
diff changeset
433 ; rcall WaitMSSP
heinrichsweikamp
parents: 20
diff changeset
434 ; movff SSP1BUF,xA+0
heinrichsweikamp
parents: 20
diff changeset
435 ; bsf SSP1CON2,PEN ; Stop condition
heinrichsweikamp
parents: 20
diff changeset
436 ; rcall WaitMSSP
heinrichsweikamp
parents: 20
diff changeset
437 ;
heinrichsweikamp
parents: 20
diff changeset
438 ;; banksel common
heinrichsweikamp
parents: 20
diff changeset
439 ; ; xA:2 loaded with raw values
heinrichsweikamp
parents: 20
diff changeset
440 ; movlw LOW .6000
heinrichsweikamp
parents: 20
diff changeset
441 ; movwf xB+0
heinrichsweikamp
parents: 20
diff changeset
442 ; movlw HIGH .6000
heinrichsweikamp
parents: 20
diff changeset
443 ; movwf xB+1
heinrichsweikamp
parents: 20
diff changeset
444 ; call mult16x16 ;xA*xB=xC
heinrichsweikamp
parents: 20
diff changeset
445 ;
heinrichsweikamp
parents: 20
diff changeset
446 ; ; devide xC (32bit)/65535 for result in 0.1K (16bit)
heinrichsweikamp
parents: 20
diff changeset
447 ; movlw .16
heinrichsweikamp
parents: 20
diff changeset
448 ; movwf i2c_temp
heinrichsweikamp
parents: 20
diff changeset
449 ;lt2942_get_temperature2:
heinrichsweikamp
parents: 20
diff changeset
450 ; bcf STATUS,C
heinrichsweikamp
parents: 20
diff changeset
451 ; rrcf xC+3,F
heinrichsweikamp
parents: 20
diff changeset
452 ; rrcf xC+2,F
heinrichsweikamp
parents: 20
diff changeset
453 ; rrcf xC+1,F
heinrichsweikamp
parents: 20
diff changeset
454 ; rrcf xC+0,F
heinrichsweikamp
parents: 20
diff changeset
455 ; decfsz i2c_temp,F
heinrichsweikamp
parents: 20
diff changeset
456 ; bra lt2942_get_temperature2
heinrichsweikamp
parents: 20
diff changeset
457 ;
heinrichsweikamp
parents: 20
diff changeset
458 ; movff xC+1,sub_a+1
heinrichsweikamp
parents: 20
diff changeset
459 ; movff xC+0,sub_a+0
heinrichsweikamp
parents: 20
diff changeset
460 ; movlw LOW .2731 ; Kelvin to Celcius offset
heinrichsweikamp
parents: 20
diff changeset
461 ; movwf sub_b+0
heinrichsweikamp
parents: 20
diff changeset
462 ; movlw HIGH .2731 ; Kelvin to Celcius offset
heinrichsweikamp
parents: 20
diff changeset
463 ; movwf sub_b+1
heinrichsweikamp
parents: 20
diff changeset
464 ; call subU16 ; sub_c = sub_a - sub_b (with UNSIGNED values)
heinrichsweikamp
parents: 20
diff changeset
465 ;
heinrichsweikamp
parents: 20
diff changeset
466 ; ; Update batttery_temperature in 0.1°C
heinrichsweikamp
parents: 20
diff changeset
467 ; movff sub_c+1,battery_temperature+1
heinrichsweikamp
parents: 20
diff changeset
468 ; movff sub_c+0,battery_temperature+0
heinrichsweikamp
parents: 20
diff changeset
469 ; return
heinrichsweikamp
parents: 20
diff changeset
470
heinrichsweikamp
parents: 20
diff changeset
471 global lt2942_get_accumulated_charge
heinrichsweikamp
parents: 20
diff changeset
472 lt2942_get_accumulated_charge: ; Read accumulated charge and compute percent
heinrichsweikamp
parents: 20
diff changeset
473 clrf i2c_temp
heinrichsweikamp
parents: 20
diff changeset
474 movlw 0x02 ; Point to accumulated charge registers
heinrichsweikamp
parents: 20
diff changeset
475 call I2C_TX_GAUGE
heinrichsweikamp
parents: 20
diff changeset
476 call I2C_RX_GAUGE
heinrichsweikamp
parents: 20
diff changeset
477 bsf SSP1CON2,ACKEN ; Master acknowlegde
heinrichsweikamp
parents: 20
diff changeset
478 rcall WaitMSSP
heinrichsweikamp
parents: 20
diff changeset
479 movff SSP1BUF,sub_a+1 ; battery_acumulated_charge+1
heinrichsweikamp
parents: 20
diff changeset
480 bsf SSP1CON2, RCEN ; Enable recieve mode
heinrichsweikamp
parents: 20
diff changeset
481 rcall WaitMSSP
heinrichsweikamp
parents: 20
diff changeset
482 movff SSP1BUF,sub_a+0 ; battery_acumulated_charge+0
heinrichsweikamp
parents: 20
diff changeset
483 bsf SSP1CON2,PEN ; Stop condition
heinrichsweikamp
parents: 20
diff changeset
484 rcall WaitMSSP
heinrichsweikamp
parents: 20
diff changeset
485
heinrichsweikamp
parents: 20
diff changeset
486 ; Compute batt_percent
heinrichsweikamp
parents: 20
diff changeset
487 ; charge-battery_offset/382
heinrichsweikamp
parents: 20
diff changeset
488 movlw LOW battery_offset
heinrichsweikamp
parents: 20
diff changeset
489 movwf sub_b+0
heinrichsweikamp
parents: 20
diff changeset
490 movlw HIGH battery_offset
heinrichsweikamp
parents: 20
diff changeset
491 movwf sub_b+1
heinrichsweikamp
parents: 20
diff changeset
492 call subU16 ; sub_c = sub_a - sub_b (with signed values)
heinrichsweikamp
parents: 20
diff changeset
493
heinrichsweikamp
parents: 20
diff changeset
494 clrf batt_percent ; Set to zero
heinrichsweikamp
parents: 20
diff changeset
495 btfsc neg_flag ; result negative?
heinrichsweikamp
parents: 20
diff changeset
496 return ; Yes, done.
heinrichsweikamp
parents: 20
diff changeset
497
heinrichsweikamp
parents: 20
diff changeset
498 ; > Zero, set batt_percent properly
heinrichsweikamp
parents: 20
diff changeset
499 movff sub_c+0,xA+0
heinrichsweikamp
parents: 20
diff changeset
500 movff sub_c+1,xA+1
heinrichsweikamp
parents: 20
diff changeset
501 movlw LOW battery_devider
heinrichsweikamp
parents: 20
diff changeset
502 movwf xB+0
heinrichsweikamp
parents: 20
diff changeset
503 movlw HIGH battery_devider
heinrichsweikamp
parents: 20
diff changeset
504 movwf xB+1
heinrichsweikamp
parents: 20
diff changeset
505 call div16x16 ;xA/xB=xC with xA+0 as remainder, uses divB as temp variable
heinrichsweikamp
parents: 20
diff changeset
506 movff xC+0,batt_percent
heinrichsweikamp
parents: 20
diff changeset
507 return
heinrichsweikamp
parents: 20
diff changeset
508
heinrichsweikamp
parents: 20
diff changeset
509 global lt2942_charge_done
heinrichsweikamp
parents: 20
diff changeset
510 lt2942_charge_done: ; Reset accumulating registers to 0xFFFF
heinrichsweikamp
parents: 20
diff changeset
511 clrf i2c_temp
heinrichsweikamp
parents: 20
diff changeset
512 movlw 0x02 ; Point to accumulated charge registers
heinrichsweikamp
parents: 20
diff changeset
513 call I2C_TX_GAUGE
heinrichsweikamp
parents: 20
diff changeset
514 movlw 0xFF
heinrichsweikamp
parents: 20
diff changeset
515 movff WREG, SSP1BUF ; Data Byte
heinrichsweikamp
parents: 20
diff changeset
516 rcall WaitMSSP
heinrichsweikamp
parents: 20
diff changeset
517 rcall I2C_WaitforACK
heinrichsweikamp
parents: 20
diff changeset
518 movlw 0xFF
heinrichsweikamp
parents: 20
diff changeset
519 movff WREG, SSP1BUF ; Data Byte
heinrichsweikamp
parents: 20
diff changeset
520 rcall WaitMSSP
heinrichsweikamp
parents: 20
diff changeset
521 rcall I2C_WaitforACK
heinrichsweikamp
parents: 20
diff changeset
522 bsf SSP1CON2,PEN ; Stop condition
heinrichsweikamp
parents: 20
diff changeset
523 rcall WaitMSSP
heinrichsweikamp
parents: 20
diff changeset
524 return
heinrichsweikamp
parents: 20
diff changeset
525
heinrichsweikamp
parents: 20
diff changeset
526 I2C_TX_GAUGE: ; Sends a byte to the LT2942 Gauge IC
heinrichsweikamp
parents: 20
diff changeset
527 movwf i2c_temp+1 ; Data byte
heinrichsweikamp
parents: 20
diff changeset
528 bsf SSP1CON2,SEN ; Start condition
heinrichsweikamp
parents: 20
diff changeset
529 rcall WaitMSSP
heinrichsweikamp
parents: 20
diff changeset
530 movlw b'11001000' ; Address byte + Write bit
heinrichsweikamp
parents: 20
diff changeset
531 movwf SSP1BUF ; control byte
heinrichsweikamp
parents: 20
diff changeset
532 rcall WaitMSSP
heinrichsweikamp
parents: 20
diff changeset
533 rcall I2C_WaitforACK
heinrichsweikamp
parents: 20
diff changeset
534 movff i2c_temp+1, SSP1BUF ; Data Byte
heinrichsweikamp
parents: 20
diff changeset
535 rcall WaitMSSP
heinrichsweikamp
parents: 20
diff changeset
536 rcall I2C_WaitforACK
heinrichsweikamp
parents: 20
diff changeset
537 return
heinrichsweikamp
parents: 20
diff changeset
538
heinrichsweikamp
parents: 20
diff changeset
539 I2C_RX_GAUGE:
heinrichsweikamp
parents: 20
diff changeset
540 bsf SSP1CON2,SEN ; Start condition
heinrichsweikamp
parents: 20
diff changeset
541 rcall WaitMSSP
heinrichsweikamp
parents: 20
diff changeset
542 movlw b'11001001' ; Address byte + Read bit
heinrichsweikamp
parents: 20
diff changeset
543 movwf SSP1BUF ; control byte
heinrichsweikamp
parents: 20
diff changeset
544 rcall WaitMSSP
heinrichsweikamp
parents: 20
diff changeset
545 rcall I2C_WaitforACK
heinrichsweikamp
parents: 20
diff changeset
546 bsf SSP1CON2, RCEN ; Enable recieve mode
heinrichsweikamp
parents: 20
diff changeset
547 rcall WaitMSSP
heinrichsweikamp
parents: 20
diff changeset
548 return
heinrichsweikamp
parents: 20
diff changeset
549
heinrichsweikamp
parents: 20
diff changeset
550
0
heinrichsweikamp
parents:
diff changeset
551
heinrichsweikamp
parents:
diff changeset
552 END