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