Rev 2926 Rev 2984
Line 1... Line 1...
1 CCS PCM C Compiler, Version 4.106, 47914 16-4-13 18:24 1 CCS PCM C Compiler, Version 4.106, 47914 15-V-13 16:26
2   2  
3 Filename: c:\users\honza\documents\pic\i2c_magnetometr\main.lst 3 Filename: Z:\home\kaklik\svnMLAB\Modules\Sensors\MAG01A\SW\PIC16F887\main.lst
4   4  
5 ROM used: 788 words (10%) 5 ROM used: 972 words (12%)
6 Largest free fragment is 2048 6 Largest free fragment is 2048
7 RAM used: 7 (2%) at main() level 7 RAM used: 12 (3%) at main() level
8 22 (6%) worst case 8 22 (6%) worst case
9 Stack: 3 locations 9 Stack: 3 locations
10   10  
11 * 11 *
12 0000: MOVLW 02 12 0000: MOVLW 03
13 0001: MOVWF 0A 13 0001: MOVWF 0A
14 0002: GOTO 237 14 0002: GOTO 317
15 0003: NOP 15 0003: NOP
16 .................... //Magnetometr Jan Chroust 2013 -  
17 .................... //vypise hodnoty jednotlivych os -  
18 .................... -  
19 .................... #include "main.h" 16 .................... #include "main.h"
20 .................... #include <16F887.h> 17 .................... #include <16F887.h>
21 .................... //////// Standard Header file for the PIC16F887 device //////////////// 18 .................... //////// Standard Header file for the PIC16F887 device ////////////////
22 .................... #device PIC16F887 19 .................... #device PIC16F887
23 .................... #list 20 .................... #list
24 .................... 21 ....................
25 .................... #device adc=8 22 .................... #device adc=8
26 .................... 23 ....................
27 .................... #FUSES NOWDT //No Watch Dog Timer 24 .................... #FUSES NOWDT //No Watch Dog Timer
28 .................... #FUSES INTRC //Internal RC Osc 25 .................... #FUSES INTRC //Internal RC Osc
29 .................... #FUSES NOPUT //No Power Up Timer 26 .................... #FUSES NOPUT //No Power Up Timer
30 .................... #FUSES MCLR //Master Clear pin enabled 27 .................... #FUSES MCLR //Master Clear pin enabled
31 .................... #FUSES NOPROTECT //Code not protected from reading 28 .................... #FUSES NOPROTECT //Code not protected from reading
32 .................... #FUSES NOCPD //No EE protection 29 .................... #FUSES NOCPD //No EE protection
33 .................... #FUSES NOBROWNOUT //No brownout reset 30 .................... #FUSES NOBROWNOUT //No brownout reset
34 .................... #FUSES IESO //Internal External Switch Over mode enabled 31 .................... #FUSES IESO //Internal External Switch Over mode enabled
35 .................... #FUSES FCMEN //Fail-safe clock monitor enabled 32 .................... #FUSES FCMEN //Fail-safe clock monitor enabled
36 .................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O 33 .................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
37 .................... #FUSES NODEBUG //No Debug mode for ICD 34 .................... #FUSES NODEBUG //No Debug mode for ICD
38 .................... #FUSES NOWRT //Program memory not write protected 35 .................... #FUSES NOWRT //Program memory not write protected
39 .................... #FUSES BORV40 //Brownout reset at 4.0V 36 .................... #FUSES BORV40 //Brownout reset at 4.0V
40 .................... 37 ....................
41 .................... #use delay(clock=8000000) 38 .................... #use delay(clock=8000000)
42 * 39 *
43 0221: MOVLW 28 40 0069: MOVLW 27
44 0222: MOVWF 04 41 006A: MOVWF 04
45 0223: BCF 03.7 42 006B: BCF 03.7
46 0224: MOVF 00,W 43 006C: MOVF 00,W
47 0225: BTFSC 03.2 44 006D: BTFSC 03.2
48 0226: GOTO 234 45 006E: GOTO 07C
49 0227: MOVLW 02 46 006F: MOVLW 02
50 0228: MOVWF 78 47 0070: MOVWF 78
51 0229: CLRF 77 48 0071: CLRF 77
52 022A: DECFSZ 77,F 49 0072: DECFSZ 77,F
53 022B: GOTO 22A 50 0073: GOTO 072
54 022C: DECFSZ 78,F 51 0074: DECFSZ 78,F
55 022D: GOTO 229 52 0075: GOTO 071
56 022E: MOVLW 97 53 0076: MOVLW 97
57 022F: MOVWF 77 54 0077: MOVWF 77
58 0230: DECFSZ 77,F 55 0078: DECFSZ 77,F
59 0231: GOTO 230 56 0079: GOTO 078
60 0232: DECFSZ 00,F 57 007A: DECFSZ 00,F
61 0233: GOTO 227 58 007B: GOTO 06F
62 0234: BCF 0A.3 -  
63 0235: BCF 0A.4 -  
64 0236: GOTO 310 (RETURN) 59 007C: RETURN
65 .................... -  
66 .................... -  
67 .................... -  
68 .................... #define EEPROM_SDA PIN_B0 -  
69 .................... #define EEPROM_SCL PIN_B1 -  
70 .................... #use i2c(master, sda=EEPROM_SDA, scl=EEPROM_SCL) 60 .................... #use i2c(master, sda=PIN_C4, scl=PIN_C3)
71 * 61 *
72 009F: MOVLW 08 62 001F: MOVLW 08
73 00A0: MOVWF 78 63 0020: MOVWF 78
74 00A1: NOP 64 0021: NOP
75 00A2: BCF 06.1 65 0022: BCF 07.3
76 00A3: BSF 03.5 66 0023: BCF 20.3
-   67 0024: MOVF 20,W
77 00A4: BCF 06.1 68 0025: BSF 03.5
-   69 0026: MOVWF 07
78 00A5: NOP 70 0027: NOP
79 00A6: BCF 03.5 71 0028: BCF 03.5
80 00A7: RLF 2C,F 72 0029: RLF 2C,F
81 00A8: BCF 06.0 73 002A: BCF 07.4
82 00A9: BTFSS 03.0 74 002B: BTFSS 03.0
83 00AA: GOTO 0AE 75 002C: GOTO 033
84 00AB: BSF 03.5 76 002D: BSF 20.4
85 00AC: BSF 06.0 77 002E: MOVF 20,W
86 00AD: BCF 03.5 78 002F: BSF 03.5
87 00AE: BTFSC 03.0 79 0030: MOVWF 07
88 00AF: GOTO 0B3 80 0031: GOTO 037
89 00B0: BSF 03.5 81 0032: BCF 03.5
90 00B1: BCF 06.0 82 0033: BCF 20.4
-   83 0034: MOVF 20,W
91 00B2: BCF 03.5 84 0035: BSF 03.5
-   85 0036: MOVWF 07
-   86 0037: NOP
92 00B3: BSF 03.5 87 0038: BCF 03.5
-   88 0039: BSF 20.3
-   89 003A: MOVF 20,W
93 00B4: BSF 06.1 90 003B: BSF 03.5
-   91 003C: MOVWF 07
94 00B5: BCF 03.5 92 003D: BCF 03.5
95 00B6: BTFSS 06.1 93 003E: BTFSS 07.3
96 00B7: GOTO 0B6 94 003F: GOTO 03E
97 00B8: DECFSZ 78,F 95 0040: DECFSZ 78,F
98 00B9: GOTO 0A1 96 0041: GOTO 021
99 00BA: NOP 97 0042: NOP
100 00BB: BCF 06.1 98 0043: BCF 07.3
101 00BC: BSF 03.5 99 0044: BCF 20.3
-   100 0045: MOVF 20,W
102 00BD: BCF 06.1 101 0046: BSF 03.5
-   102 0047: MOVWF 07
103 00BE: NOP 103 0048: NOP
-   104 0049: BCF 03.5
-   105 004A: BSF 20.4
-   106 004B: MOVF 20,W
104 00BF: BSF 06.0 107 004C: BSF 03.5
-   108 004D: MOVWF 07
105 00C0: NOP 109 004E: NOP
106 00C1: NOP 110 004F: NOP
-   111 0050: BCF 03.5
-   112 0051: BSF 20.3
-   113 0052: MOVF 20,W
107 00C2: BSF 06.1 114 0053: BSF 03.5
-   115 0054: MOVWF 07
108 00C3: BCF 03.5 116 0055: BCF 03.5
109 00C4: BTFSS 06.1 117 0056: BTFSS 07.3
110 00C5: GOTO 0C4 118 0057: GOTO 056
111 00C6: CLRF 78 119 0058: CLRF 78
112 00C7: NOP 120 0059: NOP
113 00C8: BTFSC 06.0 121 005A: BTFSC 07.4
114 00C9: BSF 78.0 122 005B: BSF 78.0
115 00CA: BCF 06.1 123 005C: BCF 07.3
-   124 005D: BCF 20.3
-   125 005E: MOVF 20,W
116 00CB: BSF 03.5 126 005F: BSF 03.5
-   127 0060: MOVWF 07
117 00CC: BCF 06.1 128 0061: BCF 03.5
118 00CD: BCF 03.5 129 0062: BCF 07.4
119 00CE: BCF 06.0 130 0063: BCF 20.4
-   131 0064: MOVF 20,W
120 00CF: BSF 03.5 132 0065: BSF 03.5
121 00D0: BCF 06.0 133 0066: MOVWF 07
122 00D1: BCF 03.5 134 0067: BCF 03.5
123 00D2: RETURN 135 0068: RETURN
124 * 136 *
125 0107: MOVLW 08 137 01EB: MOVLW 08
126 0108: MOVWF 2D 138 01EC: MOVWF 2D
127 0109: MOVF 77,W 139 01ED: MOVF 77,W
128 010A: MOVWF 2E 140 01EE: MOVWF 2E
129 010B: BSF 03.5 141 01EF: BSF 20.4
-   142 01F0: MOVF 20,W
130 010C: BSF 06.0 143 01F1: BSF 03.5
-   144 01F2: MOVWF 07
131 010D: NOP 145 01F3: NOP
-   146 01F4: BCF 03.5
-   147 01F5: BSF 20.3
-   148 01F6: MOVF 20,W
132 010E: BSF 06.1 149 01F7: BSF 03.5
-   150 01F8: MOVWF 07
133 010F: BCF 03.5 151 01F9: BCF 03.5
134 0110: BTFSS 06.1 152 01FA: BTFSS 07.3
135 0111: GOTO 110 153 01FB: GOTO 1FA
136 0112: BTFSC 06.0 154 01FC: BTFSC 07.4
137 0113: BSF 03.0 155 01FD: BSF 03.0
138 0114: BTFSS 06.0 156 01FE: BTFSS 07.4
139 0115: BCF 03.0 157 01FF: BCF 03.0
140 0116: RLF 78,F 158 0200: RLF 78,F
141 0117: NOP 159 0201: NOP
142 0118: BSF 03.5 160 0202: BCF 20.3
-   161 0203: MOVF 20,W
143 0119: BCF 06.1 162 0204: BSF 03.5
-   163 0205: MOVWF 07
144 011A: BCF 03.5 164 0206: BCF 03.5
145 011B: BCF 06.1 165 0207: BCF 07.3
146 011C: DECFSZ 2D,F 166 0208: DECFSZ 2D,F
147 011D: GOTO 10B 167 0209: GOTO 1EF
148 011E: BSF 03.5 168 020A: BSF 20.4
-   169 020B: MOVF 20,W
149 011F: BSF 06.0 170 020C: BSF 03.5
-   171 020D: MOVWF 07
150 0120: NOP 172 020E: NOP
151 0121: BCF 03.5 173 020F: BCF 03.5
152 0122: BCF 06.0 174 0210: BCF 07.4
153 0123: MOVF 2E,W 175 0211: MOVF 2E,W
154 0124: BTFSC 03.2 176 0212: BTFSC 03.2
155 0125: GOTO 129 177 0213: GOTO 219
-   178 0214: BCF 20.4
-   179 0215: MOVF 20,W
156 0126: BSF 03.5 180 0216: BSF 03.5
157 0127: BCF 06.0 181 0217: MOVWF 07
158 0128: BCF 03.5 182 0218: BCF 03.5
159 0129: NOP 183 0219: NOP
160 012A: BSF 03.5 184 021A: BSF 20.3
-   185 021B: MOVF 20,W
161 012B: BSF 06.1 186 021C: BSF 03.5
-   187 021D: MOVWF 07
162 012C: BCF 03.5 188 021E: BCF 03.5
163 012D: BTFSS 06.1 189 021F: BTFSS 07.3
164 012E: GOTO 12D 190 0220: GOTO 21F
165 012F: NOP 191 0221: NOP
166 0130: BCF 06.1 192 0222: BCF 07.3
167 0131: BSF 03.5 193 0223: BCF 20.3
-   194 0224: MOVF 20,W
168 0132: BCF 06.1 195 0225: BSF 03.5
-   196 0226: MOVWF 07
169 0133: NOP 197 0227: NOP
170 0134: BCF 03.5 198 0228: BCF 03.5
171 0135: BCF 06.0 199 0229: BCF 07.4
172 0136: BSF 03.5 200 022A: BCF 20.4
-   201 022B: MOVF 20,W
173 0137: BCF 06.0 202 022C: BSF 03.5
-   203 022D: MOVWF 07
174 .................... #use rs232(baud=9600,parity=N,xmit=PIN_B3,rcv=PIN_B2,bits=8) //rcv TXD xmit RXD 204 .................... #use rs232(baud=9600,parity=N,xmit=PIN_C7,rcv=PIN_C6,bits=8) //rcv TXD xmit RXD
175 * 205 *
176 0037: BSF 03.5 206 012F: BCF 20.7
-   207 0130: MOVF 20,W
177 0038: BCF 06.3 208 0131: BSF 03.5
-   209 0132: MOVWF 07
178 0039: BCF 03.5 210 0133: BCF 03.5
179 003A: BCF 06.3 211 0134: BCF 07.7
180 003B: MOVLW 08 212 0135: MOVLW 08
181 003C: MOVWF 78 213 0136: MOVWF 78
182 003D: GOTO 03E 214 0137: GOTO 138
183 003E: NOP 215 0138: NOP
184 003F: BSF 78.7 216 0139: BSF 78.7
185 0040: GOTO 04F 217 013A: GOTO 149
186 0041: BCF 78.7 218 013B: BCF 78.7
187 0042: RRF 30,F 219 013C: RRF 30,F
188 0043: BTFSC 03.0 220 013D: BTFSC 03.0
189 0044: BSF 06.3 221 013E: BSF 07.7
190 0045: BTFSS 03.0 222 013F: BTFSS 03.0
191 0046: BCF 06.3 223 0140: BCF 07.7
192 0047: BSF 78.6 224 0141: BSF 78.6
193 0048: GOTO 04F 225 0142: GOTO 149
194 0049: BCF 78.6 226 0143: BCF 78.6
195 004A: DECFSZ 78,F 227 0144: DECFSZ 78,F
196 004B: GOTO 042 228 0145: GOTO 13C
197 004C: GOTO 04D 229 0146: GOTO 147
198 004D: NOP 230 0147: NOP
199 004E: BSF 06.3 231 0148: BSF 07.7
200 004F: MOVLW 3F 232 0149: MOVLW 3F
201 0050: MOVWF 04 233 014A: MOVWF 04
202 0051: DECFSZ 04,F 234 014B: DECFSZ 04,F
203 0052: GOTO 051 235 014C: GOTO 14B
204 0053: NOP 236 014D: NOP
205 0054: BTFSC 78.7 237 014E: BTFSC 78.7
206 0055: GOTO 041 238 014F: GOTO 13B
207 0056: BTFSC 78.6 239 0150: BTFSC 78.6
208 0057: GOTO 049 240 0151: GOTO 143
209 0058: RETURN 241 0152: RETURN
-   242 ....................
210 .................... 243 ....................
211 .................... #include "HMC5883L.h" 244 .................... #include "HMC5883L.h"
212 .................... #define MAG_ADDR_R 0x3D //addresa pro cteni 245 .................... #define MAG_ADDR_R 0x3D //addresa pro cteni
213 .................... #define MAG_ADDR_W 0x3C 246 .................... #define MAG_ADDR_W 0x3C
214 .................... 247 ....................
Line 227... Line 260...
227 .................... 260 ....................
228 .................... #include "HMC5883L.c" 261 .................... #include "HMC5883L.c"
229 .................... void set_mag (void) //uvodni nastaveni na kontinualni mereni, rozsah ± 8.1 Ga, frekvence mereni 15HZ 262 .................... void set_mag (void) //uvodni nastaveni na kontinualni mereni, rozsah ± 8.1 Ga, frekvence mereni 15HZ
230 .................... { 263 .................... {
231 .................... i2c_start(); //nastavení Configuration Register A 264 .................... i2c_start(); //nastavení Configuration Register A
-   265 *
-   266 007D: BSF 20.4
-   267 007E: MOVF 20,W
-   268 007F: BSF 03.5
-   269 0080: MOVWF 07
-   270 0081: NOP
-   271 0082: BCF 03.5
-   272 0083: BSF 20.3
-   273 0084: MOVF 20,W
-   274 0085: BSF 03.5
-   275 0086: MOVWF 07
-   276 0087: NOP
-   277 0088: BCF 03.5
-   278 0089: BCF 07.4
-   279 008A: BCF 20.4
-   280 008B: MOVF 20,W
-   281 008C: BSF 03.5
-   282 008D: MOVWF 07
-   283 008E: NOP
-   284 008F: BCF 03.5
-   285 0090: BCF 07.3
-   286 0091: BCF 20.3
-   287 0092: MOVF 20,W
-   288 0093: BSF 03.5
-   289 0094: MOVWF 07
232 .................... I2C_Write(MAG_ADDR_W); 290 .................... I2C_Write(MAG_ADDR_W);
-   291 0095: MOVLW 3C
-   292 0096: BCF 03.5
-   293 0097: MOVWF 2C
-   294 0098: CALL 01F
233 .................... I2C_Write(0x00); 295 .................... I2C_Write(0x00);
-   296 0099: CLRF 2C
-   297 009A: CALL 01F
234 .................... I2C_Write(0x70); 298 .................... I2C_Write(0x70);
-   299 009B: MOVLW 70
-   300 009C: MOVWF 2C
-   301 009D: CALL 01F
235 .................... i2c_stop(); 302 .................... i2c_stop();
-   303 009E: BCF 20.4
-   304 009F: MOVF 20,W
-   305 00A0: BSF 03.5
-   306 00A1: MOVWF 07
-   307 00A2: NOP
-   308 00A3: BCF 03.5
-   309 00A4: BSF 20.3
-   310 00A5: MOVF 20,W
-   311 00A6: BSF 03.5
-   312 00A7: MOVWF 07
-   313 00A8: BCF 03.5
-   314 00A9: BTFSS 07.3
-   315 00AA: GOTO 0A9
-   316 00AB: NOP
-   317 00AC: GOTO 0AD
-   318 00AD: NOP
-   319 00AE: BSF 20.4
-   320 00AF: MOVF 20,W
-   321 00B0: BSF 03.5
-   322 00B1: MOVWF 07
-   323 00B2: NOP
236 .................... Delay_ms(6); 324 .................... Delay_ms(6);
-   325 00B3: MOVLW 06
-   326 00B4: BCF 03.5
-   327 00B5: MOVWF 27
-   328 00B6: CALL 069
237 .................... 329 ....................
238 .................... i2c_start(); //nastavení Configuration Register B 330 .................... i2c_start(); //nastavení Configuration Register B
-   331 00B7: BSF 20.4
-   332 00B8: MOVF 20,W
-   333 00B9: BSF 03.5
-   334 00BA: MOVWF 07
-   335 00BB: NOP
-   336 00BC: BCF 03.5
-   337 00BD: BSF 20.3
-   338 00BE: MOVF 20,W
-   339 00BF: BSF 03.5
-   340 00C0: MOVWF 07
-   341 00C1: NOP
-   342 00C2: BCF 03.5
-   343 00C3: BCF 07.4
-   344 00C4: BCF 20.4
-   345 00C5: MOVF 20,W
-   346 00C6: BSF 03.5
-   347 00C7: MOVWF 07
-   348 00C8: NOP
-   349 00C9: BCF 03.5
-   350 00CA: BCF 07.3
-   351 00CB: BCF 20.3
-   352 00CC: MOVF 20,W
-   353 00CD: BSF 03.5
-   354 00CE: MOVWF 07
239 .................... I2C_Write(MAG_ADDR_W); 355 .................... I2C_Write(MAG_ADDR_W);
-   356 00CF: MOVLW 3C
-   357 00D0: BCF 03.5
-   358 00D1: MOVWF 2C
-   359 00D2: CALL 01F
240 .................... I2C_Write(0x01); 360 .................... I2C_Write(0x01);
-   361 00D3: MOVLW 01
-   362 00D4: MOVWF 2C
-   363 00D5: CALL 01F
241 .................... I2C_Write(MAG_ROZ810); 364 .................... I2C_Write(MAG_ROZ810);
-   365 00D6: MOVLW E0
-   366 00D7: MOVWF 2C
-   367 00D8: CALL 01F
242 .................... i2c_stop(); 368 .................... i2c_stop();
-   369 00D9: BCF 20.4
-   370 00DA: MOVF 20,W
-   371 00DB: BSF 03.5
-   372 00DC: MOVWF 07
-   373 00DD: NOP
-   374 00DE: BCF 03.5
-   375 00DF: BSF 20.3
-   376 00E0: MOVF 20,W
-   377 00E1: BSF 03.5
-   378 00E2: MOVWF 07
-   379 00E3: BCF 03.5
-   380 00E4: BTFSS 07.3
-   381 00E5: GOTO 0E4
-   382 00E6: NOP
-   383 00E7: GOTO 0E8
-   384 00E8: NOP
-   385 00E9: BSF 20.4
-   386 00EA: MOVF 20,W
-   387 00EB: BSF 03.5
-   388 00EC: MOVWF 07
-   389 00ED: NOP
243 .................... 390 ....................
244 .................... Delay_ms(6); 391 .................... Delay_ms(6);
-   392 00EE: MOVLW 06
-   393 00EF: BCF 03.5
-   394 00F0: MOVWF 27
-   395 00F1: CALL 069
245 .................... 396 ....................
246 .................... i2c_start(); //nastveni Mode Register 397 .................... i2c_start(); //nastveni Mode Register
-   398 00F2: BSF 20.4
-   399 00F3: MOVF 20,W
-   400 00F4: BSF 03.5
-   401 00F5: MOVWF 07
-   402 00F6: NOP
-   403 00F7: BCF 03.5
-   404 00F8: BSF 20.3
-   405 00F9: MOVF 20,W
-   406 00FA: BSF 03.5
-   407 00FB: MOVWF 07
-   408 00FC: NOP
-   409 00FD: BCF 03.5
-   410 00FE: BCF 07.4
-   411 00FF: BCF 20.4
-   412 0100: MOVF 20,W
-   413 0101: BSF 03.5
-   414 0102: MOVWF 07
-   415 0103: NOP
-   416 0104: BCF 03.5
-   417 0105: BCF 07.3
-   418 0106: BCF 20.3
-   419 0107: MOVF 20,W
-   420 0108: BSF 03.5
-   421 0109: MOVWF 07
247 .................... I2C_Write(MAG_ADDR_W); 422 .................... I2C_Write(MAG_ADDR_W);
-   423 010A: MOVLW 3C
-   424 010B: BCF 03.5
-   425 010C: MOVWF 2C
-   426 010D: CALL 01F
248 .................... I2C_Write(0x02); 427 .................... I2C_Write(0x02);
-   428 010E: MOVLW 02
-   429 010F: MOVWF 2C
-   430 0110: CALL 01F
249 .................... I2C_Write(0x00); 431 .................... I2C_Write(0x00);
-   432 0111: CLRF 2C
-   433 0112: CALL 01F
250 .................... i2c_stop(); 434 .................... i2c_stop();
-   435 0113: BCF 20.4
-   436 0114: MOVF 20,W
-   437 0115: BSF 03.5
-   438 0116: MOVWF 07
-   439 0117: NOP
-   440 0118: BCF 03.5
-   441 0119: BSF 20.3
-   442 011A: MOVF 20,W
-   443 011B: BSF 03.5
-   444 011C: MOVWF 07
-   445 011D: BCF 03.5
-   446 011E: BTFSS 07.3
-   447 011F: GOTO 11E
-   448 0120: NOP
-   449 0121: GOTO 122
-   450 0122: NOP
-   451 0123: BSF 20.4
-   452 0124: MOVF 20,W
-   453 0125: BSF 03.5
-   454 0126: MOVWF 07
-   455 0127: NOP
251 .................... Delay_ms(6); 456 .................... Delay_ms(6);
-   457 0128: MOVLW 06
-   458 0129: BCF 03.5
-   459 012A: MOVWF 27
-   460 012B: CALL 069
252 .................... } 461 .................... }
-   462 012C: BCF 0A.3
-   463 012D: BCF 0A.4
-   464 012E: GOTO 37F (RETURN)
253 .................... 465 ....................
254 .................... void set_mag_roz (unsigned int8 h) //nastavy rozsah 466 .................... void set_mag_roz (unsigned int8 h) //nastavy rozsah
255 .................... { 467 .................... {
256 .................... 468 ....................
257 .................... // 469 .................... //
Line 272... Line 484...
272 .................... byte mag_read(byte reg) //pro cteni reg 484 .................... byte mag_read(byte reg) //pro cteni reg
273 .................... { 485 .................... {
274 .................... 486 ....................
275 .................... i2c_start(); 487 .................... i2c_start();
276 * 488 *
277 00D3: BSF 03.5 489 0199: BSF 20.4
-   490 019A: MOVF 20,W
278 00D4: BSF 06.0 491 019B: BSF 03.5
-   492 019C: MOVWF 07
279 00D5: NOP 493 019D: NOP
-   494 019E: BCF 03.5
-   495 019F: BSF 20.3
-   496 01A0: MOVF 20,W
280 00D6: BSF 06.1 497 01A1: BSF 03.5
-   498 01A2: MOVWF 07
281 00D7: NOP 499 01A3: NOP
282 00D8: BCF 03.5 500 01A4: BCF 03.5
283 00D9: BCF 06.0 501 01A5: BCF 07.4
284 00DA: BSF 03.5 502 01A6: BCF 20.4
-   503 01A7: MOVF 20,W
285 00DB: BCF 06.0 504 01A8: BSF 03.5
-   505 01A9: MOVWF 07
286 00DC: NOP 506 01AA: NOP
287 00DD: BCF 03.5 507 01AB: BCF 03.5
288 00DE: BCF 06.1 508 01AC: BCF 07.3
-   509 01AD: BCF 20.3
-   510 01AE: MOVF 20,W
289 00DF: BSF 03.5 511 01AF: BSF 03.5
290 00E0: BCF 06.1 512 01B0: MOVWF 07
291 .................... I2C_Write(MAG_ADDR_W); 513 .................... I2C_Write(MAG_ADDR_W);
292 00E1: MOVLW 3C 514 01B1: MOVLW 3C
293 00E2: BCF 03.5 515 01B2: BCF 03.5
294 00E3: MOVWF 2C 516 01B3: MOVWF 2C
295 00E4: CALL 09F 517 01B4: CALL 01F
296 .................... I2C_write(reg); 518 .................... I2C_write(reg);
297 00E5: MOVF 2B,W 519 01B5: MOVF 2B,W
298 00E6: MOVWF 2C 520 01B6: MOVWF 2C
299 00E7: CALL 09F 521 01B7: CALL 01F
300 .................... i2c_stop(); 522 .................... i2c_stop();
301 00E8: BSF 03.5 523 01B8: BCF 20.4
-   524 01B9: MOVF 20,W
302 00E9: BCF 06.0 525 01BA: BSF 03.5
-   526 01BB: MOVWF 07
303 00EA: NOP 527 01BC: NOP
-   528 01BD: BCF 03.5
-   529 01BE: BSF 20.3
-   530 01BF: MOVF 20,W
304 00EB: BSF 06.1 531 01C0: BSF 03.5
-   532 01C1: MOVWF 07
305 00EC: BCF 03.5 533 01C2: BCF 03.5
306 00ED: BTFSS 06.1 534 01C3: BTFSS 07.3
307 00EE: GOTO 0ED 535 01C4: GOTO 1C3
308 00EF: NOP 536 01C5: NOP
309 00F0: GOTO 0F1 537 01C6: GOTO 1C7
310 00F1: NOP 538 01C7: NOP
311 00F2: BSF 03.5 539 01C8: BSF 20.4
-   540 01C9: MOVF 20,W
312 00F3: BSF 06.0 541 01CA: BSF 03.5
-   542 01CB: MOVWF 07
313 00F4: NOP 543 01CC: NOP
314 .................... i2c_start(); 544 .................... i2c_start();
-   545 01CD: BCF 03.5
-   546 01CE: BSF 20.4
-   547 01CF: MOVF 20,W
315 00F5: BSF 06.0 548 01D0: BSF 03.5
-   549 01D1: MOVWF 07
316 00F6: NOP 550 01D2: NOP
-   551 01D3: BCF 03.5
-   552 01D4: BSF 20.3
-   553 01D5: MOVF 20,W
317 00F7: BSF 06.1 554 01D6: BSF 03.5
-   555 01D7: MOVWF 07
318 00F8: NOP 556 01D8: NOP
319 00F9: BCF 03.5 557 01D9: BCF 03.5
320 00FA: BCF 06.0 558 01DA: BCF 07.4
321 00FB: BSF 03.5 559 01DB: BCF 20.4
-   560 01DC: MOVF 20,W
322 00FC: BCF 06.0 561 01DD: BSF 03.5
-   562 01DE: MOVWF 07
323 00FD: NOP 563 01DF: NOP
324 00FE: BCF 03.5 564 01E0: BCF 03.5
325 00FF: BCF 06.1 565 01E1: BCF 07.3
326 0100: BSF 03.5 566 01E2: BCF 20.3
-   567 01E3: MOVF 20,W
327 0101: BCF 06.1 568 01E4: BSF 03.5
-   569 01E5: MOVWF 07
328 .................... I2C_Write(MAG_ADDR_R); 570 .................... I2C_Write(MAG_ADDR_R);
329 0102: MOVLW 3D 571 01E6: MOVLW 3D
330 0103: BCF 03.5 572 01E7: BCF 03.5
331 0104: MOVWF 2C 573 01E8: MOVWF 2C
332 0105: CALL 09F 574 01E9: CALL 01F
333 .................... reg=i2c_read(0); 575 .................... reg=i2c_read(0);
334 0106: CLRF 77 576 01EA: CLRF 77
335 * 577 *
336 0138: MOVF 78,W 578 022E: MOVF 78,W
337 0139: BCF 03.5 579 022F: BCF 03.5
338 013A: MOVWF 2B 580 0230: MOVWF 2B
339 .................... return reg; 581 .................... return reg;
340 013B: MOVF 2B,W 582 0231: MOVF 2B,W
341 013C: MOVWF 78 583 0232: MOVWF 78
342 .................... } 584 .................... }
343 013D: RETURN 585 0233: RETURN
344 .................... 586 ....................
345 .................... 587 ....................
346 .................... signed int16 mag_vypocet(unsigned int8 h, unsigned int8 l) //prepocet na 16bit cislo 588 .................... signed int16 mag_vypocet(unsigned int8 h, unsigned int8 l) //prepocet na 16bit cislo
347 .................... { 589 .................... {
348 .................... signed int16 x; 590 .................... signed int16 x;
349 .................... x = (((unsigned int16) h << 8) + l ); 591 .................... x = (((unsigned int16) h << 8) + l );
350 013E: CLRF 30 592 0234: CLRF 30
351 013F: MOVF 2B,W 593 0235: MOVF 2B,W
352 0140: MOVWF 2F 594 0236: MOVWF 2F
353 0141: MOVWF 30 595 0237: MOVWF 30
354 0142: CLRF 2F 596 0238: CLRF 2F
355 0143: MOVF 2C,W 597 0239: MOVF 2C,W
356 0144: ADDWF 2F,W 598 023A: ADDWF 2F,W
357 0145: MOVWF 78 599 023B: MOVWF 78
358 0146: MOVF 30,W 600 023C: MOVF 30,W
359 0147: MOVWF 7A 601 023D: MOVWF 7A
360 0148: BTFSC 03.0 602 023E: BTFSC 03.0
361 0149: INCF 7A,F 603 023F: INCF 7A,F
362 014A: MOVF 78,W 604 0240: MOVF 78,W
363 014B: MOVWF 2D 605 0241: MOVWF 2D
364 014C: MOVF 7A,W 606 0242: MOVF 7A,W
365 014D: MOVWF 2E 607 0243: MOVWF 2E
366 .................... return x; 608 .................... return x;
367 014E: MOVF 2D,W 609 0244: MOVF 2D,W
368 014F: MOVWF 78 610 0245: MOVWF 78
369 0150: MOVF 2E,W 611 0246: MOVF 2E,W
370 0151: MOVWF 79 612 0247: MOVWF 79
371 .................... } 613 .................... }
372 0152: RETURN 614 0248: RETURN
373 .................... 615 ....................
374 .................... 616 ....................
375 .................... signed int16 mag_readX(void) //nacteni osy x 617 .................... signed int16 mag_readX(void) //nacteni osy x
376 .................... { 618 .................... {
377 .................... unsigned int8 h,l; 619 .................... unsigned int8 h,l;
378 .................... signed int16 x; 620 .................... signed int16 x;
379 .................... h=mag_read(0x03); 621 .................... h=mag_read(0x03);
380 0153: MOVLW 03 622 0249: MOVLW 03
381 0154: MOVWF 2B 623 024A: MOVWF 2B
382 0155: CALL 0D3 624 024B: CALL 199
383 0156: MOVF 78,W 625 024C: MOVF 78,W
384 0157: MOVWF 27 626 024D: MOVWF 27
385 .................... l=mag_read(0x04); 627 .................... l=mag_read(0x04);
386 0158: MOVLW 04 628 024E: MOVLW 04
387 0159: MOVWF 2B 629 024F: MOVWF 2B
388 015A: CALL 0D3 630 0250: CALL 199
389 015B: MOVF 78,W 631 0251: MOVF 78,W
390 015C: MOVWF 28 632 0252: MOVWF 28
391 .................... x=mag_vypocet(h,l); 633 .................... x=mag_vypocet(h,l);
392 015D: MOVF 27,W 634 0253: MOVF 27,W
393 015E: MOVWF 2B 635 0254: MOVWF 2B
394 015F: MOVF 28,W 636 0255: MOVF 28,W
395 0160: MOVWF 2C 637 0256: MOVWF 2C
396 0161: CALL 13E 638 0257: CALL 234
397 0162: MOVF 79,W 639 0258: MOVF 79,W
398 0163: MOVWF 2A 640 0259: MOVWF 2A
399 0164: MOVF 78,W 641 025A: MOVF 78,W
400 0165: MOVWF 29 642 025B: MOVWF 29
401 .................... return x; 643 .................... return x;
402 0166: MOVF 29,W 644 025C: MOVF 29,W
403 0167: MOVWF 78 645 025D: MOVWF 78
404 0168: MOVF 2A,W 646 025E: MOVF 2A,W
405 0169: MOVWF 79 647 025F: MOVWF 79
406 .................... 648 ....................
407 .................... } 649 .................... }
408 016A: BCF 0A.3 650 0260: BCF 0A.3
409 016B: BCF 0A.4 651 0261: BCF 0A.4
410 016C: GOTO 2B5 (RETURN) 652 0262: GOTO 395 (RETURN)
411 .................... 653 ....................
412 .................... 654 ....................
413 .................... signed int16 mag_readY(void) //nacteni osy x 655 .................... signed int16 mag_readY(void) //nacteni osy x
414 .................... { 656 .................... {
415 .................... unsigned int8 h,l; 657 .................... unsigned int8 h,l;
416 .................... signed int16 x; 658 .................... signed int16 x;
417 .................... h=mag_read(0x07); 659 .................... h=mag_read(0x07);
418 016D: MOVLW 07 660 0263: MOVLW 07
419 016E: MOVWF 2B 661 0264: MOVWF 2B
420 016F: CALL 0D3 662 0265: CALL 199
421 0170: MOVF 78,W 663 0266: MOVF 78,W
422 0171: MOVWF 27 664 0267: MOVWF 27
423 .................... l=mag_read(0x08); 665 .................... l=mag_read(0x08);
424 0172: MOVLW 08 666 0268: MOVLW 08
425 0173: MOVWF 2B 667 0269: MOVWF 2B
426 0174: CALL 0D3 668 026A: CALL 199
427 0175: MOVF 78,W 669 026B: MOVF 78,W
428 0176: MOVWF 28 670 026C: MOVWF 28
429 .................... x=mag_vypocet(h,l); 671 .................... x=mag_vypocet(h,l);
430 0177: MOVF 27,W 672 026D: MOVF 27,W
431 0178: MOVWF 2B 673 026E: MOVWF 2B
432 0179: MOVF 28,W 674 026F: MOVF 28,W
433 017A: MOVWF 2C 675 0270: MOVWF 2C
434 017B: CALL 13E 676 0271: CALL 234
435 017C: MOVF 79,W 677 0272: MOVF 79,W
436 017D: MOVWF 2A 678 0273: MOVWF 2A
437 017E: MOVF 78,W 679 0274: MOVF 78,W
438 017F: MOVWF 29 680 0275: MOVWF 29
439 .................... return x; 681 .................... return x;
440 0180: MOVF 29,W 682 0276: MOVF 29,W
441 0181: MOVWF 78 683 0277: MOVWF 78
442 0182: MOVF 2A,W 684 0278: MOVF 2A,W
443 0183: MOVWF 79 685 0279: MOVWF 79
444 .................... 686 ....................
445 .................... } 687 .................... }
446 0184: BCF 0A.3 688 027A: BCF 0A.3
447 0185: BCF 0A.4 689 027B: BCF 0A.4
448 0186: GOTO 2BA (RETURN) 690 027C: GOTO 39A (RETURN)
449 .................... 691 ....................
450 .................... 692 ....................
451 .................... signed int16 mag_readZ(void) //nacteni osy x 693 .................... signed int16 mag_readZ(void) //nacteni osy x
452 .................... { 694 .................... {
453 .................... unsigned int8 h,l; 695 .................... unsigned int8 h,l;
454 .................... signed int16 x; 696 .................... signed int16 x;
455 .................... h=mag_read(0x05); 697 .................... h=mag_read(0x05);
456 0187: MOVLW 05 698 027D: MOVLW 05
457 0188: MOVWF 2B 699 027E: MOVWF 2B
458 0189: CALL 0D3 700 027F: CALL 199
459 018A: MOVF 78,W 701 0280: MOVF 78,W
460 018B: MOVWF 27 702 0281: MOVWF 27
461 .................... l=mag_read(0x06); 703 .................... l=mag_read(0x06);
462 018C: MOVLW 06 704 0282: MOVLW 06
463 018D: MOVWF 2B 705 0283: MOVWF 2B
464 018E: CALL 0D3 706 0284: CALL 199
465 018F: MOVF 78,W 707 0285: MOVF 78,W
466 0190: MOVWF 28 708 0286: MOVWF 28
467 .................... x=mag_vypocet(h,l); 709 .................... x=mag_vypocet(h,l);
468 0191: MOVF 27,W 710 0287: MOVF 27,W
469 0192: MOVWF 2B 711 0288: MOVWF 2B
470 0193: MOVF 28,W 712 0289: MOVF 28,W
471 0194: MOVWF 2C 713 028A: MOVWF 2C
472 0195: CALL 13E 714 028B: CALL 234
473 0196: MOVF 79,W 715 028C: MOVF 79,W
474 0197: MOVWF 2A 716 028D: MOVWF 2A
475 0198: MOVF 78,W 717 028E: MOVF 78,W
476 0199: MOVWF 29 718 028F: MOVWF 29
477 .................... return x; 719 .................... return x;
478 019A: MOVF 29,W 720 0290: MOVF 29,W
479 019B: MOVWF 78 721 0291: MOVWF 78
480 019C: MOVF 2A,W 722 0292: MOVF 2A,W
481 019D: MOVWF 79 723 0293: MOVWF 79
482 .................... 724 ....................
483 .................... } 725 .................... }
484 019E: BCF 0A.3 726 0294: BCF 0A.3
485 019F: BCF 0A.4 727 0295: BCF 0A.4
486 01A0: GOTO 2BF (RETURN) 728 0296: GOTO 39F (RETURN)
-   729 ....................
487 .................... 730 ....................
488 .................... 731 ....................
489 .................... 732 ....................
490 .................... 733 ....................
491 .................... 734 ....................
492 .................... void main() 735 .................... void main()
493 .................... { 736 .................... {
494 * 737 *
495 0237: CLRF 04 738 0317: CLRF 04
496 0238: BCF 03.7 739 0318: BCF 03.7
497 0239: MOVLW 1F 740 0319: MOVLW 1F
498 023A: ANDWF 03,F 741 031A: ANDWF 03,F
499 023B: MOVLW 71 742 031B: MOVLW 71
500 023C: BSF 03.5 743 031C: BSF 03.5
501 023D: MOVWF 0F 744 031D: MOVWF 0F
502 023E: MOVF 0F,W 745 031E: MOVF 0F,W
503 023F: BCF 06.3 746 031F: BCF 03.5
504 0240: BCF 03.5 747 0320: BCF 20.7
505 0241: BSF 06.3 748 0321: MOVF 20,W
506 0242: BSF 03.5 749 0322: BSF 03.5
507 0243: BSF 03.6 -  
508 0244: MOVF 09,W -  
509 0245: ANDLW C0 -  
510 0246: MOVWF 09 750 0323: MOVWF 07
511 0247: BCF 03.6 751 0324: BCF 03.5
512 0248: BCF 1F.4 -  
513 0249: BCF 1F.5 -  
514 024A: MOVLW 00 -  
515 024B: BSF 03.6 752 0325: BSF 07.7
516 024C: MOVWF 08 -  
517 024D: BCF 03.5 -  
518 024E: CLRF 07 -  
519 024F: CLRF 08 -  
520 0250: CLRF 09 -  
521 .................... -  
522 .................... setup_adc_ports(NO_ANALOGS|VSS_VDD); -  
523 * -  
524 0254: BSF 03.5 753 0326: BSF 03.5
525 0255: BSF 03.6 754 0327: BSF 03.6
526 0256: MOVF 09,W 755 0328: MOVF 09,W
527 0257: ANDLW C0 756 0329: ANDLW C0
528 0258: MOVWF 09 757 032A: MOVWF 09
529 0259: BCF 03.6 758 032B: BCF 03.6
530 025A: BCF 1F.4 759 032C: BCF 1F.4
531 025B: BCF 1F.5 760 032D: BCF 1F.5
532 025C: MOVLW 00 761 032E: MOVLW 00
533 025D: BSF 03.6 -  
534 025E: MOVWF 08 -  
535 .................... setup_adc(ADC_CLOCK_DIV_2); -  
536 025F: BCF 03.5 -  
537 0260: BCF 03.6 -  
538 0261: BCF 1F.6 -  
539 0262: BCF 1F.7 -  
540 0263: BSF 03.5 -  
541 0264: BCF 1F.7 -  
542 0265: BCF 03.5 -  
543 0266: BSF 1F.0 -  
544 .................... setup_spi(SPI_SS_DISABLED); -  
545 0267: BCF 14.5 -  
546 0268: BCF 20.5 -  
547 0269: MOVF 20,W -  
548 026A: BSF 03.5 -  
549 026B: MOVWF 07 -  
550 026C: BCF 03.5 -  
551 026D: BSF 20.4 -  
552 026E: MOVF 20,W -  
553 026F: BSF 03.5 762 032F: BSF 03.6
554 0270: MOVWF 07 763 0330: MOVWF 08
555 0271: BCF 03.5 764 0331: BCF 03.5
556 0272: BCF 20.3 -  
557 0273: MOVF 20,W -  
558 0274: BSF 03.5 -  
559 0275: MOVWF 07 -  
560 0276: MOVLW 01 -  
561 0277: BCF 03.5 -  
562 0278: MOVWF 14 -  
563 0279: MOVLW 00 -  
564 027A: BSF 03.5 -  
565 027B: MOVWF 14 -  
566 .................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); -  
567 027C: MOVF 01,W -  
568 027D: ANDLW C7 -  
569 027E: IORLW 08 -  
570 027F: MOVWF 01 -  
571 .................... setup_timer_1(T1_DISABLED); -  
572 0280: BCF 03.5 -  
573 0281: CLRF 10 -  
574 .................... setup_timer_2(T2_DISABLED,0,1); -  
575 0282: MOVLW 00 -  
576 0283: MOVWF 78 -  
577 0284: MOVWF 12 -  
578 0285: MOVLW 00 -  
579 0286: BSF 03.5 -  
580 0287: MOVWF 12 -  
581 .................... setup_ccp1(CCP_OFF); -  
582 0288: BCF 03.5 -  
583 0289: BSF 20.2 -  
584 028A: MOVF 20,W -  
585 028B: BSF 03.5 -  
586 028C: MOVWF 07 -  
587 028D: BCF 03.5 -  
588 028E: CLRF 17 -  
589 028F: BSF 03.5 -  
590 0290: CLRF 1B -  
591 0291: CLRF 1C -  
592 0292: MOVLW 01 -  
593 0293: MOVWF 1D -  
594 .................... setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard -  
595 0294: BCF 03.5 -  
596 0295: BSF 03.6 -  
597 0296: CLRF 07 765 0332: CLRF 07
598 0297: CLRF 08 766 0333: CLRF 08
599 0298: CLRF 09 767 0334: CLRF 09
600 .................... -  
601 .................... printf("Magnetometr: \r\n",); -  
602 0299: MOVLW 04 -  
603 029A: MOVWF 0D -  
604 029B: MOVLW 00 -  
605 029C: MOVWF 0F -  
606 029D: BCF 03.6 -  
607 029E: CALL 059 -  
608 .................... printf("(c)mlab JACHO 2013: \r\n",); -  
609 029F: MOVLW 0D -  
610 02A0: BSF 03.6 -  
611 02A1: MOVWF 0D -  
612 02A2: MOVLW 00 -  
613 02A3: MOVWF 0F -  
614 02A4: BCF 03.6 -  
615 02A5: CALL 059 -  
616 .................... printf("Vysledky z jednotlivych os:\r\n",); -  
617 02A6: MOVLW 19 -  
618 02A7: BSF 03.6 -  
619 02A8: MOVWF 0D -  
620 02A9: MOVLW 00 -  
621 02AA: MOVWF 0F -  
622 02AB: BCF 03.6 -  
623 02AC: CALL 059 -  
624 .................... signed int16 X,Y,Z; 768 .................... signed int16 X,Y,Z;
625 .................... 769 .................... setup_adc_ports(NO_ANALOGS|VSS_VDD);
626 .................... 770 *
627 .................... while(true) 771 0338: BSF 03.5
628 .................... { 772 0339: BSF 03.6
629 .................... printf("Vysledky z jednotlivych os:\r\n",); 773 033A: MOVF 09,W
630 02AD: MOVLW 28 774 033B: ANDLW C0
631 02AE: BSF 03.6 775 033C: MOVWF 09
632 02AF: MOVWF 0D 776 033D: BCF 03.6
633 02B0: MOVLW 00 777 033E: BCF 1F.4
634 02B1: MOVWF 0F 778 033F: BCF 1F.5
635 02B2: BCF 03.6 779 0340: MOVLW 00
636 02B3: CALL 059 780 0341: BSF 03.6
637 .................... X=mag_readX(); 781 0342: MOVWF 08
638 02B4: GOTO 153 782 .................... setup_adc(ADC_CLOCK_DIV_2);
639 02B5: MOVF 79,W 783 0343: BCF 03.5
640 02B6: MOVWF 22 784 0344: BCF 03.6
641 02B7: MOVF 78,W 785 0345: BCF 1F.6
642 02B8: MOVWF 21 786 0346: BCF 1F.7
643 .................... Y=mag_readY(); 787 0347: BSF 03.5
644 02B9: GOTO 16D 788 0348: BCF 1F.7
645 02BA: MOVF 79,W 789 0349: BCF 03.5
646 02BB: MOVWF 24 790 034A: BSF 1F.0
647 02BC: MOVF 78,W 791 .................... setup_spi(SPI_SS_DISABLED);
648 02BD: MOVWF 23 792 034B: BCF 14.5
649 .................... Z=mag_readZ(); 793 034C: BCF 20.5
650 02BE: GOTO 187 794 034D: MOVF 20,W
651 02BF: MOVF 79,W 795 034E: BSF 03.5
652 02C0: MOVWF 26 796 034F: MOVWF 07
653 02C1: MOVF 78,W 797 0350: BCF 03.5
654 02C2: MOVWF 25 798 0351: BSF 20.4
655 .................... printf("X: %Ld \r\n", X); 799 0352: MOVF 20,W
656 02C3: MOVLW 58 800 0353: BSF 03.5
657 02C4: MOVWF 30 801 0354: MOVWF 07
658 02C5: CALL 037 802 0355: BCF 03.5
659 02C6: MOVLW 3A 803 0356: BCF 20.3
660 02C7: MOVWF 30 804 0357: MOVF 20,W
661 02C8: CALL 037 805 0358: BSF 03.5
662 02C9: MOVLW 20 806 0359: MOVWF 07
663 02CA: MOVWF 30 807 035A: MOVLW 01
664 02CB: CALL 037 808 035B: BCF 03.5
665 02CC: MOVLW 10 809 035C: MOVWF 14
666 02CD: MOVWF 04 810 035D: MOVLW 00
667 02CE: MOVF 22,W 811 035E: BSF 03.5
668 02CF: MOVWF 28 812 035F: MOVWF 14
669 02D0: MOVF 21,W 813 .................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
670 02D1: MOVWF 27 814 0360: MOVF 01,W
671 02D2: CALL 1A1 815 0361: ANDLW C7
672 02D3: MOVLW 20 816 0362: IORLW 08
673 02D4: MOVWF 30 817 0363: MOVWF 01
674 02D5: CALL 037 818 .................... setup_timer_1(T1_DISABLED);
675 02D6: MOVLW 0D 819 0364: BCF 03.5
676 02D7: MOVWF 30 820 0365: CLRF 10
677 02D8: CALL 037 821 .................... setup_timer_2(T2_DISABLED,0,1);
678 02D9: MOVLW 0A 822 0366: MOVLW 00
679 02DA: MOVWF 30 823 0367: MOVWF 78
680 02DB: CALL 037 824 0368: MOVWF 12
681 .................... printf("Y %Ld \r\n", Y); 825 0369: MOVLW 00
682 02DC: MOVLW 59 826 036A: BSF 03.5
683 02DD: MOVWF 30 827 036B: MOVWF 12
684 02DE: CALL 037 828 .................... setup_ccp1(CCP_OFF);
685 02DF: MOVLW 20 829 036C: BCF 03.5
686 02E0: MOVWF 30 830 036D: BSF 20.2
687 02E1: CALL 037 831 036E: MOVF 20,W
688 02E2: MOVLW 10 832 036F: BSF 03.5
689 02E3: MOVWF 04 833 0370: MOVWF 07
690 02E4: MOVF 24,W 834 0371: BCF 03.5
691 02E5: MOVWF 28 835 0372: CLRF 17
692 02E6: MOVF 23,W 836 0373: BSF 03.5
693 02E7: MOVWF 27 837 0374: CLRF 1B
694 02E8: CALL 1A1 838 0375: CLRF 1C
695 02E9: MOVLW 20 839 0376: MOVLW 01
696 02EA: MOVWF 30 840 0377: MOVWF 1D
697 02EB: CALL 037 841 .................... setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
698 02EC: MOVLW 0D 842 0378: BCF 03.5
699 02ED: MOVWF 30 843 0379: BSF 03.6
700 02EE: CALL 037 844 037A: CLRF 07
701 02EF: MOVLW 0A 845 037B: CLRF 08
702 02F0: MOVWF 30 846 037C: CLRF 09
703 02F1: CALL 037 847 ....................
704 .................... printf("Z: %Ld \r\n", Z); 848 .................... set_mag();
705 02F2: MOVLW 5A 849 037D: BCF 03.6
706 02F3: MOVWF 30 850 037E: GOTO 07D
707 02F4: CALL 037 851 ....................
708 02F5: MOVLW 3A 852 .................... printf("Magnetometr: \r\n",);
709 02F6: MOVWF 30 853 037F: MOVLW 04
710 02F7: CALL 037 854 0380: BSF 03.6
711 02F8: MOVLW 20 855 0381: MOVWF 0D
712 02F9: MOVWF 30 856 0382: MOVLW 00
713 02FA: CALL 037 857 0383: MOVWF 0F
714 02FB: MOVLW 10 858 0384: BCF 03.6
715 02FC: MOVWF 04 859 0385: CALL 153
716 02FD: MOVF 26,W 860 .................... printf("(c)mlab JACHO 2013: \r\n",);
717 02FE: MOVWF 28 861 0386: MOVLW 0D
718 02FF: MOVF 25,W 862 0387: BSF 03.6
719 0300: MOVWF 27 863 0388: MOVWF 0D
720 0301: CALL 1A1 864 0389: MOVLW 00
721 0302: MOVLW 20 865 038A: MOVWF 0F
722 0303: MOVWF 30 866 038B: BCF 03.6
723 0304: CALL 037 867 038C: CALL 153
724 0305: MOVLW 0D 868 .................... printf("X, Y, Z \r\n",);
725 0306: MOVWF 30 869 038D: MOVLW 19
726 0307: CALL 037 870 038E: BSF 03.6
727 0308: MOVLW 0A 871 038F: MOVWF 0D
728 0309: MOVWF 30 872 0390: MOVLW 00
729 030A: CALL 037 873 0391: MOVWF 0F
730 .................... Delay_ms(2000); 874 0392: BCF 03.6
731 030B: MOVLW 08 875 0393: CALL 153
732 030C: MOVWF 27 876 ....................
733 030D: MOVLW FA 877 .................... while(true)
734 030E: MOVWF 28 878 .................... {
735 030F: GOTO 221 879 .................... X = mag_readX();
736 0310: DECFSZ 27,F 880 0394: GOTO 249
737 0311: GOTO 30D 881 0395: MOVF 79,W
-   882 0396: MOVWF 22
-   883 0397: MOVF 78,W
-   884 0398: MOVWF 21
-   885 .................... Y = mag_readY();
-   886 0399: GOTO 263
-   887 039A: MOVF 79,W
-   888 039B: MOVWF 24
-   889 039C: MOVF 78,W
-   890 039D: MOVWF 23
-   891 .................... Z = mag_readZ();
-   892 039E: GOTO 27D
-   893 039F: MOVF 79,W
-   894 03A0: MOVWF 26
-   895 03A1: MOVF 78,W
-   896 03A2: MOVWF 25
-   897 .................... printf("%4Ld %4Ld %4Ld \r\n", X, Y, Z);
-   898 03A3: MOVLW 02
-   899 03A4: MOVWF 04
-   900 03A5: MOVF 22,W
-   901 03A6: MOVWF 28
-   902 03A7: MOVF 21,W
-   903 03A8: MOVWF 27
-   904 03A9: CALL 297
-   905 03AA: MOVLW 20
-   906 03AB: MOVWF 30
-   907 03AC: CALL 12F
-   908 03AD: MOVLW 02
-   909 03AE: MOVWF 04
-   910 03AF: MOVF 24,W
-   911 03B0: MOVWF 28
-   912 03B1: MOVF 23,W
-   913 03B2: MOVWF 27
-   914 03B3: CALL 297
-   915 03B4: MOVLW 20
-   916 03B5: MOVWF 30
-   917 03B6: CALL 12F
-   918 03B7: MOVLW 02
-   919 03B8: MOVWF 04
-   920 03B9: MOVF 26,W
-   921 03BA: MOVWF 28
-   922 03BB: MOVF 25,W
-   923 03BC: MOVWF 27
-   924 03BD: CALL 297
-   925 03BE: MOVLW 20
-   926 03BF: MOVWF 30
-   927 03C0: CALL 12F
-   928 03C1: MOVLW 0D
-   929 03C2: MOVWF 30
-   930 03C3: CALL 12F
-   931 03C4: MOVLW 0A
-   932 03C5: MOVWF 30
-   933 03C6: CALL 12F
-   934 .................... Delay_ms(50);
-   935 03C7: MOVLW 32
-   936 03C8: MOVWF 27
-   937 03C9: CALL 069
738 .................... 938 ....................
-   939 .................... }
-   940 03CA: GOTO 394
739 .................... } 941 .................... }
740 0312: GOTO 2AD -  
741 .................... } -  
742 0313: SLEEP 942 03CB: SLEEP
743   943  
744 Configuration Fuses: 944 Configuration Fuses:
745 Word 1: 2CF5 INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG 945 Word 1: 2CF5 INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG
746 Word 2: 3FFF NOWRT BORV40 946 Word 2: 3FFF NOWRT BORV40