Line 1... |
Line 1... |
1 |
CCS PCM C Compiler, Version 4.106, 47914 17-V-13 12:14 |
1 |
CCS PCM C Compiler, Version 4.106, 47914 25-VIII-13 18:55 |
2 |
|
2 |
|
3 |
Filename: Z:\home\kaklik\svnMLAB\Modules\Sensors\MAG01A\SW\PIC16F887\main.lst |
3 |
Filename: Z:\home\kaklik\svnMLAB\Modules\Sensors\MAG01A\SW\PIC16F887\main.lst |
4 |
|
4 |
|
5 |
ROM used: 799 words (10%) |
5 |
ROM used: 762 words (9%) |
6 |
Largest free fragment is 2048 |
6 |
Largest free fragment is 2048 |
7 |
RAM used: 28 (8%) at main() level |
7 |
RAM used: 12 (3%) at main() level |
8 |
38 (10%) worst case |
8 |
21 (6%) worst case |
9 |
Stack: 2 locations |
9 |
Stack: 2 locations |
10 |
|
10 |
|
11 |
* |
11 |
* |
12 |
0000: MOVLW 02 |
12 |
0000: MOVLW 02 |
13 |
0001: MOVWF 0A |
13 |
0001: MOVWF 0A |
14 |
0002: GOTO 266 |
14 |
0002: GOTO 23C |
15 |
0003: NOP |
15 |
0003: NOP |
16 |
.................... #include "main.h" |
16 |
.................... #include "main.h" |
17 |
.................... #include <16F887.h> |
17 |
.................... #include <16F887.h> |
18 |
.................... //////// Standard Header file for the PIC16F887 device //////////////// |
18 |
.................... //////// Standard Header file for the PIC16F887 device //////////////// |
19 |
.................... #device PIC16F887 |
19 |
.................... #device PIC16F887 |
Line 35... |
Line 35... |
35 |
.................... #FUSES NOWRT //Program memory not write protected |
35 |
.................... #FUSES NOWRT //Program memory not write protected |
36 |
.................... #FUSES BORV40 //Brownout reset at 4.0V |
36 |
.................... #FUSES BORV40 //Brownout reset at 4.0V |
37 |
.................... |
37 |
.................... |
38 |
.................... #use delay(clock=8000000) |
38 |
.................... #use delay(clock=8000000) |
39 |
* |
39 |
* |
40 |
0250: MOVLW 37 |
40 |
0226: MOVLW 27 |
41 |
0251: MOVWF 04 |
41 |
0227: MOVWF 04 |
42 |
0252: BCF 03.7 |
42 |
0228: BCF 03.7 |
43 |
0253: MOVF 00,W |
43 |
0229: MOVF 00,W |
44 |
0254: BTFSC 03.2 |
44 |
022A: BTFSC 03.2 |
45 |
0255: GOTO 263 |
45 |
022B: GOTO 239 |
46 |
0256: MOVLW 02 |
46 |
022C: MOVLW 02 |
47 |
0257: MOVWF 78 |
47 |
022D: MOVWF 78 |
48 |
0258: CLRF 77 |
48 |
022E: CLRF 77 |
49 |
0259: DECFSZ 77,F |
49 |
022F: DECFSZ 77,F |
50 |
025A: GOTO 259 |
50 |
0230: GOTO 22F |
51 |
025B: DECFSZ 78,F |
51 |
0231: DECFSZ 78,F |
52 |
025C: GOTO 258 |
52 |
0232: GOTO 22E |
53 |
025D: MOVLW 97 |
53 |
0233: MOVLW 97 |
54 |
025E: MOVWF 77 |
54 |
0234: MOVWF 77 |
55 |
025F: DECFSZ 77,F |
55 |
0235: DECFSZ 77,F |
56 |
0260: GOTO 25F |
56 |
0236: GOTO 235 |
57 |
0261: DECFSZ 00,F |
57 |
0237: DECFSZ 00,F |
58 |
0262: GOTO 256 |
58 |
0238: GOTO 22C |
59 |
0263: BCF 0A.3 |
59 |
0239: BCF 0A.3 |
60 |
0264: BCF 0A.4 |
60 |
023A: BCF 0A.4 |
61 |
0265: GOTO 31D (RETURN) |
61 |
023B: GOTO 2F8 (RETURN) |
62 |
.................... #use i2c(Master,Slow,sda=PIN_C4,scl=PIN_C3) |
62 |
.................... #use i2c(Master,Slow,sda=PIN_C4,scl=PIN_C3) |
63 |
* |
63 |
* |
64 |
0089: MOVLW 08 |
64 |
0069: MOVLW 08 |
65 |
008A: MOVWF 78 |
65 |
006A: MOVWF 78 |
66 |
008B: NOP |
66 |
006B: NOP |
67 |
008C: BCF 07.3 |
67 |
006C: BCF 07.3 |
68 |
008D: BCF 20.3 |
68 |
006D: BCF 20.3 |
69 |
008E: MOVF 20,W |
69 |
006E: MOVF 20,W |
70 |
008F: BSF 03.5 |
70 |
006F: BSF 03.5 |
71 |
0090: MOVWF 07 |
71 |
0070: MOVWF 07 |
72 |
0091: NOP |
72 |
0071: NOP |
73 |
0092: BCF 03.5 |
73 |
0072: BCF 03.5 |
74 |
0093: RLF 3D,F |
74 |
0073: RLF 2D,F |
75 |
0094: BCF 07.4 |
75 |
0074: BCF 07.4 |
76 |
0095: BTFSS 03.0 |
76 |
0075: BTFSS 03.0 |
77 |
0096: GOTO 09D |
77 |
0076: GOTO 07D |
78 |
0097: BSF 20.4 |
78 |
0077: BSF 20.4 |
79 |
0098: MOVF 20,W |
79 |
0078: MOVF 20,W |
80 |
0099: BSF 03.5 |
80 |
0079: BSF 03.5 |
81 |
009A: MOVWF 07 |
81 |
007A: MOVWF 07 |
82 |
009B: GOTO 0A1 |
82 |
007B: GOTO 081 |
83 |
009C: BCF 03.5 |
83 |
007C: BCF 03.5 |
84 |
009D: BCF 20.4 |
84 |
007D: BCF 20.4 |
85 |
009E: MOVF 20,W |
85 |
007E: MOVF 20,W |
86 |
009F: BSF 03.5 |
86 |
007F: BSF 03.5 |
87 |
00A0: MOVWF 07 |
87 |
0080: MOVWF 07 |
88 |
00A1: NOP |
88 |
0081: NOP |
89 |
00A2: BCF 03.5 |
89 |
0082: BCF 03.5 |
90 |
00A3: BSF 20.3 |
90 |
0083: BSF 20.3 |
91 |
00A4: MOVF 20,W |
91 |
0084: MOVF 20,W |
92 |
00A5: BSF 03.5 |
92 |
0085: BSF 03.5 |
93 |
00A6: MOVWF 07 |
93 |
0086: MOVWF 07 |
94 |
00A7: BCF 03.5 |
94 |
0087: BCF 03.5 |
95 |
00A8: BTFSS 07.3 |
95 |
0088: BTFSS 07.3 |
96 |
00A9: GOTO 0A8 |
96 |
0089: GOTO 088 |
97 |
00AA: DECFSZ 78,F |
97 |
008A: DECFSZ 78,F |
98 |
00AB: GOTO 08B |
98 |
008B: GOTO 06B |
99 |
00AC: NOP |
99 |
008C: NOP |
100 |
00AD: BCF 07.3 |
100 |
008D: BCF 07.3 |
101 |
00AE: BCF 20.3 |
101 |
008E: BCF 20.3 |
102 |
00AF: MOVF 20,W |
102 |
008F: MOVF 20,W |
103 |
00B0: BSF 03.5 |
103 |
0090: BSF 03.5 |
104 |
00B1: MOVWF 07 |
104 |
0091: MOVWF 07 |
105 |
00B2: NOP |
105 |
0092: NOP |
106 |
00B3: BCF 03.5 |
106 |
0093: BCF 03.5 |
107 |
00B4: BSF 20.4 |
107 |
0094: BSF 20.4 |
108 |
00B5: MOVF 20,W |
108 |
0095: MOVF 20,W |
109 |
00B6: BSF 03.5 |
109 |
0096: BSF 03.5 |
110 |
00B7: MOVWF 07 |
110 |
0097: MOVWF 07 |
111 |
00B8: NOP |
111 |
0098: NOP |
112 |
00B9: NOP |
112 |
0099: NOP |
113 |
00BA: BCF 03.5 |
113 |
009A: BCF 03.5 |
114 |
00BB: BSF 20.3 |
114 |
009B: BSF 20.3 |
115 |
00BC: MOVF 20,W |
115 |
009C: MOVF 20,W |
116 |
00BD: BSF 03.5 |
116 |
009D: BSF 03.5 |
117 |
00BE: MOVWF 07 |
117 |
009E: MOVWF 07 |
118 |
00BF: BCF 03.5 |
118 |
009F: BCF 03.5 |
119 |
00C0: BTFSS 07.3 |
119 |
00A0: BTFSS 07.3 |
120 |
00C1: GOTO 0C0 |
120 |
00A1: GOTO 0A0 |
121 |
00C2: CLRF 78 |
121 |
00A2: CLRF 78 |
122 |
00C3: NOP |
122 |
00A3: NOP |
123 |
00C4: BTFSC 07.4 |
123 |
00A4: BTFSC 07.4 |
124 |
00C5: BSF 78.0 |
124 |
00A5: BSF 78.0 |
125 |
00C6: BCF 07.3 |
125 |
00A6: BCF 07.3 |
126 |
00C7: BCF 20.3 |
126 |
00A7: BCF 20.3 |
127 |
00C8: MOVF 20,W |
127 |
00A8: MOVF 20,W |
128 |
00C9: BSF 03.5 |
128 |
00A9: BSF 03.5 |
129 |
00CA: MOVWF 07 |
129 |
00AA: MOVWF 07 |
130 |
00CB: BCF 03.5 |
130 |
00AB: BCF 03.5 |
131 |
00CC: BCF 07.4 |
131 |
00AC: BCF 07.4 |
132 |
00CD: BCF 20.4 |
132 |
00AD: BCF 20.4 |
133 |
00CE: MOVF 20,W |
133 |
00AE: MOVF 20,W |
134 |
00CF: BSF 03.5 |
134 |
00AF: BSF 03.5 |
135 |
00D0: MOVWF 07 |
135 |
00B0: MOVWF 07 |
136 |
00D1: BCF 03.5 |
136 |
00B1: BCF 03.5 |
137 |
00D2: RETURN |
137 |
00B2: RETURN |
138 |
* |
138 |
* |
139 |
010C: MOVLW 08 |
139 |
00EC: MOVLW 08 |
140 |
010D: MOVWF 3E |
140 |
00ED: MOVWF 2E |
141 |
010E: MOVF 77,W |
141 |
00EE: MOVF 77,W |
142 |
010F: MOVWF 3F |
142 |
00EF: MOVWF 2F |
143 |
0110: BSF 20.4 |
143 |
00F0: BSF 20.4 |
144 |
0111: MOVF 20,W |
144 |
00F1: MOVF 20,W |
145 |
0112: BSF 03.5 |
145 |
00F2: BSF 03.5 |
146 |
0113: MOVWF 07 |
146 |
00F3: MOVWF 07 |
147 |
0114: NOP |
147 |
00F4: NOP |
148 |
0115: BCF 03.5 |
148 |
00F5: BCF 03.5 |
149 |
0116: BSF 20.3 |
149 |
00F6: BSF 20.3 |
150 |
0117: MOVF 20,W |
150 |
00F7: MOVF 20,W |
151 |
0118: BSF 03.5 |
151 |
00F8: BSF 03.5 |
152 |
0119: MOVWF 07 |
152 |
00F9: MOVWF 07 |
153 |
011A: BCF 03.5 |
153 |
00FA: BCF 03.5 |
154 |
011B: BTFSS 07.3 |
154 |
00FB: BTFSS 07.3 |
155 |
011C: GOTO 11B |
155 |
00FC: GOTO 0FB |
156 |
011D: BTFSC 07.4 |
156 |
00FD: BTFSC 07.4 |
157 |
011E: BSF 03.0 |
157 |
00FE: BSF 03.0 |
158 |
011F: BTFSS 07.4 |
158 |
00FF: BTFSS 07.4 |
159 |
0120: BCF 03.0 |
159 |
0100: BCF 03.0 |
160 |
0121: RLF 78,F |
160 |
0101: RLF 78,F |
- |
|
161 |
0102: NOP |
- |
|
162 |
0103: BCF 20.3 |
- |
|
163 |
0104: MOVF 20,W |
- |
|
164 |
0105: BSF 03.5 |
- |
|
165 |
0106: MOVWF 07 |
- |
|
166 |
0107: BCF 03.5 |
- |
|
167 |
0108: BCF 07.3 |
- |
|
168 |
0109: DECFSZ 2E,F |
- |
|
169 |
010A: GOTO 0F0 |
- |
|
170 |
010B: BSF 20.4 |
- |
|
171 |
010C: MOVF 20,W |
- |
|
172 |
010D: BSF 03.5 |
- |
|
173 |
010E: MOVWF 07 |
- |
|
174 |
010F: NOP |
- |
|
175 |
0110: BCF 03.5 |
- |
|
176 |
0111: BCF 07.4 |
- |
|
177 |
0112: MOVF 2F,W |
- |
|
178 |
0113: BTFSC 03.2 |
- |
|
179 |
0114: GOTO 11A |
- |
|
180 |
0115: BCF 20.4 |
- |
|
181 |
0116: MOVF 20,W |
- |
|
182 |
0117: BSF 03.5 |
- |
|
183 |
0118: MOVWF 07 |
- |
|
184 |
0119: BCF 03.5 |
- |
|
185 |
011A: NOP |
- |
|
186 |
011B: BSF 20.3 |
- |
|
187 |
011C: MOVF 20,W |
- |
|
188 |
011D: BSF 03.5 |
- |
|
189 |
011E: MOVWF 07 |
- |
|
190 |
011F: BCF 03.5 |
- |
|
191 |
0120: BTFSS 07.3 |
- |
|
192 |
0121: GOTO 120 |
161 |
0122: NOP |
193 |
0122: NOP |
- |
|
194 |
0123: BCF 07.3 |
162 |
0123: BCF 20.3 |
195 |
0124: BCF 20.3 |
163 |
0124: MOVF 20,W |
196 |
0125: MOVF 20,W |
164 |
0125: BSF 03.5 |
197 |
0126: BSF 03.5 |
165 |
0126: MOVWF 07 |
198 |
0127: MOVWF 07 |
166 |
0127: BCF 03.5 |
199 |
0128: NOP |
167 |
0128: BCF 07.3 |
200 |
0129: BCF 03.5 |
168 |
0129: DECFSZ 3E,F |
- |
|
169 |
012A: GOTO 110 |
201 |
012A: BCF 07.4 |
170 |
012B: BSF 20.4 |
202 |
012B: BCF 20.4 |
171 |
012C: MOVF 20,W |
203 |
012C: MOVF 20,W |
172 |
012D: BSF 03.5 |
204 |
012D: BSF 03.5 |
173 |
012E: MOVWF 07 |
205 |
012E: MOVWF 07 |
174 |
012F: NOP |
- |
|
175 |
0130: BCF 03.5 |
- |
|
176 |
0131: BCF 07.4 |
- |
|
177 |
0132: MOVF 3F,W |
- |
|
178 |
0133: BTFSC 03.2 |
- |
|
179 |
0134: GOTO 13A |
- |
|
180 |
0135: BCF 20.4 |
- |
|
181 |
0136: MOVF 20,W |
- |
|
182 |
0137: BSF 03.5 |
- |
|
183 |
0138: MOVWF 07 |
- |
|
184 |
0139: BCF 03.5 |
- |
|
185 |
013A: NOP |
- |
|
186 |
013B: BSF 20.3 |
- |
|
187 |
013C: MOVF 20,W |
- |
|
188 |
013D: BSF 03.5 |
- |
|
189 |
013E: MOVWF 07 |
- |
|
190 |
013F: BCF 03.5 |
206 |
012F: BCF 03.5 |
191 |
0140: BTFSS 07.3 |
- |
|
192 |
0141: GOTO 140 |
- |
|
193 |
0142: NOP |
- |
|
194 |
0143: BCF 07.3 |
- |
|
195 |
0144: BCF 20.3 |
- |
|
196 |
0145: MOVF 20,W |
- |
|
197 |
0146: BSF 03.5 |
- |
|
198 |
0147: MOVWF 07 |
- |
|
199 |
0148: NOP |
- |
|
200 |
0149: BCF 03.5 |
- |
|
201 |
014A: BCF 07.4 |
- |
|
202 |
014B: BCF 20.4 |
- |
|
203 |
014C: MOVF 20,W |
- |
|
204 |
014D: BSF 03.5 |
- |
|
205 |
014E: MOVWF 07 |
- |
|
206 |
014F: BCF 03.5 |
- |
|
207 |
0150: RETURN |
207 |
0130: RETURN |
208 |
.................... #use rs232(baud=9600,parity=N,xmit=PIN_C7,rcv=PIN_C6,bits=8) //rcv TXD xmit RXD |
208 |
.................... #use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8) //rcv TXD xmit RXD |
209 |
* |
- |
|
210 |
001F: BCF 20.7 |
- |
|
211 |
0020: MOVF 20,W |
- |
|
212 |
0021: BSF 03.5 |
- |
|
213 |
0022: MOVWF 07 |
- |
|
214 |
0023: BCF 03.5 |
- |
|
215 |
0024: BCF 07.7 |
- |
|
216 |
0025: MOVLW 08 |
- |
|
217 |
0026: MOVWF 78 |
- |
|
218 |
0027: GOTO 028 |
- |
|
219 |
0028: NOP |
- |
|
220 |
0029: BSF 78.7 |
- |
|
221 |
002A: GOTO 039 |
- |
|
222 |
002B: BCF 78.7 |
- |
|
223 |
002C: RRF 40,F |
- |
|
224 |
002D: BTFSC 03.0 |
- |
|
225 |
002E: BSF 07.7 |
- |
|
226 |
002F: BTFSS 03.0 |
- |
|
227 |
0030: BCF 07.7 |
- |
|
228 |
0031: BSF 78.6 |
- |
|
229 |
0032: GOTO 039 |
- |
|
230 |
0033: BCF 78.6 |
- |
|
231 |
0034: DECFSZ 78,F |
- |
|
232 |
0035: GOTO 02C |
- |
|
233 |
0036: GOTO 037 |
- |
|
234 |
0037: NOP |
- |
|
235 |
0038: BSF 07.7 |
- |
|
236 |
0039: MOVLW 3F |
- |
|
237 |
003A: MOVWF 04 |
- |
|
238 |
003B: DECFSZ 04,F |
- |
|
239 |
003C: GOTO 03B |
- |
|
240 |
003D: NOP |
- |
|
241 |
003E: BTFSC 78.7 |
- |
|
242 |
003F: GOTO 02B |
- |
|
243 |
0040: BTFSC 78.6 |
- |
|
244 |
0041: GOTO 033 |
- |
|
245 |
0042: RETURN |
- |
|
246 |
.................... |
209 |
.................... |
247 |
.................... |
210 |
.................... |
248 |
.................... #include "HMC5883L.h" |
211 |
.................... #include "HMC5883L.h" |
249 |
.................... // i2c slave addresses |
212 |
.................... // i2c slave addresses |
250 |
.................... #define HMC5883L_WRT_ADDR 0x3C |
213 |
.................... #define HMC5883L_WRT_ADDR 0x3C |
Line 274... |
Line 237... |
274 |
.................... //------------------------------ |
237 |
.................... //------------------------------ |
275 |
.................... void hmc5883l_write_reg(int8 reg, int8 data) |
238 |
.................... void hmc5883l_write_reg(int8 reg, int8 data) |
276 |
.................... { |
239 |
.................... { |
277 |
.................... i2c_start(); |
240 |
.................... i2c_start(); |
278 |
* |
241 |
* |
279 |
00D3: BSF 20.4 |
242 |
00B3: BSF 20.4 |
280 |
00D4: MOVF 20,W |
243 |
00B4: MOVF 20,W |
281 |
00D5: BSF 03.5 |
244 |
00B5: BSF 03.5 |
282 |
00D6: MOVWF 07 |
245 |
00B6: MOVWF 07 |
283 |
00D7: NOP |
246 |
00B7: NOP |
284 |
00D8: BCF 03.5 |
247 |
00B8: BCF 03.5 |
285 |
00D9: BSF 20.3 |
248 |
00B9: BSF 20.3 |
286 |
00DA: MOVF 20,W |
249 |
00BA: MOVF 20,W |
287 |
00DB: BSF 03.5 |
250 |
00BB: BSF 03.5 |
288 |
00DC: MOVWF 07 |
251 |
00BC: MOVWF 07 |
289 |
00DD: NOP |
252 |
00BD: NOP |
290 |
00DE: BCF 03.5 |
253 |
00BE: BCF 03.5 |
291 |
00DF: BCF 07.4 |
254 |
00BF: BCF 07.4 |
292 |
00E0: BCF 20.4 |
255 |
00C0: BCF 20.4 |
293 |
00E1: MOVF 20,W |
256 |
00C1: MOVF 20,W |
294 |
00E2: BSF 03.5 |
257 |
00C2: BSF 03.5 |
295 |
00E3: MOVWF 07 |
258 |
00C3: MOVWF 07 |
296 |
00E4: NOP |
259 |
00C4: NOP |
297 |
00E5: BCF 03.5 |
260 |
00C5: BCF 03.5 |
298 |
00E6: BCF 07.3 |
261 |
00C6: BCF 07.3 |
299 |
00E7: BCF 20.3 |
262 |
00C7: BCF 20.3 |
300 |
00E8: MOVF 20,W |
263 |
00C8: MOVF 20,W |
301 |
00E9: BSF 03.5 |
264 |
00C9: BSF 03.5 |
302 |
00EA: MOVWF 07 |
265 |
00CA: MOVWF 07 |
303 |
.................... i2c_write(HMC5883L_WRT_ADDR); |
266 |
.................... i2c_write(HMC5883L_WRT_ADDR); |
304 |
00EB: MOVLW 3C |
267 |
00CB: MOVLW 3C |
305 |
00EC: BCF 03.5 |
268 |
00CC: BCF 03.5 |
306 |
00ED: MOVWF 3D |
269 |
00CD: MOVWF 2D |
307 |
00EE: CALL 089 |
270 |
00CE: CALL 069 |
308 |
.................... i2c_write(reg); |
271 |
.................... i2c_write(reg); |
309 |
00EF: MOVF 37,W |
272 |
00CF: MOVF 27,W |
310 |
00F0: MOVWF 3D |
273 |
00D0: MOVWF 2D |
311 |
00F1: CALL 089 |
274 |
00D1: CALL 069 |
312 |
.................... i2c_write(data); |
275 |
.................... i2c_write(data); |
313 |
00F2: MOVF 38,W |
276 |
00D2: MOVF 28,W |
314 |
00F3: MOVWF 3D |
277 |
00D3: MOVWF 2D |
315 |
00F4: CALL 089 |
278 |
00D4: CALL 069 |
316 |
.................... i2c_stop(); |
279 |
.................... i2c_stop(); |
317 |
00F5: BCF 20.4 |
280 |
00D5: BCF 20.4 |
318 |
00F6: MOVF 20,W |
281 |
00D6: MOVF 20,W |
319 |
00F7: BSF 03.5 |
282 |
00D7: BSF 03.5 |
320 |
00F8: MOVWF 07 |
283 |
00D8: MOVWF 07 |
321 |
00F9: NOP |
284 |
00D9: NOP |
322 |
00FA: BCF 03.5 |
285 |
00DA: BCF 03.5 |
323 |
00FB: BSF 20.3 |
286 |
00DB: BSF 20.3 |
324 |
00FC: MOVF 20,W |
287 |
00DC: MOVF 20,W |
325 |
00FD: BSF 03.5 |
288 |
00DD: BSF 03.5 |
326 |
00FE: MOVWF 07 |
289 |
00DE: MOVWF 07 |
327 |
00FF: BCF 03.5 |
290 |
00DF: BCF 03.5 |
328 |
0100: BTFSS 07.3 |
291 |
00E0: BTFSS 07.3 |
329 |
0101: GOTO 100 |
292 |
00E1: GOTO 0E0 |
330 |
0102: NOP |
293 |
00E2: NOP |
331 |
0103: GOTO 104 |
294 |
00E3: GOTO 0E4 |
332 |
0104: NOP |
295 |
00E4: NOP |
333 |
0105: BSF 20.4 |
296 |
00E5: BSF 20.4 |
334 |
0106: MOVF 20,W |
297 |
00E6: MOVF 20,W |
335 |
0107: BSF 03.5 |
298 |
00E7: BSF 03.5 |
336 |
0108: MOVWF 07 |
299 |
00E8: MOVWF 07 |
337 |
0109: NOP |
300 |
00E9: NOP |
338 |
.................... } |
301 |
.................... } |
339 |
010A: BCF 03.5 |
302 |
00EA: BCF 03.5 |
340 |
010B: RETURN |
303 |
00EB: RETURN |
341 |
.................... |
304 |
.................... |
342 |
.................... //------------------------------ |
305 |
.................... //------------------------------ |
343 |
.................... int8 hmc5883l_read_reg(int8 reg) |
306 |
.................... int8 hmc5883l_read_reg(int8 reg) |
344 |
.................... { |
307 |
.................... { |
345 |
.................... int8 retval; |
308 |
.................... int8 retval; |
Line 365... |
Line 328... |
365 |
.................... |
328 |
.................... |
366 |
.................... // This global structure holds the values read |
329 |
.................... // This global structure holds the values read |
367 |
.................... // from the HMC5883L x,y,z registers. |
330 |
.................... // from the HMC5883L x,y,z registers. |
368 |
.................... hmc5883l_result compass = {0,0,0}; |
331 |
.................... hmc5883l_result compass = {0,0,0}; |
369 |
* |
332 |
* |
370 |
0287: CLRF 21 |
333 |
0260: CLRF 21 |
371 |
0288: CLRF 22 |
334 |
0261: CLRF 22 |
372 |
0289: CLRF 23 |
335 |
0262: CLRF 23 |
373 |
028A: CLRF 24 |
336 |
0263: CLRF 24 |
374 |
028B: CLRF 25 |
337 |
0264: CLRF 25 |
375 |
028C: CLRF 26 |
338 |
0265: CLRF 26 |
376 |
.................... |
339 |
.................... |
377 |
.................... //------------------------------ |
340 |
.................... //------------------------------ |
378 |
.................... void hmc5883l_read_data(void) |
341 |
.................... void hmc5883l_read_data(void) |
379 |
.................... { |
342 |
.................... { |
380 |
.................... unsigned int8 x_lsb; |
343 |
.................... unsigned int8 x_lsb; |
Line 386... |
Line 349... |
386 |
.................... unsigned int8 z_lsb; |
349 |
.................... unsigned int8 z_lsb; |
387 |
.................... unsigned int8 z_msb; |
350 |
.................... unsigned int8 z_msb; |
388 |
.................... |
351 |
.................... |
389 |
.................... i2c_start(); |
352 |
.................... i2c_start(); |
390 |
* |
353 |
* |
391 |
0151: BSF 20.4 |
354 |
0131: BSF 20.4 |
392 |
0152: MOVF 20,W |
355 |
0132: MOVF 20,W |
393 |
0153: BSF 03.5 |
356 |
0133: BSF 03.5 |
394 |
0154: MOVWF 07 |
357 |
0134: MOVWF 07 |
395 |
0155: NOP |
358 |
0135: NOP |
396 |
0156: BCF 03.5 |
359 |
0136: BCF 03.5 |
397 |
0157: BSF 20.3 |
360 |
0137: BSF 20.3 |
398 |
0158: MOVF 20,W |
361 |
0138: MOVF 20,W |
399 |
0159: BSF 03.5 |
362 |
0139: BSF 03.5 |
400 |
015A: MOVWF 07 |
363 |
013A: MOVWF 07 |
401 |
015B: NOP |
364 |
013B: NOP |
402 |
015C: BCF 03.5 |
365 |
013C: BCF 03.5 |
403 |
015D: BCF 07.4 |
366 |
013D: BCF 07.4 |
404 |
015E: BCF 20.4 |
367 |
013E: BCF 20.4 |
405 |
015F: MOVF 20,W |
368 |
013F: MOVF 20,W |
406 |
0160: BSF 03.5 |
369 |
0140: BSF 03.5 |
407 |
0161: MOVWF 07 |
370 |
0141: MOVWF 07 |
408 |
0162: NOP |
371 |
0142: NOP |
409 |
0163: BCF 03.5 |
372 |
0143: BCF 03.5 |
410 |
0164: BCF 07.3 |
373 |
0144: BCF 07.3 |
411 |
0165: BCF 20.3 |
374 |
0145: BCF 20.3 |
412 |
0166: MOVF 20,W |
375 |
0146: MOVF 20,W |
413 |
0167: BSF 03.5 |
376 |
0147: BSF 03.5 |
414 |
0168: MOVWF 07 |
377 |
0148: MOVWF 07 |
415 |
.................... i2c_write(HMC5883L_WRT_ADDR); |
378 |
.................... i2c_write(HMC5883L_WRT_ADDR); |
416 |
0169: MOVLW 3C |
379 |
0149: MOVLW 3C |
417 |
016A: BCF 03.5 |
380 |
014A: BCF 03.5 |
418 |
016B: MOVWF 3D |
381 |
014B: MOVWF 2D |
419 |
016C: CALL 089 |
382 |
014C: CALL 069 |
420 |
.................... i2c_write(HMC5883L_X_MSB_REG); // Point to X-msb register |
383 |
.................... i2c_write(HMC5883L_X_MSB_REG); // Point to X-msb register |
421 |
016D: MOVLW 03 |
384 |
014D: MOVLW 03 |
422 |
016E: MOVWF 3D |
385 |
014E: MOVWF 2D |
423 |
016F: CALL 089 |
386 |
014F: CALL 069 |
424 |
.................... i2c_start(); |
387 |
.................... i2c_start(); |
425 |
0170: BSF 20.4 |
388 |
0150: BSF 20.4 |
426 |
0171: MOVF 20,W |
389 |
0151: MOVF 20,W |
427 |
0172: BSF 03.5 |
390 |
0152: BSF 03.5 |
428 |
0173: MOVWF 07 |
391 |
0153: MOVWF 07 |
429 |
0174: NOP |
392 |
0154: NOP |
430 |
0175: BCF 03.5 |
393 |
0155: BCF 03.5 |
431 |
0176: BSF 20.3 |
394 |
0156: BSF 20.3 |
432 |
0177: MOVF 20,W |
395 |
0157: MOVF 20,W |
433 |
0178: BSF 03.5 |
396 |
0158: BSF 03.5 |
434 |
0179: MOVWF 07 |
397 |
0159: MOVWF 07 |
435 |
017A: NOP |
398 |
015A: NOP |
436 |
017B: BCF 03.5 |
399 |
015B: BCF 03.5 |
437 |
017C: BTFSS 07.3 |
400 |
015C: BTFSS 07.3 |
438 |
017D: GOTO 17C |
401 |
015D: GOTO 15C |
439 |
017E: BCF 07.4 |
402 |
015E: BCF 07.4 |
440 |
017F: BCF 20.4 |
403 |
015F: BCF 20.4 |
441 |
0180: MOVF 20,W |
404 |
0160: MOVF 20,W |
442 |
0181: BSF 03.5 |
405 |
0161: BSF 03.5 |
443 |
0182: MOVWF 07 |
406 |
0162: MOVWF 07 |
444 |
0183: NOP |
407 |
0163: NOP |
445 |
0184: BCF 03.5 |
408 |
0164: BCF 03.5 |
446 |
0185: BCF 07.3 |
409 |
0165: BCF 07.3 |
447 |
0186: BCF 20.3 |
410 |
0166: BCF 20.3 |
448 |
0187: MOVF 20,W |
411 |
0167: MOVF 20,W |
449 |
0188: BSF 03.5 |
412 |
0168: BSF 03.5 |
450 |
0189: MOVWF 07 |
413 |
0169: MOVWF 07 |
451 |
.................... i2c_write(HMC5883L_READ_ADDR); |
414 |
.................... i2c_write(HMC5883L_READ_ADDR); |
452 |
018A: MOVLW 3D |
415 |
016A: MOVLW 3D |
453 |
018B: BCF 03.5 |
416 |
016B: BCF 03.5 |
454 |
018C: MOVWF 3D |
417 |
016C: MOVWF 2D |
455 |
018D: CALL 089 |
418 |
016D: CALL 069 |
456 |
.................... |
419 |
.................... |
457 |
.................... x_msb = i2c_read(); |
420 |
.................... x_msb = i2c_read(); |
458 |
018E: MOVLW 01 |
421 |
016E: MOVLW 01 |
459 |
018F: MOVWF 77 |
422 |
016F: MOVWF 77 |
460 |
0190: CALL 10C |
423 |
0170: CALL 0EC |
461 |
0191: MOVF 78,W |
424 |
0171: MOVF 78,W |
462 |
0192: MOVWF 38 |
425 |
0172: MOVWF 28 |
463 |
.................... x_lsb = i2c_read(); |
426 |
.................... x_lsb = i2c_read(); |
464 |
0193: MOVLW 01 |
427 |
0173: MOVLW 01 |
465 |
0194: MOVWF 77 |
428 |
0174: MOVWF 77 |
466 |
0195: CALL 10C |
429 |
0175: CALL 0EC |
467 |
0196: MOVF 78,W |
430 |
0176: MOVF 78,W |
468 |
0197: MOVWF 37 |
431 |
0177: MOVWF 27 |
469 |
.................... |
432 |
.................... |
470 |
.................... z_msb = i2c_read(); |
433 |
.................... z_msb = i2c_read(); |
471 |
0198: MOVLW 01 |
434 |
0178: MOVLW 01 |
472 |
0199: MOVWF 77 |
435 |
0179: MOVWF 77 |
473 |
019A: CALL 10C |
436 |
017A: CALL 0EC |
474 |
019B: MOVF 78,W |
437 |
017B: MOVF 78,W |
475 |
019C: MOVWF 3C |
438 |
017C: MOVWF 2C |
476 |
.................... z_lsb = i2c_read(); |
439 |
.................... z_lsb = i2c_read(); |
477 |
019D: MOVLW 01 |
440 |
017D: MOVLW 01 |
478 |
019E: MOVWF 77 |
441 |
017E: MOVWF 77 |
479 |
019F: CALL 10C |
442 |
017F: CALL 0EC |
480 |
01A0: MOVF 78,W |
443 |
0180: MOVF 78,W |
481 |
01A1: MOVWF 3B |
444 |
0181: MOVWF 2B |
482 |
.................... |
445 |
.................... |
483 |
.................... y_msb = i2c_read(); |
446 |
.................... y_msb = i2c_read(); |
484 |
01A2: MOVLW 01 |
447 |
0182: MOVLW 01 |
485 |
01A3: MOVWF 77 |
448 |
0183: MOVWF 77 |
486 |
01A4: CALL 10C |
449 |
0184: CALL 0EC |
487 |
01A5: MOVF 78,W |
450 |
0185: MOVF 78,W |
488 |
01A6: MOVWF 3A |
451 |
0186: MOVWF 2A |
489 |
.................... y_lsb = i2c_read(0); // do a NACK on last read |
452 |
.................... y_lsb = i2c_read(0); // do a NACK on last read |
490 |
01A7: CLRF 77 |
453 |
0187: CLRF 77 |
491 |
01A8: CALL 10C |
454 |
0188: CALL 0EC |
492 |
01A9: MOVF 78,W |
455 |
0189: MOVF 78,W |
493 |
01AA: MOVWF 39 |
456 |
018A: MOVWF 29 |
494 |
.................... |
457 |
.................... |
495 |
.................... i2c_stop(); |
458 |
.................... i2c_stop(); |
496 |
01AB: BCF 20.4 |
459 |
018B: BCF 20.4 |
497 |
01AC: MOVF 20,W |
460 |
018C: MOVF 20,W |
498 |
01AD: BSF 03.5 |
461 |
018D: BSF 03.5 |
499 |
01AE: MOVWF 07 |
462 |
018E: MOVWF 07 |
500 |
01AF: NOP |
463 |
018F: NOP |
501 |
01B0: BCF 03.5 |
464 |
0190: BCF 03.5 |
502 |
01B1: BSF 20.3 |
465 |
0191: BSF 20.3 |
503 |
01B2: MOVF 20,W |
466 |
0192: MOVF 20,W |
504 |
01B3: BSF 03.5 |
467 |
0193: BSF 03.5 |
505 |
01B4: MOVWF 07 |
468 |
0194: MOVWF 07 |
506 |
01B5: BCF 03.5 |
469 |
0195: BCF 03.5 |
507 |
01B6: BTFSS 07.3 |
470 |
0196: BTFSS 07.3 |
508 |
01B7: GOTO 1B6 |
471 |
0197: GOTO 196 |
509 |
01B8: NOP |
472 |
0198: NOP |
510 |
01B9: GOTO 1BA |
473 |
0199: GOTO 19A |
511 |
01BA: NOP |
474 |
019A: NOP |
512 |
01BB: BSF 20.4 |
475 |
019B: BSF 20.4 |
513 |
01BC: MOVF 20,W |
476 |
019C: MOVF 20,W |
514 |
01BD: BSF 03.5 |
477 |
019D: BSF 03.5 |
515 |
01BE: MOVWF 07 |
478 |
019E: MOVWF 07 |
516 |
01BF: NOP |
479 |
019F: NOP |
517 |
.................... |
480 |
.................... |
518 |
.................... // Combine high and low bytes into 16-bit values. |
481 |
.................... // Combine high and low bytes into 16-bit values. |
519 |
.................... compass.x = make16(x_msb, x_lsb); |
482 |
.................... compass.x = make16(x_msb, x_lsb); |
520 |
01C0: BCF 03.5 |
483 |
01A0: BCF 03.5 |
521 |
01C1: MOVF 38,W |
484 |
01A1: MOVF 28,W |
522 |
01C2: MOVWF 22 |
485 |
01A2: MOVWF 22 |
523 |
01C3: MOVF 37,W |
486 |
01A3: MOVF 27,W |
524 |
01C4: MOVWF 21 |
487 |
01A4: MOVWF 21 |
525 |
.................... compass.y = make16(y_msb, y_lsb); |
488 |
.................... compass.y = make16(y_msb, y_lsb); |
526 |
01C5: MOVF 3A,W |
489 |
01A5: MOVF 2A,W |
527 |
01C6: MOVWF 24 |
490 |
01A6: MOVWF 24 |
528 |
01C7: MOVF 39,W |
491 |
01A7: MOVF 29,W |
529 |
01C8: MOVWF 23 |
492 |
01A8: MOVWF 23 |
530 |
.................... compass.z = make16(z_msb, z_lsb); |
493 |
.................... compass.z = make16(z_msb, z_lsb); |
531 |
01C9: MOVF 3C,W |
494 |
01A9: MOVF 2C,W |
532 |
01CA: MOVWF 26 |
495 |
01AA: MOVWF 26 |
533 |
01CB: MOVF 3B,W |
496 |
01AB: MOVF 2B,W |
534 |
01CC: MOVWF 25 |
497 |
01AC: MOVWF 25 |
535 |
.................... } |
498 |
.................... } |
536 |
01CD: BCF 0A.3 |
499 |
01AD: BCF 0A.3 |
537 |
01CE: BCF 0A.4 |
500 |
01AE: BCF 0A.4 |
538 |
01CF: GOTO 2F6 (RETURN) |
501 |
01AF: GOTO 2CC (RETURN) |
539 |
.................... |
502 |
.................... |
540 |
.................... |
503 |
.................... |
541 |
.................... |
504 |
.................... |
542 |
.................... |
505 |
.................... |
543 |
.................... #include <math.h> |
506 |
.................... #include <math.h> |
Line 2715... |
Line 2678... |
2715 |
.................... |
2678 |
.................... |
2716 |
.................... |
2679 |
.................... |
2717 |
.................... void main() |
2680 |
.................... void main() |
2718 |
.................... { |
2681 |
.................... { |
2719 |
* |
2682 |
* |
2720 |
0266: CLRF 04 |
2683 |
023C: CLRF 04 |
2721 |
0267: BCF 03.7 |
2684 |
023D: BCF 03.7 |
2722 |
0268: MOVLW 1F |
2685 |
023E: MOVLW 1F |
2723 |
0269: ANDWF 03,F |
2686 |
023F: ANDWF 03,F |
2724 |
026A: MOVLW 71 |
2687 |
0240: MOVLW 71 |
2725 |
026B: BSF 03.5 |
2688 |
0241: BSF 03.5 |
2726 |
026C: MOVWF 0F |
2689 |
0242: MOVWF 0F |
2727 |
026D: MOVF 0F,W |
2690 |
0243: MOVF 0F,W |
2728 |
026E: BCF 03.5 |
2691 |
0244: BSF 03.6 |
2729 |
026F: BCF 20.7 |
2692 |
0245: BCF 07.3 |
2730 |
0270: MOVF 20,W |
2693 |
0246: MOVLW 0C |
2731 |
0271: BSF 03.5 |
2694 |
0247: BCF 03.6 |
- |
|
2695 |
0248: MOVWF 19 |
- |
|
2696 |
0249: MOVLW A2 |
2732 |
0272: MOVWF 07 |
2697 |
024A: MOVWF 18 |
- |
|
2698 |
024B: MOVLW 90 |
2733 |
0273: BCF 03.5 |
2699 |
024C: BCF 03.5 |
2734 |
0274: BSF 07.7 |
2700 |
024D: MOVWF 18 |
2735 |
0275: BSF 03.5 |
2701 |
024E: BSF 03.5 |
2736 |
0276: BSF 03.6 |
2702 |
024F: BSF 03.6 |
2737 |
0277: MOVF 09,W |
2703 |
0250: MOVF 09,W |
2738 |
0278: ANDLW C0 |
2704 |
0251: ANDLW C0 |
2739 |
0279: MOVWF 09 |
2705 |
0252: MOVWF 09 |
2740 |
027A: BCF 03.6 |
2706 |
0253: BCF 03.6 |
2741 |
027B: BCF 1F.4 |
2707 |
0254: BCF 1F.4 |
2742 |
027C: BCF 1F.5 |
2708 |
0255: BCF 1F.5 |
2743 |
027D: MOVLW 00 |
2709 |
0256: MOVLW 00 |
2744 |
027E: BSF 03.6 |
2710 |
0257: BSF 03.6 |
2745 |
027F: MOVWF 08 |
2711 |
0258: MOVWF 08 |
2746 |
0280: BCF 03.5 |
2712 |
0259: BCF 03.5 |
2747 |
0281: CLRF 07 |
2713 |
025A: CLRF 07 |
2748 |
0282: CLRF 08 |
2714 |
025B: CLRF 08 |
2749 |
0283: CLRF 09 |
2715 |
025C: CLRF 09 |
2750 |
* |
- |
|
2751 |
028D: CLRF 34 |
- |
|
2752 |
028E: CLRF 33 |
- |
|
2753 |
.................... float last,b,anemo_speed; |
- |
|
2754 |
.................... unsigned int16 anemo_round=0; |
- |
|
2755 |
.................... unsigned int16 i; |
- |
|
2756 |
.................... |
- |
|
2757 |
.................... //signed int16 X,Y,Z; |
- |
|
2758 |
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD); |
2716 |
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD); |
- |
|
2717 |
* |
2759 |
028F: BSF 03.5 |
2718 |
0266: BSF 03.5 |
2760 |
0290: BSF 03.6 |
2719 |
0267: BSF 03.6 |
2761 |
0291: MOVF 09,W |
2720 |
0268: MOVF 09,W |
2762 |
0292: ANDLW C0 |
2721 |
0269: ANDLW C0 |
2763 |
0293: MOVWF 09 |
2722 |
026A: MOVWF 09 |
2764 |
0294: BCF 03.6 |
2723 |
026B: BCF 03.6 |
2765 |
0295: BCF 1F.4 |
2724 |
026C: BCF 1F.4 |
2766 |
0296: BCF 1F.5 |
2725 |
026D: BCF 1F.5 |
2767 |
0297: MOVLW 00 |
2726 |
026E: MOVLW 00 |
2768 |
0298: BSF 03.6 |
2727 |
026F: BSF 03.6 |
2769 |
0299: MOVWF 08 |
2728 |
0270: MOVWF 08 |
2770 |
.................... setup_adc(ADC_CLOCK_DIV_2); |
2729 |
.................... setup_adc(ADC_CLOCK_DIV_2); |
2771 |
029A: BCF 03.5 |
2730 |
0271: BCF 03.5 |
2772 |
029B: BCF 03.6 |
2731 |
0272: BCF 03.6 |
2773 |
029C: BCF 1F.6 |
2732 |
0273: BCF 1F.6 |
2774 |
029D: BCF 1F.7 |
2733 |
0274: BCF 1F.7 |
2775 |
029E: BSF 03.5 |
2734 |
0275: BSF 03.5 |
2776 |
029F: BCF 1F.7 |
2735 |
0276: BCF 1F.7 |
2777 |
02A0: BCF 03.5 |
2736 |
0277: BCF 03.5 |
2778 |
02A1: BSF 1F.0 |
2737 |
0278: BSF 1F.0 |
2779 |
.................... setup_spi(SPI_SS_DISABLED); |
2738 |
.................... setup_spi(SPI_SS_DISABLED); |
2780 |
02A2: BCF 14.5 |
2739 |
0279: BCF 14.5 |
2781 |
02A3: BCF 20.5 |
2740 |
027A: BCF 20.5 |
2782 |
02A4: MOVF 20,W |
2741 |
027B: MOVF 20,W |
2783 |
02A5: BSF 03.5 |
2742 |
027C: BSF 03.5 |
2784 |
02A6: MOVWF 07 |
2743 |
027D: MOVWF 07 |
2785 |
02A7: BCF 03.5 |
2744 |
027E: BCF 03.5 |
2786 |
02A8: BSF 20.4 |
2745 |
027F: BSF 20.4 |
2787 |
02A9: MOVF 20,W |
2746 |
0280: MOVF 20,W |
2788 |
02AA: BSF 03.5 |
2747 |
0281: BSF 03.5 |
2789 |
02AB: MOVWF 07 |
2748 |
0282: MOVWF 07 |
2790 |
02AC: BCF 03.5 |
2749 |
0283: BCF 03.5 |
2791 |
02AD: BCF 20.3 |
2750 |
0284: BCF 20.3 |
2792 |
02AE: MOVF 20,W |
2751 |
0285: MOVF 20,W |
2793 |
02AF: BSF 03.5 |
2752 |
0286: BSF 03.5 |
2794 |
02B0: MOVWF 07 |
2753 |
0287: MOVWF 07 |
2795 |
02B1: MOVLW 01 |
2754 |
0288: MOVLW 01 |
2796 |
02B2: BCF 03.5 |
2755 |
0289: BCF 03.5 |
2797 |
02B3: MOVWF 14 |
2756 |
028A: MOVWF 14 |
2798 |
02B4: MOVLW 00 |
2757 |
028B: MOVLW 00 |
2799 |
02B5: BSF 03.5 |
2758 |
028C: BSF 03.5 |
2800 |
02B6: MOVWF 14 |
2759 |
028D: MOVWF 14 |
2801 |
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
2760 |
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
2802 |
02B7: MOVF 01,W |
2761 |
028E: MOVF 01,W |
2803 |
02B8: ANDLW C7 |
2762 |
028F: ANDLW C7 |
2804 |
02B9: IORLW 08 |
2763 |
0290: IORLW 08 |
2805 |
02BA: MOVWF 01 |
2764 |
0291: MOVWF 01 |
2806 |
.................... setup_timer_1(T1_DISABLED); |
2765 |
.................... setup_timer_1(T1_DISABLED); |
2807 |
02BB: BCF 03.5 |
2766 |
0292: BCF 03.5 |
2808 |
02BC: CLRF 10 |
2767 |
0293: CLRF 10 |
2809 |
.................... setup_timer_2(T2_DISABLED,0,1); |
2768 |
.................... setup_timer_2(T2_DISABLED,0,1); |
2810 |
02BD: MOVLW 00 |
2769 |
0294: MOVLW 00 |
2811 |
02BE: MOVWF 78 |
2770 |
0295: MOVWF 78 |
2812 |
02BF: MOVWF 12 |
2771 |
0296: MOVWF 12 |
2813 |
02C0: MOVLW 00 |
2772 |
0297: MOVLW 00 |
2814 |
02C1: BSF 03.5 |
2773 |
0298: BSF 03.5 |
2815 |
02C2: MOVWF 12 |
2774 |
0299: MOVWF 12 |
2816 |
.................... setup_ccp1(CCP_OFF); |
2775 |
.................... setup_ccp1(CCP_OFF); |
2817 |
02C3: BCF 03.5 |
2776 |
029A: BCF 03.5 |
2818 |
02C4: BSF 20.2 |
2777 |
029B: BSF 20.2 |
2819 |
02C5: MOVF 20,W |
2778 |
029C: MOVF 20,W |
2820 |
02C6: BSF 03.5 |
2779 |
029D: BSF 03.5 |
2821 |
02C7: MOVWF 07 |
2780 |
029E: MOVWF 07 |
2822 |
02C8: BCF 03.5 |
2781 |
029F: BCF 03.5 |
2823 |
02C9: CLRF 17 |
2782 |
02A0: CLRF 17 |
2824 |
02CA: BSF 03.5 |
2783 |
02A1: BSF 03.5 |
2825 |
02CB: CLRF 1B |
2784 |
02A2: CLRF 1B |
2826 |
02CC: CLRF 1C |
2785 |
02A3: CLRF 1C |
2827 |
02CD: MOVLW 01 |
2786 |
02A4: MOVLW 01 |
2828 |
02CE: MOVWF 1D |
2787 |
02A5: MOVWF 1D |
2829 |
.................... setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard |
2788 |
.................... setup_comparator(NC_NC_NC_NC); |
2830 |
02CF: BCF 03.5 |
2789 |
02A6: BCF 03.5 |
2831 |
02D0: BSF 03.6 |
2790 |
02A7: BSF 03.6 |
2832 |
02D1: CLRF 07 |
2791 |
02A8: CLRF 07 |
2833 |
02D2: CLRF 08 |
2792 |
02A9: CLRF 08 |
2834 |
02D3: CLRF 09 |
2793 |
02AA: CLRF 09 |
2835 |
.................... |
2794 |
.................... |
2836 |
.................... printf("Magnetometr: \r\n",); |
2795 |
.................... printf("Magnetometr: \r\n",); |
2837 |
02D4: MOVLW 04 |
2796 |
02AB: MOVLW 04 |
2838 |
02D5: MOVWF 0D |
2797 |
02AC: MOVWF 0D |
2839 |
02D6: MOVLW 00 |
2798 |
02AD: MOVLW 00 |
2840 |
02D7: MOVWF 0F |
2799 |
02AE: MOVWF 0F |
2841 |
02D8: BCF 03.6 |
2800 |
02AF: BCF 03.6 |
2842 |
02D9: CALL 043 |
2801 |
02B0: CALL 021 |
2843 |
.................... printf("(c)mlab JACHO 2013: \r\n",); |
2802 |
.................... printf("(c)mlab.cz kaklik 2013: \r\n",); |
2844 |
02DA: MOVLW 0D |
2803 |
02B1: MOVLW 0D |
2845 |
02DB: BSF 03.6 |
2804 |
02B2: BSF 03.6 |
2846 |
02DC: MOVWF 0D |
2805 |
02B3: MOVWF 0D |
2847 |
02DD: MOVLW 00 |
2806 |
02B4: MOVLW 00 |
2848 |
02DE: MOVWF 0F |
2807 |
02B5: MOVWF 0F |
2849 |
02DF: BCF 03.6 |
2808 |
02B6: BCF 03.6 |
2850 |
02E0: CALL 043 |
2809 |
02B7: CALL 021 |
2851 |
.................... printf("X, Y, Z \r\n",); |
2810 |
.................... printf("X, Y, Z \r\n",); |
2852 |
02E1: MOVLW 19 |
2811 |
02B8: MOVLW 1B |
2853 |
02E2: BSF 03.6 |
2812 |
02B9: BSF 03.6 |
2854 |
02E3: MOVWF 0D |
2813 |
02BA: MOVWF 0D |
2855 |
02E4: MOVLW 00 |
2814 |
02BB: MOVLW 00 |
2856 |
02E5: MOVWF 0F |
2815 |
02BC: MOVWF 0F |
2857 |
02E6: BCF 03.6 |
2816 |
02BD: BCF 03.6 |
2858 |
02E7: CALL 043 |
2817 |
02BE: CALL 021 |
2859 |
.................... |
2818 |
.................... |
2860 |
.................... |
2819 |
.................... |
2861 |
.................... // Init the HMC5883L. Set Mode register for |
2820 |
.................... // Init the HMC5883L. Set Mode register for |
2862 |
.................... // continuous measurements. |
2821 |
.................... // continuous measurements. |
2863 |
.................... hmc5883l_write_reg(HMC5883L_CFG_A_REG, 0x18); // no average, maximal update range |
2822 |
.................... hmc5883l_write_reg(HMC5883L_CFG_A_REG, 0x18); // no average, maximal update range |
2864 |
02E8: CLRF 37 |
2823 |
02BF: CLRF 27 |
2865 |
02E9: MOVLW 18 |
2824 |
02C0: MOVLW 18 |
2866 |
02EA: MOVWF 38 |
2825 |
02C1: MOVWF 28 |
2867 |
02EB: CALL 0D3 |
2826 |
02C2: CALL 0B3 |
2868 |
.................... hmc5883l_write_reg(HMC5883L_CFG_B_REG, 0xE0); // maximal range |
2827 |
.................... hmc5883l_write_reg(HMC5883L_CFG_B_REG, 0x00); // minimal range |
2869 |
02EC: MOVLW 01 |
2828 |
02C3: MOVLW 01 |
2870 |
02ED: MOVWF 37 |
2829 |
02C4: MOVWF 27 |
2871 |
02EE: MOVLW E0 |
- |
|
2872 |
02EF: MOVWF 38 |
2830 |
02C5: CLRF 28 |
2873 |
02F0: CALL 0D3 |
2831 |
02C6: CALL 0B3 |
2874 |
.................... hmc5883l_write_reg(HMC5883L_MODE_REG, 0x00); |
2832 |
.................... hmc5883l_write_reg(HMC5883L_MODE_REG, 0x00); |
2875 |
02F1: MOVLW 02 |
2833 |
02C7: MOVLW 02 |
2876 |
02F2: MOVWF 37 |
2834 |
02C8: MOVWF 27 |
2877 |
02F3: CLRF 38 |
2835 |
02C9: CLRF 28 |
2878 |
02F4: CALL 0D3 |
2836 |
02CA: CALL 0B3 |
2879 |
.................... |
2837 |
.................... |
2880 |
.................... // Continuously read and display the x,y,z results. |
2838 |
.................... // Continuously read and display the x,y,z results. |
2881 |
.................... // Wait at least 67 ms between reads, re the HMC5883L data sheet. |
2839 |
.................... // Wait at least 67 ms between reads, re the HMC5883L data sheet. |
2882 |
.................... |
2840 |
.................... |
2883 |
.................... |
2841 |
.................... |
2884 |
.................... while(TRUE) |
2842 |
.................... while(TRUE) |
2885 |
.................... { |
2843 |
.................... { |
2886 |
.................... |
2844 |
.................... |
2887 |
.................... hmc5883l_read_data(); |
2845 |
.................... hmc5883l_read_data(); |
2888 |
02F5: GOTO 151 |
2846 |
02CB: GOTO 131 |
2889 |
.................... printf("%6Ld %6Ld %6Ld \n\r", compass.x, compass.y, compass.z); |
2847 |
.................... printf("%6Ld %6Ld %6Ld \n\r", compass.x, compass.y, compass.z); |
2890 |
02F6: MOVLW 00 |
2848 |
02CC: MOVLW 00 |
2891 |
02F7: MOVWF 04 |
2849 |
02CD: MOVWF 04 |
2892 |
02F8: MOVF 22,W |
2850 |
02CE: MOVF 22,W |
2893 |
02F9: MOVWF 38 |
2851 |
02CF: MOVWF 28 |
2894 |
02FA: MOVF 21,W |
2852 |
02D0: MOVF 21,W |
2895 |
02FB: MOVWF 37 |
2853 |
02D1: MOVWF 27 |
2896 |
02FC: CALL 1D0 |
2854 |
02D2: CALL 1B0 |
2897 |
02FD: MOVLW 20 |
2855 |
02D3: MOVLW 20 |
- |
|
2856 |
02D4: BTFSS 0C.4 |
2898 |
02FE: MOVWF 40 |
2857 |
02D5: GOTO 2D4 |
2899 |
02FF: CALL 01F |
2858 |
02D6: MOVWF 19 |
2900 |
0300: MOVLW 00 |
2859 |
02D7: MOVLW 00 |
2901 |
0301: MOVWF 04 |
2860 |
02D8: MOVWF 04 |
2902 |
0302: MOVF 24,W |
2861 |
02D9: MOVF 24,W |
2903 |
0303: MOVWF 38 |
2862 |
02DA: MOVWF 28 |
2904 |
0304: MOVF 23,W |
2863 |
02DB: MOVF 23,W |
2905 |
0305: MOVWF 37 |
2864 |
02DC: MOVWF 27 |
2906 |
0306: CALL 1D0 |
2865 |
02DD: CALL 1B0 |
2907 |
0307: MOVLW 20 |
2866 |
02DE: MOVLW 20 |
- |
|
2867 |
02DF: BTFSS 0C.4 |
2908 |
0308: MOVWF 40 |
2868 |
02E0: GOTO 2DF |
2909 |
0309: CALL 01F |
2869 |
02E1: MOVWF 19 |
2910 |
030A: MOVLW 00 |
2870 |
02E2: MOVLW 00 |
2911 |
030B: MOVWF 04 |
2871 |
02E3: MOVWF 04 |
2912 |
030C: MOVF 26,W |
2872 |
02E4: MOVF 26,W |
2913 |
030D: MOVWF 38 |
2873 |
02E5: MOVWF 28 |
2914 |
030E: MOVF 25,W |
2874 |
02E6: MOVF 25,W |
2915 |
030F: MOVWF 37 |
2875 |
02E7: MOVWF 27 |
2916 |
0310: CALL 1D0 |
2876 |
02E8: CALL 1B0 |
2917 |
0311: MOVLW 20 |
2877 |
02E9: MOVLW 20 |
- |
|
2878 |
02EA: BTFSS 0C.4 |
2918 |
0312: MOVWF 40 |
2879 |
02EB: GOTO 2EA |
2919 |
0313: CALL 01F |
2880 |
02EC: MOVWF 19 |
2920 |
0314: MOVLW 0A |
2881 |
02ED: MOVLW 0A |
- |
|
2882 |
02EE: BTFSS 0C.4 |
2921 |
0315: MOVWF 40 |
2883 |
02EF: GOTO 2EE |
2922 |
0316: CALL 01F |
2884 |
02F0: MOVWF 19 |
2923 |
0317: MOVLW 0D |
2885 |
02F1: MOVLW 0D |
- |
|
2886 |
02F2: BTFSS 0C.4 |
2924 |
0318: MOVWF 40 |
2887 |
02F3: GOTO 2F2 |
2925 |
0319: CALL 01F |
2888 |
02F4: MOVWF 19 |
2926 |
.................... delay_ms(100); |
2889 |
.................... delay_ms(100); |
2927 |
031A: MOVLW 64 |
2890 |
02F5: MOVLW 64 |
2928 |
031B: MOVWF 37 |
2891 |
02F6: MOVWF 27 |
2929 |
031C: GOTO 250 |
2892 |
02F7: GOTO 226 |
2930 |
.................... } |
2893 |
.................... } |
2931 |
031D: GOTO 2F5 |
2894 |
02F8: GOTO 2CB |
2932 |
.................... |
2895 |
.................... |
2933 |
.................... } |
2896 |
.................... } |
2934 |
.................... |
2897 |
.................... |
2935 |
.................... |
2898 |
.................... |
2936 |
.................... |
2899 |
.................... |
2937 |
031E: SLEEP |
2900 |
02F9: SLEEP |
2938 |
|
2901 |
|
2939 |
Configuration Fuses: |
2902 |
Configuration Fuses: |
2940 |
Word 1: 2CF5 INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG |
2903 |
Word 1: 2CF5 INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG |
2941 |
Word 2: 3FFF NOWRT BORV40 |
2904 |
Word 2: 3FFF NOWRT BORV40 |