1045 |
jacho |
1 |
CCS PCM C Compiler, Version 4.106, 47914 06-5-13 11:39 |
960 |
jacho |
2 |
|
1045 |
jacho |
3 |
Filename: c:\users\honza\documents\pic\meteo_stanice\nová sloka\main.lst |
960 |
jacho |
4 |
|
1045 |
jacho |
5 |
ROM used: 5847 words (71%) |
|
|
6 |
Largest free fragment is 2048 |
|
|
7 |
RAM used: 25 (7%) at main() level |
|
|
8 |
260 (71%) worst case |
960 |
jacho |
9 |
Stack: 5 worst case (3 in main + 2 for interrupts) |
|
|
10 |
|
|
|
11 |
* |
1045 |
jacho |
12 |
0000: MOVLW 15 |
960 |
jacho |
13 |
0001: MOVWF 0A |
1045 |
jacho |
14 |
0002: GOTO 53E |
960 |
jacho |
15 |
0003: NOP |
|
|
16 |
0004: MOVWF 7F |
|
|
17 |
0005: SWAPF 03,W |
|
|
18 |
0006: CLRF 03 |
|
|
19 |
0007: MOVWF 21 |
|
|
20 |
0008: MOVF 0A,W |
|
|
21 |
0009: MOVWF 20 |
|
|
22 |
000A: CLRF 0A |
|
|
23 |
000B: MOVF 04,W |
|
|
24 |
000C: MOVWF 22 |
|
|
25 |
000D: MOVF 77,W |
|
|
26 |
000E: MOVWF 23 |
|
|
27 |
000F: MOVF 78,W |
|
|
28 |
0010: MOVWF 24 |
|
|
29 |
0011: MOVF 79,W |
|
|
30 |
0012: MOVWF 25 |
|
|
31 |
0013: MOVF 7A,W |
|
|
32 |
0014: MOVWF 26 |
|
|
33 |
0015: BCF 03.7 |
|
|
34 |
0016: BCF 03.5 |
|
|
35 |
0017: MOVLW 8C |
|
|
36 |
0018: MOVWF 04 |
|
|
37 |
0019: BTFSS 00.0 |
|
|
38 |
001A: GOTO 01D |
|
|
39 |
001B: BTFSC 0C.0 |
|
|
40 |
001C: GOTO 032 |
|
|
41 |
001D: BTFSS 0B.5 |
|
|
42 |
001E: GOTO 021 |
|
|
43 |
001F: BTFSC 0B.2 |
|
|
44 |
0020: GOTO 035 |
|
|
45 |
0021: MOVF 22,W |
|
|
46 |
0022: MOVWF 04 |
|
|
47 |
0023: MOVF 23,W |
|
|
48 |
0024: MOVWF 77 |
|
|
49 |
0025: MOVF 24,W |
|
|
50 |
0026: MOVWF 78 |
|
|
51 |
0027: MOVF 25,W |
|
|
52 |
0028: MOVWF 79 |
|
|
53 |
0029: MOVF 26,W |
|
|
54 |
002A: MOVWF 7A |
|
|
55 |
002B: MOVF 20,W |
|
|
56 |
002C: MOVWF 0A |
|
|
57 |
002D: SWAPF 21,W |
|
|
58 |
002E: MOVWF 03 |
|
|
59 |
002F: SWAPF 7F,F |
|
|
60 |
0030: SWAPF 7F,W |
|
|
61 |
0031: RETFIE |
|
|
62 |
0032: BCF 0A.3 |
|
|
63 |
0033: BCF 0A.4 |
|
|
64 |
0034: GOTO 123 |
|
|
65 |
0035: BCF 0A.3 |
|
|
66 |
0036: BCF 0A.4 |
|
|
67 |
0037: GOTO 191 |
|
|
68 |
.................... |
|
|
69 |
.................... //Meteorologicka cast |
|
|
70 |
.................... #define VERSION "0.1" |
|
|
71 |
.................... #define AUTOR "Jan Chroust" |
|
|
72 |
.................... #define DATE "15.4.2013" |
|
|
73 |
.................... |
|
|
74 |
.................... #include <main.h> |
|
|
75 |
.................... #include <16F887.h> |
|
|
76 |
.................... //////// Standard Header file for the PIC16F887 device //////////////// |
|
|
77 |
.................... #device PIC16F887 |
|
|
78 |
.................... #list |
|
|
79 |
.................... |
|
|
80 |
.................... #device adc=8 |
|
|
81 |
.................... |
|
|
82 |
.................... |
|
|
83 |
.................... |
1045 |
jacho |
84 |
.................... //#FUSES WDT // Watch Dog Timer |
|
|
85 |
.................... #FUSES NOWDT //No Watch Dog Timer |
|
|
86 |
.................... #FUSES INTRC //Internal RC Osc |
|
|
87 |
.................... #FUSES NOPUT //No Power Up Timer |
|
|
88 |
.................... #FUSES MCLR //Master Clear pin enabled |
|
|
89 |
.................... #FUSES NOPROTECT //Code not protected from reading |
|
|
90 |
.................... #FUSES NOCPD //No EE protection |
|
|
91 |
.................... #FUSES NOBROWNOUT //No brownout reset |
|
|
92 |
.................... #FUSES IESO //Internal External Switch Over mode enabled |
|
|
93 |
.................... #FUSES FCMEN //Fail-safe clock monitor enabled |
|
|
94 |
.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O |
|
|
95 |
.................... #FUSES NODEBUG //No Debug mode for ICD |
|
|
96 |
.................... #FUSES NOWRT //Program memory not write protected |
|
|
97 |
.................... #FUSES BORV40 //Brownout reset at 4.0V |
960 |
jacho |
98 |
.................... |
|
|
99 |
.................... #use delay(clock=8000000) |
|
|
100 |
* |
1045 |
jacho |
101 |
0303: MOVLW E2 |
|
|
102 |
0304: MOVWF 04 |
|
|
103 |
0305: BCF 03.7 |
|
|
104 |
0306: MOVF 00,W |
|
|
105 |
0307: BTFSC 03.2 |
|
|
106 |
0308: GOTO 316 |
|
|
107 |
0309: MOVLW 02 |
|
|
108 |
030A: MOVWF 78 |
|
|
109 |
030B: CLRF 77 |
|
|
110 |
030C: DECFSZ 77,F |
|
|
111 |
030D: GOTO 30C |
|
|
112 |
030E: DECFSZ 78,F |
|
|
113 |
030F: GOTO 30B |
|
|
114 |
0310: MOVLW 97 |
|
|
115 |
0311: MOVWF 77 |
|
|
116 |
0312: DECFSZ 77,F |
|
|
117 |
0313: GOTO 312 |
|
|
118 |
0314: DECFSZ 00,F |
|
|
119 |
0315: GOTO 309 |
|
|
120 |
0316: RETURN |
960 |
jacho |
121 |
.................... |
|
|
122 |
.................... //set I2C |
1045 |
jacho |
123 |
.................... #define PIN_SDA PIN_C3 |
|
|
124 |
.................... #define PIN_SCL PIN_C4 |
960 |
jacho |
125 |
.................... #use i2c(master, sda=PIN_SDA, scl=PIN_SCL) |
|
|
126 |
* |
|
|
127 |
022E: MOVLW 08 |
|
|
128 |
022F: MOVWF 78 |
|
|
129 |
0230: NOP |
1045 |
jacho |
130 |
0231: BCF 07.4 |
|
|
131 |
0232: BCF 28.4 |
960 |
jacho |
132 |
0233: MOVF 28,W |
|
|
133 |
0234: BSF 03.5 |
|
|
134 |
0235: MOVWF 07 |
|
|
135 |
0236: NOP |
1045 |
jacho |
136 |
0237: BCF 03.5 |
|
|
137 |
0238: BSF 03.6 |
|
|
138 |
0239: RLF 12,F |
|
|
139 |
023A: BCF 03.6 |
|
|
140 |
023B: BCF 07.3 |
|
|
141 |
023C: BTFSS 03.0 |
|
|
142 |
023D: GOTO 244 |
|
|
143 |
023E: BSF 28.3 |
|
|
144 |
023F: MOVF 28,W |
|
|
145 |
0240: BSF 03.5 |
|
|
146 |
0241: MOVWF 07 |
|
|
147 |
0242: GOTO 248 |
|
|
148 |
0243: BCF 03.5 |
|
|
149 |
0244: BCF 28.3 |
|
|
150 |
0245: MOVF 28,W |
|
|
151 |
0246: BSF 03.5 |
|
|
152 |
0247: MOVWF 07 |
|
|
153 |
0248: NOP |
|
|
154 |
0249: BCF 03.5 |
|
|
155 |
024A: BSF 28.4 |
|
|
156 |
024B: MOVF 28,W |
|
|
157 |
024C: BSF 03.5 |
|
|
158 |
024D: MOVWF 07 |
|
|
159 |
024E: BCF 03.5 |
|
|
160 |
024F: BTFSS 07.4 |
|
|
161 |
0250: GOTO 24F |
|
|
162 |
0251: DECFSZ 78,F |
|
|
163 |
0252: GOTO 230 |
|
|
164 |
0253: NOP |
|
|
165 |
0254: BCF 07.4 |
|
|
166 |
0255: BCF 28.4 |
|
|
167 |
0256: MOVF 28,W |
|
|
168 |
0257: BSF 03.5 |
|
|
169 |
0258: MOVWF 07 |
|
|
170 |
0259: NOP |
|
|
171 |
025A: BCF 03.5 |
|
|
172 |
025B: BSF 28.3 |
|
|
173 |
025C: MOVF 28,W |
|
|
174 |
025D: BSF 03.5 |
|
|
175 |
025E: MOVWF 07 |
|
|
176 |
025F: NOP |
|
|
177 |
0260: NOP |
|
|
178 |
0261: BCF 03.5 |
|
|
179 |
0262: BSF 28.4 |
|
|
180 |
0263: MOVF 28,W |
|
|
181 |
0264: BSF 03.5 |
|
|
182 |
0265: MOVWF 07 |
|
|
183 |
0266: BCF 03.5 |
|
|
184 |
0267: BTFSS 07.4 |
|
|
185 |
0268: GOTO 267 |
|
|
186 |
0269: CLRF 78 |
|
|
187 |
026A: NOP |
|
|
188 |
026B: BTFSC 07.3 |
|
|
189 |
026C: BSF 78.0 |
|
|
190 |
026D: BCF 07.4 |
|
|
191 |
026E: BCF 28.4 |
|
|
192 |
026F: MOVF 28,W |
|
|
193 |
0270: BSF 03.5 |
|
|
194 |
0271: MOVWF 07 |
|
|
195 |
0272: BCF 03.5 |
|
|
196 |
0273: BCF 07.3 |
|
|
197 |
0274: BCF 28.3 |
|
|
198 |
0275: MOVF 28,W |
|
|
199 |
0276: BSF 03.5 |
|
|
200 |
0277: MOVWF 07 |
|
|
201 |
0278: BCF 03.5 |
|
|
202 |
0279: RETURN |
960 |
jacho |
203 |
* |
1045 |
jacho |
204 |
02B6: MOVLW 08 |
|
|
205 |
02B7: BSF 03.6 |
|
|
206 |
02B8: MOVWF 13 |
|
|
207 |
02B9: MOVF 77,W |
|
|
208 |
02BA: MOVWF 14 |
|
|
209 |
02BB: BCF 03.6 |
|
|
210 |
02BC: BSF 28.3 |
|
|
211 |
02BD: MOVF 28,W |
|
|
212 |
02BE: BSF 03.5 |
|
|
213 |
02BF: MOVWF 07 |
|
|
214 |
02C0: NOP |
|
|
215 |
02C1: BCF 03.5 |
|
|
216 |
02C2: BSF 28.4 |
|
|
217 |
02C3: MOVF 28,W |
|
|
218 |
02C4: BSF 03.5 |
|
|
219 |
02C5: MOVWF 07 |
|
|
220 |
02C6: BCF 03.5 |
|
|
221 |
02C7: BTFSS 07.4 |
|
|
222 |
02C8: GOTO 2C7 |
|
|
223 |
02C9: BTFSC 07.3 |
|
|
224 |
02CA: BSF 03.0 |
|
|
225 |
02CB: BTFSS 07.3 |
|
|
226 |
02CC: BCF 03.0 |
|
|
227 |
02CD: RLF 78,F |
|
|
228 |
02CE: NOP |
|
|
229 |
02CF: BCF 28.4 |
960 |
jacho |
230 |
02D0: MOVF 28,W |
|
|
231 |
02D1: BSF 03.5 |
|
|
232 |
02D2: MOVWF 07 |
1045 |
jacho |
233 |
02D3: BCF 03.5 |
|
|
234 |
02D4: BCF 07.4 |
|
|
235 |
02D5: BSF 03.6 |
|
|
236 |
02D6: DECFSZ 13,F |
|
|
237 |
02D7: GOTO 2BB |
|
|
238 |
02D8: BCF 03.6 |
|
|
239 |
02D9: BSF 28.3 |
960 |
jacho |
240 |
02DA: MOVF 28,W |
|
|
241 |
02DB: BSF 03.5 |
|
|
242 |
02DC: MOVWF 07 |
1045 |
jacho |
243 |
02DD: NOP |
|
|
244 |
02DE: BCF 03.5 |
|
|
245 |
02DF: BCF 07.3 |
|
|
246 |
02E0: BSF 03.6 |
|
|
247 |
02E1: MOVF 14,W |
|
|
248 |
02E2: BTFSC 03.2 |
|
|
249 |
02E3: GOTO 2EB |
|
|
250 |
02E4: BCF 03.6 |
|
|
251 |
02E5: BCF 28.3 |
|
|
252 |
02E6: MOVF 28,W |
|
|
253 |
02E7: BSF 03.5 |
|
|
254 |
02E8: MOVWF 07 |
|
|
255 |
02E9: BCF 03.5 |
|
|
256 |
02EA: BSF 03.6 |
|
|
257 |
02EB: NOP |
|
|
258 |
02EC: BCF 03.6 |
|
|
259 |
02ED: BSF 28.4 |
|
|
260 |
02EE: MOVF 28,W |
|
|
261 |
02EF: BSF 03.5 |
|
|
262 |
02F0: MOVWF 07 |
|
|
263 |
02F1: BCF 03.5 |
|
|
264 |
02F2: BTFSS 07.4 |
|
|
265 |
02F3: GOTO 2F2 |
|
|
266 |
02F4: NOP |
|
|
267 |
02F5: BCF 07.4 |
|
|
268 |
02F6: BCF 28.4 |
|
|
269 |
02F7: MOVF 28,W |
|
|
270 |
02F8: BSF 03.5 |
|
|
271 |
02F9: MOVWF 07 |
|
|
272 |
02FA: NOP |
|
|
273 |
02FB: BCF 03.5 |
|
|
274 |
02FC: BCF 07.3 |
|
|
275 |
02FD: BCF 28.3 |
|
|
276 |
02FE: MOVF 28,W |
|
|
277 |
02FF: BSF 03.5 |
|
|
278 |
0300: MOVWF 07 |
|
|
279 |
0301: BCF 03.5 |
|
|
280 |
0302: RETURN |
960 |
jacho |
281 |
.................... //set RS232 |
|
|
282 |
.................... #use rs232(baud=9600,parity=N,xmit=PIN_C7,rcv=PIN_C6,bits=8) //rcv TXD xmit RXD |
|
|
283 |
* |
1045 |
jacho |
284 |
0F62: BCF 03.5 |
|
|
285 |
0F63: BCF 28.7 |
|
|
286 |
0F64: MOVF 28,W |
|
|
287 |
0F65: BSF 03.5 |
|
|
288 |
0F66: MOVWF 07 |
|
|
289 |
0F67: BCF 03.5 |
|
|
290 |
0F68: BCF 07.7 |
|
|
291 |
0F69: MOVLW 08 |
|
|
292 |
0F6A: MOVWF 78 |
|
|
293 |
0F6B: GOTO 76C |
|
|
294 |
0F6C: NOP |
|
|
295 |
0F6D: BSF 78.7 |
|
|
296 |
0F6E: GOTO 77F |
|
|
297 |
0F6F: BCF 78.7 |
|
|
298 |
0F70: BSF 03.5 |
|
|
299 |
0F71: RRF 5F,F |
|
|
300 |
0F72: BCF 03.5 |
|
|
301 |
0F73: BTFSC 03.0 |
|
|
302 |
0F74: BSF 07.7 |
|
|
303 |
0F75: BTFSS 03.0 |
|
|
304 |
0F76: BCF 07.7 |
|
|
305 |
0F77: BSF 78.6 |
|
|
306 |
0F78: GOTO 77F |
|
|
307 |
0F79: BCF 78.6 |
|
|
308 |
0F7A: DECFSZ 78,F |
|
|
309 |
0F7B: GOTO 770 |
|
|
310 |
0F7C: GOTO 77D |
|
|
311 |
0F7D: NOP |
|
|
312 |
0F7E: BSF 07.7 |
|
|
313 |
0F7F: MOVLW 3F |
|
|
314 |
0F80: MOVWF 04 |
|
|
315 |
0F81: DECFSZ 04,F |
|
|
316 |
0F82: GOTO 781 |
|
|
317 |
0F83: NOP |
|
|
318 |
0F84: BTFSC 78.7 |
|
|
319 |
0F85: GOTO 76F |
|
|
320 |
0F86: BTFSC 78.6 |
|
|
321 |
0F87: GOTO 779 |
960 |
jacho |
322 |
.................... |
1045 |
jacho |
323 |
.................... |
960 |
jacho |
324 |
.................... #include <math.h> |
|
|
325 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
326 |
.................... //// (C) Copyright 1996,2008 Custom Computer Services //// |
|
|
327 |
.................... //// This source code may only be used by licensed users of the CCS C //// |
|
|
328 |
.................... //// compiler. This source code may only be distributed to other //// |
|
|
329 |
.................... //// licensed users of the CCS C compiler. No other use, reproduction //// |
|
|
330 |
.................... //// or distribution is permitted without written permission. //// |
|
|
331 |
.................... //// Derivative programs created using this software in object code //// |
|
|
332 |
.................... //// form are not restricted in any way. //// |
|
|
333 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
334 |
.................... //// //// |
|
|
335 |
.................... //// History: //// |
|
|
336 |
.................... //// * 9/20/2001 : Improvments are made to sin/cos code. //// |
|
|
337 |
.................... //// The code now is small, much faster, //// |
|
|
338 |
.................... //// and more accurate. //// |
|
|
339 |
.................... //// * 2/21/2007 : Compiler handles & operator differently and does |
|
|
340 |
.................... //// not return generic (int8 *) so type cast is done //// |
|
|
341 |
.................... //// //// |
|
|
342 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
343 |
.................... |
|
|
344 |
.................... #ifndef MATH_H |
|
|
345 |
.................... #define MATH_H |
|
|
346 |
.................... |
|
|
347 |
.................... #ifdef PI |
|
|
348 |
.................... #undef PI |
|
|
349 |
.................... #endif |
|
|
350 |
.................... #define PI 3.1415926535897932 |
|
|
351 |
.................... |
|
|
352 |
.................... |
|
|
353 |
.................... #define SQRT2 1.4142135623730950 |
|
|
354 |
.................... |
|
|
355 |
.................... //float const ps[4] = {5.9304945, 21.125224, 8.9403076, 0.29730279}; |
|
|
356 |
.................... //float const qs[4] = {1.0000000, 15.035723, 17.764134, 2.4934718}; |
|
|
357 |
.................... |
|
|
358 |
.................... ///////////////////////////// Round Functions ////////////////////////////// |
|
|
359 |
.................... |
|
|
360 |
.................... float32 CEIL_FLOOR(float32 x, unsigned int8 n) |
|
|
361 |
.................... { |
|
|
362 |
.................... float32 y, res; |
|
|
363 |
.................... unsigned int16 l; |
|
|
364 |
.................... int1 s; |
|
|
365 |
.................... |
|
|
366 |
.................... s = 0; |
|
|
367 |
.................... y = x; |
|
|
368 |
.................... |
|
|
369 |
.................... if (x < 0) |
|
|
370 |
.................... { |
|
|
371 |
.................... s = 1; |
|
|
372 |
.................... y = -y; |
|
|
373 |
.................... } |
|
|
374 |
.................... |
|
|
375 |
.................... if (y <= 32768.0) |
|
|
376 |
.................... res = (float32)(unsigned int16)y; |
|
|
377 |
.................... |
|
|
378 |
.................... else if (y < 10000000.0) |
|
|
379 |
.................... { |
|
|
380 |
.................... l = (unsigned int16)(y/32768.0); |
|
|
381 |
.................... y = 32768.0*(y/32768.0 - (float32)l); |
|
|
382 |
.................... res = 32768.0*(float32)l; |
|
|
383 |
.................... res += (float32)(unsigned int16)y; |
|
|
384 |
.................... } |
|
|
385 |
.................... |
|
|
386 |
.................... else |
|
|
387 |
.................... res = y; |
|
|
388 |
.................... |
|
|
389 |
.................... y = y - (float32)(unsigned int16)y; |
|
|
390 |
.................... |
|
|
391 |
.................... if (s) |
|
|
392 |
.................... res = -res; |
|
|
393 |
.................... |
|
|
394 |
.................... if (y != 0) |
|
|
395 |
.................... { |
|
|
396 |
.................... if (s == 1 && n == 0) |
|
|
397 |
.................... res -= 1.0; |
|
|
398 |
.................... |
|
|
399 |
.................... if (s == 0 && n == 1) |
|
|
400 |
.................... res += 1.0; |
|
|
401 |
.................... } |
|
|
402 |
.................... if (x == 0) |
|
|
403 |
.................... res = 0; |
|
|
404 |
.................... |
|
|
405 |
.................... return (res); |
|
|
406 |
.................... } |
|
|
407 |
.................... |
|
|
408 |
.................... // Overloaded Functions to take care for new Data types in PCD |
|
|
409 |
.................... // Overloaded function CEIL_FLOOR() for data type - Float48 |
|
|
410 |
.................... #if defined(__PCD__) |
|
|
411 |
.................... float48 CEIL_FLOOR(float48 x, unsigned int8 n) |
|
|
412 |
.................... { |
|
|
413 |
.................... float48 y, res; |
|
|
414 |
.................... unsigned int16 l; |
|
|
415 |
.................... int1 s; |
|
|
416 |
.................... |
|
|
417 |
.................... s = 0; |
|
|
418 |
.................... y = x; |
|
|
419 |
.................... |
|
|
420 |
.................... if (x < 0) |
|
|
421 |
.................... { |
|
|
422 |
.................... s = 1; |
|
|
423 |
.................... y = -y; |
|
|
424 |
.................... } |
|
|
425 |
.................... |
|
|
426 |
.................... if (y <= 32768.0) |
|
|
427 |
.................... res = (float48)(unsigned int16)y; |
|
|
428 |
.................... |
|
|
429 |
.................... else if (y < 10000000.0) |
|
|
430 |
.................... { |
|
|
431 |
.................... l = (unsigned int16)(y/32768.0); |
|
|
432 |
.................... y = 32768.0*(y/32768.0 - (float48)l); |
|
|
433 |
.................... res = 32768.0*(float32)l; |
|
|
434 |
.................... res += (float48)(unsigned int16)y; |
|
|
435 |
.................... } |
|
|
436 |
.................... |
|
|
437 |
.................... else |
|
|
438 |
.................... res = y; |
|
|
439 |
.................... |
|
|
440 |
.................... y = y - (float48)(unsigned int16)y; |
|
|
441 |
.................... |
|
|
442 |
.................... if (s) |
|
|
443 |
.................... res = -res; |
|
|
444 |
.................... |
|
|
445 |
.................... if (y != 0) |
|
|
446 |
.................... { |
|
|
447 |
.................... if (s == 1 && n == 0) |
|
|
448 |
.................... res -= 1.0; |
|
|
449 |
.................... |
|
|
450 |
.................... if (s == 0 && n == 1) |
|
|
451 |
.................... res += 1.0; |
|
|
452 |
.................... } |
|
|
453 |
.................... if (x == 0) |
|
|
454 |
.................... res = 0; |
|
|
455 |
.................... |
|
|
456 |
.................... return (res); |
|
|
457 |
.................... } |
|
|
458 |
.................... |
|
|
459 |
.................... |
|
|
460 |
.................... // Overloaded function CEIL_FLOOR() for data type - Float64 |
|
|
461 |
.................... float64 CEIL_FLOOR(float64 x, unsigned int8 n) |
|
|
462 |
.................... { |
|
|
463 |
.................... float64 y, res; |
|
|
464 |
.................... unsigned int16 l; |
|
|
465 |
.................... int1 s; |
|
|
466 |
.................... |
|
|
467 |
.................... s = 0; |
|
|
468 |
.................... y = x; |
|
|
469 |
.................... |
|
|
470 |
.................... if (x < 0) |
|
|
471 |
.................... { |
|
|
472 |
.................... s = 1; |
|
|
473 |
.................... y = -y; |
|
|
474 |
.................... } |
|
|
475 |
.................... |
|
|
476 |
.................... if (y <= 32768.0) |
|
|
477 |
.................... res = (float64)(unsigned int16)y; |
|
|
478 |
.................... |
|
|
479 |
.................... else if (y < 10000000.0) |
|
|
480 |
.................... { |
|
|
481 |
.................... l = (unsigned int16)(y/32768.0); |
|
|
482 |
.................... y = 32768.0*(y/32768.0 - (float64)l); |
|
|
483 |
.................... res = 32768.0*(float64)l; |
|
|
484 |
.................... res += (float64)(unsigned int16)y; |
|
|
485 |
.................... } |
|
|
486 |
.................... |
|
|
487 |
.................... else |
|
|
488 |
.................... res = y; |
|
|
489 |
.................... |
|
|
490 |
.................... y = y - (float64)(unsigned int16)y; |
|
|
491 |
.................... |
|
|
492 |
.................... if (s) |
|
|
493 |
.................... res = -res; |
|
|
494 |
.................... |
|
|
495 |
.................... if (y != 0) |
|
|
496 |
.................... { |
|
|
497 |
.................... if (s == 1 && n == 0) |
|
|
498 |
.................... res -= 1.0; |
|
|
499 |
.................... |
|
|
500 |
.................... if (s == 0 && n == 1) |
|
|
501 |
.................... res += 1.0; |
|
|
502 |
.................... } |
|
|
503 |
.................... if (x == 0) |
|
|
504 |
.................... res = 0; |
|
|
505 |
.................... |
|
|
506 |
.................... return (res); |
|
|
507 |
.................... } |
|
|
508 |
.................... #endif |
|
|
509 |
.................... |
|
|
510 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
511 |
.................... // float floor(float x) |
|
|
512 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
513 |
.................... // Description : rounds down the number x. |
|
|
514 |
.................... // Date : N/A |
|
|
515 |
.................... // |
|
|
516 |
.................... float32 floor(float32 x) |
|
|
517 |
.................... { |
|
|
518 |
.................... return CEIL_FLOOR(x, 0); |
|
|
519 |
.................... } |
|
|
520 |
.................... // Following 2 functions are overloaded functions of floor() for PCD |
|
|
521 |
.................... // Overloaded function floor() for data type - Float48 |
|
|
522 |
.................... #if defined(__PCD__) |
|
|
523 |
.................... float48 floor(float48 x) |
|
|
524 |
.................... { |
|
|
525 |
.................... return CEIL_FLOOR(x, 0); |
|
|
526 |
.................... } |
|
|
527 |
.................... |
|
|
528 |
.................... // Overloaded function floor() for data type - Float64 |
|
|
529 |
.................... float64 floor(float64 x) |
|
|
530 |
.................... { |
|
|
531 |
.................... return CEIL_FLOOR(x, 0); |
|
|
532 |
.................... } |
|
|
533 |
.................... #endif |
|
|
534 |
.................... |
|
|
535 |
.................... |
|
|
536 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
537 |
.................... // float ceil(float x) |
|
|
538 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
539 |
.................... // Description : rounds up the number x. |
|
|
540 |
.................... // Date : N/A |
|
|
541 |
.................... // |
|
|
542 |
.................... float32 ceil(float32 x) |
|
|
543 |
.................... { |
|
|
544 |
.................... return CEIL_FLOOR(x, 1); |
|
|
545 |
.................... } |
|
|
546 |
.................... // Following 2 functions are overloaded functions of ceil() for PCD |
|
|
547 |
.................... // Overloaded function ceil() for data type - Float48 |
|
|
548 |
.................... #if defined(__PCD__) |
|
|
549 |
.................... float48 ceil(float48 x) |
|
|
550 |
.................... { |
|
|
551 |
.................... return CEIL_FLOOR(x, 1); |
|
|
552 |
.................... } |
|
|
553 |
.................... |
|
|
554 |
.................... // Overloaded function ceil() for data type - Float64 |
|
|
555 |
.................... float64 ceil(float64 x) |
|
|
556 |
.................... { |
|
|
557 |
.................... return CEIL_FLOOR(x, 1); |
|
|
558 |
.................... } |
|
|
559 |
.................... #endif |
|
|
560 |
.................... |
|
|
561 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
562 |
.................... // float fabs(float x) |
|
|
563 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
564 |
.................... // Description : Computes the absolute value of floating point number x |
|
|
565 |
.................... // Returns : returns the absolute value of x |
|
|
566 |
.................... // Date : N/A |
|
|
567 |
.................... // |
|
|
568 |
.................... #define fabs abs |
|
|
569 |
.................... |
|
|
570 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
571 |
.................... // float fmod(float x) |
|
|
572 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
573 |
.................... // Description : Computes the floating point remainder of x/y |
|
|
574 |
.................... // Returns : returns the value of x= i*y, for some integer i such that, if y |
|
|
575 |
.................... // is non zero, the result has the same isgn of x na dmagnitude less than the |
|
|
576 |
.................... // magnitude of y. If y is zero then a domain error occurs. |
|
|
577 |
.................... // Date : N/A |
|
|
578 |
.................... // |
|
|
579 |
.................... |
|
|
580 |
.................... float fmod(float32 x,float32 y) |
|
|
581 |
.................... { |
|
|
582 |
.................... float32 i; |
|
|
583 |
.................... if (y!=0.0) |
|
|
584 |
.................... { |
|
|
585 |
.................... i=(x/y < 0.0)? ceil(x/y): floor(x/y); |
|
|
586 |
.................... return(x-(i*y)); |
|
|
587 |
.................... } |
|
|
588 |
.................... else |
|
|
589 |
.................... { |
|
|
590 |
.................... #ifdef _ERRNO |
|
|
591 |
.................... { |
|
|
592 |
.................... errno=EDOM; |
|
|
593 |
.................... } |
|
|
594 |
.................... #endif |
|
|
595 |
.................... } |
|
|
596 |
.................... } |
|
|
597 |
.................... //Overloaded function for fmod() for PCD |
|
|
598 |
.................... // Overloaded function fmod() for data type - Float48 |
|
|
599 |
.................... #if defined(__PCD__) |
|
|
600 |
.................... float48 fmod(float48 x,float48 y) |
|
|
601 |
.................... { |
|
|
602 |
.................... float48 i; |
|
|
603 |
.................... if (y!=0.0) |
|
|
604 |
.................... { |
|
|
605 |
.................... i=(x/y < 0.0)? ceil(x/y): floor(x/y); |
|
|
606 |
.................... return(x-(i*y)); |
|
|
607 |
.................... } |
|
|
608 |
.................... else |
|
|
609 |
.................... { |
|
|
610 |
.................... #ifdef _ERRNO |
|
|
611 |
.................... { |
|
|
612 |
.................... errno=EDOM; |
|
|
613 |
.................... } |
|
|
614 |
.................... #endif |
|
|
615 |
.................... } |
|
|
616 |
.................... } |
|
|
617 |
.................... // Overloaded function fmod() for data type - Float64 |
|
|
618 |
.................... float64 fmod(float64 x,float64 y) |
|
|
619 |
.................... { |
|
|
620 |
.................... float64 i; |
|
|
621 |
.................... if (y!=0.0) |
|
|
622 |
.................... { |
|
|
623 |
.................... i=(x/y < 0.0)? ceil(x/y): floor(x/y); |
|
|
624 |
.................... return(x-(i*y)); |
|
|
625 |
.................... } |
|
|
626 |
.................... else |
|
|
627 |
.................... { |
|
|
628 |
.................... #ifdef _ERRNO |
|
|
629 |
.................... { |
|
|
630 |
.................... errno=EDOM; |
|
|
631 |
.................... } |
|
|
632 |
.................... #endif |
|
|
633 |
.................... } |
|
|
634 |
.................... } |
|
|
635 |
.................... #endif |
|
|
636 |
.................... //////////////////// Exponential and logarithmic functions //////////////////// |
|
|
637 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
638 |
.................... // float exp(float x) |
|
|
639 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
640 |
.................... // Description : returns the value (e^x) |
|
|
641 |
.................... // Date : N/A |
|
|
642 |
.................... // |
|
|
643 |
.................... #define LN2 0.6931471805599453 |
|
|
644 |
.................... |
|
|
645 |
.................... float const pe[6] = {0.000207455774, 0.00127100575, 0.00965065093, |
|
|
646 |
.................... 0.0554965651, 0.240227138, 0.693147172}; |
|
|
647 |
.................... |
|
|
648 |
.................... |
|
|
649 |
.................... float32 exp(float32 x) |
|
|
650 |
.................... { |
|
|
651 |
.................... float32 y, res, r; |
|
|
652 |
.................... #if defined(__PCD__) |
|
|
653 |
.................... int8 data1; |
|
|
654 |
.................... #endif |
|
|
655 |
.................... signed int8 n; |
|
|
656 |
.................... int1 s; |
|
|
657 |
.................... #ifdef _ERRNO |
|
|
658 |
.................... if(x > 88.722838) |
|
|
659 |
.................... { |
|
|
660 |
.................... errno=ERANGE; |
|
|
661 |
.................... return(0); |
|
|
662 |
.................... } |
|
|
663 |
.................... #endif |
|
|
664 |
.................... n = (signed int16)(x/LN2); |
|
|
665 |
.................... s = 0; |
|
|
666 |
.................... y = x; |
|
|
667 |
.................... |
|
|
668 |
.................... if (x < 0) |
|
|
669 |
.................... { |
|
|
670 |
.................... s = 1; |
|
|
671 |
.................... n = -n; |
|
|
672 |
.................... y = -y; |
|
|
673 |
.................... } |
|
|
674 |
.................... |
|
|
675 |
.................... res = 0.0; |
|
|
676 |
.................... #if !defined(__PCD__) |
|
|
677 |
.................... *((unsigned int8 *)(&res)) = n + 0x7F; |
|
|
678 |
.................... #endif |
|
|
679 |
.................... |
|
|
680 |
.................... #if defined(__PCD__) // Takes care of IEEE format for PCD |
|
|
681 |
.................... data1 = n+0x7F; |
|
|
682 |
.................... if(bit_test(data1,0)) |
|
|
683 |
.................... bit_set(*(((unsigned int8 *)(&res)+2)),7); |
|
|
684 |
.................... rotate_right(&data1,1); |
|
|
685 |
.................... bit_clear(data1,7); |
|
|
686 |
.................... *(((unsigned int8 *)(&res)+3)) = data1; |
|
|
687 |
.................... #endif |
|
|
688 |
.................... |
|
|
689 |
.................... y = y/LN2 - (float32)n; |
|
|
690 |
.................... |
|
|
691 |
.................... r = pe[0]*y + pe[1]; |
|
|
692 |
.................... r = r*y + pe[2]; |
|
|
693 |
.................... r = r*y + pe[3]; |
|
|
694 |
.................... r = r*y + pe[4]; |
|
|
695 |
.................... r = r*y + pe[5]; |
|
|
696 |
.................... |
|
|
697 |
.................... res = res*(1.0 + y*r); |
|
|
698 |
.................... |
|
|
699 |
.................... if (s) |
|
|
700 |
.................... res = 1.0/res; |
|
|
701 |
.................... return(res); |
|
|
702 |
.................... } |
|
|
703 |
.................... |
|
|
704 |
.................... |
|
|
705 |
.................... //Overloaded function for exp() for PCD |
|
|
706 |
.................... // Overloaded function exp() for data type - Float48 |
|
|
707 |
.................... #if defined(__PCD__) |
|
|
708 |
.................... float48 exp(float48 x) |
|
|
709 |
.................... { |
|
|
710 |
.................... float48 y, res, r; |
|
|
711 |
.................... int8 data1; |
|
|
712 |
.................... signed int8 n; |
|
|
713 |
.................... int1 s; |
|
|
714 |
.................... #ifdef _ERRNO |
|
|
715 |
.................... if(x > 88.722838) |
|
|
716 |
.................... { |
|
|
717 |
.................... errno=ERANGE; |
|
|
718 |
.................... return(0); |
|
|
719 |
.................... } |
|
|
720 |
.................... #endif |
|
|
721 |
.................... n = (signed int16)(x/LN2); |
|
|
722 |
.................... s = 0; |
|
|
723 |
.................... y = x; |
|
|
724 |
.................... |
|
|
725 |
.................... if (x < 0) |
|
|
726 |
.................... { |
|
|
727 |
.................... s = 1; |
|
|
728 |
.................... n = -n; |
|
|
729 |
.................... y = -y; |
|
|
730 |
.................... } |
|
|
731 |
.................... |
|
|
732 |
.................... res = 0.0; |
|
|
733 |
.................... |
|
|
734 |
.................... data1 = n+0x7F; |
|
|
735 |
.................... if(bit_test(data1,0)) |
|
|
736 |
.................... bit_set(*(((unsigned int8 *)(&res)+4)),7); |
|
|
737 |
.................... rotate_right(&data1,1); |
|
|
738 |
.................... bit_clear(data1,7); |
|
|
739 |
.................... *(((unsigned int8 *)(&res)+5)) = data1; |
|
|
740 |
.................... |
|
|
741 |
.................... y = y/LN2 - (float48)n; |
|
|
742 |
.................... |
|
|
743 |
.................... r = pe[0]*y + pe[1]; |
|
|
744 |
.................... r = r*y + pe[2]; |
|
|
745 |
.................... r = r*y + pe[3]; |
|
|
746 |
.................... r = r*y + pe[4]; |
|
|
747 |
.................... r = r*y + pe[5]; |
|
|
748 |
.................... |
|
|
749 |
.................... res = res*(1.0 + y*r); |
|
|
750 |
.................... |
|
|
751 |
.................... if (s) |
|
|
752 |
.................... res = 1.0/res; |
|
|
753 |
.................... return(res); |
|
|
754 |
.................... } |
|
|
755 |
.................... |
|
|
756 |
.................... // Overloaded function exp() for data type - Float64 |
|
|
757 |
.................... float64 exp(float64 x) |
|
|
758 |
.................... { |
|
|
759 |
.................... float64 y, res, r; |
|
|
760 |
.................... unsigned int16 data1, data2; |
|
|
761 |
.................... unsigned int16 *p; |
|
|
762 |
.................... signed int16 n; |
|
|
763 |
.................... int1 s; |
|
|
764 |
.................... #ifdef _ERRNO |
|
|
765 |
.................... if(x > 709.7827128) |
|
|
766 |
.................... { |
|
|
767 |
.................... errno=ERANGE; |
|
|
768 |
.................... return(0); |
|
|
769 |
.................... } |
|
|
770 |
.................... #endif |
|
|
771 |
.................... n = (signed int16)(x/LN2); |
|
|
772 |
.................... s = 0; |
|
|
773 |
.................... y = x; |
|
|
774 |
.................... |
|
|
775 |
.................... if (x < 0) |
|
|
776 |
.................... { |
|
|
777 |
.................... s = 1; |
|
|
778 |
.................... n = -n; |
|
|
779 |
.................... y = -y; |
|
|
780 |
.................... } |
|
|
781 |
.................... |
|
|
782 |
.................... res = 0.0; |
|
|
783 |
.................... |
|
|
784 |
.................... #if !defined(__PCD__) |
|
|
785 |
.................... *((unsigned int16 *)(&res)) = n + 0x7F; |
|
|
786 |
.................... #endif |
|
|
787 |
.................... p= (((unsigned int16 *)(&res))+3); |
|
|
788 |
.................... data1 = *p; |
|
|
789 |
.................... data2 = *p; |
|
|
790 |
.................... data1 = n + 0x3FF; |
|
|
791 |
.................... data1 = data1 <<4; |
|
|
792 |
.................... if(bit_test(data2,15)) |
|
|
793 |
.................... bit_set(data1,15); |
|
|
794 |
.................... data2 = data2 & 0x000F; |
|
|
795 |
.................... data1 ^= data2; |
|
|
796 |
.................... |
|
|
797 |
.................... *(((unsigned int16 *)(&res)+3)) = data1; |
|
|
798 |
.................... |
|
|
799 |
.................... |
|
|
800 |
.................... y = y/LN2 - (float64)n; |
|
|
801 |
.................... |
|
|
802 |
.................... r = pe[0]*y + pe[1]; |
|
|
803 |
.................... r = r*y + pe[2]; |
|
|
804 |
.................... r = r*y + pe[3]; |
|
|
805 |
.................... r = r*y + pe[4]; |
|
|
806 |
.................... r = r*y + pe[5]; |
|
|
807 |
.................... |
|
|
808 |
.................... res = res*(1.0 + y*r); |
|
|
809 |
.................... |
|
|
810 |
.................... if (s) |
|
|
811 |
.................... res = 1.0/res; |
|
|
812 |
.................... return(res); |
|
|
813 |
.................... } |
|
|
814 |
.................... |
|
|
815 |
.................... #ENDIF |
|
|
816 |
.................... |
|
|
817 |
.................... |
|
|
818 |
.................... /************************************************************/ |
|
|
819 |
.................... |
|
|
820 |
.................... float32 const pl[4] = {0.45145214, -9.0558803, 26.940971, -19.860189}; |
|
|
821 |
.................... float32 const ql[4] = {1.0000000, -8.1354259, 16.780517, -9.9300943}; |
|
|
822 |
.................... |
|
|
823 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
824 |
.................... // float log(float x) |
|
|
825 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
826 |
.................... // Description : returns the the natural log of x |
|
|
827 |
.................... // Date : N/A |
|
|
828 |
.................... // |
|
|
829 |
.................... float32 log(float32 x) |
|
|
830 |
.................... { |
|
|
831 |
.................... float32 y, res, r, y2; |
|
|
832 |
.................... #if defined(__PCD__) |
|
|
833 |
.................... unsigned int8 data1,data2; |
|
|
834 |
.................... #endif |
|
|
835 |
.................... signed int8 n; |
|
|
836 |
.................... #ifdef _ERRNO |
|
|
837 |
.................... if(x <0) |
|
|
838 |
.................... { |
|
|
839 |
.................... errno=EDOM; |
|
|
840 |
.................... } |
|
|
841 |
.................... if(x ==0) |
|
|
842 |
.................... { |
|
|
843 |
.................... errno=ERANGE; |
|
|
844 |
.................... return(0); |
|
|
845 |
.................... } |
|
|
846 |
.................... #endif |
|
|
847 |
.................... y = x; |
|
|
848 |
.................... |
|
|
849 |
.................... if (y != 1.0) |
|
|
850 |
.................... { |
|
|
851 |
.................... #if !defined(__PCD__) |
|
|
852 |
.................... *((unsigned int8 *)(&y)) = 0x7E; |
|
|
853 |
.................... #endif |
|
|
854 |
.................... |
|
|
855 |
.................... #if defined(__PCD__) // Takes care of IEEE format |
|
|
856 |
.................... data2 = *(((unsigned int8 *)(&y))+3); |
|
|
857 |
.................... *(((unsigned int8 *)(&y))+3) = 0x3F; |
|
|
858 |
.................... data1 = *(((unsigned int8 *)(&y))+2); |
|
|
859 |
.................... bit_clear(data1,7); |
|
|
860 |
.................... *(((unsigned int8 *)(&y))+2) = data1; |
|
|
861 |
.................... if(bit_test(data2,7)) |
|
|
862 |
.................... bit_set(*(((unsigned int8 *)(&y))+3),7); |
|
|
863 |
.................... #endif |
|
|
864 |
.................... |
|
|
865 |
.................... y = (y - 1.0)/(y + 1.0); |
|
|
866 |
.................... |
|
|
867 |
.................... y2=y*y; |
|
|
868 |
.................... |
|
|
869 |
.................... res = pl[0]*y2 + pl[1]; |
|
|
870 |
.................... res = res*y2 + pl[2]; |
|
|
871 |
.................... res = res*y2 + pl[3]; |
|
|
872 |
.................... |
|
|
873 |
.................... r = ql[0]*y2 + ql[1]; |
|
|
874 |
.................... r = r*y2 + ql[2]; |
|
|
875 |
.................... r = r*y2 + ql[3]; |
|
|
876 |
.................... |
|
|
877 |
.................... res = y*res/r; |
|
|
878 |
.................... #if !defined(__PCD__) |
|
|
879 |
.................... n = *((unsigned int8 *)(&x)) - 0x7E; |
|
|
880 |
.................... #endif |
|
|
881 |
.................... #if defined(__PCD__) |
|
|
882 |
.................... data1 = *(((unsigned int8 *)(&x)+3)); |
|
|
883 |
.................... rotate_left(&data1,1); |
|
|
884 |
.................... data2 = *(((unsigned int8 *)(&x)+2)); |
|
|
885 |
.................... if(bit_test (data2,7)) |
|
|
886 |
.................... bit_set(data1,0); |
|
|
887 |
.................... n = data1 - 0x7E; |
|
|
888 |
.................... #endif |
|
|
889 |
.................... |
|
|
890 |
.................... if (n<0) |
|
|
891 |
.................... r = -(float32)-n; |
|
|
892 |
.................... else |
|
|
893 |
.................... r = (float32)n; |
|
|
894 |
.................... |
|
|
895 |
.................... res += r*LN2; |
|
|
896 |
.................... } |
|
|
897 |
.................... |
|
|
898 |
.................... else |
|
|
899 |
.................... res = 0.0; |
|
|
900 |
.................... |
|
|
901 |
.................... return(res); |
|
|
902 |
.................... } |
|
|
903 |
.................... |
|
|
904 |
.................... //Overloaded function for log() for PCD |
|
|
905 |
.................... // Overloaded function log() for data type - Float48 |
|
|
906 |
.................... #if defined(__PCD__) |
|
|
907 |
.................... float48 log(float48 x) |
|
|
908 |
.................... { |
|
|
909 |
.................... float48 y, res, r, y2; |
|
|
910 |
.................... unsigned int8 data1,data2; |
|
|
911 |
.................... signed int8 n; |
|
|
912 |
.................... #ifdef _ERRNO |
|
|
913 |
.................... if(x <0) |
|
|
914 |
.................... { |
|
|
915 |
.................... errno=EDOM; |
|
|
916 |
.................... } |
|
|
917 |
.................... if(x ==0) |
|
|
918 |
.................... { |
|
|
919 |
.................... errno=ERANGE; |
|
|
920 |
.................... return(0); |
|
|
921 |
.................... } |
|
|
922 |
.................... #endif |
|
|
923 |
.................... y = x; |
|
|
924 |
.................... |
|
|
925 |
.................... if (y != 1.0) |
|
|
926 |
.................... { |
|
|
927 |
.................... |
|
|
928 |
.................... #if !defined(__PCD__) |
|
|
929 |
.................... *((unsigned int8 *)(&y)) = 0x7E; |
|
|
930 |
.................... #endif |
|
|
931 |
.................... data2 = *(((unsigned int8 *)(&y))+5); |
|
|
932 |
.................... *(((unsigned int8 *)(&y))+5) = 0x3F; |
|
|
933 |
.................... data1 = *(((unsigned int8 *)(&y))+4); |
|
|
934 |
.................... bit_clear(data1,7); |
|
|
935 |
.................... *(((unsigned int8 *)(&y))+4) = data1; |
|
|
936 |
.................... |
|
|
937 |
.................... if(bit_test(data2,7)) |
|
|
938 |
.................... bit_set(*(((unsigned int8 *)(&y))+4),7); |
|
|
939 |
.................... y = (y - 1.0)/(y + 1.0); |
|
|
940 |
.................... |
|
|
941 |
.................... y2=y*y; |
|
|
942 |
.................... |
|
|
943 |
.................... res = pl[0]*y2 + pl[1]; |
|
|
944 |
.................... res = res*y2 + pl[2]; |
|
|
945 |
.................... res = res*y2 + pl[3]; |
|
|
946 |
.................... |
|
|
947 |
.................... r = ql[0]*y2 + ql[1]; |
|
|
948 |
.................... r = r*y2 + ql[2]; |
|
|
949 |
.................... r = r*y2 + ql[3]; |
|
|
950 |
.................... |
|
|
951 |
.................... res = y*res/r; |
|
|
952 |
.................... |
|
|
953 |
.................... data1 = *(((unsigned int8 *)(&x)+5)); |
|
|
954 |
.................... rotate_left(&data1,1); |
|
|
955 |
.................... data2 = *(((unsigned int8 *)(&x)+4)); |
|
|
956 |
.................... if(bit_test (data2,7)) |
|
|
957 |
.................... bit_set(data1,0); |
|
|
958 |
.................... |
|
|
959 |
.................... n = data1 - 0x7E; |
|
|
960 |
.................... |
|
|
961 |
.................... if (n<0) |
|
|
962 |
.................... r = -(float48)-n; |
|
|
963 |
.................... else |
|
|
964 |
.................... r = (float48)n; |
|
|
965 |
.................... |
|
|
966 |
.................... res += r*LN2; |
|
|
967 |
.................... } |
|
|
968 |
.................... |
|
|
969 |
.................... else |
|
|
970 |
.................... res = 0.0; |
|
|
971 |
.................... |
|
|
972 |
.................... return(res); |
|
|
973 |
.................... } |
|
|
974 |
.................... |
|
|
975 |
.................... // Overloaded function log() for data type - Float48 |
|
|
976 |
.................... #if defined(__PCD__) |
|
|
977 |
.................... float32 const pl_64[4] = {0.45145214, -9.0558803, 26.940971, -19.860189}; |
|
|
978 |
.................... float32 const ql_64[4] = {1.0000000, -8.1354259, 16.780517, -9.9300943}; |
|
|
979 |
.................... #endif |
|
|
980 |
.................... float64 log(float64 x) |
|
|
981 |
.................... { |
|
|
982 |
.................... float64 y, res, r, y2; |
|
|
983 |
.................... unsigned int16 data1,data2; |
|
|
984 |
.................... unsigned int16 *p; |
|
|
985 |
.................... signed int16 n; |
|
|
986 |
.................... #ifdef _ERRNO |
|
|
987 |
.................... if(x <0) |
|
|
988 |
.................... { |
|
|
989 |
.................... errno=EDOM; |
|
|
990 |
.................... } |
|
|
991 |
.................... if(x ==0) |
|
|
992 |
.................... { |
|
|
993 |
.................... errno=ERANGE; |
|
|
994 |
.................... return(0); |
|
|
995 |
.................... } |
|
|
996 |
.................... #endif |
|
|
997 |
.................... y = x; |
|
|
998 |
.................... |
|
|
999 |
.................... if (y != 1.0) |
|
|
1000 |
.................... { |
|
|
1001 |
.................... #if !defined(__PCD__) |
|
|
1002 |
.................... *((unsigned int8 *)(&y)) = 0x7E; |
|
|
1003 |
.................... #endif |
|
|
1004 |
.................... p= (((unsigned int16 *)(&y))+3); |
|
|
1005 |
.................... data1 = *p; |
|
|
1006 |
.................... data2 = *p; |
|
|
1007 |
.................... data1 = 0x3FE; |
|
|
1008 |
.................... data1 = data1 <<4; |
|
|
1009 |
.................... if(bit_test (data2,15)) |
|
|
1010 |
.................... bit_set(data1,15); |
|
|
1011 |
.................... data2 = data2 & 0x000F; |
|
|
1012 |
.................... data1 ^=data2; |
|
|
1013 |
.................... |
|
|
1014 |
.................... *p = data1; |
|
|
1015 |
.................... |
|
|
1016 |
.................... y = (y - 1.0)/(y + 1.0); |
|
|
1017 |
.................... |
|
|
1018 |
.................... y2=y*y; |
|
|
1019 |
.................... |
|
|
1020 |
.................... res = pl_64[0]*y2 + pl_64[1]; |
|
|
1021 |
.................... res = res*y2 + pl_64[2]; |
|
|
1022 |
.................... res = res*y2 + pl_64[3]; |
|
|
1023 |
.................... |
|
|
1024 |
.................... r = ql_64[0]*y2 + ql_64[1]; |
|
|
1025 |
.................... r = r*y2 + ql_64[2]; |
|
|
1026 |
.................... r = r*y2 + ql_64[3]; |
|
|
1027 |
.................... |
|
|
1028 |
.................... res = y*res/r; |
|
|
1029 |
.................... |
|
|
1030 |
.................... p= (((unsigned int16 *)(&x))+3); |
|
|
1031 |
.................... data1 = *p; |
|
|
1032 |
.................... bit_clear(data1,15); |
|
|
1033 |
.................... data1 = data1 >>4; |
|
|
1034 |
.................... n = data1 - 0x3FE; |
|
|
1035 |
.................... |
|
|
1036 |
.................... |
|
|
1037 |
.................... if (n<0) |
|
|
1038 |
.................... r = -(float64)-n; |
|
|
1039 |
.................... else |
|
|
1040 |
.................... r = (float64)n; |
|
|
1041 |
.................... |
|
|
1042 |
.................... res += r*LN2; |
|
|
1043 |
.................... } |
|
|
1044 |
.................... |
|
|
1045 |
.................... else |
|
|
1046 |
.................... res = 0.0; |
|
|
1047 |
.................... |
|
|
1048 |
.................... return(res); |
|
|
1049 |
.................... } |
|
|
1050 |
.................... #endif |
|
|
1051 |
.................... |
|
|
1052 |
.................... |
|
|
1053 |
.................... #define LN10 2.3025850929940456 |
|
|
1054 |
.................... |
|
|
1055 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1056 |
.................... // float log10(float x) |
|
|
1057 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1058 |
.................... // Description : returns the the log base 10 of x |
|
|
1059 |
.................... // Date : N/A |
|
|
1060 |
.................... // |
|
|
1061 |
.................... float32 log10(float32 x) |
|
|
1062 |
.................... { |
|
|
1063 |
.................... float32 r; |
|
|
1064 |
.................... |
|
|
1065 |
.................... r = log(x); |
|
|
1066 |
.................... r = r/LN10; |
|
|
1067 |
.................... return(r); |
|
|
1068 |
.................... } |
|
|
1069 |
.................... |
|
|
1070 |
.................... //Overloaded functions for log10() for PCD |
|
|
1071 |
.................... // Overloaded function log10() for data type - Float48 |
|
|
1072 |
.................... #if defined(__PCD__) |
|
|
1073 |
.................... float48 log10(float48 x) |
|
|
1074 |
.................... { |
|
|
1075 |
.................... float48 r; |
|
|
1076 |
.................... |
|
|
1077 |
.................... r = log(x); |
|
|
1078 |
.................... r = r/LN10; |
|
|
1079 |
.................... return(r); |
|
|
1080 |
.................... } |
|
|
1081 |
.................... |
|
|
1082 |
.................... // Overloaded function log10() for data type - Float64 |
|
|
1083 |
.................... float64 log10(float64 x) |
|
|
1084 |
.................... { |
|
|
1085 |
.................... float64 r; |
|
|
1086 |
.................... |
|
|
1087 |
.................... r = log(x); |
|
|
1088 |
.................... r = r/LN10; |
|
|
1089 |
.................... return(r); |
|
|
1090 |
.................... } |
|
|
1091 |
.................... #endif |
|
|
1092 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1093 |
.................... // float modf(float x) |
|
|
1094 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1095 |
.................... // Description :breaks the argument value int integral and fractional parts, |
|
|
1096 |
.................... // ach of which have the same sign as the argument. It stores the integral part |
|
|
1097 |
.................... // as a float in the object pointed to by the iptr |
|
|
1098 |
.................... // Returns : returns the signed fractional part of value. |
|
|
1099 |
.................... // Date : N/A |
|
|
1100 |
.................... // |
|
|
1101 |
.................... |
|
|
1102 |
.................... float32 modf(float32 value,float32 *iptr) |
|
|
1103 |
.................... { |
|
|
1104 |
.................... *iptr=(value < 0.0)? ceil(value): floor(value); |
|
|
1105 |
.................... return(value - *iptr); |
|
|
1106 |
.................... } |
|
|
1107 |
.................... //Overloaded functions for modf() for PCD |
|
|
1108 |
.................... // Overloaded function modf() for data type - Float48 |
|
|
1109 |
.................... #if defined(__PCD__) |
|
|
1110 |
.................... float48 modf(float48 value,float48 *iptr) |
|
|
1111 |
.................... { |
|
|
1112 |
.................... *iptr=(value < 0.0)? ceil(value): floor(value); |
|
|
1113 |
.................... return(value - *iptr); |
|
|
1114 |
.................... } |
|
|
1115 |
.................... // Overloaded function modf() for data type - Float64 |
|
|
1116 |
.................... float64 modf(float64 value,float64 *iptr) |
|
|
1117 |
.................... { |
|
|
1118 |
.................... *iptr=(value < 0.0)? ceil(value): floor(value); |
|
|
1119 |
.................... return(value - *iptr); |
|
|
1120 |
.................... } |
|
|
1121 |
.................... #endif |
|
|
1122 |
.................... |
|
|
1123 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1124 |
.................... // float pwr(float x,float y) |
|
|
1125 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1126 |
.................... // Description : returns the value (x^y) |
|
|
1127 |
.................... // Date : N/A |
|
|
1128 |
.................... // Note : 0 is returned when the function will generate an imaginary number |
|
|
1129 |
.................... // |
|
|
1130 |
.................... float32 pwr(float32 x,float32 y) |
|
|
1131 |
.................... { |
|
|
1132 |
.................... if(0 > x && fmod(y, 1) == 0) { |
|
|
1133 |
.................... if(fmod(y, 2) == 0) { |
|
|
1134 |
.................... return (exp(log(-x) * y)); |
|
|
1135 |
.................... } else { |
|
|
1136 |
.................... return (-exp(log(-x) * y)); |
|
|
1137 |
.................... } |
|
|
1138 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
|
|
1139 |
.................... return 0; |
|
|
1140 |
.................... } else { |
|
|
1141 |
.................... if(x != 0 || 0 >= y) { |
|
|
1142 |
.................... return (exp(log(x) * y)); |
|
|
1143 |
.................... } |
|
|
1144 |
.................... } |
|
|
1145 |
.................... } |
|
|
1146 |
.................... //Overloaded functions for pwr() for PCD |
|
|
1147 |
.................... // Overloaded function pwr() for data type - Float48 |
|
|
1148 |
.................... #if defined(__PCD__) |
|
|
1149 |
.................... float48 pwr(float48 x,float48 y) |
|
|
1150 |
.................... { |
|
|
1151 |
.................... if(0 > x && fmod(y, 1) == 0) { |
|
|
1152 |
.................... if(fmod(y, 2) == 0) { |
|
|
1153 |
.................... return (exp(log(-x) * y)); |
|
|
1154 |
.................... } else { |
|
|
1155 |
.................... return (-exp(log(-x) * y)); |
|
|
1156 |
.................... } |
|
|
1157 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
|
|
1158 |
.................... return 0; |
|
|
1159 |
.................... } else { |
|
|
1160 |
.................... if(x != 0 || 0 >= y) { |
|
|
1161 |
.................... return (exp(log(x) * y)); |
|
|
1162 |
.................... } |
|
|
1163 |
.................... } |
|
|
1164 |
.................... } |
|
|
1165 |
.................... // Overloaded function pwr() for data type - Float64 |
|
|
1166 |
.................... float64 pwr(float64 x,float64 y) |
|
|
1167 |
.................... { |
|
|
1168 |
.................... if(0 > x && fmod(y, 1) == 0) { |
|
|
1169 |
.................... if(fmod(y, 2) == 0) { |
|
|
1170 |
.................... return (exp(log(-x) * y)); |
|
|
1171 |
.................... } else { |
|
|
1172 |
.................... return (-exp(log(-x) * y)); |
|
|
1173 |
.................... } |
|
|
1174 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
|
|
1175 |
.................... return 0; |
|
|
1176 |
.................... } else { |
|
|
1177 |
.................... if(x != 0 || 0 >= y) { |
|
|
1178 |
.................... return (exp(log(x) * y)); |
|
|
1179 |
.................... } |
|
|
1180 |
.................... } |
|
|
1181 |
.................... } |
|
|
1182 |
.................... #endif |
|
|
1183 |
.................... |
|
|
1184 |
.................... //////////////////// Power functions //////////////////// |
|
|
1185 |
.................... |
|
|
1186 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1187 |
.................... // float pow(float x,float y) |
|
|
1188 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1189 |
.................... // Description : returns the value (x^y) |
|
|
1190 |
.................... // Date : N/A |
|
|
1191 |
.................... // Note : 0 is returned when the function will generate an imaginary number |
|
|
1192 |
.................... // |
|
|
1193 |
.................... float32 pow(float32 x,float32 y) |
|
|
1194 |
.................... { |
|
|
1195 |
.................... if(0 > x && fmod(y, 1) == 0) { |
|
|
1196 |
.................... if(fmod(y, 2) == 0) { |
|
|
1197 |
.................... return (exp(log(-x) * y)); |
|
|
1198 |
.................... } else { |
|
|
1199 |
.................... return (-exp(log(-x) * y)); |
|
|
1200 |
.................... } |
|
|
1201 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
|
|
1202 |
.................... return 0; |
|
|
1203 |
.................... } else { |
|
|
1204 |
.................... if(x != 0 || 0 >= y) { |
|
|
1205 |
.................... return (exp(log(x) * y)); |
|
|
1206 |
.................... } |
|
|
1207 |
.................... } |
|
|
1208 |
.................... } |
|
|
1209 |
.................... //Overloaded functions for pow() for PCD |
|
|
1210 |
.................... // Overloaded function for pow() data type - Float48 |
|
|
1211 |
.................... #if defined(__PCD__) |
|
|
1212 |
.................... float48 pow(float48 x,float48 y) |
|
|
1213 |
.................... { |
|
|
1214 |
.................... if(0 > x && fmod(y, 1) == 0) { |
|
|
1215 |
.................... if(fmod(y, 2) == 0) { |
|
|
1216 |
.................... return (exp(log(-x) * y)); |
|
|
1217 |
.................... } else { |
|
|
1218 |
.................... return (-exp(log(-x) * y)); |
|
|
1219 |
.................... } |
|
|
1220 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
|
|
1221 |
.................... return 0; |
|
|
1222 |
.................... } else { |
|
|
1223 |
.................... if(x != 0 || 0 >= y) { |
|
|
1224 |
.................... return (exp(log(x) * y)); |
|
|
1225 |
.................... } |
|
|
1226 |
.................... } |
|
|
1227 |
.................... } |
|
|
1228 |
.................... |
|
|
1229 |
.................... // Overloaded function pow() for data type - Float64 |
|
|
1230 |
.................... float64 pow(float64 x,float64 y) |
|
|
1231 |
.................... { |
|
|
1232 |
.................... if(0 > x && fmod(y, 1) == 0) { |
|
|
1233 |
.................... if(fmod(y, 2) == 0) { |
|
|
1234 |
.................... return (exp(log(-x) * y)); |
|
|
1235 |
.................... } else { |
|
|
1236 |
.................... return (-exp(log(-x) * y)); |
|
|
1237 |
.................... } |
|
|
1238 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
|
|
1239 |
.................... return 0; |
|
|
1240 |
.................... } else { |
|
|
1241 |
.................... if(x != 0 || 0 >= y) { |
|
|
1242 |
.................... return (exp(log(x) * y)); |
|
|
1243 |
.................... } |
|
|
1244 |
.................... } |
|
|
1245 |
.................... } |
|
|
1246 |
.................... #endif |
|
|
1247 |
.................... |
|
|
1248 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1249 |
.................... // float sqrt(float x) |
|
|
1250 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1251 |
.................... // Description : returns the square root of x |
|
|
1252 |
.................... // Date : N/A |
|
|
1253 |
.................... // |
|
|
1254 |
.................... float32 sqrt(float32 x) |
|
|
1255 |
.................... { |
|
|
1256 |
.................... float32 y, res; |
|
|
1257 |
.................... #if defined(__PCD__) |
|
|
1258 |
.................... unsigned int16 data1,data2; |
|
|
1259 |
.................... #endif |
|
|
1260 |
.................... BYTE *p; |
|
|
1261 |
.................... |
|
|
1262 |
.................... #ifdef _ERRNO |
|
|
1263 |
.................... if(x < 0) |
|
|
1264 |
.................... { |
|
|
1265 |
.................... errno=EDOM; |
|
|
1266 |
.................... } |
|
|
1267 |
.................... #endif |
|
|
1268 |
.................... |
|
|
1269 |
.................... if( x<=0.0) |
|
|
1270 |
.................... return(0.0); |
|
|
1271 |
.................... |
|
|
1272 |
.................... y=x; |
|
|
1273 |
.................... |
|
|
1274 |
.................... #if !defined(__PCD__) |
|
|
1275 |
.................... p=&y; |
|
|
1276 |
.................... (*p)=(BYTE)((((unsigned int16)(*p)) + 127) >> 1); |
|
|
1277 |
.................... #endif |
|
|
1278 |
.................... |
|
|
1279 |
.................... #if defined(__PCD__) |
|
|
1280 |
.................... p = (((unsigned int8 *)(&y))+3); |
|
|
1281 |
.................... data1 = *(((unsigned int8 *)(&y))+3); |
|
|
1282 |
.................... data2 = *(((unsigned int8 *)(&y))+2); |
|
|
1283 |
.................... rotate_left(&data1,1); |
|
|
1284 |
.................... if(bit_test(data2,7)) |
|
|
1285 |
.................... bit_set(data1,0); |
|
|
1286 |
.................... data1 = ((data1+127) >>1); |
|
|
1287 |
.................... bit_clear(data2,7); |
|
|
1288 |
.................... if(bit_test(data1,0)) |
|
|
1289 |
.................... bit_set(data2,7); |
|
|
1290 |
.................... data1 = data1 >>1; |
|
|
1291 |
.................... *(((unsigned int8 *)(&y))+3) = data1; |
|
|
1292 |
.................... *(((unsigned int8 *)(&y))+2) = data2; |
|
|
1293 |
.................... |
|
|
1294 |
.................... #endif |
|
|
1295 |
.................... |
|
|
1296 |
.................... do { |
|
|
1297 |
.................... res=y; |
|
|
1298 |
.................... y+=(x/y); |
|
|
1299 |
.................... |
|
|
1300 |
.................... #if !defined(__PCD__) |
|
|
1301 |
.................... (*p)--; |
|
|
1302 |
.................... #endif |
|
|
1303 |
.................... |
|
|
1304 |
.................... #if defined(__PCD__) |
|
|
1305 |
.................... data1 = *(((unsigned int8 *)(&y))+3); |
|
|
1306 |
.................... data2 = *(((unsigned int8 *)(&y))+2); |
|
|
1307 |
.................... rotate_left(&data1,1); |
|
|
1308 |
.................... if(bit_test(data2,7)) |
|
|
1309 |
.................... bit_set(data1,0); |
|
|
1310 |
.................... data1--; |
|
|
1311 |
.................... bit_clear(data2,7); |
|
|
1312 |
.................... if(bit_test(data1,0)) |
|
|
1313 |
.................... bit_set(data2,7); |
|
|
1314 |
.................... data1 = data1 >>1; |
|
|
1315 |
.................... *(((unsigned int8 *)(&y))+3) = data1; |
|
|
1316 |
.................... *(((unsigned int8 *)(&y))+2) = data2; |
|
|
1317 |
.................... |
|
|
1318 |
.................... #endif |
|
|
1319 |
.................... } while(res != y); |
|
|
1320 |
.................... |
|
|
1321 |
.................... return(res); |
|
|
1322 |
.................... } |
|
|
1323 |
.................... //Overloaded functions for sqrt() for PCD |
|
|
1324 |
.................... // Overloaded function sqrt() for data type - Float48 |
|
|
1325 |
.................... #if defined(__PCD__) |
|
|
1326 |
.................... float48 sqrt(float48 x) |
|
|
1327 |
.................... { |
|
|
1328 |
.................... float48 y, res; |
|
|
1329 |
.................... unsigned int16 data1,data2; |
|
|
1330 |
.................... BYTE *p; |
|
|
1331 |
.................... |
|
|
1332 |
.................... #ifdef _ERRNO |
|
|
1333 |
.................... if(x < 0) |
|
|
1334 |
.................... { |
|
|
1335 |
.................... errno=EDOM; |
|
|
1336 |
.................... } |
|
|
1337 |
.................... #endif |
|
|
1338 |
.................... |
|
|
1339 |
.................... if( x<=0.0) |
|
|
1340 |
.................... return(0.0); |
|
|
1341 |
.................... |
|
|
1342 |
.................... y=x; |
|
|
1343 |
.................... |
|
|
1344 |
.................... #if !defined(__PCD__) |
|
|
1345 |
.................... p=&y; |
|
|
1346 |
.................... (*p)=(BYTE)((((unsigned int16)(*p)) + 127) >> 1); |
|
|
1347 |
.................... #endif |
|
|
1348 |
.................... |
|
|
1349 |
.................... #if defined(__PCD__) |
|
|
1350 |
.................... p = (((unsigned int8 *)(&y))+5); |
|
|
1351 |
.................... data1 = *(((unsigned int8 *)(&y))+5); |
|
|
1352 |
.................... data2 = *(((unsigned int8 *)(&y))+4); |
|
|
1353 |
.................... rotate_left(&data1,1); |
|
|
1354 |
.................... if(bit_test(data2,7)) |
|
|
1355 |
.................... bit_set(data1,0); |
|
|
1356 |
.................... data1 = ((data1+127) >>1); |
|
|
1357 |
.................... bit_clear(data2,7); |
|
|
1358 |
.................... if(bit_test(data1,0)) |
|
|
1359 |
.................... bit_set(data2,7); |
|
|
1360 |
.................... data1 = data1 >>1; |
|
|
1361 |
.................... *(((unsigned int8 *)(&y))+5) = data1; |
|
|
1362 |
.................... *(((unsigned int8 *)(&y))+4) = data2; |
|
|
1363 |
.................... |
|
|
1364 |
.................... #endif |
|
|
1365 |
.................... |
|
|
1366 |
.................... do { |
|
|
1367 |
.................... res=y; |
|
|
1368 |
.................... y+=(x/y); |
|
|
1369 |
.................... |
|
|
1370 |
.................... #if !defined(__PCD__) |
|
|
1371 |
.................... (*p)--; |
|
|
1372 |
.................... #endif |
|
|
1373 |
.................... |
|
|
1374 |
.................... data1 = *(((unsigned int8 *)(&y))+5); |
|
|
1375 |
.................... data2 = *(((unsigned int8 *)(&y))+4); |
|
|
1376 |
.................... rotate_left(&data1,1); |
|
|
1377 |
.................... if(bit_test(data2,7)) |
|
|
1378 |
.................... bit_set(data1,0); |
|
|
1379 |
.................... data1--; |
|
|
1380 |
.................... bit_clear(data2,7); |
|
|
1381 |
.................... if(bit_test(data1,0)) |
|
|
1382 |
.................... bit_set(data2,7); |
|
|
1383 |
.................... data1 = data1 >>1; |
|
|
1384 |
.................... *(((unsigned int8 *)(&y))+5) = data1; |
|
|
1385 |
.................... *(((unsigned int8 *)(&y))+4) = data2; |
|
|
1386 |
.................... |
|
|
1387 |
.................... } while(res != y); |
|
|
1388 |
.................... |
|
|
1389 |
.................... return(res); |
|
|
1390 |
.................... } |
|
|
1391 |
.................... |
|
|
1392 |
.................... // Overloaded function sqrt() for data type - Float64 |
|
|
1393 |
.................... float64 sqrt(float64 x) |
|
|
1394 |
.................... { |
|
|
1395 |
.................... float64 y, res; |
|
|
1396 |
.................... unsigned int16 *p; |
|
|
1397 |
.................... unsigned int16 temp1,temp2; |
|
|
1398 |
.................... |
|
|
1399 |
.................... #ifdef _ERRNO |
|
|
1400 |
.................... if(x < 0) |
|
|
1401 |
.................... { |
|
|
1402 |
.................... errno=EDOM; |
|
|
1403 |
.................... } |
|
|
1404 |
.................... #endif |
|
|
1405 |
.................... |
|
|
1406 |
.................... if( x<=0.0) |
|
|
1407 |
.................... return(0.0); |
|
|
1408 |
.................... |
|
|
1409 |
.................... y=x; |
|
|
1410 |
.................... p= (((unsigned int16 *)(&y))+3); |
|
|
1411 |
.................... temp1 = *p; |
|
|
1412 |
.................... temp2 = *p; |
|
|
1413 |
.................... bit_clear(temp1,15); |
|
|
1414 |
.................... temp1 = (temp1>>4)+1023; |
|
|
1415 |
.................... temp1 = temp1 >> 1; |
|
|
1416 |
.................... temp1 = (temp1<<4) & 0xFFF0; |
|
|
1417 |
.................... if(bit_test(temp2,15)) |
|
|
1418 |
.................... bit_set(temp1,15); |
|
|
1419 |
.................... temp2 = temp2 & 0x000F; |
|
|
1420 |
.................... temp1 ^= temp2; |
|
|
1421 |
.................... |
|
|
1422 |
.................... (*p) = temp1; |
|
|
1423 |
.................... |
|
|
1424 |
.................... do { |
|
|
1425 |
.................... res=y; |
|
|
1426 |
.................... y+=(x/y); |
|
|
1427 |
.................... temp1 = *p; |
|
|
1428 |
.................... temp2 = *p; |
|
|
1429 |
.................... bit_clear(temp1,15); |
|
|
1430 |
.................... temp1 = (temp1>>4); |
|
|
1431 |
.................... temp1--; |
|
|
1432 |
.................... temp1 = (temp1<<4) & 0xFFF0; |
|
|
1433 |
.................... if(bit_test(temp2,15)) |
|
|
1434 |
.................... bit_set(temp1,15); |
|
|
1435 |
.................... temp2 = temp2 & 0x000F; |
|
|
1436 |
.................... temp1 ^= temp2; |
|
|
1437 |
.................... (*p) = temp1; |
|
|
1438 |
.................... |
|
|
1439 |
.................... } while(res != y); |
|
|
1440 |
.................... |
|
|
1441 |
.................... return(res); |
|
|
1442 |
.................... } |
|
|
1443 |
.................... #endif |
|
|
1444 |
.................... |
|
|
1445 |
.................... ////////////////////////////// Trig Functions ////////////////////////////// |
|
|
1446 |
.................... #ifdef PI_DIV_BY_TWO |
|
|
1447 |
.................... #undef PI_DIV_BY_TWO |
|
|
1448 |
.................... #endif |
|
|
1449 |
.................... #define PI_DIV_BY_TWO 1.5707963267948966 |
|
|
1450 |
.................... #ifdef TWOBYPI |
|
|
1451 |
.................... #undef TWOBYPI |
|
|
1452 |
.................... #define TWOBYPI 0.6366197723675813 |
|
|
1453 |
.................... #endif |
|
|
1454 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1455 |
.................... // float cos(float x) |
|
|
1456 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1457 |
.................... // Description : returns the cosine value of the angle x, which is in radian |
|
|
1458 |
.................... // Date : 9/20/2001 |
|
|
1459 |
.................... // |
|
|
1460 |
.................... float32 cos(float32 x) |
|
|
1461 |
.................... { |
|
|
1462 |
.................... float32 y, t, t2 = 1.0; |
|
|
1463 |
.................... unsigned int8 quad, i; |
|
|
1464 |
.................... float32 frac; |
|
|
1465 |
.................... float32 p[6] = { //by the series definition for cosine |
|
|
1466 |
.................... -0.5, // sum ( ( (-1)^n * x^2n )/(2n)! ) |
|
|
1467 |
.................... 0.04166666666667, |
|
|
1468 |
.................... -0.00138888888889, |
|
|
1469 |
.................... 0.00002480158730, |
|
|
1470 |
.................... -0.00000027557319, |
|
|
1471 |
.................... 0.00000000208767, |
|
|
1472 |
.................... //-0.00000000001147, |
|
|
1473 |
.................... // 0.00000000000005 |
|
|
1474 |
.................... }; |
|
|
1475 |
.................... |
|
|
1476 |
.................... if (x < 0) x = -x; // absolute value of input |
|
|
1477 |
.................... |
|
|
1478 |
.................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant |
|
|
1479 |
.................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input |
|
|
1480 |
.................... quad = quad % 4; // quadrant (0 to 3) |
|
|
1481 |
.................... |
|
|
1482 |
.................... if (quad == 0 || quad == 2) |
|
|
1483 |
.................... t = frac * PI_DIV_BY_TWO; |
|
|
1484 |
.................... else if (quad == 1) |
|
|
1485 |
.................... t = (1-frac) * PI_DIV_BY_TWO; |
|
|
1486 |
.................... else // should be 3 |
|
|
1487 |
.................... t = (frac-1) * PI_DIV_BY_TWO; |
|
|
1488 |
.................... |
|
|
1489 |
.................... y = 1.0; |
|
|
1490 |
.................... t = t * t; |
|
|
1491 |
.................... for (i = 0; i <= 5; i++) |
|
|
1492 |
.................... { |
|
|
1493 |
.................... t2 = t2 * t; |
|
|
1494 |
.................... y = y + p[i] * t2; |
|
|
1495 |
.................... } |
|
|
1496 |
.................... |
|
|
1497 |
.................... if (quad == 2 || quad == 1) |
|
|
1498 |
.................... y = -y; // correct sign |
|
|
1499 |
.................... |
|
|
1500 |
.................... return (y); |
|
|
1501 |
.................... } |
|
|
1502 |
.................... |
|
|
1503 |
.................... |
|
|
1504 |
.................... //Overloaded functions for cos() for PCD |
|
|
1505 |
.................... // Overloaded function cos() for data type - Float48 |
|
|
1506 |
.................... #if defined(__PCD__) |
|
|
1507 |
.................... float48 cos(float48 x) |
|
|
1508 |
.................... { |
|
|
1509 |
.................... float48 y, t, t2 = 1.0; |
|
|
1510 |
.................... unsigned int8 quad, i; |
|
|
1511 |
.................... float48 frac; |
|
|
1512 |
.................... float48 p[6] = { //by the series definition for cosine |
|
|
1513 |
.................... -0.5, // sum ( ( (-1)^n * x^2n )/(2n)! ) |
|
|
1514 |
.................... 0.04166666666667, |
|
|
1515 |
.................... -0.00138888888889, |
|
|
1516 |
.................... 0.00002480158730, |
|
|
1517 |
.................... -0.00000027557319, |
|
|
1518 |
.................... 0.00000000208767, |
|
|
1519 |
.................... //-0.00000000001147, |
|
|
1520 |
.................... // 0.00000000000005 |
|
|
1521 |
.................... }; |
|
|
1522 |
.................... |
|
|
1523 |
.................... if (x < 0) x = -x; // absolute value of input |
|
|
1524 |
.................... |
|
|
1525 |
.................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant |
|
|
1526 |
.................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input |
|
|
1527 |
.................... quad = quad % 4; // quadrant (0 to 3) |
|
|
1528 |
.................... |
|
|
1529 |
.................... if (quad == 0 || quad == 2) |
|
|
1530 |
.................... t = frac * PI_DIV_BY_TWO; |
|
|
1531 |
.................... else if (quad == 1) |
|
|
1532 |
.................... t = (1-frac) * PI_DIV_BY_TWO; |
|
|
1533 |
.................... else // should be 3 |
|
|
1534 |
.................... t = (frac-1) * PI_DIV_BY_TWO; |
|
|
1535 |
.................... |
|
|
1536 |
.................... y = 0.999999999781; |
|
|
1537 |
.................... t = t * t; |
|
|
1538 |
.................... for (i = 0; i <= 5; i++) |
|
|
1539 |
.................... { |
|
|
1540 |
.................... t2 = t2 * t; |
|
|
1541 |
.................... y = y + p[i] * t2; |
|
|
1542 |
.................... } |
|
|
1543 |
.................... |
|
|
1544 |
.................... if (quad == 2 || quad == 1) |
|
|
1545 |
.................... y = -y; // correct sign |
|
|
1546 |
.................... |
|
|
1547 |
.................... return (y); |
|
|
1548 |
.................... } |
|
|
1549 |
.................... |
|
|
1550 |
.................... // Overloaded function cos() for data type - Float48 |
|
|
1551 |
.................... float64 cos(float64 x) |
|
|
1552 |
.................... { |
|
|
1553 |
.................... float64 y, t, t2 = 1.0; |
|
|
1554 |
.................... unsigned int8 quad, i; |
|
|
1555 |
.................... float64 frac; |
|
|
1556 |
.................... float64 p[6] = { //by the series definition for cosine |
|
|
1557 |
.................... -0.5, // sum ( ( (-1)^n * x^2n )/(2n)! ) |
|
|
1558 |
.................... 0.04166666666667, |
|
|
1559 |
.................... -0.00138888888889, |
|
|
1560 |
.................... 0.00002480158730, |
|
|
1561 |
.................... -0.00000027557319, |
|
|
1562 |
.................... 0.00000000208767, |
|
|
1563 |
.................... //-0.00000000001147, |
|
|
1564 |
.................... // 0.00000000000005 |
|
|
1565 |
.................... }; |
|
|
1566 |
.................... |
|
|
1567 |
.................... if (x < 0) x = -x; // absolute value of input |
|
|
1568 |
.................... |
|
|
1569 |
.................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant |
|
|
1570 |
.................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input |
|
|
1571 |
.................... quad = quad % 4; // quadrant (0 to 3) |
|
|
1572 |
.................... |
|
|
1573 |
.................... if (quad == 0 || quad == 2) |
|
|
1574 |
.................... t = frac * PI_DIV_BY_TWO; |
|
|
1575 |
.................... else if (quad == 1) |
|
|
1576 |
.................... t = (1-frac) * PI_DIV_BY_TWO; |
|
|
1577 |
.................... else // should be 3 |
|
|
1578 |
.................... t = (frac-1) * PI_DIV_BY_TWO; |
|
|
1579 |
.................... |
|
|
1580 |
.................... y = 0.999999999781; |
|
|
1581 |
.................... t = t * t; |
|
|
1582 |
.................... for (i = 0; i <= 5; i++) |
|
|
1583 |
.................... { |
|
|
1584 |
.................... t2 = t2 * t; |
|
|
1585 |
.................... y = y + p[i] * t2; |
|
|
1586 |
.................... } |
|
|
1587 |
.................... |
|
|
1588 |
.................... if (quad == 2 || quad == 1) |
|
|
1589 |
.................... y = -y; // correct sign |
|
|
1590 |
.................... |
|
|
1591 |
.................... return (y); |
|
|
1592 |
.................... } |
|
|
1593 |
.................... |
|
|
1594 |
.................... #endif |
|
|
1595 |
.................... |
|
|
1596 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1597 |
.................... // float sin(float x) |
|
|
1598 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1599 |
.................... // Description : returns the sine value of the angle x, which is in radian |
|
|
1600 |
.................... // Date : 9/20/2001 |
|
|
1601 |
.................... // |
|
|
1602 |
.................... float32 sin(float32 x) |
|
|
1603 |
.................... { |
|
|
1604 |
.................... return cos(x - PI_DIV_BY_TWO); |
|
|
1605 |
.................... } |
|
|
1606 |
.................... |
|
|
1607 |
.................... //Overloaded functions for sin() for PCD |
|
|
1608 |
.................... // Overloaded function sin() for data type - Float48 |
|
|
1609 |
.................... #if defined(__PCD__) |
|
|
1610 |
.................... float48 sin(float48 x) |
|
|
1611 |
.................... { |
|
|
1612 |
.................... return cos(x - PI_DIV_BY_TWO); |
|
|
1613 |
.................... } |
|
|
1614 |
.................... |
|
|
1615 |
.................... // Overloaded function sin() for data type - Float48 |
|
|
1616 |
.................... float64 sin(float64 x) |
|
|
1617 |
.................... { |
|
|
1618 |
.................... return cos(x - PI_DIV_BY_TWO); |
|
|
1619 |
.................... } |
|
|
1620 |
.................... #endif |
|
|
1621 |
.................... |
|
|
1622 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1623 |
.................... // float tan(float x) |
|
|
1624 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1625 |
.................... // Description : returns the tangent value of the angle x, which is in radian |
|
|
1626 |
.................... // Date : 9/20/2001 |
|
|
1627 |
.................... // |
|
|
1628 |
.................... float32 tan(float32 x) |
|
|
1629 |
.................... { |
|
|
1630 |
.................... float32 c, s; |
|
|
1631 |
.................... |
|
|
1632 |
.................... c = cos(x); |
|
|
1633 |
.................... if (c == 0.0) |
|
|
1634 |
.................... return (1.0e+36); |
|
|
1635 |
.................... |
|
|
1636 |
.................... s = sin(x); |
|
|
1637 |
.................... return(s/c); |
|
|
1638 |
.................... } |
|
|
1639 |
.................... //Overloaded functions for tan() for PCD |
|
|
1640 |
.................... // Overloaded function tan() for data type - Float48 |
|
|
1641 |
.................... #if defined(__PCD__) |
|
|
1642 |
.................... float48 tan(float48 x) |
|
|
1643 |
.................... { |
|
|
1644 |
.................... float48 c, s; |
|
|
1645 |
.................... |
|
|
1646 |
.................... c = cos(x); |
|
|
1647 |
.................... if (c == 0.0) |
|
|
1648 |
.................... return (1.0e+36); |
|
|
1649 |
.................... |
|
|
1650 |
.................... s = sin(x); |
|
|
1651 |
.................... return(s/c); |
|
|
1652 |
.................... } |
|
|
1653 |
.................... |
|
|
1654 |
.................... // Overloaded function tan() for data type - Float48 |
|
|
1655 |
.................... float64 tan(float64 x) |
|
|
1656 |
.................... { |
|
|
1657 |
.................... float64 c, s; |
|
|
1658 |
.................... |
|
|
1659 |
.................... c = cos(x); |
|
|
1660 |
.................... if (c == 0.0) |
|
|
1661 |
.................... return (1.0e+36); |
|
|
1662 |
.................... |
|
|
1663 |
.................... s = sin(x); |
|
|
1664 |
.................... return(s/c); |
|
|
1665 |
.................... } |
|
|
1666 |
.................... #endif |
|
|
1667 |
.................... |
|
|
1668 |
.................... float32 const pas[3] = {0.49559947, -4.6145309, 5.6036290}; |
|
|
1669 |
.................... float32 const qas[3] = {1.0000000, -5.5484666, 5.6036290}; |
|
|
1670 |
.................... |
|
|
1671 |
.................... float32 ASIN_COS(float32 x, unsigned int8 n) |
|
|
1672 |
.................... { |
|
|
1673 |
.................... float32 y, res, r, y2; |
|
|
1674 |
.................... int1 s; |
|
|
1675 |
.................... #ifdef _ERRNO |
|
|
1676 |
.................... if(x <-1 || x > 1) |
|
|
1677 |
.................... { |
|
|
1678 |
.................... errno=EDOM; |
|
|
1679 |
.................... } |
|
|
1680 |
.................... #endif |
|
|
1681 |
.................... s = 0; |
|
|
1682 |
.................... y = x; |
|
|
1683 |
.................... |
|
|
1684 |
.................... if (x < 0) |
|
|
1685 |
.................... { |
|
|
1686 |
.................... s = 1; |
|
|
1687 |
.................... y = -y; |
|
|
1688 |
.................... } |
|
|
1689 |
.................... |
|
|
1690 |
.................... if (y > 0.5) |
|
|
1691 |
.................... { |
|
|
1692 |
.................... y = sqrt((1.0 - y)/2.0); |
|
|
1693 |
.................... n += 2; |
|
|
1694 |
.................... } |
|
|
1695 |
.................... |
|
|
1696 |
.................... y2=y*y; |
|
|
1697 |
.................... |
|
|
1698 |
.................... res = pas[0]*y2 + pas[1]; |
|
|
1699 |
.................... res = res*y2 + pas[2]; |
|
|
1700 |
.................... |
|
|
1701 |
.................... r = qas[0]*y2 + qas[1]; |
|
|
1702 |
.................... r = r*y2 + qas[2]; |
|
|
1703 |
.................... |
|
|
1704 |
.................... res = y*res/r; |
|
|
1705 |
.................... |
|
|
1706 |
.................... if (n & 2) // |x| > 0.5 |
|
|
1707 |
.................... res = PI_DIV_BY_TWO - 2.0*res; |
|
|
1708 |
.................... if (s) |
|
|
1709 |
.................... res = -res; |
|
|
1710 |
.................... if (n & 1) // take arccos |
|
|
1711 |
.................... res = PI_DIV_BY_TWO - res; |
|
|
1712 |
.................... |
|
|
1713 |
.................... return(res); |
|
|
1714 |
.................... } |
|
|
1715 |
.................... |
|
|
1716 |
.................... //Overloaded functions for ASIN_COS() for PCD |
|
|
1717 |
.................... // Overloaded function ASIN_COS() for data type - Float48 |
|
|
1718 |
.................... #if defined(__PCD__) |
|
|
1719 |
.................... float48 ASIN_COS(float48 x, unsigned int8 n) |
|
|
1720 |
.................... { |
|
|
1721 |
.................... float48 y, res, r, y2; |
|
|
1722 |
.................... int1 s; |
|
|
1723 |
.................... #ifdef _ERRNO |
|
|
1724 |
.................... if(x <-1 || x > 1) |
|
|
1725 |
.................... { |
|
|
1726 |
.................... errno=EDOM; |
|
|
1727 |
.................... } |
|
|
1728 |
.................... #endif |
|
|
1729 |
.................... s = 0; |
|
|
1730 |
.................... y = x; |
|
|
1731 |
.................... |
|
|
1732 |
.................... if (x < 0) |
|
|
1733 |
.................... { |
|
|
1734 |
.................... s = 1; |
|
|
1735 |
.................... y = -y; |
|
|
1736 |
.................... } |
|
|
1737 |
.................... |
|
|
1738 |
.................... if (y > 0.5) |
|
|
1739 |
.................... { |
|
|
1740 |
.................... y = sqrt((1.0 - y)/2.0); |
|
|
1741 |
.................... n += 2; |
|
|
1742 |
.................... } |
|
|
1743 |
.................... |
|
|
1744 |
.................... y2=y*y; |
|
|
1745 |
.................... |
|
|
1746 |
.................... res = pas[0]*y2 + pas[1]; |
|
|
1747 |
.................... res = res*y2 + pas[2]; |
|
|
1748 |
.................... |
|
|
1749 |
.................... r = qas[0]*y2 + qas[1]; |
|
|
1750 |
.................... r = r*y2 + qas[2]; |
|
|
1751 |
.................... |
|
|
1752 |
.................... res = y*res/r; |
|
|
1753 |
.................... |
|
|
1754 |
.................... if (n & 2) // |x| > 0.5 |
|
|
1755 |
.................... res = PI_DIV_BY_TWO - 2.0*res; |
|
|
1756 |
.................... if (s) |
|
|
1757 |
.................... res = -res; |
|
|
1758 |
.................... if (n & 1) // take arccos |
|
|
1759 |
.................... res = PI_DIV_BY_TWO - res; |
|
|
1760 |
.................... |
|
|
1761 |
.................... return(res); |
|
|
1762 |
.................... } |
|
|
1763 |
.................... |
|
|
1764 |
.................... // Overloaded function ASIN_COS() for data type - Float64 |
|
|
1765 |
.................... float64 ASIN_COS(float64 x, unsigned int8 n) |
|
|
1766 |
.................... { |
|
|
1767 |
.................... float64 y, res, r, y2; |
|
|
1768 |
.................... int1 s; |
|
|
1769 |
.................... #ifdef _ERRNO |
|
|
1770 |
.................... if(x <-1 || x > 1) |
|
|
1771 |
.................... { |
|
|
1772 |
.................... errno=EDOM; |
|
|
1773 |
.................... } |
|
|
1774 |
.................... #endif |
|
|
1775 |
.................... s = 0; |
|
|
1776 |
.................... y = x; |
|
|
1777 |
.................... |
|
|
1778 |
.................... if (x < 0) |
|
|
1779 |
.................... { |
|
|
1780 |
.................... s = 1; |
|
|
1781 |
.................... y = -y; |
|
|
1782 |
.................... } |
|
|
1783 |
.................... |
|
|
1784 |
.................... if (y > 0.5) |
|
|
1785 |
.................... { |
|
|
1786 |
.................... y = sqrt((1.0 - y)/2.0); |
|
|
1787 |
.................... n += 2; |
|
|
1788 |
.................... } |
|
|
1789 |
.................... |
|
|
1790 |
.................... y2=y*y; |
|
|
1791 |
.................... |
|
|
1792 |
.................... res = pas[0]*y2 + pas[1]; |
|
|
1793 |
.................... res = res*y2 + pas[2]; |
|
|
1794 |
.................... |
|
|
1795 |
.................... r = qas[0]*y2 + qas[1]; |
|
|
1796 |
.................... r = r*y2 + qas[2]; |
|
|
1797 |
.................... |
|
|
1798 |
.................... res = y*res/r; |
|
|
1799 |
.................... |
|
|
1800 |
.................... if (n & 2) // |x| > 0.5 |
|
|
1801 |
.................... res = PI_DIV_BY_TWO - 2.0*res; |
|
|
1802 |
.................... if (s) |
|
|
1803 |
.................... res = -res; |
|
|
1804 |
.................... if (n & 1) // take arccos |
|
|
1805 |
.................... res = PI_DIV_BY_TWO - res; |
|
|
1806 |
.................... |
|
|
1807 |
.................... return(res); |
|
|
1808 |
.................... } |
|
|
1809 |
.................... #endif |
|
|
1810 |
.................... |
|
|
1811 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1812 |
.................... // float asin(float x) |
|
|
1813 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1814 |
.................... // Description : returns the arcsine value of the value x. |
|
|
1815 |
.................... // Date : N/A |
|
|
1816 |
.................... // |
|
|
1817 |
.................... float32 asin(float32 x) |
|
|
1818 |
.................... { |
|
|
1819 |
.................... float32 r; |
|
|
1820 |
.................... |
|
|
1821 |
.................... r = ASIN_COS(x, 0); |
|
|
1822 |
.................... return(r); |
|
|
1823 |
.................... } |
|
|
1824 |
.................... //Overloaded functions for asin() for PCD |
|
|
1825 |
.................... // Overloaded function asin() for data type - Float48 |
|
|
1826 |
.................... #if defined(__PCD__) |
|
|
1827 |
.................... float48 asin(float48 x) |
|
|
1828 |
.................... { |
|
|
1829 |
.................... float48 r; |
|
|
1830 |
.................... |
|
|
1831 |
.................... r = ASIN_COS(x, 0); |
|
|
1832 |
.................... return(r); |
|
|
1833 |
.................... } |
|
|
1834 |
.................... |
|
|
1835 |
.................... // Overloaded function asin() for data type - Float64 |
|
|
1836 |
.................... float64 asin(float64 x) |
|
|
1837 |
.................... { |
|
|
1838 |
.................... float64 r; |
|
|
1839 |
.................... |
|
|
1840 |
.................... r = ASIN_COS(x, 0); |
|
|
1841 |
.................... return(r); |
|
|
1842 |
.................... } |
|
|
1843 |
.................... #endif |
|
|
1844 |
.................... |
|
|
1845 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1846 |
.................... // float acos(float x) |
|
|
1847 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1848 |
.................... // Description : returns the arccosine value of the value x. |
|
|
1849 |
.................... // Date : N/A |
|
|
1850 |
.................... // |
|
|
1851 |
.................... float32 acos(float32 x) |
|
|
1852 |
.................... { |
|
|
1853 |
.................... float32 r; |
|
|
1854 |
.................... |
|
|
1855 |
.................... r = ASIN_COS(x, 1); |
|
|
1856 |
.................... return(r); |
|
|
1857 |
.................... } |
|
|
1858 |
.................... //Overloaded functions for acos() for PCD |
|
|
1859 |
.................... // Overloaded function acos() for data type - Float48 |
|
|
1860 |
.................... #if defined(__PCD__) |
|
|
1861 |
.................... float48 acos(float48 x) |
|
|
1862 |
.................... { |
|
|
1863 |
.................... float48 r; |
|
|
1864 |
.................... |
|
|
1865 |
.................... r = ASIN_COS(x, 1); |
|
|
1866 |
.................... return(r); |
|
|
1867 |
.................... } |
|
|
1868 |
.................... |
|
|
1869 |
.................... // Overloaded function acos() for data type - Float64 |
|
|
1870 |
.................... float64 acos(float64 x) |
|
|
1871 |
.................... { |
|
|
1872 |
.................... float64 r; |
|
|
1873 |
.................... |
|
|
1874 |
.................... r = ASIN_COS(x, 1); |
|
|
1875 |
.................... return(r); |
|
|
1876 |
.................... } |
|
|
1877 |
.................... #endif |
|
|
1878 |
.................... |
|
|
1879 |
.................... float32 const pat[4] = {0.17630401, 5.6710795, 22.376096, 19.818457}; |
|
|
1880 |
.................... float32 const qat[4] = {1.0000000, 11.368190, 28.982246, 19.818457}; |
|
|
1881 |
.................... |
|
|
1882 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1883 |
.................... // float atan(float x) |
|
|
1884 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1885 |
.................... // Description : returns the arctangent value of the value x. |
|
|
1886 |
.................... // Date : N/A |
|
|
1887 |
.................... // |
|
|
1888 |
.................... float32 atan(float32 x) |
|
|
1889 |
.................... { |
|
|
1890 |
.................... float32 y, res, r; |
|
|
1891 |
.................... int1 s, flag; |
|
|
1892 |
.................... |
|
|
1893 |
.................... s = 0; |
|
|
1894 |
* |
1045 |
jacho |
1895 |
10E7: BCF 6F.0 |
960 |
jacho |
1896 |
.................... flag = 0; |
1045 |
jacho |
1897 |
10E8: BCF 6F.1 |
960 |
jacho |
1898 |
.................... y = x; |
1045 |
jacho |
1899 |
10E9: MOVF 6E,W |
|
|
1900 |
10EA: BCF 03.5 |
|
|
1901 |
10EB: BSF 03.6 |
|
|
1902 |
10EC: MOVWF 13 |
|
|
1903 |
10ED: BSF 03.5 |
|
|
1904 |
10EE: BCF 03.6 |
|
|
1905 |
10EF: MOVF 6D,W |
|
|
1906 |
10F0: BCF 03.5 |
|
|
1907 |
10F1: BSF 03.6 |
|
|
1908 |
10F2: MOVWF 12 |
|
|
1909 |
10F3: BSF 03.5 |
|
|
1910 |
10F4: BCF 03.6 |
|
|
1911 |
10F5: MOVF 6C,W |
|
|
1912 |
10F6: BCF 03.5 |
|
|
1913 |
10F7: BSF 03.6 |
|
|
1914 |
10F8: MOVWF 11 |
|
|
1915 |
10F9: BSF 03.5 |
|
|
1916 |
10FA: BCF 03.6 |
|
|
1917 |
10FB: MOVF 6B,W |
|
|
1918 |
10FC: BCF 03.5 |
|
|
1919 |
10FD: BSF 03.6 |
|
|
1920 |
10FE: MOVWF 10 |
960 |
jacho |
1921 |
.................... |
|
|
1922 |
.................... if (x < 0) |
1045 |
jacho |
1923 |
10FF: BSF 03.5 |
|
|
1924 |
1100: BCF 03.6 |
|
|
1925 |
1101: MOVF 6E,W |
|
|
1926 |
1102: BCF 03.5 |
|
|
1927 |
1103: BSF 03.6 |
|
|
1928 |
1104: MOVWF 20 |
|
|
1929 |
1105: BSF 03.5 |
|
|
1930 |
1106: BCF 03.6 |
|
|
1931 |
1107: MOVF 6D,W |
|
|
1932 |
1108: BCF 03.5 |
|
|
1933 |
1109: BSF 03.6 |
|
|
1934 |
110A: MOVWF 1F |
|
|
1935 |
110B: BSF 03.5 |
|
|
1936 |
110C: BCF 03.6 |
|
|
1937 |
110D: MOVF 6C,W |
|
|
1938 |
110E: BCF 03.5 |
|
|
1939 |
110F: BSF 03.6 |
|
|
1940 |
1110: MOVWF 1E |
|
|
1941 |
1111: BSF 03.5 |
|
|
1942 |
1112: BCF 03.6 |
|
|
1943 |
1113: MOVF 6B,W |
|
|
1944 |
1114: BCF 03.5 |
|
|
1945 |
1115: BSF 03.6 |
|
|
1946 |
1116: MOVWF 1D |
|
|
1947 |
1117: CLRF 24 |
|
|
1948 |
1118: CLRF 23 |
|
|
1949 |
1119: CLRF 22 |
|
|
1950 |
111A: CLRF 21 |
|
|
1951 |
111B: BCF 0A.4 |
|
|
1952 |
111C: BSF 0A.3 |
|
|
1953 |
111D: BCF 03.6 |
|
|
1954 |
111E: CALL 5A9 |
|
|
1955 |
111F: BSF 0A.4 |
|
|
1956 |
1120: BCF 0A.3 |
|
|
1957 |
1121: BTFSS 03.0 |
|
|
1958 |
1122: GOTO 12B |
960 |
jacho |
1959 |
.................... { |
|
|
1960 |
.................... s = 1; |
1045 |
jacho |
1961 |
1123: BSF 03.5 |
|
|
1962 |
1124: BSF 6F.0 |
960 |
jacho |
1963 |
.................... y = -y; |
1045 |
jacho |
1964 |
1125: BCF 03.5 |
|
|
1965 |
1126: BSF 03.6 |
|
|
1966 |
1127: MOVF 11,W |
|
|
1967 |
1128: XORLW 80 |
|
|
1968 |
1129: MOVWF 11 |
|
|
1969 |
112A: BCF 03.6 |
960 |
jacho |
1970 |
.................... } |
|
|
1971 |
.................... |
|
|
1972 |
.................... if (y > 1.0) |
1045 |
jacho |
1973 |
112B: BSF 03.6 |
|
|
1974 |
112C: CLRF 20 |
|
|
1975 |
112D: CLRF 1F |
|
|
1976 |
112E: CLRF 1E |
|
|
1977 |
112F: MOVLW 7F |
|
|
1978 |
1130: MOVWF 1D |
|
|
1979 |
1131: MOVF 13,W |
|
|
1980 |
1132: MOVWF 24 |
|
|
1981 |
1133: MOVF 12,W |
|
|
1982 |
1134: MOVWF 23 |
|
|
1983 |
1135: MOVF 11,W |
|
|
1984 |
1136: MOVWF 22 |
|
|
1985 |
1137: MOVF 10,W |
|
|
1986 |
1138: MOVWF 21 |
|
|
1987 |
1139: BCF 0A.4 |
|
|
1988 |
113A: BSF 0A.3 |
|
|
1989 |
113B: BCF 03.6 |
|
|
1990 |
113C: CALL 5A9 |
|
|
1991 |
113D: BSF 0A.4 |
|
|
1992 |
113E: BCF 0A.3 |
|
|
1993 |
113F: BTFSS 03.0 |
|
|
1994 |
1140: GOTO 166 |
|
|
1995 |
1141: CLRF 27 |
|
|
1996 |
1142: BTFSC 0B.7 |
|
|
1997 |
1143: BSF 27.7 |
|
|
1998 |
1144: BCF 0B.7 |
960 |
jacho |
1999 |
.................... { |
|
|
2000 |
.................... y = 1.0/y; |
1045 |
jacho |
2001 |
1145: BSF 03.6 |
|
|
2002 |
1146: CLRF 59 |
|
|
2003 |
1147: CLRF 58 |
|
|
2004 |
1148: CLRF 57 |
|
|
2005 |
1149: MOVLW 7F |
|
|
2006 |
114A: MOVWF 56 |
|
|
2007 |
114B: MOVF 13,W |
|
|
2008 |
114C: MOVWF 5D |
|
|
2009 |
114D: MOVF 12,W |
|
|
2010 |
114E: MOVWF 5C |
|
|
2011 |
114F: MOVF 11,W |
|
|
2012 |
1150: MOVWF 5B |
|
|
2013 |
1151: MOVF 10,W |
|
|
2014 |
1152: MOVWF 5A |
|
|
2015 |
1153: BCF 0A.4 |
|
|
2016 |
1154: BCF 03.6 |
|
|
2017 |
1155: CALL 057 |
|
|
2018 |
1156: BSF 0A.4 |
|
|
2019 |
1157: BTFSC 27.7 |
|
|
2020 |
1158: BSF 0B.7 |
|
|
2021 |
1159: MOVF 7A,W |
|
|
2022 |
115A: BSF 03.6 |
|
|
2023 |
115B: MOVWF 13 |
|
|
2024 |
115C: MOVF 79,W |
|
|
2025 |
115D: MOVWF 12 |
|
|
2026 |
115E: MOVF 78,W |
|
|
2027 |
115F: MOVWF 11 |
|
|
2028 |
1160: MOVF 77,W |
|
|
2029 |
1161: MOVWF 10 |
960 |
jacho |
2030 |
.................... flag = 1; |
1045 |
jacho |
2031 |
1162: BSF 03.5 |
|
|
2032 |
1163: BCF 03.6 |
|
|
2033 |
1164: BSF 6F.1 |
|
|
2034 |
1165: BCF 03.5 |
960 |
jacho |
2035 |
.................... } |
|
|
2036 |
.................... |
|
|
2037 |
.................... res = pat[0]*y*y + pat[1]; |
1045 |
jacho |
2038 |
1166: MOVLW 0A |
|
|
2039 |
1167: BSF 03.6 |
|
|
2040 |
1168: MOVWF 24 |
|
|
2041 |
1169: MOVLW 89 |
|
|
2042 |
116A: MOVWF 23 |
|
|
2043 |
116B: MOVLW 34 |
|
|
2044 |
116C: MOVWF 22 |
|
|
2045 |
116D: MOVLW 7C |
|
|
2046 |
116E: MOVWF 21 |
|
|
2047 |
116F: MOVF 13,W |
|
|
2048 |
1170: MOVWF 28 |
|
|
2049 |
1171: MOVF 12,W |
|
|
2050 |
1172: MOVWF 27 |
|
|
2051 |
1173: MOVF 11,W |
|
|
2052 |
1174: MOVWF 26 |
|
|
2053 |
1175: MOVF 10,W |
|
|
2054 |
1176: MOVWF 25 |
|
|
2055 |
1177: BCF 0A.4 |
|
|
2056 |
1178: BSF 0A.3 |
|
|
2057 |
1179: BCF 03.6 |
|
|
2058 |
117A: CALL 2AB |
|
|
2059 |
117B: BSF 0A.4 |
|
|
2060 |
117C: BCF 0A.3 |
|
|
2061 |
117D: MOVF 77,W |
|
|
2062 |
117E: BSF 03.6 |
|
|
2063 |
117F: MOVWF 1C |
|
|
2064 |
1180: MOVF 78,W |
|
|
2065 |
1181: MOVWF 1D |
|
|
2066 |
1182: MOVF 79,W |
|
|
2067 |
1183: MOVWF 1E |
|
|
2068 |
1184: MOVF 7A,W |
|
|
2069 |
1185: MOVWF 1F |
|
|
2070 |
1186: MOVWF 24 |
|
|
2071 |
1187: MOVF 1E,W |
|
|
2072 |
1188: MOVWF 23 |
|
|
2073 |
1189: MOVF 1D,W |
|
|
2074 |
118A: MOVWF 22 |
|
|
2075 |
118B: MOVF 1C,W |
|
|
2076 |
118C: MOVWF 21 |
|
|
2077 |
118D: MOVF 13,W |
|
|
2078 |
118E: MOVWF 28 |
|
|
2079 |
118F: MOVF 12,W |
|
|
2080 |
1190: MOVWF 27 |
|
|
2081 |
1191: MOVF 11,W |
|
|
2082 |
1192: MOVWF 26 |
|
|
2083 |
1193: MOVF 10,W |
|
|
2084 |
1194: MOVWF 25 |
|
|
2085 |
1195: BCF 0A.4 |
|
|
2086 |
1196: BSF 0A.3 |
|
|
2087 |
1197: BCF 03.6 |
|
|
2088 |
1198: CALL 2AB |
|
|
2089 |
1199: BSF 0A.4 |
|
|
2090 |
119A: BCF 0A.3 |
|
|
2091 |
119B: MOVF 77,W |
|
|
2092 |
119C: BSF 03.6 |
|
|
2093 |
119D: MOVWF 1C |
|
|
2094 |
119E: MOVF 78,W |
|
|
2095 |
119F: MOVWF 1D |
|
|
2096 |
11A0: MOVF 79,W |
|
|
2097 |
11A1: MOVWF 1E |
|
|
2098 |
11A2: MOVF 7A,W |
|
|
2099 |
11A3: MOVWF 1F |
|
|
2100 |
11A4: BCF 03.1 |
|
|
2101 |
11A5: MOVF 1F,W |
|
|
2102 |
11A6: MOVWF 24 |
|
|
2103 |
11A7: MOVF 1E,W |
|
|
2104 |
11A8: MOVWF 23 |
|
|
2105 |
11A9: MOVF 1D,W |
|
|
2106 |
11AA: MOVWF 22 |
|
|
2107 |
11AB: MOVF 1C,W |
|
|
2108 |
11AC: MOVWF 21 |
|
|
2109 |
11AD: MOVLW 7C |
|
|
2110 |
11AE: MOVWF 28 |
|
|
2111 |
11AF: MOVLW 79 |
|
|
2112 |
11B0: MOVWF 27 |
|
|
2113 |
11B1: MOVLW 35 |
|
|
2114 |
11B2: MOVWF 26 |
|
|
2115 |
11B3: MOVLW 81 |
|
|
2116 |
11B4: MOVWF 25 |
|
|
2117 |
11B5: BCF 0A.4 |
|
|
2118 |
11B6: BCF 03.6 |
|
|
2119 |
11B7: CALL 5DC |
|
|
2120 |
11B8: BSF 0A.4 |
|
|
2121 |
11B9: MOVF 7A,W |
|
|
2122 |
11BA: BSF 03.6 |
|
|
2123 |
11BB: MOVWF 17 |
|
|
2124 |
11BC: MOVF 79,W |
|
|
2125 |
11BD: MOVWF 16 |
|
|
2126 |
11BE: MOVF 78,W |
|
|
2127 |
11BF: MOVWF 15 |
|
|
2128 |
11C0: MOVF 77,W |
|
|
2129 |
11C1: MOVWF 14 |
960 |
jacho |
2130 |
.................... res = res*y*y + pat[2]; |
1045 |
jacho |
2131 |
11C2: MOVF 17,W |
|
|
2132 |
11C3: MOVWF 24 |
|
|
2133 |
11C4: MOVF 16,W |
|
|
2134 |
11C5: MOVWF 23 |
|
|
2135 |
11C6: MOVF 15,W |
|
|
2136 |
11C7: MOVWF 22 |
|
|
2137 |
11C8: MOVF 14,W |
|
|
2138 |
11C9: MOVWF 21 |
|
|
2139 |
11CA: MOVF 13,W |
|
|
2140 |
11CB: MOVWF 28 |
|
|
2141 |
11CC: MOVF 12,W |
|
|
2142 |
11CD: MOVWF 27 |
|
|
2143 |
11CE: MOVF 11,W |
|
|
2144 |
11CF: MOVWF 26 |
|
|
2145 |
11D0: MOVF 10,W |
|
|
2146 |
11D1: MOVWF 25 |
|
|
2147 |
11D2: BCF 0A.4 |
|
|
2148 |
11D3: BSF 0A.3 |
|
|
2149 |
11D4: BCF 03.6 |
|
|
2150 |
11D5: CALL 2AB |
|
|
2151 |
11D6: BSF 0A.4 |
|
|
2152 |
11D7: BCF 0A.3 |
|
|
2153 |
11D8: MOVF 77,W |
|
|
2154 |
11D9: BSF 03.6 |
|
|
2155 |
11DA: MOVWF 1C |
|
|
2156 |
11DB: MOVF 78,W |
|
|
2157 |
11DC: MOVWF 1D |
|
|
2158 |
11DD: MOVF 79,W |
|
|
2159 |
11DE: MOVWF 1E |
|
|
2160 |
11DF: MOVF 7A,W |
|
|
2161 |
11E0: MOVWF 1F |
|
|
2162 |
11E1: MOVWF 24 |
|
|
2163 |
11E2: MOVF 1E,W |
|
|
2164 |
11E3: MOVWF 23 |
|
|
2165 |
11E4: MOVF 1D,W |
|
|
2166 |
11E5: MOVWF 22 |
|
|
2167 |
11E6: MOVF 1C,W |
|
|
2168 |
11E7: MOVWF 21 |
|
|
2169 |
11E8: MOVF 13,W |
|
|
2170 |
11E9: MOVWF 28 |
|
|
2171 |
11EA: MOVF 12,W |
|
|
2172 |
11EB: MOVWF 27 |
|
|
2173 |
11EC: MOVF 11,W |
|
|
2174 |
11ED: MOVWF 26 |
|
|
2175 |
11EE: MOVF 10,W |
|
|
2176 |
11EF: MOVWF 25 |
|
|
2177 |
11F0: BCF 0A.4 |
|
|
2178 |
11F1: BSF 0A.3 |
|
|
2179 |
11F2: BCF 03.6 |
|
|
2180 |
11F3: CALL 2AB |
|
|
2181 |
11F4: BSF 0A.4 |
|
|
2182 |
11F5: BCF 0A.3 |
|
|
2183 |
11F6: MOVF 77,W |
|
|
2184 |
11F7: BSF 03.6 |
|
|
2185 |
11F8: MOVWF 1C |
|
|
2186 |
11F9: MOVF 78,W |
|
|
2187 |
11FA: MOVWF 1D |
|
|
2188 |
11FB: MOVF 79,W |
|
|
2189 |
11FC: MOVWF 1E |
|
|
2190 |
11FD: MOVF 7A,W |
|
|
2191 |
11FE: MOVWF 1F |
|
|
2192 |
11FF: BCF 03.1 |
|
|
2193 |
1200: MOVF 1F,W |
|
|
2194 |
1201: MOVWF 24 |
|
|
2195 |
1202: MOVF 1E,W |
|
|
2196 |
1203: MOVWF 23 |
|
|
2197 |
1204: MOVF 1D,W |
|
|
2198 |
1205: MOVWF 22 |
|
|
2199 |
1206: MOVF 1C,W |
|
|
2200 |
1207: MOVWF 21 |
|
|
2201 |
1208: MOVLW 3F |
|
|
2202 |
1209: MOVWF 28 |
|
|
2203 |
120A: MOVLW 02 |
|
|
2204 |
120B: MOVWF 27 |
|
|
2205 |
120C: MOVLW 33 |
|
|
2206 |
120D: MOVWF 26 |
|
|
2207 |
120E: MOVLW 83 |
|
|
2208 |
120F: MOVWF 25 |
|
|
2209 |
1210: BCF 0A.4 |
|
|
2210 |
1211: BCF 03.6 |
|
|
2211 |
1212: CALL 5DC |
|
|
2212 |
1213: BSF 0A.4 |
|
|
2213 |
1214: MOVF 7A,W |
|
|
2214 |
1215: BSF 03.6 |
|
|
2215 |
1216: MOVWF 17 |
|
|
2216 |
1217: MOVF 79,W |
|
|
2217 |
1218: MOVWF 16 |
|
|
2218 |
1219: MOVF 78,W |
|
|
2219 |
121A: MOVWF 15 |
|
|
2220 |
121B: MOVF 77,W |
|
|
2221 |
121C: MOVWF 14 |
960 |
jacho |
2222 |
.................... res = res*y*y + pat[3]; |
1045 |
jacho |
2223 |
121D: MOVF 17,W |
|
|
2224 |
121E: MOVWF 24 |
|
|
2225 |
121F: MOVF 16,W |
|
|
2226 |
1220: MOVWF 23 |
|
|
2227 |
1221: MOVF 15,W |
|
|
2228 |
1222: MOVWF 22 |
|
|
2229 |
1223: MOVF 14,W |
|
|
2230 |
1224: MOVWF 21 |
|
|
2231 |
1225: MOVF 13,W |
|
|
2232 |
1226: MOVWF 28 |
|
|
2233 |
1227: MOVF 12,W |
|
|
2234 |
1228: MOVWF 27 |
|
|
2235 |
1229: MOVF 11,W |
|
|
2236 |
122A: MOVWF 26 |
|
|
2237 |
122B: MOVF 10,W |
|
|
2238 |
122C: MOVWF 25 |
|
|
2239 |
122D: BCF 0A.4 |
|
|
2240 |
122E: BSF 0A.3 |
|
|
2241 |
122F: BCF 03.6 |
|
|
2242 |
1230: CALL 2AB |
|
|
2243 |
1231: BSF 0A.4 |
|
|
2244 |
1232: BCF 0A.3 |
960 |
jacho |
2245 |
1233: MOVF 77,W |
1045 |
jacho |
2246 |
1234: BSF 03.6 |
|
|
2247 |
1235: MOVWF 1C |
960 |
jacho |
2248 |
1236: MOVF 78,W |
1045 |
jacho |
2249 |
1237: MOVWF 1D |
960 |
jacho |
2250 |
1238: MOVF 79,W |
1045 |
jacho |
2251 |
1239: MOVWF 1E |
960 |
jacho |
2252 |
123A: MOVF 7A,W |
1045 |
jacho |
2253 |
123B: MOVWF 1F |
|
|
2254 |
123C: MOVWF 24 |
|
|
2255 |
123D: MOVF 1E,W |
|
|
2256 |
123E: MOVWF 23 |
|
|
2257 |
123F: MOVF 1D,W |
|
|
2258 |
1240: MOVWF 22 |
|
|
2259 |
1241: MOVF 1C,W |
|
|
2260 |
1242: MOVWF 21 |
|
|
2261 |
1243: MOVF 13,W |
|
|
2262 |
1244: MOVWF 28 |
|
|
2263 |
1245: MOVF 12,W |
|
|
2264 |
1246: MOVWF 27 |
|
|
2265 |
1247: MOVF 11,W |
|
|
2266 |
1248: MOVWF 26 |
|
|
2267 |
1249: MOVF 10,W |
|
|
2268 |
124A: MOVWF 25 |
960 |
jacho |
2269 |
124B: BCF 0A.4 |
1045 |
jacho |
2270 |
124C: BSF 0A.3 |
|
|
2271 |
124D: BCF 03.6 |
|
|
2272 |
124E: CALL 2AB |
|
|
2273 |
124F: BSF 0A.4 |
|
|
2274 |
1250: BCF 0A.3 |
|
|
2275 |
1251: MOVF 77,W |
|
|
2276 |
1252: BSF 03.6 |
|
|
2277 |
1253: MOVWF 1C |
|
|
2278 |
1254: MOVF 78,W |
|
|
2279 |
1255: MOVWF 1D |
|
|
2280 |
1256: MOVF 79,W |
|
|
2281 |
1257: MOVWF 1E |
|
|
2282 |
1258: MOVF 7A,W |
|
|
2283 |
1259: MOVWF 1F |
|
|
2284 |
125A: BCF 03.1 |
|
|
2285 |
125B: MOVF 1F,W |
|
|
2286 |
125C: MOVWF 24 |
|
|
2287 |
125D: MOVF 1E,W |
|
|
2288 |
125E: MOVWF 23 |
|
|
2289 |
125F: MOVF 1D,W |
|
|
2290 |
1260: MOVWF 22 |
|
|
2291 |
1261: MOVF 1C,W |
|
|
2292 |
1262: MOVWF 21 |
|
|
2293 |
1263: MOVLW 33 |
|
|
2294 |
1264: MOVWF 28 |
|
|
2295 |
1265: MOVLW 8C |
|
|
2296 |
1266: MOVWF 27 |
|
|
2297 |
1267: MOVLW 1E |
|
|
2298 |
1268: MOVWF 26 |
|
|
2299 |
1269: MOVLW 83 |
|
|
2300 |
126A: MOVWF 25 |
|
|
2301 |
126B: BCF 0A.4 |
|
|
2302 |
126C: BCF 03.6 |
|
|
2303 |
126D: CALL 5DC |
|
|
2304 |
126E: BSF 0A.4 |
960 |
jacho |
2305 |
126F: MOVF 7A,W |
1045 |
jacho |
2306 |
1270: BSF 03.6 |
|
|
2307 |
1271: MOVWF 17 |
960 |
jacho |
2308 |
1272: MOVF 79,W |
1045 |
jacho |
2309 |
1273: MOVWF 16 |
960 |
jacho |
2310 |
1274: MOVF 78,W |
1045 |
jacho |
2311 |
1275: MOVWF 15 |
960 |
jacho |
2312 |
1276: MOVF 77,W |
1045 |
jacho |
2313 |
1277: MOVWF 14 |
|
|
2314 |
.................... |
|
|
2315 |
.................... r = qat[0]*y*y + qat[1]; |
|
|
2316 |
1278: CLRF 24 |
|
|
2317 |
1279: CLRF 23 |
|
|
2318 |
127A: CLRF 22 |
|
|
2319 |
127B: MOVLW 7F |
|
|
2320 |
127C: MOVWF 21 |
|
|
2321 |
127D: MOVF 13,W |
|
|
2322 |
127E: MOVWF 28 |
|
|
2323 |
127F: MOVF 12,W |
|
|
2324 |
1280: MOVWF 27 |
|
|
2325 |
1281: MOVF 11,W |
|
|
2326 |
1282: MOVWF 26 |
|
|
2327 |
1283: MOVF 10,W |
|
|
2328 |
1284: MOVWF 25 |
|
|
2329 |
1285: BCF 0A.4 |
|
|
2330 |
1286: BSF 0A.3 |
|
|
2331 |
1287: BCF 03.6 |
|
|
2332 |
1288: CALL 2AB |
|
|
2333 |
1289: BSF 0A.4 |
|
|
2334 |
128A: BCF 0A.3 |
|
|
2335 |
128B: MOVF 77,W |
|
|
2336 |
128C: BSF 03.6 |
|
|
2337 |
128D: MOVWF 1C |
|
|
2338 |
128E: MOVF 78,W |
|
|
2339 |
128F: MOVWF 1D |
|
|
2340 |
1290: MOVF 79,W |
|
|
2341 |
1291: MOVWF 1E |
|
|
2342 |
1292: MOVF 7A,W |
|
|
2343 |
1293: MOVWF 1F |
|
|
2344 |
1294: MOVWF 24 |
|
|
2345 |
1295: MOVF 1E,W |
|
|
2346 |
1296: MOVWF 23 |
|
|
2347 |
1297: MOVF 1D,W |
|
|
2348 |
1298: MOVWF 22 |
|
|
2349 |
1299: MOVF 1C,W |
|
|
2350 |
129A: MOVWF 21 |
|
|
2351 |
129B: MOVF 13,W |
|
|
2352 |
129C: MOVWF 28 |
|
|
2353 |
129D: MOVF 12,W |
|
|
2354 |
129E: MOVWF 27 |
|
|
2355 |
129F: MOVF 11,W |
|
|
2356 |
12A0: MOVWF 26 |
|
|
2357 |
12A1: MOVF 10,W |
|
|
2358 |
12A2: MOVWF 25 |
|
|
2359 |
12A3: BCF 0A.4 |
|
|
2360 |
12A4: BSF 0A.3 |
|
|
2361 |
12A5: BCF 03.6 |
|
|
2362 |
12A6: CALL 2AB |
960 |
jacho |
2363 |
12A7: BSF 0A.4 |
1045 |
jacho |
2364 |
12A8: BCF 0A.3 |
|
|
2365 |
12A9: MOVF 77,W |
|
|
2366 |
12AA: BSF 03.6 |
|
|
2367 |
12AB: MOVWF 1C |
|
|
2368 |
12AC: MOVF 78,W |
|
|
2369 |
12AD: MOVWF 1D |
|
|
2370 |
12AE: MOVF 79,W |
|
|
2371 |
12AF: MOVWF 1E |
|
|
2372 |
12B0: MOVF 7A,W |
|
|
2373 |
12B1: MOVWF 1F |
|
|
2374 |
12B2: BCF 03.1 |
|
|
2375 |
12B3: MOVF 1F,W |
|
|
2376 |
12B4: MOVWF 24 |
|
|
2377 |
12B5: MOVF 1E,W |
|
|
2378 |
12B6: MOVWF 23 |
|
|
2379 |
12B7: MOVF 1D,W |
|
|
2380 |
12B8: MOVWF 22 |
|
|
2381 |
12B9: MOVF 1C,W |
|
|
2382 |
12BA: MOVWF 21 |
|
|
2383 |
12BB: MOVLW 1B |
|
|
2384 |
12BC: MOVWF 28 |
|
|
2385 |
12BD: MOVLW E4 |
|
|
2386 |
12BE: MOVWF 27 |
|
|
2387 |
12BF: MOVLW 35 |
|
|
2388 |
12C0: MOVWF 26 |
|
|
2389 |
12C1: MOVLW 82 |
|
|
2390 |
12C2: MOVWF 25 |
|
|
2391 |
12C3: BCF 0A.4 |
|
|
2392 |
12C4: BCF 03.6 |
|
|
2393 |
12C5: CALL 5DC |
960 |
jacho |
2394 |
12C6: BSF 0A.4 |
1045 |
jacho |
2395 |
12C7: MOVF 7A,W |
|
|
2396 |
12C8: BSF 03.6 |
|
|
2397 |
12C9: MOVWF 1B |
|
|
2398 |
12CA: MOVF 79,W |
|
|
2399 |
12CB: MOVWF 1A |
|
|
2400 |
12CC: MOVF 78,W |
|
|
2401 |
12CD: MOVWF 19 |
|
|
2402 |
12CE: MOVF 77,W |
|
|
2403 |
12CF: MOVWF 18 |
|
|
2404 |
.................... r = r*y*y + qat[2]; |
|
|
2405 |
12D0: MOVF 1B,W |
|
|
2406 |
12D1: MOVWF 24 |
|
|
2407 |
12D2: MOVF 1A,W |
|
|
2408 |
12D3: MOVWF 23 |
|
|
2409 |
12D4: MOVF 19,W |
|
|
2410 |
12D5: MOVWF 22 |
|
|
2411 |
12D6: MOVF 18,W |
|
|
2412 |
12D7: MOVWF 21 |
|
|
2413 |
12D8: MOVF 13,W |
|
|
2414 |
12D9: MOVWF 28 |
|
|
2415 |
12DA: MOVF 12,W |
|
|
2416 |
12DB: MOVWF 27 |
|
|
2417 |
12DC: MOVF 11,W |
|
|
2418 |
12DD: MOVWF 26 |
|
|
2419 |
12DE: MOVF 10,W |
|
|
2420 |
12DF: MOVWF 25 |
|
|
2421 |
12E0: BCF 0A.4 |
|
|
2422 |
12E1: BSF 0A.3 |
|
|
2423 |
12E2: BCF 03.6 |
|
|
2424 |
12E3: CALL 2AB |
|
|
2425 |
12E4: BSF 0A.4 |
|
|
2426 |
12E5: BCF 0A.3 |
|
|
2427 |
12E6: MOVF 77,W |
|
|
2428 |
12E7: BSF 03.6 |
|
|
2429 |
12E8: MOVWF 1C |
|
|
2430 |
12E9: MOVF 78,W |
|
|
2431 |
12EA: MOVWF 1D |
|
|
2432 |
12EB: MOVF 79,W |
|
|
2433 |
12EC: MOVWF 1E |
|
|
2434 |
12ED: MOVF 7A,W |
|
|
2435 |
12EE: MOVWF 1F |
|
|
2436 |
12EF: MOVWF 24 |
|
|
2437 |
12F0: MOVF 1E,W |
|
|
2438 |
12F1: MOVWF 23 |
|
|
2439 |
12F2: MOVF 1D,W |
|
|
2440 |
12F3: MOVWF 22 |
|
|
2441 |
12F4: MOVF 1C,W |
|
|
2442 |
12F5: MOVWF 21 |
|
|
2443 |
12F6: MOVF 13,W |
|
|
2444 |
12F7: MOVWF 28 |
|
|
2445 |
12F8: MOVF 12,W |
|
|
2446 |
12F9: MOVWF 27 |
|
|
2447 |
12FA: MOVF 11,W |
|
|
2448 |
12FB: MOVWF 26 |
|
|
2449 |
12FC: MOVF 10,W |
|
|
2450 |
12FD: MOVWF 25 |
|
|
2451 |
12FE: BCF 0A.4 |
|
|
2452 |
12FF: BSF 0A.3 |
|
|
2453 |
1300: BCF 03.6 |
|
|
2454 |
1301: CALL 2AB |
|
|
2455 |
1302: BSF 0A.4 |
|
|
2456 |
1303: BCF 0A.3 |
|
|
2457 |
1304: MOVF 77,W |
|
|
2458 |
1305: BSF 03.6 |
|
|
2459 |
1306: MOVWF 1C |
|
|
2460 |
1307: MOVF 78,W |
|
|
2461 |
1308: MOVWF 1D |
|
|
2462 |
1309: MOVF 79,W |
|
|
2463 |
130A: MOVWF 1E |
|
|
2464 |
130B: MOVF 7A,W |
|
|
2465 |
130C: MOVWF 1F |
|
|
2466 |
130D: BCF 03.1 |
|
|
2467 |
130E: MOVF 1F,W |
|
|
2468 |
130F: MOVWF 24 |
|
|
2469 |
1310: MOVF 1E,W |
|
|
2470 |
1311: MOVWF 23 |
|
|
2471 |
1312: MOVF 1D,W |
|
|
2472 |
1313: MOVWF 22 |
|
|
2473 |
1314: MOVF 1C,W |
|
|
2474 |
1315: MOVWF 21 |
|
|
2475 |
1316: MOVLW A4 |
|
|
2476 |
1317: MOVWF 28 |
|
|
2477 |
1318: MOVLW DB |
|
|
2478 |
1319: MOVWF 27 |
|
|
2479 |
131A: MOVLW 67 |
|
|
2480 |
131B: MOVWF 26 |
|
|
2481 |
131C: MOVLW 83 |
|
|
2482 |
131D: MOVWF 25 |
|
|
2483 |
131E: BCF 0A.4 |
|
|
2484 |
131F: BCF 03.6 |
|
|
2485 |
1320: CALL 5DC |
|
|
2486 |
1321: BSF 0A.4 |
|
|
2487 |
1322: MOVF 7A,W |
|
|
2488 |
1323: BSF 03.6 |
|
|
2489 |
1324: MOVWF 1B |
|
|
2490 |
1325: MOVF 79,W |
|
|
2491 |
1326: MOVWF 1A |
|
|
2492 |
1327: MOVF 78,W |
|
|
2493 |
1328: MOVWF 19 |
|
|
2494 |
1329: MOVF 77,W |
|
|
2495 |
132A: MOVWF 18 |
960 |
jacho |
2496 |
.................... r = r*y*y + qat[3]; |
1045 |
jacho |
2497 |
132B: MOVF 1B,W |
|
|
2498 |
132C: MOVWF 24 |
|
|
2499 |
132D: MOVF 1A,W |
|
|
2500 |
132E: MOVWF 23 |
|
|
2501 |
132F: MOVF 19,W |
|
|
2502 |
1330: MOVWF 22 |
|
|
2503 |
1331: MOVF 18,W |
|
|
2504 |
1332: MOVWF 21 |
|
|
2505 |
1333: MOVF 13,W |
|
|
2506 |
1334: MOVWF 28 |
|
|
2507 |
1335: MOVF 12,W |
|
|
2508 |
1336: MOVWF 27 |
|
|
2509 |
1337: MOVF 11,W |
|
|
2510 |
1338: MOVWF 26 |
|
|
2511 |
1339: MOVF 10,W |
|
|
2512 |
133A: MOVWF 25 |
|
|
2513 |
133B: BCF 0A.4 |
|
|
2514 |
133C: BSF 0A.3 |
|
|
2515 |
133D: BCF 03.6 |
|
|
2516 |
133E: CALL 2AB |
|
|
2517 |
133F: BSF 0A.4 |
|
|
2518 |
1340: BCF 0A.3 |
|
|
2519 |
1341: MOVF 77,W |
|
|
2520 |
1342: BSF 03.6 |
|
|
2521 |
1343: MOVWF 1C |
|
|
2522 |
1344: MOVF 78,W |
|
|
2523 |
1345: MOVWF 1D |
|
|
2524 |
1346: MOVF 79,W |
|
|
2525 |
1347: MOVWF 1E |
|
|
2526 |
1348: MOVF 7A,W |
|
|
2527 |
1349: MOVWF 1F |
|
|
2528 |
134A: MOVWF 24 |
|
|
2529 |
134B: MOVF 1E,W |
|
|
2530 |
134C: MOVWF 23 |
|
|
2531 |
134D: MOVF 1D,W |
|
|
2532 |
134E: MOVWF 22 |
|
|
2533 |
134F: MOVF 1C,W |
|
|
2534 |
1350: MOVWF 21 |
|
|
2535 |
1351: MOVF 13,W |
|
|
2536 |
1352: MOVWF 28 |
|
|
2537 |
1353: MOVF 12,W |
|
|
2538 |
1354: MOVWF 27 |
|
|
2539 |
1355: MOVF 11,W |
|
|
2540 |
1356: MOVWF 26 |
|
|
2541 |
1357: MOVF 10,W |
|
|
2542 |
1358: MOVWF 25 |
|
|
2543 |
1359: BCF 0A.4 |
|
|
2544 |
135A: BSF 0A.3 |
|
|
2545 |
135B: BCF 03.6 |
|
|
2546 |
135C: CALL 2AB |
|
|
2547 |
135D: BSF 0A.4 |
|
|
2548 |
135E: BCF 0A.3 |
|
|
2549 |
135F: MOVF 77,W |
|
|
2550 |
1360: BSF 03.6 |
|
|
2551 |
1361: MOVWF 1C |
|
|
2552 |
1362: MOVF 78,W |
|
|
2553 |
1363: MOVWF 1D |
|
|
2554 |
1364: MOVF 79,W |
|
|
2555 |
1365: MOVWF 1E |
|
|
2556 |
1366: MOVF 7A,W |
|
|
2557 |
1367: MOVWF 1F |
|
|
2558 |
1368: BCF 03.1 |
|
|
2559 |
1369: MOVF 1F,W |
|
|
2560 |
136A: MOVWF 24 |
|
|
2561 |
136B: MOVF 1E,W |
|
|
2562 |
136C: MOVWF 23 |
|
|
2563 |
136D: MOVF 1D,W |
|
|
2564 |
136E: MOVWF 22 |
|
|
2565 |
136F: MOVF 1C,W |
|
|
2566 |
1370: MOVWF 21 |
|
|
2567 |
1371: MOVLW 33 |
|
|
2568 |
1372: MOVWF 28 |
|
|
2569 |
1373: MOVLW 8C |
|
|
2570 |
1374: MOVWF 27 |
|
|
2571 |
1375: MOVLW 1E |
|
|
2572 |
1376: MOVWF 26 |
|
|
2573 |
1377: MOVLW 83 |
|
|
2574 |
1378: MOVWF 25 |
|
|
2575 |
1379: BCF 0A.4 |
|
|
2576 |
137A: BCF 03.6 |
|
|
2577 |
137B: CALL 5DC |
|
|
2578 |
137C: BSF 0A.4 |
|
|
2579 |
137D: MOVF 7A,W |
|
|
2580 |
137E: BSF 03.6 |
|
|
2581 |
137F: MOVWF 1B |
|
|
2582 |
1380: MOVF 79,W |
|
|
2583 |
1381: MOVWF 1A |
|
|
2584 |
1382: MOVF 78,W |
|
|
2585 |
1383: MOVWF 19 |
|
|
2586 |
1384: MOVF 77,W |
|
|
2587 |
1385: MOVWF 18 |
960 |
jacho |
2588 |
.................... |
|
|
2589 |
.................... res = y*res/r; |
1045 |
jacho |
2590 |
1386: MOVF 13,W |
|
|
2591 |
1387: MOVWF 24 |
|
|
2592 |
1388: MOVF 12,W |
|
|
2593 |
1389: MOVWF 23 |
|
|
2594 |
138A: MOVF 11,W |
|
|
2595 |
138B: MOVWF 22 |
|
|
2596 |
138C: MOVF 10,W |
|
|
2597 |
138D: MOVWF 21 |
|
|
2598 |
138E: MOVF 17,W |
|
|
2599 |
138F: MOVWF 28 |
|
|
2600 |
1390: MOVF 16,W |
|
|
2601 |
1391: MOVWF 27 |
|
|
2602 |
1392: MOVF 15,W |
|
|
2603 |
1393: MOVWF 26 |
|
|
2604 |
1394: MOVF 14,W |
|
|
2605 |
1395: MOVWF 25 |
|
|
2606 |
1396: BCF 0A.4 |
|
|
2607 |
1397: BSF 0A.3 |
|
|
2608 |
1398: BCF 03.6 |
|
|
2609 |
1399: CALL 2AB |
|
|
2610 |
139A: BSF 0A.4 |
|
|
2611 |
139B: BCF 0A.3 |
|
|
2612 |
139C: MOVF 77,W |
|
|
2613 |
139D: BSF 03.6 |
|
|
2614 |
139E: MOVWF 1C |
|
|
2615 |
139F: MOVF 78,W |
|
|
2616 |
13A0: MOVWF 1D |
|
|
2617 |
13A1: MOVF 79,W |
|
|
2618 |
13A2: MOVWF 1E |
|
|
2619 |
13A3: MOVF 7A,W |
|
|
2620 |
13A4: MOVWF 1F |
|
|
2621 |
13A5: BCF 03.6 |
|
|
2622 |
13A6: CLRF 27 |
|
|
2623 |
13A7: BTFSC 0B.7 |
|
|
2624 |
13A8: BSF 27.7 |
|
|
2625 |
13A9: BCF 0B.7 |
|
|
2626 |
13AA: BSF 03.6 |
|
|
2627 |
13AB: MOVF 1F,W |
|
|
2628 |
13AC: MOVWF 59 |
|
|
2629 |
13AD: MOVF 1E,W |
|
|
2630 |
13AE: MOVWF 58 |
|
|
2631 |
13AF: MOVF 1D,W |
|
|
2632 |
13B0: MOVWF 57 |
|
|
2633 |
13B1: MOVF 1C,W |
|
|
2634 |
13B2: MOVWF 56 |
|
|
2635 |
13B3: MOVF 1B,W |
|
|
2636 |
13B4: MOVWF 5D |
|
|
2637 |
13B5: MOVF 1A,W |
|
|
2638 |
13B6: MOVWF 5C |
|
|
2639 |
13B7: MOVF 19,W |
|
|
2640 |
13B8: MOVWF 5B |
|
|
2641 |
13B9: MOVF 18,W |
|
|
2642 |
13BA: MOVWF 5A |
|
|
2643 |
13BB: BCF 0A.4 |
|
|
2644 |
13BC: BCF 03.6 |
|
|
2645 |
13BD: CALL 057 |
|
|
2646 |
13BE: BSF 0A.4 |
|
|
2647 |
13BF: BTFSC 27.7 |
|
|
2648 |
13C0: BSF 0B.7 |
|
|
2649 |
13C1: MOVF 7A,W |
|
|
2650 |
13C2: BSF 03.6 |
|
|
2651 |
13C3: MOVWF 17 |
|
|
2652 |
13C4: MOVF 79,W |
|
|
2653 |
13C5: MOVWF 16 |
|
|
2654 |
13C6: MOVF 78,W |
|
|
2655 |
13C7: MOVWF 15 |
|
|
2656 |
13C8: MOVF 77,W |
|
|
2657 |
13C9: MOVWF 14 |
960 |
jacho |
2658 |
.................... |
|
|
2659 |
.................... |
|
|
2660 |
.................... if (flag) // for |x| > 1 |
1045 |
jacho |
2661 |
13CA: BSF 03.5 |
|
|
2662 |
13CB: BCF 03.6 |
|
|
2663 |
13CC: BTFSS 6F.1 |
|
|
2664 |
13CD: GOTO 3F0 |
960 |
jacho |
2665 |
.................... res = PI_DIV_BY_TWO - res; |
1045 |
jacho |
2666 |
13CE: BSF 03.1 |
|
|
2667 |
13CF: MOVLW DB |
|
|
2668 |
13D0: BCF 03.5 |
|
|
2669 |
13D1: BSF 03.6 |
|
|
2670 |
13D2: MOVWF 24 |
|
|
2671 |
13D3: MOVLW 0F |
|
|
2672 |
13D4: MOVWF 23 |
|
|
2673 |
13D5: MOVLW 49 |
|
|
2674 |
13D6: MOVWF 22 |
|
|
2675 |
13D7: MOVLW 7F |
|
|
2676 |
13D8: MOVWF 21 |
|
|
2677 |
13D9: MOVF 17,W |
|
|
2678 |
13DA: MOVWF 28 |
|
|
2679 |
13DB: MOVF 16,W |
|
|
2680 |
13DC: MOVWF 27 |
|
|
2681 |
13DD: MOVF 15,W |
|
|
2682 |
13DE: MOVWF 26 |
|
|
2683 |
13DF: MOVF 14,W |
|
|
2684 |
13E0: MOVWF 25 |
|
|
2685 |
13E1: BCF 0A.4 |
|
|
2686 |
13E2: BCF 03.6 |
|
|
2687 |
13E3: CALL 5DC |
|
|
2688 |
13E4: BSF 0A.4 |
|
|
2689 |
13E5: MOVF 7A,W |
|
|
2690 |
13E6: BSF 03.6 |
|
|
2691 |
13E7: MOVWF 17 |
|
|
2692 |
13E8: MOVF 79,W |
|
|
2693 |
13E9: MOVWF 16 |
|
|
2694 |
13EA: MOVF 78,W |
|
|
2695 |
13EB: MOVWF 15 |
|
|
2696 |
13EC: MOVF 77,W |
|
|
2697 |
13ED: MOVWF 14 |
|
|
2698 |
13EE: BSF 03.5 |
|
|
2699 |
13EF: BCF 03.6 |
960 |
jacho |
2700 |
.................... if (s) |
1045 |
jacho |
2701 |
13F0: BTFSS 6F.0 |
|
|
2702 |
13F1: GOTO 3F9 |
960 |
jacho |
2703 |
.................... res = -res; |
1045 |
jacho |
2704 |
13F2: BCF 03.5 |
|
|
2705 |
13F3: BSF 03.6 |
|
|
2706 |
13F4: MOVF 15,W |
|
|
2707 |
13F5: XORLW 80 |
|
|
2708 |
13F6: MOVWF 15 |
|
|
2709 |
13F7: BSF 03.5 |
|
|
2710 |
13F8: BCF 03.6 |
960 |
jacho |
2711 |
.................... |
|
|
2712 |
.................... return(res); |
1045 |
jacho |
2713 |
13F9: BCF 03.5 |
|
|
2714 |
13FA: BSF 03.6 |
|
|
2715 |
13FB: MOVF 14,W |
|
|
2716 |
13FC: MOVWF 77 |
|
|
2717 |
13FD: MOVF 15,W |
|
|
2718 |
13FE: MOVWF 78 |
|
|
2719 |
13FF: MOVF 16,W |
|
|
2720 |
1400: MOVWF 79 |
|
|
2721 |
1401: MOVF 17,W |
|
|
2722 |
1402: MOVWF 7A |
960 |
jacho |
2723 |
.................... } |
|
|
2724 |
.................... //Overloaded functions for atan() for PCD |
|
|
2725 |
.................... // Overloaded function atan() for data type - Float48 |
|
|
2726 |
.................... #if defined(__PCD__) |
|
|
2727 |
.................... float48 atan(float48 x) |
|
|
2728 |
.................... { |
|
|
2729 |
.................... float48 y, res, r; |
|
|
2730 |
.................... int1 s, flag; |
|
|
2731 |
.................... |
|
|
2732 |
.................... s = 0; |
|
|
2733 |
.................... flag = 0; |
|
|
2734 |
.................... y = x; |
|
|
2735 |
.................... |
|
|
2736 |
.................... if (x < 0) |
|
|
2737 |
.................... { |
|
|
2738 |
.................... s = 1; |
|
|
2739 |
.................... y = -y; |
|
|
2740 |
.................... } |
|
|
2741 |
.................... |
|
|
2742 |
.................... if (y > 1.0) |
|
|
2743 |
.................... { |
|
|
2744 |
.................... y = 1.0/y; |
|
|
2745 |
.................... flag = 1; |
|
|
2746 |
.................... } |
|
|
2747 |
.................... |
|
|
2748 |
.................... res = pat[0]*y*y + pat[1]; |
|
|
2749 |
.................... res = res*y*y + pat[2]; |
|
|
2750 |
.................... res = res*y*y + pat[3]; |
|
|
2751 |
.................... |
|
|
2752 |
.................... r = qat[0]*y*y + qat[1]; |
|
|
2753 |
.................... r = r*y*y + qat[2]; |
|
|
2754 |
.................... r = r*y*y + qat[3]; |
|
|
2755 |
.................... |
|
|
2756 |
.................... res = y*res/r; |
|
|
2757 |
.................... |
|
|
2758 |
.................... |
|
|
2759 |
.................... if (flag) // for |x| > 1 |
|
|
2760 |
.................... res = PI_DIV_BY_TWO - res; |
|
|
2761 |
.................... if (s) |
|
|
2762 |
.................... res = -res; |
|
|
2763 |
.................... |
|
|
2764 |
.................... return(res); |
|
|
2765 |
.................... } |
|
|
2766 |
.................... |
|
|
2767 |
.................... // Overloaded function atan() for data type - Float64 |
|
|
2768 |
.................... float64 atan(float64 x) |
|
|
2769 |
.................... { |
|
|
2770 |
.................... float64 y, res, r; |
|
|
2771 |
.................... int1 s, flag; |
|
|
2772 |
.................... |
|
|
2773 |
.................... s = 0; |
|
|
2774 |
.................... flag = 0; |
|
|
2775 |
.................... y = x; |
|
|
2776 |
.................... |
|
|
2777 |
.................... if (x < 0) |
|
|
2778 |
.................... { |
|
|
2779 |
.................... s = 1; |
|
|
2780 |
.................... y = -y; |
|
|
2781 |
.................... } |
|
|
2782 |
.................... |
|
|
2783 |
.................... if (y > 1.0) |
|
|
2784 |
.................... { |
|
|
2785 |
.................... y = 1.0/y; |
|
|
2786 |
.................... flag = 1; |
|
|
2787 |
.................... } |
|
|
2788 |
.................... |
|
|
2789 |
.................... res = pat[0]*y*y + pat[1]; |
|
|
2790 |
.................... res = res*y*y + pat[2]; |
|
|
2791 |
.................... res = res*y*y + pat[3]; |
|
|
2792 |
.................... |
|
|
2793 |
.................... r = qat[0]*y*y + qat[1]; |
|
|
2794 |
.................... r = r*y*y + qat[2]; |
|
|
2795 |
.................... r = r*y*y + qat[3]; |
|
|
2796 |
.................... |
|
|
2797 |
.................... res = y*res/r; |
|
|
2798 |
.................... |
|
|
2799 |
.................... |
|
|
2800 |
.................... if (flag) // for |x| > 1 |
|
|
2801 |
.................... res = PI_DIV_BY_TWO - res; |
|
|
2802 |
.................... if (s) |
|
|
2803 |
.................... res = -res; |
|
|
2804 |
.................... |
|
|
2805 |
.................... return(res); |
|
|
2806 |
.................... } |
|
|
2807 |
.................... #endif |
|
|
2808 |
.................... |
|
|
2809 |
.................... ///////////////////////////////////////////////////////////////////////////// |
|
|
2810 |
.................... // float atan2(float y, float x) |
|
|
2811 |
.................... ///////////////////////////////////////////////////////////////////////////// |
|
|
2812 |
.................... // Description :computes the principal value of arc tangent of y/x, using the |
|
|
2813 |
.................... // signs of both the arguments to determine the quadrant of the return value |
|
|
2814 |
.................... // Returns : returns the arc tangent of y/x. |
|
|
2815 |
.................... // Date : N/A |
|
|
2816 |
.................... // |
|
|
2817 |
.................... |
|
|
2818 |
.................... float32 atan2(float32 y,float32 x) |
|
|
2819 |
.................... { |
|
|
2820 |
.................... float32 z; |
|
|
2821 |
.................... int1 sign; |
|
|
2822 |
.................... unsigned int8 quad; |
|
|
2823 |
.................... sign=0; |
|
|
2824 |
.................... quad=0; //quadrant |
|
|
2825 |
.................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1)); |
|
|
2826 |
.................... if(y<0.0) |
|
|
2827 |
.................... { |
|
|
2828 |
.................... sign=1; |
|
|
2829 |
.................... y=-y; |
|
|
2830 |
.................... } |
|
|
2831 |
.................... if(x<0.0) |
|
|
2832 |
.................... { |
|
|
2833 |
.................... x=-x; |
|
|
2834 |
.................... } |
|
|
2835 |
.................... if (x==0.0) |
|
|
2836 |
.................... { |
|
|
2837 |
.................... if(y==0.0) |
|
|
2838 |
.................... { |
|
|
2839 |
.................... #ifdef _ERRNO |
|
|
2840 |
.................... { |
|
|
2841 |
.................... errno=EDOM; |
|
|
2842 |
.................... } |
|
|
2843 |
.................... #endif |
|
|
2844 |
.................... } |
|
|
2845 |
.................... else |
|
|
2846 |
.................... { |
|
|
2847 |
.................... if(sign) |
|
|
2848 |
.................... { |
|
|
2849 |
.................... return (-(PI_DIV_BY_TWO)); |
|
|
2850 |
.................... } |
|
|
2851 |
.................... else |
|
|
2852 |
.................... { |
|
|
2853 |
.................... return (PI_DIV_BY_TWO); |
|
|
2854 |
.................... } |
|
|
2855 |
.................... } |
|
|
2856 |
.................... } |
|
|
2857 |
.................... else |
|
|
2858 |
.................... { |
|
|
2859 |
.................... z=y/x; |
|
|
2860 |
.................... switch(quad) |
|
|
2861 |
.................... { |
|
|
2862 |
.................... case 1: |
|
|
2863 |
.................... { |
|
|
2864 |
.................... return atan(z); |
|
|
2865 |
.................... break; |
|
|
2866 |
.................... } |
|
|
2867 |
.................... case 2: |
|
|
2868 |
.................... { |
|
|
2869 |
.................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122 |
|
|
2870 |
.................... return (PI-atan(z)); |
|
|
2871 |
.................... break; |
|
|
2872 |
.................... } |
|
|
2873 |
.................... case 3: |
|
|
2874 |
.................... { |
|
|
2875 |
.................... return (atan(z)-PI); |
|
|
2876 |
.................... break; |
|
|
2877 |
.................... } |
|
|
2878 |
.................... case 4: |
|
|
2879 |
.................... { |
|
|
2880 |
.................... return (-atan(z)); |
|
|
2881 |
.................... break; |
|
|
2882 |
.................... } |
|
|
2883 |
.................... } |
|
|
2884 |
.................... } |
|
|
2885 |
.................... } |
|
|
2886 |
.................... |
|
|
2887 |
.................... //Overloaded functions for atan2() for PCD |
|
|
2888 |
.................... // Overloaded function atan2() for data type - Float48 |
|
|
2889 |
.................... #if defined(__PCD__) |
|
|
2890 |
.................... float48 atan2(float48 y,float48 x) |
|
|
2891 |
.................... { |
|
|
2892 |
.................... float48 z; |
|
|
2893 |
.................... int1 sign; |
|
|
2894 |
.................... unsigned int8 quad; |
|
|
2895 |
.................... sign=0; |
|
|
2896 |
.................... quad=0; //quadrant |
|
|
2897 |
.................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1)); |
|
|
2898 |
.................... if(y<0.0) |
|
|
2899 |
.................... { |
|
|
2900 |
.................... sign=1; |
|
|
2901 |
.................... y=-y; |
|
|
2902 |
.................... } |
|
|
2903 |
.................... if(x<0.0) |
|
|
2904 |
.................... { |
|
|
2905 |
.................... x=-x; |
|
|
2906 |
.................... } |
|
|
2907 |
.................... if (x==0.0) |
|
|
2908 |
.................... { |
|
|
2909 |
.................... if(y==0.0) |
|
|
2910 |
.................... { |
|
|
2911 |
.................... #ifdef _ERRNO |
|
|
2912 |
.................... { |
|
|
2913 |
.................... errno=EDOM; |
|
|
2914 |
.................... } |
|
|
2915 |
.................... #endif |
|
|
2916 |
.................... } |
|
|
2917 |
.................... else |
|
|
2918 |
.................... { |
|
|
2919 |
.................... if(sign) |
|
|
2920 |
.................... { |
|
|
2921 |
.................... return (-(PI_DIV_BY_TWO)); |
|
|
2922 |
.................... } |
|
|
2923 |
.................... else |
|
|
2924 |
.................... { |
|
|
2925 |
.................... return (PI_DIV_BY_TWO); |
|
|
2926 |
.................... } |
|
|
2927 |
.................... } |
|
|
2928 |
.................... } |
|
|
2929 |
.................... else |
|
|
2930 |
.................... { |
|
|
2931 |
.................... z=y/x; |
|
|
2932 |
.................... switch(quad) |
|
|
2933 |
.................... { |
|
|
2934 |
.................... case 1: |
|
|
2935 |
.................... { |
|
|
2936 |
.................... return atan(z); |
|
|
2937 |
.................... break; |
|
|
2938 |
.................... } |
|
|
2939 |
.................... case 2: |
|
|
2940 |
.................... { |
|
|
2941 |
.................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122 |
|
|
2942 |
.................... return (PI-atan(z)); |
|
|
2943 |
.................... break; |
|
|
2944 |
.................... } |
|
|
2945 |
.................... case 3: |
|
|
2946 |
.................... { |
|
|
2947 |
.................... return (atan(z)-PI); |
|
|
2948 |
.................... break; |
|
|
2949 |
.................... } |
|
|
2950 |
.................... case 4: |
|
|
2951 |
.................... { |
|
|
2952 |
.................... return (-atan(z)); |
|
|
2953 |
.................... break; |
|
|
2954 |
.................... } |
|
|
2955 |
.................... } |
|
|
2956 |
.................... } |
|
|
2957 |
.................... } |
|
|
2958 |
.................... |
|
|
2959 |
.................... // Overloaded function atan2() for data type - Float64 |
|
|
2960 |
.................... float64 atan2(float64 y,float64 x) |
|
|
2961 |
.................... { |
|
|
2962 |
.................... float64 z; |
|
|
2963 |
.................... int1 sign; |
|
|
2964 |
.................... unsigned int8 quad; |
|
|
2965 |
.................... sign=0; |
|
|
2966 |
.................... quad=0; //quadrant |
|
|
2967 |
.................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1)); |
|
|
2968 |
.................... if(y<0.0) |
|
|
2969 |
.................... { |
|
|
2970 |
.................... sign=1; |
|
|
2971 |
.................... y=-y; |
|
|
2972 |
.................... } |
|
|
2973 |
.................... if(x<0.0) |
|
|
2974 |
.................... { |
|
|
2975 |
.................... x=-x; |
|
|
2976 |
.................... } |
|
|
2977 |
.................... if (x==0.0) |
|
|
2978 |
.................... { |
|
|
2979 |
.................... if(y==0.0) |
|
|
2980 |
.................... { |
|
|
2981 |
.................... #ifdef _ERRNO |
|
|
2982 |
.................... { |
|
|
2983 |
.................... errno=EDOM; |
|
|
2984 |
.................... } |
|
|
2985 |
.................... #endif |
|
|
2986 |
.................... } |
|
|
2987 |
.................... else |
|
|
2988 |
.................... { |
|
|
2989 |
.................... if(sign) |
|
|
2990 |
.................... { |
|
|
2991 |
.................... return (-(PI_DIV_BY_TWO)); |
|
|
2992 |
.................... } |
|
|
2993 |
.................... else |
|
|
2994 |
.................... { |
|
|
2995 |
.................... return (PI_DIV_BY_TWO); |
|
|
2996 |
.................... } |
|
|
2997 |
.................... } |
|
|
2998 |
.................... } |
|
|
2999 |
.................... else |
|
|
3000 |
.................... { |
|
|
3001 |
.................... z=y/x; |
|
|
3002 |
.................... switch(quad) |
|
|
3003 |
.................... { |
|
|
3004 |
.................... case 1: |
|
|
3005 |
.................... { |
|
|
3006 |
.................... return atan(z); |
|
|
3007 |
.................... break; |
|
|
3008 |
.................... } |
|
|
3009 |
.................... case 2: |
|
|
3010 |
.................... { |
|
|
3011 |
.................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122 |
|
|
3012 |
.................... return (PI-atan(z)); |
|
|
3013 |
.................... break; |
|
|
3014 |
.................... } |
|
|
3015 |
.................... case 3: |
|
|
3016 |
.................... { |
|
|
3017 |
.................... return (atan(z)-PI); |
|
|
3018 |
.................... break; |
|
|
3019 |
.................... } |
|
|
3020 |
.................... case 4: |
|
|
3021 |
.................... { |
|
|
3022 |
.................... return (-atan(z)); |
|
|
3023 |
.................... break; |
|
|
3024 |
.................... } |
|
|
3025 |
.................... } |
|
|
3026 |
.................... } |
|
|
3027 |
.................... } |
|
|
3028 |
.................... #endif |
|
|
3029 |
.................... |
|
|
3030 |
.................... //////////////////// Hyperbolic functions //////////////////// |
|
|
3031 |
.................... |
|
|
3032 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
3033 |
.................... // float cosh(float x) |
|
|
3034 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
3035 |
.................... // Description : Computes the hyperbolic cosine value of x |
|
|
3036 |
.................... // Returns : returns the hyperbolic cosine value of x |
|
|
3037 |
.................... // Date : N/A |
|
|
3038 |
.................... // |
|
|
3039 |
.................... |
|
|
3040 |
.................... float32 cosh(float32 x) |
|
|
3041 |
.................... { |
|
|
3042 |
.................... return ((exp(x)+exp(-x))/2); |
|
|
3043 |
.................... } |
|
|
3044 |
.................... //Overloaded functions for cosh() for PCD |
|
|
3045 |
.................... // Overloaded function cosh() for data type - Float48 |
|
|
3046 |
.................... #if defined(__PCD__) |
|
|
3047 |
.................... float48 cosh(float48 x) |
|
|
3048 |
.................... { |
|
|
3049 |
.................... return ((exp(x)+exp(-x))/2); |
|
|
3050 |
.................... } |
|
|
3051 |
.................... |
|
|
3052 |
.................... // Overloaded function cosh() for data type - Float64 |
|
|
3053 |
.................... float64 cosh(float64 x) |
|
|
3054 |
.................... { |
|
|
3055 |
.................... return ((exp(x)+exp(-x))/2); |
|
|
3056 |
.................... } |
|
|
3057 |
.................... #endif |
|
|
3058 |
.................... |
|
|
3059 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
3060 |
.................... // float sinh(float x) |
|
|
3061 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
3062 |
.................... // Description : Computes the hyperbolic sine value of x |
|
|
3063 |
.................... // Returns : returns the hyperbolic sine value of x |
|
|
3064 |
.................... // Date : N/A |
|
|
3065 |
.................... // |
|
|
3066 |
.................... |
|
|
3067 |
.................... float32 sinh(float32 x) |
|
|
3068 |
.................... { |
|
|
3069 |
.................... |
|
|
3070 |
.................... return ((exp(x) - exp(-x))/2); |
|
|
3071 |
.................... } |
|
|
3072 |
.................... //Overloaded functions for sinh() for PCD |
|
|
3073 |
.................... // Overloaded function sinh() for data type - Float48 |
|
|
3074 |
.................... #if defined(__PCD__) |
|
|
3075 |
.................... float48 sinh(float48 x) |
|
|
3076 |
.................... { |
|
|
3077 |
.................... |
|
|
3078 |
.................... return ((exp(x) - exp(-x))/2); |
|
|
3079 |
.................... } |
|
|
3080 |
.................... |
|
|
3081 |
.................... // Overloaded function sinh() for data type - Float48 |
|
|
3082 |
.................... float64 sinh(float64 x) |
|
|
3083 |
.................... { |
|
|
3084 |
.................... |
|
|
3085 |
.................... return ((exp(x) - exp(-x))/2); |
|
|
3086 |
.................... } |
|
|
3087 |
.................... #endif |
|
|
3088 |
.................... |
|
|
3089 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
3090 |
.................... // float tanh(float x) |
|
|
3091 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
3092 |
.................... // Description : Computes the hyperbolic tangent value of x |
|
|
3093 |
.................... // Returns : returns the hyperbolic tangent value of x |
|
|
3094 |
.................... // Date : N/A |
|
|
3095 |
.................... // |
|
|
3096 |
.................... |
|
|
3097 |
.................... float32 tanh(float32 x) |
|
|
3098 |
.................... { |
|
|
3099 |
.................... return(sinh(x)/cosh(x)); |
|
|
3100 |
.................... } |
|
|
3101 |
.................... //Overloaded functions for tanh() for PCD |
|
|
3102 |
.................... // Overloaded function tanh() for data type - Float48 |
|
|
3103 |
.................... #if defined(__PCD__) |
|
|
3104 |
.................... float48 tanh(float48 x) |
|
|
3105 |
.................... { |
|
|
3106 |
.................... return(sinh(x)/cosh(x)); |
|
|
3107 |
.................... } |
|
|
3108 |
.................... |
|
|
3109 |
.................... // Overloaded function tanh() for data type - Float64 |
|
|
3110 |
.................... float64 tanh(float64 x) |
|
|
3111 |
.................... { |
|
|
3112 |
.................... return(sinh(x)/cosh(x)); |
|
|
3113 |
.................... } |
|
|
3114 |
.................... #endif |
|
|
3115 |
.................... |
|
|
3116 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
3117 |
.................... // float frexp(float x, signed int *exp) |
|
|
3118 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
3119 |
.................... // Description : breaks a floating point number into a normalized fraction and an integral |
|
|
3120 |
.................... // power of 2. It stores the integer in the signed int object pointed to by exp. |
|
|
3121 |
.................... // Returns : returns the value x, such that x is a double with magnitude in the interval |
|
|
3122 |
.................... // [1/2,1) or zero, and value equals x times 2 raised to the power *exp.If value is zero, |
|
|
3123 |
.................... // both parts of the result are zero. |
|
|
3124 |
.................... // Date : N/A |
|
|
3125 |
.................... // |
|
|
3126 |
.................... |
|
|
3127 |
.................... #define LOG2 .30102999566398119521 |
|
|
3128 |
.................... float32 frexp(float32 x, signed int8 *exp) |
|
|
3129 |
.................... { |
|
|
3130 |
.................... float32 res; |
|
|
3131 |
.................... int1 sign = 0; |
|
|
3132 |
.................... if(x == 0.0) |
|
|
3133 |
.................... { |
|
|
3134 |
.................... *exp=0; |
|
|
3135 |
.................... return (0.0); |
|
|
3136 |
.................... } |
|
|
3137 |
.................... if(x < 0.0) |
|
|
3138 |
.................... { |
|
|
3139 |
.................... x=-x; |
|
|
3140 |
.................... sign=1; |
|
|
3141 |
.................... } |
|
|
3142 |
.................... if (x > 1.0) |
|
|
3143 |
.................... { |
|
|
3144 |
.................... *exp=(ceil(log10(x)/LOG2)); |
|
|
3145 |
.................... res=x/(pow(2, *exp)); |
|
|
3146 |
.................... if (res == 1) |
|
|
3147 |
.................... { |
|
|
3148 |
.................... *exp=*exp+1; |
|
|
3149 |
.................... res=.5; |
|
|
3150 |
.................... } |
|
|
3151 |
.................... } |
|
|
3152 |
.................... else |
|
|
3153 |
.................... { |
|
|
3154 |
.................... if(x < 0.5) |
|
|
3155 |
.................... { |
|
|
3156 |
.................... *exp=-1; |
|
|
3157 |
.................... res=x*2; |
|
|
3158 |
.................... } |
|
|
3159 |
.................... else |
|
|
3160 |
.................... { |
|
|
3161 |
.................... *exp=0; |
|
|
3162 |
.................... res=x; |
|
|
3163 |
.................... } |
|
|
3164 |
.................... } |
|
|
3165 |
.................... if(sign) |
|
|
3166 |
.................... { |
|
|
3167 |
.................... res=-res; |
|
|
3168 |
.................... } |
|
|
3169 |
.................... return res; |
|
|
3170 |
.................... } |
|
|
3171 |
.................... |
|
|
3172 |
.................... //Overloaded functions for frexp() for PCD |
|
|
3173 |
.................... // Overloaded function frexp() for data type - Float48 |
|
|
3174 |
.................... #if defined(__PCD__) |
|
|
3175 |
.................... float48 frexp(float48 x, signed int8 *exp) |
|
|
3176 |
.................... { |
|
|
3177 |
.................... float48 res; |
|
|
3178 |
.................... int1 sign = 0; |
|
|
3179 |
.................... if(x == 0.0) |
|
|
3180 |
.................... { |
|
|
3181 |
.................... *exp=0; |
|
|
3182 |
.................... return (0.0); |
|
|
3183 |
.................... } |
|
|
3184 |
.................... if(x < 0.0) |
|
|
3185 |
.................... { |
|
|
3186 |
.................... x=-x; |
|
|
3187 |
.................... sign=1; |
|
|
3188 |
.................... } |
|
|
3189 |
.................... if (x > 1.0) |
|
|
3190 |
.................... { |
|
|
3191 |
.................... *exp=(ceil(log10(x)/LOG2)); |
|
|
3192 |
.................... res=x/(pow(2, *exp)); |
|
|
3193 |
.................... if (res == 1) |
|
|
3194 |
.................... { |
|
|
3195 |
.................... *exp=*exp+1; |
|
|
3196 |
.................... res=.5; |
|
|
3197 |
.................... } |
|
|
3198 |
.................... } |
|
|
3199 |
.................... else |
|
|
3200 |
.................... { |
|
|
3201 |
.................... if(x < 0.5) |
|
|
3202 |
.................... { |
|
|
3203 |
.................... *exp=-1; |
|
|
3204 |
.................... res=x*2; |
|
|
3205 |
.................... } |
|
|
3206 |
.................... else |
|
|
3207 |
.................... { |
|
|
3208 |
.................... *exp=0; |
|
|
3209 |
.................... res=x; |
|
|
3210 |
.................... } |
|
|
3211 |
.................... } |
|
|
3212 |
.................... if(sign) |
|
|
3213 |
.................... { |
|
|
3214 |
.................... res=-res; |
|
|
3215 |
.................... } |
|
|
3216 |
.................... return res; |
|
|
3217 |
.................... } |
|
|
3218 |
.................... |
|
|
3219 |
.................... // Overloaded function frexp() for data type - Float64 |
|
|
3220 |
.................... float64 frexp(float64 x, signed int8 *exp) |
|
|
3221 |
.................... { |
|
|
3222 |
.................... float64 res; |
|
|
3223 |
.................... int1 sign = 0; |
|
|
3224 |
.................... if(x == 0.0) |
|
|
3225 |
.................... { |
|
|
3226 |
.................... *exp=0; |
|
|
3227 |
.................... return (0.0); |
|
|
3228 |
.................... } |
|
|
3229 |
.................... if(x < 0.0) |
|
|
3230 |
.................... { |
|
|
3231 |
.................... x=-x; |
|
|
3232 |
.................... sign=1; |
|
|
3233 |
.................... } |
|
|
3234 |
.................... if (x > 1.0) |
|
|
3235 |
.................... { |
|
|
3236 |
.................... *exp=(ceil(log10(x)/LOG2)); |
|
|
3237 |
.................... res=x/(pow(2, *exp)); |
|
|
3238 |
.................... if (res == 1) |
|
|
3239 |
.................... { |
|
|
3240 |
.................... *exp=*exp+1; |
|
|
3241 |
.................... res=.5; |
|
|
3242 |
.................... } |
|
|
3243 |
.................... } |
|
|
3244 |
.................... else |
|
|
3245 |
.................... { |
|
|
3246 |
.................... if(x < 0.5) |
|
|
3247 |
.................... { |
|
|
3248 |
.................... *exp=-1; |
|
|
3249 |
.................... res=x*2; |
|
|
3250 |
.................... } |
|
|
3251 |
.................... else |
|
|
3252 |
.................... { |
|
|
3253 |
.................... *exp=0; |
|
|
3254 |
.................... res=x; |
|
|
3255 |
.................... } |
|
|
3256 |
.................... } |
|
|
3257 |
.................... if(sign) |
|
|
3258 |
.................... { |
|
|
3259 |
.................... res=-res; |
|
|
3260 |
.................... } |
|
|
3261 |
.................... return res; |
|
|
3262 |
.................... } |
|
|
3263 |
.................... #endif |
|
|
3264 |
.................... |
|
|
3265 |
.................... ////////////////////////////////////////////////////////////////////////////// |
|
|
3266 |
.................... // float ldexp(float x, signed int *exp) |
|
|
3267 |
.................... ////////////////////////////////////////////////////////////////////////////// |
|
|
3268 |
.................... // Description : multiplies a floating point number by an integral power of 2. |
|
|
3269 |
.................... // Returns : returns the value of x times 2 raised to the power exp. |
|
|
3270 |
.................... // Date : N/A |
|
|
3271 |
.................... // |
|
|
3272 |
.................... |
|
|
3273 |
.................... float32 ldexp(float32 value, signed int8 exp) |
|
|
3274 |
.................... { |
|
|
3275 |
.................... return (value * pow(2,exp)); |
|
|
3276 |
.................... } |
|
|
3277 |
.................... //Overloaded functions for ldexp() for PCD |
|
|
3278 |
.................... // Overloaded function ldexp() for data type - Float48 |
|
|
3279 |
.................... |
|
|
3280 |
.................... #if defined(__PCD__) |
|
|
3281 |
.................... float48 ldexp(float48 value, signed int8 exp) |
|
|
3282 |
.................... { |
|
|
3283 |
.................... return (value * pow(2,exp)); |
|
|
3284 |
.................... } |
|
|
3285 |
.................... // Overloaded function ldexp() for data type - Float64 |
|
|
3286 |
.................... float64 ldexp(float64 value, signed int8 exp) |
|
|
3287 |
.................... { |
|
|
3288 |
.................... return (value * pow(2,exp)); |
|
|
3289 |
.................... } |
|
|
3290 |
.................... #endif |
|
|
3291 |
.................... |
|
|
3292 |
.................... #endif |
|
|
3293 |
.................... |
|
|
3294 |
.................... #include <string.h> |
|
|
3295 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
3296 |
.................... //// (C) Copyright 1996,2008 Custom Computer Services //// |
|
|
3297 |
.................... //// This source code may only be used by licensed users of the CCS C //// |
|
|
3298 |
.................... //// compiler. This source code may only be distributed to other //// |
|
|
3299 |
.................... //// licensed users of the CCS C compiler. No other use, reproduction //// |
|
|
3300 |
.................... //// or distribution is permitted without written permission. //// |
|
|
3301 |
.................... //// Derivative programs created using this software in object code //// |
|
|
3302 |
.................... //// form are not restricted in any way. //// |
|
|
3303 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
3304 |
.................... |
|
|
3305 |
.................... #ifndef _STRING |
|
|
3306 |
.................... #define _STRING |
|
|
3307 |
.................... #include <stddef.h> |
|
|
3308 |
.................... /////////////////////////////////////////////////////////////////////////// |
|
|
3309 |
.................... //// (C) Copyright 1996,2003 Custom Computer Services //// |
|
|
3310 |
.................... //// This source code may only be used by licensed users of the CCS C //// |
|
|
3311 |
.................... //// compiler. This source code may only be distributed to other //// |
|
|
3312 |
.................... //// licensed users of the CCS C compiler. No other use, reproduction //// |
|
|
3313 |
.................... //// or distribution is permitted without written permission. //// |
|
|
3314 |
.................... //// Derivative programs created using this software in object code //// |
|
|
3315 |
.................... //// form are not restricted in any way. //// |
|
|
3316 |
.................... /////////////////////////////////////////////////////////////////////////// |
|
|
3317 |
.................... |
|
|
3318 |
.................... #ifndef _STDDEF |
|
|
3319 |
.................... |
|
|
3320 |
.................... #define _STDDEF |
|
|
3321 |
.................... |
|
|
3322 |
.................... #if sizeof(unsigned int8 *)==1 |
|
|
3323 |
.................... #define ptrdiff_t unsigned int8 |
|
|
3324 |
.................... #else |
|
|
3325 |
.................... #define ptrdiff_t unsigned int16 |
|
|
3326 |
.................... #endif |
|
|
3327 |
.................... |
|
|
3328 |
.................... #define size_t unsigned int8 |
|
|
3329 |
.................... #define wchar_t char |
|
|
3330 |
.................... #define NULL 0 |
|
|
3331 |
.................... |
|
|
3332 |
.................... #define offsetof(s,f) (offsetofbit(s,f)/8) |
|
|
3333 |
.................... |
|
|
3334 |
.................... #endif |
|
|
3335 |
.................... |
|
|
3336 |
.................... #include <ctype.h> |
|
|
3337 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
3338 |
.................... //// (C) Copyright 1996,2003 Custom Computer Services //// |
|
|
3339 |
.................... //// This source code may only be used by licensed users of the CCS C //// |
|
|
3340 |
.................... //// compiler. This source code may only be distributed to other //// |
|
|
3341 |
.................... //// licensed users of the CCS C compiler. No other use, reproduction //// |
|
|
3342 |
.................... //// or distribution is permitted without written permission. //// |
|
|
3343 |
.................... //// Derivative programs created using this software in object code //// |
|
|
3344 |
.................... //// form are not restricted in any way. //// |
|
|
3345 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
3346 |
.................... |
|
|
3347 |
.................... #ifndef _CTYPE |
|
|
3348 |
.................... #define _CTYPE |
|
|
3349 |
.................... |
|
|
3350 |
.................... #define islower(x) isamong(x,"abcdefghijklmnopqrstuvwxyz") |
|
|
3351 |
.................... #define isupper(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZ") |
|
|
3352 |
.................... #define isalnum(x) isamong(x,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") |
|
|
3353 |
.................... #define isalpha(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") |
|
|
3354 |
.................... #define isdigit(x) isamong(x,"0123456789") |
|
|
3355 |
.................... #define isspace(x) ((x)==' ') |
|
|
3356 |
.................... #define isxdigit(x) isamong(x,"0123456789ABCDEFabcdef") |
|
|
3357 |
.................... #define iscntrl(x) ((x)<' ') |
|
|
3358 |
.................... #define isprint(x) ((x)>=' ') |
|
|
3359 |
.................... #define isgraph(x) ((x)>' ') |
|
|
3360 |
.................... #define ispunct(x) (((x)>' ')&&!isalnum(x)) |
|
|
3361 |
.................... |
|
|
3362 |
.................... #endif |
|
|
3363 |
.................... |
|
|
3364 |
.................... |
|
|
3365 |
.................... |
|
|
3366 |
.................... |
|
|
3367 |
.................... |
|
|
3368 |
.................... ////////////////////////////////////////////// |
|
|
3369 |
.................... //// Uncomment the following define to //// |
|
|
3370 |
.................... //// allow some functions to use a //// |
|
|
3371 |
.................... //// quicker algorithm, but use more ROM //// |
|
|
3372 |
.................... //// //// |
|
|
3373 |
.................... //// #define FASTER_BUT_MORE_ROM //// |
|
|
3374 |
.................... ////////////////////////////////////////////// |
|
|
3375 |
.................... |
|
|
3376 |
.................... |
|
|
3377 |
.................... |
|
|
3378 |
.................... /*Copying functions*/ |
|
|
3379 |
.................... /* standard template: |
|
|
3380 |
.................... void *memmove(void *s1, void *s2, size_t n). |
|
|
3381 |
.................... Copies max of n characters safely (not following ending '\0') |
|
|
3382 |
.................... from s2 in s1; if s2 has less than n characters, appends 0 */ |
|
|
3383 |
.................... |
|
|
3384 |
.................... char *memmove(void *s1,char *s2,size_t n) |
|
|
3385 |
.................... { |
|
|
3386 |
.................... char *sc1; |
|
|
3387 |
.................... char *sc2; |
|
|
3388 |
.................... sc1=s1; |
|
|
3389 |
.................... sc2=s2; |
|
|
3390 |
.................... if(sc2<sc1 && sc1 <sc2 +n) |
|
|
3391 |
.................... for(sc1+=n,sc2+=n;0<n;--n) |
|
|
3392 |
.................... *--sc1=*--sc2; |
|
|
3393 |
.................... else |
|
|
3394 |
.................... for(;0<n;--n) |
|
|
3395 |
.................... *sc1++=*sc2++; |
|
|
3396 |
.................... return s1; |
|
|
3397 |
.................... } |
|
|
3398 |
.................... |
|
|
3399 |
.................... /* Standard template: char *strcpy(char *s1, const char *s2) |
|
|
3400 |
.................... copies the string s2 including the null character to s1. |
|
|
3401 |
.................... This is a compiler built in to handle the different address |
|
|
3402 |
.................... spaces */ |
|
|
3403 |
.................... |
|
|
3404 |
.................... #define strcopy strcpy |
|
|
3405 |
.................... |
|
|
3406 |
.................... /* standard template: |
|
|
3407 |
.................... char *strncpy(char *s1, const char *s2, size_t n). |
|
|
3408 |
.................... Copies max of n characters (not following ending '\0') |
|
|
3409 |
.................... from s2 in s1; if s2 has less than n characters, appends 0 */ |
|
|
3410 |
.................... |
|
|
3411 |
.................... char *strncpy(char *s1, char *s2, size_t n) |
|
|
3412 |
.................... { |
|
|
3413 |
.................... char *s; |
|
|
3414 |
.................... |
|
|
3415 |
.................... for (s = s1; n > 0 && *s2 != '\0'; n--) |
|
|
3416 |
.................... *s++ = *s2++; |
|
|
3417 |
.................... for (; n > 0; n--) |
|
|
3418 |
.................... *s++ = '\0'; |
|
|
3419 |
.................... |
|
|
3420 |
.................... return(s1); |
|
|
3421 |
.................... } |
|
|
3422 |
.................... /***********************************************************/ |
|
|
3423 |
.................... |
|
|
3424 |
.................... /*concatenation functions*/ |
|
|
3425 |
.................... /* standard template: char *strcat(char *s1, const char *s2) |
|
|
3426 |
.................... appends s2 to s1*/ |
|
|
3427 |
.................... |
|
|
3428 |
.................... char *strcat(char *s1, char *s2) |
|
|
3429 |
.................... { |
|
|
3430 |
.................... char *s; |
|
|
3431 |
.................... |
|
|
3432 |
.................... for (s = s1; *s != '\0'; ++s); |
|
|
3433 |
.................... while(*s2 != '\0') |
|
|
3434 |
.................... { |
|
|
3435 |
.................... *s = *s2; |
|
|
3436 |
.................... ++s; |
|
|
3437 |
.................... ++s2; |
|
|
3438 |
.................... } |
|
|
3439 |
.................... |
|
|
3440 |
.................... *s = '\0'; |
|
|
3441 |
.................... return(s1); |
|
|
3442 |
.................... } |
|
|
3443 |
.................... /* standard template: char *strncat(char *s1, char *s2,size_t n) |
|
|
3444 |
.................... appends not more than n characters from s2 to s1*/ |
|
|
3445 |
.................... |
|
|
3446 |
.................... char *strncat(char *s1, char *s2, size_t n) |
|
|
3447 |
.................... { |
|
|
3448 |
.................... char *s; |
|
|
3449 |
.................... |
|
|
3450 |
.................... for (s = s1; *s != '\0'; ++s); |
|
|
3451 |
.................... while(*s2 != '\0' && 0<n) |
|
|
3452 |
.................... { |
|
|
3453 |
.................... *s = *s2; |
|
|
3454 |
.................... ++s; |
|
|
3455 |
.................... ++s2; |
|
|
3456 |
.................... --n; |
|
|
3457 |
.................... } |
|
|
3458 |
.................... |
|
|
3459 |
.................... *s = '\0'; |
|
|
3460 |
.................... return(s1); |
|
|
3461 |
.................... } |
|
|
3462 |
.................... |
|
|
3463 |
.................... /***********************************************************/ |
|
|
3464 |
.................... |
|
|
3465 |
.................... |
|
|
3466 |
.................... /*comparison functions*/ |
|
|
3467 |
.................... /* standard template: signed int memcmp(void *s1, void *s2). |
|
|
3468 |
.................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */ |
|
|
3469 |
.................... |
|
|
3470 |
.................... signed int8 memcmp(void * s1,char *s2,size_t n) |
|
|
3471 |
.................... { |
|
|
3472 |
.................... char *su1, *su2; |
|
|
3473 |
.................... for(su1=s1, su2=s2; 0<n; ++su1, ++su2, --n) |
|
|
3474 |
.................... { |
|
|
3475 |
.................... if(*su1!=*su2) |
|
|
3476 |
.................... return ((*su1<*su2)?-1:+1); |
|
|
3477 |
.................... } |
|
|
3478 |
.................... return 0; |
|
|
3479 |
.................... } |
|
|
3480 |
.................... |
|
|
3481 |
.................... /* standard template: int strcmp(const char *s1, const char *s2). |
|
|
3482 |
.................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */ |
|
|
3483 |
.................... |
|
|
3484 |
.................... signed int8 strcmp(char *s1, char *s2) |
|
|
3485 |
.................... { |
|
|
3486 |
.................... for (; *s1 == *s2; s1++, s2++) |
|
|
3487 |
.................... if (*s1 == '\0') |
|
|
3488 |
.................... return(0); |
|
|
3489 |
.................... return((*s1 < *s2) ? -1: 1); |
|
|
3490 |
.................... } |
|
|
3491 |
.................... /* standard template: int strcoll(const char *s1, const char *s2). |
|
|
3492 |
.................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */ |
|
|
3493 |
.................... |
|
|
3494 |
.................... signed int8 strcoll(char *s1, char *s2) |
|
|
3495 |
.................... { |
|
|
3496 |
.................... for (; *s1 == *s2; s1++, s2++) |
|
|
3497 |
.................... if (*s1 == '\0') |
|
|
3498 |
.................... return(0); |
|
|
3499 |
.................... return((*s1 < *s2) ? -1: 1); |
|
|
3500 |
.................... } |
|
|
3501 |
.................... |
|
|
3502 |
.................... /* standard template: |
|
|
3503 |
.................... int strncmp(const char *s1, const char *s2, size_t n). |
|
|
3504 |
.................... Compares max of n characters (not following 0) from s1 to s2; |
|
|
3505 |
.................... returns same as strcmp */ |
|
|
3506 |
.................... |
|
|
3507 |
.................... signed int8 strncmp(char *s1, char *s2, size_t n) |
|
|
3508 |
.................... { |
|
|
3509 |
.................... for (; n > 0; s1++, s2++, n--) |
|
|
3510 |
.................... if (*s1 != *s2) |
|
|
3511 |
.................... return((*s1 <*s2) ? -1: 1); |
|
|
3512 |
.................... else if (*s1 == '\0') |
|
|
3513 |
.................... return(0); |
|
|
3514 |
.................... return(0); |
|
|
3515 |
.................... } |
|
|
3516 |
.................... /* standard template: |
|
|
3517 |
.................... int strxfrm(const char *s1, const char *s2, size_t n). |
|
|
3518 |
.................... transforms maximum of n characters from s2 and places them into s1*/ |
|
|
3519 |
.................... size_t strxfrm(char *s1, char *s2, size_t n) |
|
|
3520 |
.................... { |
|
|
3521 |
.................... char *s; |
|
|
3522 |
.................... unsigned int8 n1; |
|
|
3523 |
.................... n1=n; |
|
|
3524 |
.................... for (s = s1; n > 0 && *s2 != '\0'; n--) |
|
|
3525 |
.................... *s++ = *s2++; |
|
|
3526 |
.................... for (; n > 0; n--) |
|
|
3527 |
.................... *s++ = '\0'; |
|
|
3528 |
.................... |
|
|
3529 |
.................... return(n1); |
|
|
3530 |
.................... } |
|
|
3531 |
.................... |
|
|
3532 |
.................... |
|
|
3533 |
.................... |
|
|
3534 |
.................... |
|
|
3535 |
.................... |
|
|
3536 |
.................... /***********************************************************/ |
|
|
3537 |
.................... /*Search functions*/ |
|
|
3538 |
.................... /* standard template: void *memchr(const char *s, int c). |
|
|
3539 |
.................... Finds first occurrence of c in n characters of s */ |
|
|
3540 |
.................... |
|
|
3541 |
.................... char *memchr(void *s,unsigned int8 c,size_t n) |
|
|
3542 |
.................... { |
|
|
3543 |
.................... char uc; |
|
|
3544 |
.................... char *su; |
|
|
3545 |
.................... uc=c; |
|
|
3546 |
.................... for(su=s;0<n;++su,--n) |
|
|
3547 |
.................... if(*su==uc) |
|
|
3548 |
.................... return su; |
|
|
3549 |
.................... return NULL; |
|
|
3550 |
.................... } |
|
|
3551 |
.................... |
|
|
3552 |
.................... /* standard template: char *strchr(const char *s, int c). |
|
|
3553 |
.................... Finds first occurrence of c in s */ |
|
|
3554 |
.................... |
|
|
3555 |
.................... char *strchr(char *s, unsigned int8 c) |
|
|
3556 |
.................... { |
|
|
3557 |
.................... for (; *s != c; s++) |
|
|
3558 |
.................... if (*s == '\0') |
|
|
3559 |
.................... return(0); |
|
|
3560 |
.................... return(s); |
|
|
3561 |
.................... } |
|
|
3562 |
.................... /* standard template: |
|
|
3563 |
.................... size_t strcspn(const char *s1, const char *s2). |
|
|
3564 |
.................... Computes length of max initial segment of s1 that |
|
|
3565 |
.................... consists entirely of characters NOT from s2*/ |
|
|
3566 |
.................... |
|
|
3567 |
.................... unsigned int8 strcspn(char *s1, char *s2) |
|
|
3568 |
.................... { |
|
|
3569 |
.................... char *sc1, *sc2; |
|
|
3570 |
.................... |
|
|
3571 |
.................... for (sc1 = s1; *sc1 != 0; sc1++) |
|
|
3572 |
.................... for (sc2 = s2; *sc2 != 0; sc2++) |
|
|
3573 |
.................... if (*sc1 == *sc2) |
|
|
3574 |
.................... return(sc1 - s1); |
|
|
3575 |
.................... return(sc1 - s1); |
|
|
3576 |
.................... } |
|
|
3577 |
.................... /* standard template: |
|
|
3578 |
.................... char *strpbrk(const char *s1, const char *s2). |
|
|
3579 |
.................... Locates first occurence of any character from s2 in s1; |
|
|
3580 |
.................... returns s1 if s2 is empty string */ |
|
|
3581 |
.................... |
|
|
3582 |
.................... char *strpbrk(char *s1, char *s2) |
|
|
3583 |
.................... { |
|
|
3584 |
.................... char *sc1, *sc2; |
|
|
3585 |
.................... |
|
|
3586 |
.................... for (sc1 = s1; *sc1 != 0; sc1++) |
|
|
3587 |
.................... for (sc2 = s2; *sc2 != 0; sc2++) |
|
|
3588 |
.................... if (*sc1 == *sc2) |
|
|
3589 |
.................... return(sc1); |
|
|
3590 |
.................... return(0); |
|
|
3591 |
.................... } |
|
|
3592 |
.................... |
|
|
3593 |
.................... |
|
|
3594 |
.................... /* standard template: char *strrchr(const char *s, int c). |
|
|
3595 |
.................... Finds last occurrence of c in s */ |
|
|
3596 |
.................... |
|
|
3597 |
.................... char *strrchr(char *s, unsigned int8 c) |
|
|
3598 |
.................... { |
|
|
3599 |
.................... char *p; |
|
|
3600 |
.................... |
|
|
3601 |
.................... for (p = 0; ; s++) |
|
|
3602 |
.................... { |
|
|
3603 |
.................... if (*s == c) |
|
|
3604 |
.................... p = s; |
|
|
3605 |
.................... if (*s == '\0') |
|
|
3606 |
.................... return(p); |
|
|
3607 |
.................... } |
|
|
3608 |
.................... } |
|
|
3609 |
.................... /* computes length of max initial segment of s1 consisting |
|
|
3610 |
.................... entirely of characters from s2 */ |
|
|
3611 |
.................... |
|
|
3612 |
.................... unsigned int8 strspn(char *s1, char *s2) |
|
|
3613 |
.................... { |
|
|
3614 |
.................... char *sc1, *sc2; |
|
|
3615 |
.................... |
|
|
3616 |
.................... for (sc1 = s1; *sc1 != 0; sc1++) |
|
|
3617 |
.................... for (sc2 = s2; ; sc2++) |
|
|
3618 |
.................... if (*sc2 == '\0') |
|
|
3619 |
.................... return(sc1 - s1); |
|
|
3620 |
.................... else if (*sc1 == *sc2) |
|
|
3621 |
.................... break; |
|
|
3622 |
.................... return(sc1 - s1); |
|
|
3623 |
.................... } |
|
|
3624 |
.................... /* standard template: |
|
|
3625 |
.................... char *strstr(const char *s1, const char *s2); |
|
|
3626 |
.................... Locates first occurence of character sequence s2 in s1; |
|
|
3627 |
.................... returns 0 if s2 is empty string |
|
|
3628 |
.................... |
|
|
3629 |
.................... Uncomment #define FASTER_BUT_MORE_ROM at the top of the |
|
|
3630 |
.................... file to use the faster algorithm */ |
|
|
3631 |
.................... char *strstr(char *s1, char *s2) |
|
|
3632 |
.................... { |
|
|
3633 |
.................... char *s, *t; |
|
|
3634 |
.................... |
|
|
3635 |
.................... #ifdef FASTER_BUT_MORE_ROM |
|
|
3636 |
.................... if (*s2 == '\0') |
|
|
3637 |
.................... return(s1); |
|
|
3638 |
.................... #endif |
|
|
3639 |
.................... |
|
|
3640 |
.................... while (*s1) |
|
|
3641 |
.................... { |
|
|
3642 |
.................... for(s = s1, t = s2; *t && (*s == *t); ++s, ++t); |
|
|
3643 |
.................... |
|
|
3644 |
.................... if (*t == '\0') |
|
|
3645 |
.................... return s1; |
|
|
3646 |
.................... ++s1; |
|
|
3647 |
.................... #ifdef FASTER_BUT_MORE_ROM |
|
|
3648 |
.................... while(*s1 != '\0' && *s1 != *s2) |
|
|
3649 |
.................... ++s1; |
|
|
3650 |
.................... #endif |
|
|
3651 |
.................... } |
|
|
3652 |
.................... return 0; |
|
|
3653 |
.................... } |
|
|
3654 |
.................... |
|
|
3655 |
.................... /* standard template: char *strtok(char *s1, const char *s2). |
|
|
3656 |
.................... |
|
|
3657 |
.................... Finds next token in s1 delimited by a character from separator |
|
|
3658 |
.................... string s2 (which can be different from call to call). First call |
|
|
3659 |
.................... starts at beginning of s1 searching for first character NOT |
|
|
3660 |
.................... contained in s2; returns 0 if none is found. |
|
|
3661 |
.................... If one is found, it is the start of first token (return value). |
|
|
3662 |
.................... Function then searches from there for a character contained in s2. |
|
|
3663 |
.................... If none is found, current token extends to end of s1, and subsequent |
|
|
3664 |
.................... searches for a token will return 0. If one is found, it is |
|
|
3665 |
.................... overwritten by '\0', which terminates current token. Function saves |
|
|
3666 |
.................... pointer to following character from which next search will start. |
|
|
3667 |
.................... Each subsequent call, with 0 as first argument, starts searching |
|
|
3668 |
.................... from saved pointer */ |
|
|
3669 |
.................... |
|
|
3670 |
.................... char *strtok(char *s1, char *s2) |
|
|
3671 |
.................... { |
|
|
3672 |
.................... char *beg, *end; |
|
|
3673 |
.................... static char *save; |
|
|
3674 |
* |
1045 |
jacho |
3675 |
1563: CLRF 29 |
|
|
3676 |
1564: CLRF 2A |
960 |
jacho |
3677 |
.................... |
|
|
3678 |
.................... beg = (s1)? s1: save; |
|
|
3679 |
.................... beg += strspn(beg, s2); |
|
|
3680 |
.................... if (*beg == '\0') |
|
|
3681 |
.................... { |
|
|
3682 |
.................... *save = ' '; |
|
|
3683 |
.................... return(0); |
|
|
3684 |
.................... } |
|
|
3685 |
.................... end = strpbrk(beg, s2); |
|
|
3686 |
.................... if (*end != '\0') |
|
|
3687 |
.................... { |
|
|
3688 |
.................... *end = '\0'; |
|
|
3689 |
.................... end++; |
|
|
3690 |
.................... } |
|
|
3691 |
.................... save = end; |
|
|
3692 |
.................... return(beg); |
|
|
3693 |
.................... } |
|
|
3694 |
.................... |
|
|
3695 |
.................... /*****************************************************************/ |
|
|
3696 |
.................... /*Miscellaneous functions*/ |
|
|
3697 |
.................... /* standard template |
|
|
3698 |
.................... maps error number in errnum to an error message string |
|
|
3699 |
.................... Returns: Pointer to string |
|
|
3700 |
.................... */ |
|
|
3701 |
.................... #ifdef _ERRNO |
|
|
3702 |
.................... char * strerror(unsigned int8 errnum) |
|
|
3703 |
.................... { |
|
|
3704 |
.................... char s[15]; |
|
|
3705 |
.................... switch( errnum) |
|
|
3706 |
.................... { |
|
|
3707 |
.................... case 0: |
|
|
3708 |
.................... strcpy(s,"no errors"); |
|
|
3709 |
.................... return s; |
|
|
3710 |
.................... case EDOM : |
|
|
3711 |
.................... strcpy(s,"domain error"); |
|
|
3712 |
.................... return s; |
|
|
3713 |
.................... case ERANGE: |
|
|
3714 |
.................... strcpy(s,"range error"); |
|
|
3715 |
.................... return s; |
|
|
3716 |
.................... } |
|
|
3717 |
.................... } |
|
|
3718 |
.................... #ENDIF |
|
|
3719 |
.................... /* standard template: size_t strlen(const char *s). |
|
|
3720 |
.................... Computes length of s1 (preceding terminating 0) */ |
|
|
3721 |
.................... |
|
|
3722 |
.................... unsigned int8 strlen(char *s) |
|
|
3723 |
.................... { |
|
|
3724 |
.................... char *sc; |
|
|
3725 |
.................... |
|
|
3726 |
.................... for (sc = s; *sc != 0; sc++); |
|
|
3727 |
.................... return(sc - s); |
|
|
3728 |
.................... } |
|
|
3729 |
.................... |
|
|
3730 |
.................... /* standard template: size_t stricmp(const char *s1, const char *s2). |
|
|
3731 |
.................... Compares s1 to s2 ignoring case (upper vs. lower) */ |
|
|
3732 |
.................... |
|
|
3733 |
.................... signed int8 stricmp(char *s1, char *s2) |
|
|
3734 |
.................... { |
|
|
3735 |
.................... for(; *s1==*s2||(isalpha(*s1)&&isalpha(*s2)&&(*s1==*s2+32||*s2==*s1+32)); |
|
|
3736 |
.................... s1++, s2++) |
|
|
3737 |
.................... if (*s1 == '\0') |
|
|
3738 |
.................... return(0); |
|
|
3739 |
.................... return((*s1 < *s2) ? -1: 1); |
|
|
3740 |
.................... } |
|
|
3741 |
.................... |
|
|
3742 |
.................... |
|
|
3743 |
.................... /* standard template: char *strlwr(char *s). |
|
|
3744 |
.................... Replaces uppercase letters by lowercase; |
|
|
3745 |
.................... returns pointer to new string s */ |
|
|
3746 |
.................... |
|
|
3747 |
.................... char *strlwr(char *s) |
|
|
3748 |
.................... { |
|
|
3749 |
.................... char *p; |
|
|
3750 |
.................... |
|
|
3751 |
.................... for (p = s; *p != '\0'; p++) |
|
|
3752 |
.................... if (*p >= 'A' && *p <='Z') |
|
|
3753 |
.................... *p += 'a' - 'A'; |
|
|
3754 |
.................... return(s); |
|
|
3755 |
.................... } |
|
|
3756 |
.................... |
|
|
3757 |
.................... |
|
|
3758 |
.................... /************************************************************/ |
|
|
3759 |
.................... |
|
|
3760 |
.................... |
|
|
3761 |
.................... #endif |
|
|
3762 |
.................... |
|
|
3763 |
.................... |
|
|
3764 |
.................... #include "SHT25.h" |
|
|
3765 |
.................... |
|
|
3766 |
.................... #define SHT25_HEATER_ON 0x04 |
|
|
3767 |
.................... #define SHT25_HEATER_OFF 0x00 |
|
|
3768 |
.................... #define SHT25_OTP_reload_off 0x02 |
|
|
3769 |
.................... #define SHT25_RH12_T14 0x00 |
|
|
3770 |
.................... #define SHT25_RH8_T12 0x01 |
|
|
3771 |
.................... #define SHT25_RH10_T13 0x80 |
|
|
3772 |
.................... #define SHT25_RH11_T11 0x81 |
|
|
3773 |
.................... |
|
|
3774 |
.................... #define SHT25_ADDR 0x80 |
|
|
3775 |
.................... |
|
|
3776 |
.................... #include "SHT25.c" |
|
|
3777 |
.................... void SHT25_soft_reset() |
|
|
3778 |
.................... { |
|
|
3779 |
.................... i2c_start(); // Start condition |
|
|
3780 |
* |
1045 |
jacho |
3781 |
027A: BSF 28.3 |
|
|
3782 |
027B: MOVF 28,W |
|
|
3783 |
027C: BSF 03.5 |
|
|
3784 |
027D: MOVWF 07 |
|
|
3785 |
027E: NOP |
|
|
3786 |
027F: BCF 03.5 |
|
|
3787 |
0280: BSF 28.4 |
|
|
3788 |
0281: MOVF 28,W |
|
|
3789 |
0282: BSF 03.5 |
|
|
3790 |
0283: MOVWF 07 |
|
|
3791 |
0284: NOP |
|
|
3792 |
0285: BCF 03.5 |
|
|
3793 |
0286: BCF 07.3 |
|
|
3794 |
0287: BCF 28.3 |
|
|
3795 |
0288: MOVF 28,W |
|
|
3796 |
0289: BSF 03.5 |
|
|
3797 |
028A: MOVWF 07 |
|
|
3798 |
028B: NOP |
|
|
3799 |
028C: BCF 03.5 |
|
|
3800 |
028D: BCF 07.4 |
|
|
3801 |
028E: BCF 28.4 |
|
|
3802 |
028F: MOVF 28,W |
|
|
3803 |
0290: BSF 03.5 |
|
|
3804 |
0291: MOVWF 07 |
960 |
jacho |
3805 |
.................... i2c_write(0x80); // Device address |
1045 |
jacho |
3806 |
0292: MOVLW 80 |
|
|
3807 |
0293: BCF 03.5 |
|
|
3808 |
0294: BSF 03.6 |
|
|
3809 |
0295: MOVWF 12 |
|
|
3810 |
0296: BCF 03.6 |
|
|
3811 |
0297: CALL 22E |
960 |
jacho |
3812 |
.................... i2c_write(0xFE); // Device command |
1045 |
jacho |
3813 |
0298: MOVLW FE |
|
|
3814 |
0299: BSF 03.6 |
|
|
3815 |
029A: MOVWF 12 |
|
|
3816 |
029B: BCF 03.6 |
|
|
3817 |
029C: CALL 22E |
960 |
jacho |
3818 |
.................... i2c_stop(); // Stop condition |
1045 |
jacho |
3819 |
029D: BCF 28.3 |
960 |
jacho |
3820 |
029E: MOVF 28,W |
|
|
3821 |
029F: BSF 03.5 |
|
|
3822 |
02A0: MOVWF 07 |
1045 |
jacho |
3823 |
02A1: NOP |
|
|
3824 |
02A2: BCF 03.5 |
|
|
3825 |
02A3: BSF 28.4 |
|
|
3826 |
02A4: MOVF 28,W |
|
|
3827 |
02A5: BSF 03.5 |
|
|
3828 |
02A6: MOVWF 07 |
|
|
3829 |
02A7: BCF 03.5 |
|
|
3830 |
02A8: BTFSS 07.4 |
|
|
3831 |
02A9: GOTO 2A8 |
|
|
3832 |
02AA: NOP |
|
|
3833 |
02AB: GOTO 2AC |
|
|
3834 |
02AC: NOP |
|
|
3835 |
02AD: BSF 28.3 |
|
|
3836 |
02AE: MOVF 28,W |
|
|
3837 |
02AF: BSF 03.5 |
|
|
3838 |
02B0: MOVWF 07 |
|
|
3839 |
02B1: NOP |
960 |
jacho |
3840 |
.................... } |
1045 |
jacho |
3841 |
02B2: BCF 03.5 |
|
|
3842 |
02B3: BCF 0A.3 |
|
|
3843 |
02B4: BSF 0A.4 |
|
|
3844 |
02B5: GOTO 5B0 (RETURN) |
960 |
jacho |
3845 |
.................... |
|
|
3846 |
.................... unsigned int8 SHT25_setup(unsigned int8 setup_reg ) // writes to status register and returns its value |
|
|
3847 |
.................... { |
|
|
3848 |
.................... unsigned int8 reg; |
|
|
3849 |
.................... |
|
|
3850 |
.................... i2c_start(); // Start condition |
|
|
3851 |
* |
1045 |
jacho |
3852 |
0317: BSF 28.3 |
|
|
3853 |
0318: MOVF 28,W |
|
|
3854 |
0319: BSF 03.5 |
|
|
3855 |
031A: MOVWF 07 |
|
|
3856 |
031B: NOP |
|
|
3857 |
031C: BCF 03.5 |
|
|
3858 |
031D: BSF 28.4 |
960 |
jacho |
3859 |
031E: MOVF 28,W |
|
|
3860 |
031F: BSF 03.5 |
|
|
3861 |
0320: MOVWF 07 |
1045 |
jacho |
3862 |
0321: NOP |
|
|
3863 |
0322: BCF 03.5 |
|
|
3864 |
0323: BCF 07.3 |
|
|
3865 |
0324: BCF 28.3 |
|
|
3866 |
0325: MOVF 28,W |
|
|
3867 |
0326: BSF 03.5 |
|
|
3868 |
0327: MOVWF 07 |
|
|
3869 |
0328: NOP |
|
|
3870 |
0329: BCF 03.5 |
|
|
3871 |
032A: BCF 07.4 |
|
|
3872 |
032B: BCF 28.4 |
|
|
3873 |
032C: MOVF 28,W |
|
|
3874 |
032D: BSF 03.5 |
|
|
3875 |
032E: MOVWF 07 |
960 |
jacho |
3876 |
.................... i2c_write(SHT25_ADDR); // Device address |
1045 |
jacho |
3877 |
032F: MOVLW 80 |
|
|
3878 |
0330: BCF 03.5 |
|
|
3879 |
0331: BSF 03.6 |
|
|
3880 |
0332: MOVWF 12 |
|
|
3881 |
0333: BCF 03.6 |
|
|
3882 |
0334: CALL 22E |
960 |
jacho |
3883 |
.................... i2c_write(0xE7); // Device command |
1045 |
jacho |
3884 |
0335: MOVLW E7 |
|
|
3885 |
0336: BSF 03.6 |
|
|
3886 |
0337: MOVWF 12 |
|
|
3887 |
0338: BCF 03.6 |
|
|
3888 |
0339: CALL 22E |
960 |
jacho |
3889 |
.................... |
|
|
3890 |
.................... i2c_start(); // Start condition |
1045 |
jacho |
3891 |
033A: BSF 28.3 |
|
|
3892 |
033B: MOVF 28,W |
|
|
3893 |
033C: BSF 03.5 |
|
|
3894 |
033D: MOVWF 07 |
|
|
3895 |
033E: NOP |
|
|
3896 |
033F: BCF 03.5 |
|
|
3897 |
0340: BSF 28.4 |
|
|
3898 |
0341: MOVF 28,W |
|
|
3899 |
0342: BSF 03.5 |
|
|
3900 |
0343: MOVWF 07 |
|
|
3901 |
0344: NOP |
|
|
3902 |
0345: BCF 03.5 |
|
|
3903 |
0346: BTFSS 07.4 |
|
|
3904 |
0347: GOTO 346 |
|
|
3905 |
0348: BCF 07.3 |
|
|
3906 |
0349: BCF 28.3 |
|
|
3907 |
034A: MOVF 28,W |
|
|
3908 |
034B: BSF 03.5 |
|
|
3909 |
034C: MOVWF 07 |
|
|
3910 |
034D: NOP |
|
|
3911 |
034E: BCF 03.5 |
|
|
3912 |
034F: BCF 07.4 |
|
|
3913 |
0350: BCF 28.4 |
|
|
3914 |
0351: MOVF 28,W |
|
|
3915 |
0352: BSF 03.5 |
|
|
3916 |
0353: MOVWF 07 |
960 |
jacho |
3917 |
.................... i2c_write(SHT25_ADDR+1); // Device address |
1045 |
jacho |
3918 |
0354: MOVLW 81 |
|
|
3919 |
0355: BCF 03.5 |
|
|
3920 |
0356: BSF 03.6 |
|
|
3921 |
0357: MOVWF 12 |
|
|
3922 |
0358: BCF 03.6 |
|
|
3923 |
0359: CALL 22E |
960 |
jacho |
3924 |
.................... reg=i2c_read(0); // Read status actual status register |
1045 |
jacho |
3925 |
035A: CLRF 77 |
|
|
3926 |
035B: CALL 2B6 |
|
|
3927 |
035C: MOVF 78,W |
|
|
3928 |
035D: BSF 03.5 |
|
|
3929 |
035E: MOVWF 5E |
960 |
jacho |
3930 |
.................... |
|
|
3931 |
.................... reg = (reg & 0x3A) | setup_reg; |
1045 |
jacho |
3932 |
035F: MOVF 5E,W |
|
|
3933 |
0360: ANDLW 3A |
|
|
3934 |
0361: IORWF 5D,W |
|
|
3935 |
0362: MOVWF 5E |
960 |
jacho |
3936 |
.................... |
|
|
3937 |
.................... i2c_start(); // Start condition |
1045 |
jacho |
3938 |
0363: BCF 03.5 |
|
|
3939 |
0364: BSF 28.3 |
960 |
jacho |
3940 |
0365: MOVF 28,W |
|
|
3941 |
0366: BSF 03.5 |
|
|
3942 |
0367: MOVWF 07 |
1045 |
jacho |
3943 |
0368: NOP |
|
|
3944 |
0369: BCF 03.5 |
|
|
3945 |
036A: BSF 28.4 |
|
|
3946 |
036B: MOVF 28,W |
|
|
3947 |
036C: BSF 03.5 |
|
|
3948 |
036D: MOVWF 07 |
|
|
3949 |
036E: NOP |
|
|
3950 |
036F: BCF 03.5 |
|
|
3951 |
0370: BTFSS 07.4 |
|
|
3952 |
0371: GOTO 370 |
|
|
3953 |
0372: BCF 07.3 |
|
|
3954 |
0373: BCF 28.3 |
|
|
3955 |
0374: MOVF 28,W |
|
|
3956 |
0375: BSF 03.5 |
|
|
3957 |
0376: MOVWF 07 |
|
|
3958 |
0377: NOP |
|
|
3959 |
0378: BCF 03.5 |
|
|
3960 |
0379: BCF 07.4 |
|
|
3961 |
037A: BCF 28.4 |
|
|
3962 |
037B: MOVF 28,W |
|
|
3963 |
037C: BSF 03.5 |
|
|
3964 |
037D: MOVWF 07 |
960 |
jacho |
3965 |
.................... i2c_write(SHT25_ADDR); // Device address |
1045 |
jacho |
3966 |
037E: MOVLW 80 |
|
|
3967 |
037F: BCF 03.5 |
|
|
3968 |
0380: BSF 03.6 |
|
|
3969 |
0381: MOVWF 12 |
|
|
3970 |
0382: BCF 03.6 |
|
|
3971 |
0383: CALL 22E |
960 |
jacho |
3972 |
.................... i2c_write(0xE6); // Write to status register |
1045 |
jacho |
3973 |
0384: MOVLW E6 |
|
|
3974 |
0385: BSF 03.6 |
|
|
3975 |
0386: MOVWF 12 |
|
|
3976 |
0387: BCF 03.6 |
|
|
3977 |
0388: CALL 22E |
960 |
jacho |
3978 |
.................... i2c_write(reg); // Device command |
1045 |
jacho |
3979 |
0389: BSF 03.5 |
|
|
3980 |
038A: MOVF 5E,W |
|
|
3981 |
038B: BCF 03.5 |
|
|
3982 |
038C: BSF 03.6 |
|
|
3983 |
038D: MOVWF 12 |
|
|
3984 |
038E: BCF 03.6 |
|
|
3985 |
038F: CALL 22E |
960 |
jacho |
3986 |
.................... i2c_stop(); // Stop condition |
1045 |
jacho |
3987 |
0390: BCF 28.3 |
|
|
3988 |
0391: MOVF 28,W |
|
|
3989 |
0392: BSF 03.5 |
|
|
3990 |
0393: MOVWF 07 |
|
|
3991 |
0394: NOP |
|
|
3992 |
0395: BCF 03.5 |
|
|
3993 |
0396: BSF 28.4 |
|
|
3994 |
0397: MOVF 28,W |
|
|
3995 |
0398: BSF 03.5 |
|
|
3996 |
0399: MOVWF 07 |
|
|
3997 |
039A: BCF 03.5 |
|
|
3998 |
039B: BTFSS 07.4 |
|
|
3999 |
039C: GOTO 39B |
|
|
4000 |
039D: NOP |
|
|
4001 |
039E: GOTO 39F |
|
|
4002 |
039F: NOP |
|
|
4003 |
03A0: BSF 28.3 |
|
|
4004 |
03A1: MOVF 28,W |
|
|
4005 |
03A2: BSF 03.5 |
|
|
4006 |
03A3: MOVWF 07 |
|
|
4007 |
03A4: NOP |
960 |
jacho |
4008 |
.................... |
|
|
4009 |
.................... delay_ms(10); |
1045 |
jacho |
4010 |
03A5: MOVLW 0A |
|
|
4011 |
03A6: MOVWF 62 |
|
|
4012 |
03A7: BCF 03.5 |
|
|
4013 |
03A8: CALL 303 |
960 |
jacho |
4014 |
.................... |
|
|
4015 |
.................... i2c_start(); // Start condition |
1045 |
jacho |
4016 |
03A9: BSF 28.3 |
|
|
4017 |
03AA: MOVF 28,W |
|
|
4018 |
03AB: BSF 03.5 |
|
|
4019 |
03AC: MOVWF 07 |
|
|
4020 |
03AD: NOP |
|
|
4021 |
03AE: BCF 03.5 |
|
|
4022 |
03AF: BSF 28.4 |
|
|
4023 |
03B0: MOVF 28,W |
|
|
4024 |
03B1: BSF 03.5 |
|
|
4025 |
03B2: MOVWF 07 |
|
|
4026 |
03B3: NOP |
|
|
4027 |
03B4: BCF 03.5 |
|
|
4028 |
03B5: BCF 07.3 |
|
|
4029 |
03B6: BCF 28.3 |
|
|
4030 |
03B7: MOVF 28,W |
|
|
4031 |
03B8: BSF 03.5 |
|
|
4032 |
03B9: MOVWF 07 |
|
|
4033 |
03BA: NOP |
|
|
4034 |
03BB: BCF 03.5 |
|
|
4035 |
03BC: BCF 07.4 |
|
|
4036 |
03BD: BCF 28.4 |
|
|
4037 |
03BE: MOVF 28,W |
|
|
4038 |
03BF: BSF 03.5 |
|
|
4039 |
03C0: MOVWF 07 |
960 |
jacho |
4040 |
.................... i2c_write(SHT25_ADDR); // Device address |
1045 |
jacho |
4041 |
03C1: MOVLW 80 |
|
|
4042 |
03C2: BCF 03.5 |
|
|
4043 |
03C3: BSF 03.6 |
|
|
4044 |
03C4: MOVWF 12 |
|
|
4045 |
03C5: BCF 03.6 |
|
|
4046 |
03C6: CALL 22E |
960 |
jacho |
4047 |
.................... i2c_write(0xE7); // Device command |
1045 |
jacho |
4048 |
03C7: MOVLW E7 |
|
|
4049 |
03C8: BSF 03.6 |
|
|
4050 |
03C9: MOVWF 12 |
|
|
4051 |
03CA: BCF 03.6 |
|
|
4052 |
03CB: CALL 22E |
960 |
jacho |
4053 |
.................... |
|
|
4054 |
.................... i2c_start(); // Start condition |
1045 |
jacho |
4055 |
03CC: BSF 28.3 |
|
|
4056 |
03CD: MOVF 28,W |
|
|
4057 |
03CE: BSF 03.5 |
|
|
4058 |
03CF: MOVWF 07 |
|
|
4059 |
03D0: NOP |
|
|
4060 |
03D1: BCF 03.5 |
|
|
4061 |
03D2: BSF 28.4 |
|
|
4062 |
03D3: MOVF 28,W |
|
|
4063 |
03D4: BSF 03.5 |
|
|
4064 |
03D5: MOVWF 07 |
|
|
4065 |
03D6: NOP |
|
|
4066 |
03D7: BCF 03.5 |
|
|
4067 |
03D8: BTFSS 07.4 |
|
|
4068 |
03D9: GOTO 3D8 |
|
|
4069 |
03DA: BCF 07.3 |
|
|
4070 |
03DB: BCF 28.3 |
|
|
4071 |
03DC: MOVF 28,W |
|
|
4072 |
03DD: BSF 03.5 |
|
|
4073 |
03DE: MOVWF 07 |
|
|
4074 |
03DF: NOP |
|
|
4075 |
03E0: BCF 03.5 |
|
|
4076 |
03E1: BCF 07.4 |
|
|
4077 |
03E2: BCF 28.4 |
|
|
4078 |
03E3: MOVF 28,W |
|
|
4079 |
03E4: BSF 03.5 |
|
|
4080 |
03E5: MOVWF 07 |
960 |
jacho |
4081 |
.................... i2c_write(SHT25_ADDR+1); // Device address |
1045 |
jacho |
4082 |
03E6: MOVLW 81 |
|
|
4083 |
03E7: BCF 03.5 |
|
|
4084 |
03E8: BSF 03.6 |
|
|
4085 |
03E9: MOVWF 12 |
|
|
4086 |
03EA: BCF 03.6 |
|
|
4087 |
03EB: CALL 22E |
960 |
jacho |
4088 |
.................... reg=i2c_read(0); // Read status actual status register |
1045 |
jacho |
4089 |
03EC: CLRF 77 |
|
|
4090 |
03ED: CALL 2B6 |
|
|
4091 |
03EE: MOVF 78,W |
|
|
4092 |
03EF: BSF 03.5 |
|
|
4093 |
03F0: MOVWF 5E |
960 |
jacho |
4094 |
.................... |
|
|
4095 |
.................... return (reg); |
1045 |
jacho |
4096 |
03F1: MOVF 5E,W |
|
|
4097 |
03F2: MOVWF 78 |
960 |
jacho |
4098 |
.................... } |
1045 |
jacho |
4099 |
03F3: BCF 03.5 |
|
|
4100 |
03F4: BCF 0A.3 |
|
|
4101 |
03F5: BSF 0A.4 |
|
|
4102 |
03F6: GOTO 5B8 (RETURN) |
960 |
jacho |
4103 |
.................... |
|
|
4104 |
.................... |
|
|
4105 |
.................... float SHT25_get_temp() |
|
|
4106 |
.................... { |
|
|
4107 |
.................... unsigned int8 MSB, LSB, Check; |
|
|
4108 |
.................... unsigned int16 data; |
|
|
4109 |
.................... |
|
|
4110 |
.................... i2c_start(); |
|
|
4111 |
* |
1045 |
jacho |
4112 |
0B22: BSF 28.3 |
|
|
4113 |
0B23: MOVF 28,W |
|
|
4114 |
0B24: BSF 03.5 |
|
|
4115 |
0B25: MOVWF 07 |
|
|
4116 |
0B26: NOP |
|
|
4117 |
0B27: BCF 03.5 |
|
|
4118 |
0B28: BSF 28.4 |
|
|
4119 |
0B29: MOVF 28,W |
|
|
4120 |
0B2A: BSF 03.5 |
|
|
4121 |
0B2B: MOVWF 07 |
|
|
4122 |
0B2C: NOP |
|
|
4123 |
0B2D: BCF 03.5 |
|
|
4124 |
0B2E: BTFSS 07.4 |
|
|
4125 |
0B2F: GOTO 32E |
|
|
4126 |
0B30: BCF 07.3 |
|
|
4127 |
0B31: BCF 28.3 |
|
|
4128 |
0B32: MOVF 28,W |
|
|
4129 |
0B33: BSF 03.5 |
|
|
4130 |
0B34: MOVWF 07 |
|
|
4131 |
0B35: NOP |
|
|
4132 |
0B36: BCF 03.5 |
|
|
4133 |
0B37: BCF 07.4 |
|
|
4134 |
0B38: BCF 28.4 |
|
|
4135 |
0B39: MOVF 28,W |
|
|
4136 |
0B3A: BSF 03.5 |
|
|
4137 |
0B3B: MOVWF 07 |
960 |
jacho |
4138 |
.................... I2C_Write(SHT25_ADDR); |
1045 |
jacho |
4139 |
0B3C: MOVLW 80 |
|
|
4140 |
0B3D: BCF 03.5 |
|
|
4141 |
0B3E: BSF 03.6 |
|
|
4142 |
0B3F: MOVWF 12 |
|
|
4143 |
0B40: BCF 0A.3 |
|
|
4144 |
0B41: BCF 03.6 |
|
|
4145 |
0B42: CALL 22E |
|
|
4146 |
0B43: BSF 0A.3 |
960 |
jacho |
4147 |
.................... I2C_write(0xE3); |
1045 |
jacho |
4148 |
0B44: MOVLW E3 |
|
|
4149 |
0B45: BSF 03.6 |
|
|
4150 |
0B46: MOVWF 12 |
|
|
4151 |
0B47: BCF 0A.3 |
|
|
4152 |
0B48: BCF 03.6 |
|
|
4153 |
0B49: CALL 22E |
|
|
4154 |
0B4A: BSF 0A.3 |
960 |
jacho |
4155 |
.................... i2c_stop(); |
1045 |
jacho |
4156 |
0B4B: BCF 28.3 |
|
|
4157 |
0B4C: MOVF 28,W |
|
|
4158 |
0B4D: BSF 03.5 |
|
|
4159 |
0B4E: MOVWF 07 |
|
|
4160 |
0B4F: NOP |
|
|
4161 |
0B50: BCF 03.5 |
|
|
4162 |
0B51: BSF 28.4 |
|
|
4163 |
0B52: MOVF 28,W |
|
|
4164 |
0B53: BSF 03.5 |
|
|
4165 |
0B54: MOVWF 07 |
|
|
4166 |
0B55: BCF 03.5 |
|
|
4167 |
0B56: BTFSS 07.4 |
|
|
4168 |
0B57: GOTO 356 |
|
|
4169 |
0B58: NOP |
|
|
4170 |
0B59: GOTO 35A |
|
|
4171 |
0B5A: NOP |
|
|
4172 |
0B5B: BSF 28.3 |
|
|
4173 |
0B5C: MOVF 28,W |
|
|
4174 |
0B5D: BSF 03.5 |
|
|
4175 |
0B5E: MOVWF 07 |
|
|
4176 |
0B5F: NOP |
960 |
jacho |
4177 |
.................... |
|
|
4178 |
.................... delay_ms(100); |
1045 |
jacho |
4179 |
0B60: MOVLW 64 |
|
|
4180 |
0B61: MOVWF 62 |
|
|
4181 |
0B62: BCF 0A.3 |
|
|
4182 |
0B63: BCF 03.5 |
|
|
4183 |
0B64: CALL 303 |
|
|
4184 |
0B65: BSF 0A.3 |
960 |
jacho |
4185 |
.................... |
|
|
4186 |
.................... i2c_start(); |
1045 |
jacho |
4187 |
0B66: BSF 28.3 |
|
|
4188 |
0B67: MOVF 28,W |
|
|
4189 |
0B68: BSF 03.5 |
|
|
4190 |
0B69: MOVWF 07 |
|
|
4191 |
0B6A: NOP |
|
|
4192 |
0B6B: BCF 03.5 |
|
|
4193 |
0B6C: BSF 28.4 |
|
|
4194 |
0B6D: MOVF 28,W |
|
|
4195 |
0B6E: BSF 03.5 |
|
|
4196 |
0B6F: MOVWF 07 |
|
|
4197 |
0B70: NOP |
|
|
4198 |
0B71: BCF 03.5 |
|
|
4199 |
0B72: BCF 07.3 |
|
|
4200 |
0B73: BCF 28.3 |
|
|
4201 |
0B74: MOVF 28,W |
|
|
4202 |
0B75: BSF 03.5 |
|
|
4203 |
0B76: MOVWF 07 |
|
|
4204 |
0B77: NOP |
|
|
4205 |
0B78: BCF 03.5 |
|
|
4206 |
0B79: BCF 07.4 |
|
|
4207 |
0B7A: BCF 28.4 |
|
|
4208 |
0B7B: MOVF 28,W |
|
|
4209 |
0B7C: BSF 03.5 |
|
|
4210 |
0B7D: MOVWF 07 |
960 |
jacho |
4211 |
.................... I2C_Write(SHT25_ADDR+1); |
1045 |
jacho |
4212 |
0B7E: MOVLW 81 |
|
|
4213 |
0B7F: BCF 03.5 |
|
|
4214 |
0B80: BSF 03.6 |
|
|
4215 |
0B81: MOVWF 12 |
|
|
4216 |
0B82: BCF 0A.3 |
|
|
4217 |
0B83: BCF 03.6 |
|
|
4218 |
0B84: CALL 22E |
|
|
4219 |
0B85: BSF 0A.3 |
960 |
jacho |
4220 |
.................... MSB=i2c_read(1); |
1045 |
jacho |
4221 |
0B86: MOVLW 01 |
|
|
4222 |
0B87: MOVWF 77 |
|
|
4223 |
0B88: BCF 0A.3 |
|
|
4224 |
0B89: CALL 2B6 |
|
|
4225 |
0B8A: BSF 0A.3 |
|
|
4226 |
0B8B: MOVF 78,W |
|
|
4227 |
0B8C: BSF 03.5 |
|
|
4228 |
0B8D: MOVWF 5D |
960 |
jacho |
4229 |
.................... LSB=i2c_read(1); |
1045 |
jacho |
4230 |
0B8E: MOVLW 01 |
|
|
4231 |
0B8F: MOVWF 77 |
|
|
4232 |
0B90: BCF 0A.3 |
|
|
4233 |
0B91: BCF 03.5 |
|
|
4234 |
0B92: CALL 2B6 |
|
|
4235 |
0B93: BSF 0A.3 |
|
|
4236 |
0B94: MOVF 78,W |
|
|
4237 |
0B95: BSF 03.5 |
|
|
4238 |
0B96: MOVWF 5E |
960 |
jacho |
4239 |
.................... Check=i2c_read(0); |
1045 |
jacho |
4240 |
0B97: CLRF 77 |
|
|
4241 |
0B98: BCF 0A.3 |
|
|
4242 |
0B99: BCF 03.5 |
|
|
4243 |
0B9A: CALL 2B6 |
|
|
4244 |
0B9B: BSF 0A.3 |
|
|
4245 |
0B9C: MOVF 78,W |
|
|
4246 |
0B9D: BSF 03.5 |
|
|
4247 |
0B9E: MOVWF 5F |
960 |
jacho |
4248 |
.................... i2c_stop(); |
1045 |
jacho |
4249 |
0B9F: BCF 03.5 |
|
|
4250 |
0BA0: BCF 28.3 |
|
|
4251 |
0BA1: MOVF 28,W |
|
|
4252 |
0BA2: BSF 03.5 |
|
|
4253 |
0BA3: MOVWF 07 |
|
|
4254 |
0BA4: NOP |
|
|
4255 |
0BA5: BCF 03.5 |
|
|
4256 |
0BA6: BSF 28.4 |
|
|
4257 |
0BA7: MOVF 28,W |
|
|
4258 |
0BA8: BSF 03.5 |
|
|
4259 |
0BA9: MOVWF 07 |
|
|
4260 |
0BAA: BCF 03.5 |
|
|
4261 |
0BAB: BTFSS 07.4 |
|
|
4262 |
0BAC: GOTO 3AB |
|
|
4263 |
0BAD: NOP |
|
|
4264 |
0BAE: GOTO 3AF |
|
|
4265 |
0BAF: NOP |
|
|
4266 |
0BB0: BSF 28.3 |
|
|
4267 |
0BB1: MOVF 28,W |
|
|
4268 |
0BB2: BSF 03.5 |
|
|
4269 |
0BB3: MOVWF 07 |
|
|
4270 |
0BB4: NOP |
960 |
jacho |
4271 |
.................... |
|
|
4272 |
.................... LSB = LSB >> 2; // trow out status bits |
1045 |
jacho |
4273 |
0BB5: RRF 5E,F |
|
|
4274 |
0BB6: RRF 5E,F |
|
|
4275 |
0BB7: MOVLW 3F |
|
|
4276 |
0BB8: ANDWF 5E,F |
960 |
jacho |
4277 |
.................... |
|
|
4278 |
.................... data = (((unsigned int16) MSB << 8) + (LSB << 4)); |
1045 |
jacho |
4279 |
0BB9: CLRF 63 |
|
|
4280 |
0BBA: MOVF 5D,W |
|
|
4281 |
0BBB: MOVWF 62 |
|
|
4282 |
0BBC: MOVWF 63 |
|
|
4283 |
0BBD: CLRF 62 |
|
|
4284 |
0BBE: SWAPF 5E,W |
|
|
4285 |
0BBF: MOVWF 77 |
|
|
4286 |
0BC0: MOVLW F0 |
|
|
4287 |
0BC1: ANDWF 77,F |
|
|
4288 |
0BC2: MOVF 77,W |
|
|
4289 |
0BC3: ADDWF 62,W |
|
|
4290 |
0BC4: MOVWF 60 |
|
|
4291 |
0BC5: MOVF 63,W |
|
|
4292 |
0BC6: MOVWF 61 |
|
|
4293 |
0BC7: BTFSC 03.0 |
|
|
4294 |
0BC8: INCF 61,F |
|
|
4295 |
0BC9: BCF 03.5 |
|
|
4296 |
0BCA: CLRF 27 |
|
|
4297 |
0BCB: BTFSC 0B.7 |
|
|
4298 |
0BCC: BSF 27.7 |
|
|
4299 |
0BCD: BCF 0B.7 |
960 |
jacho |
4300 |
.................... return(-46.85 + 175.72*((float)data/0xFFFF)); |
1045 |
jacho |
4301 |
0BCE: BSF 03.5 |
|
|
4302 |
0BCF: MOVF 61,W |
|
|
4303 |
0BD0: BCF 03.5 |
|
|
4304 |
0BD1: BSF 03.6 |
|
|
4305 |
0BD2: MOVWF 45 |
|
|
4306 |
0BD3: BSF 03.5 |
|
|
4307 |
0BD4: BCF 03.6 |
|
|
4308 |
0BD5: MOVF 60,W |
|
|
4309 |
0BD6: BCF 03.5 |
|
|
4310 |
0BD7: BSF 03.6 |
|
|
4311 |
0BD8: MOVWF 44 |
|
|
4312 |
0BD9: BCF 0A.3 |
|
|
4313 |
0BDA: BCF 03.6 |
|
|
4314 |
0BDB: CALL 038 |
|
|
4315 |
0BDC: BSF 0A.3 |
|
|
4316 |
0BDD: BTFSC 27.7 |
|
|
4317 |
0BDE: BSF 0B.7 |
|
|
4318 |
0BDF: MOVF 77,W |
|
|
4319 |
0BE0: BSF 03.5 |
|
|
4320 |
0BE1: MOVWF 62 |
|
|
4321 |
0BE2: MOVF 78,W |
|
|
4322 |
0BE3: MOVWF 63 |
|
|
4323 |
0BE4: MOVF 79,W |
|
|
4324 |
0BE5: MOVWF 64 |
|
|
4325 |
0BE6: MOVF 7A,W |
|
|
4326 |
0BE7: MOVWF 65 |
|
|
4327 |
0BE8: BCF 03.5 |
|
|
4328 |
0BE9: CLRF 27 |
|
|
4329 |
0BEA: BTFSC 0B.7 |
|
|
4330 |
0BEB: BSF 27.7 |
|
|
4331 |
0BEC: BCF 0B.7 |
|
|
4332 |
0BED: BSF 03.5 |
|
|
4333 |
0BEE: MOVF 65,W |
|
|
4334 |
0BEF: BCF 03.5 |
|
|
4335 |
0BF0: BSF 03.6 |
|
|
4336 |
0BF1: MOVWF 59 |
|
|
4337 |
0BF2: BSF 03.5 |
|
|
4338 |
0BF3: BCF 03.6 |
|
|
4339 |
0BF4: MOVF 64,W |
|
|
4340 |
0BF5: BCF 03.5 |
|
|
4341 |
0BF6: BSF 03.6 |
|
|
4342 |
0BF7: MOVWF 58 |
|
|
4343 |
0BF8: BSF 03.5 |
|
|
4344 |
0BF9: BCF 03.6 |
|
|
4345 |
0BFA: MOVF 63,W |
|
|
4346 |
0BFB: BCF 03.5 |
|
|
4347 |
0BFC: BSF 03.6 |
|
|
4348 |
0BFD: MOVWF 57 |
|
|
4349 |
0BFE: BSF 03.5 |
|
|
4350 |
0BFF: BCF 03.6 |
|
|
4351 |
0C00: MOVF 62,W |
|
|
4352 |
0C01: BCF 03.5 |
|
|
4353 |
0C02: BSF 03.6 |
|
|
4354 |
0C03: MOVWF 56 |
|
|
4355 |
0C04: CLRF 5D |
|
|
4356 |
0C05: MOVLW FF |
|
|
4357 |
0C06: MOVWF 5C |
|
|
4358 |
0C07: MOVLW 7F |
|
|
4359 |
0C08: MOVWF 5B |
|
|
4360 |
0C09: MOVLW 8E |
|
|
4361 |
0C0A: MOVWF 5A |
|
|
4362 |
0C0B: BCF 0A.3 |
|
|
4363 |
0C0C: BCF 03.6 |
|
|
4364 |
0C0D: CALL 057 |
|
|
4365 |
0C0E: BSF 0A.3 |
|
|
4366 |
0C0F: BTFSC 27.7 |
|
|
4367 |
0C10: BSF 0B.7 |
|
|
4368 |
0C11: MOVLW 52 |
|
|
4369 |
0C12: BSF 03.6 |
|
|
4370 |
0C13: MOVWF 24 |
|
|
4371 |
0C14: MOVLW B8 |
|
|
4372 |
0C15: MOVWF 23 |
|
|
4373 |
0C16: MOVLW 2F |
|
|
4374 |
0C17: MOVWF 22 |
|
|
4375 |
0C18: MOVLW 86 |
|
|
4376 |
0C19: MOVWF 21 |
|
|
4377 |
0C1A: MOVF 7A,W |
|
|
4378 |
0C1B: MOVWF 28 |
|
|
4379 |
0C1C: MOVF 79,W |
|
|
4380 |
0C1D: MOVWF 27 |
|
|
4381 |
0C1E: MOVF 78,W |
|
|
4382 |
0C1F: MOVWF 26 |
|
|
4383 |
0C20: MOVF 77,W |
|
|
4384 |
0C21: MOVWF 25 |
|
|
4385 |
0C22: BCF 03.6 |
|
|
4386 |
0C23: CALL 2AB |
|
|
4387 |
0C24: BCF 03.1 |
|
|
4388 |
0C25: MOVLW 66 |
|
|
4389 |
0C26: BSF 03.6 |
|
|
4390 |
0C27: MOVWF 24 |
|
|
4391 |
0C28: MOVWF 23 |
|
|
4392 |
0C29: MOVLW BB |
|
|
4393 |
0C2A: MOVWF 22 |
|
|
4394 |
0C2B: MOVLW 84 |
|
|
4395 |
0C2C: MOVWF 21 |
|
|
4396 |
0C2D: MOVF 7A,W |
|
|
4397 |
0C2E: MOVWF 28 |
|
|
4398 |
0C2F: MOVF 79,W |
|
|
4399 |
0C30: MOVWF 27 |
|
|
4400 |
0C31: MOVF 78,W |
|
|
4401 |
0C32: MOVWF 26 |
|
|
4402 |
0C33: MOVF 77,W |
|
|
4403 |
0C34: MOVWF 25 |
|
|
4404 |
0C35: BCF 0A.3 |
|
|
4405 |
0C36: BCF 03.6 |
|
|
4406 |
0C37: CALL 5DC |
|
|
4407 |
0C38: BSF 0A.3 |
960 |
jacho |
4408 |
.................... } |
1045 |
jacho |
4409 |
0C39: BCF 0A.3 |
|
|
4410 |
0C3A: BSF 0A.4 |
|
|
4411 |
0C3B: GOTO 611 (RETURN) |
960 |
jacho |
4412 |
.................... |
|
|
4413 |
.................... float SHT25_get_hum() |
|
|
4414 |
.................... { |
|
|
4415 |
.................... unsigned int8 MSB, LSB, Check; |
|
|
4416 |
.................... unsigned int16 data; |
|
|
4417 |
.................... |
|
|
4418 |
.................... i2c_start(); //RH |
1045 |
jacho |
4419 |
0C3C: BSF 28.3 |
|
|
4420 |
0C3D: MOVF 28,W |
|
|
4421 |
0C3E: BSF 03.5 |
|
|
4422 |
0C3F: MOVWF 07 |
|
|
4423 |
0C40: NOP |
|
|
4424 |
0C41: BCF 03.5 |
|
|
4425 |
0C42: BSF 28.4 |
|
|
4426 |
0C43: MOVF 28,W |
|
|
4427 |
0C44: BSF 03.5 |
|
|
4428 |
0C45: MOVWF 07 |
|
|
4429 |
0C46: NOP |
|
|
4430 |
0C47: BCF 03.5 |
|
|
4431 |
0C48: BCF 07.3 |
|
|
4432 |
0C49: BCF 28.3 |
|
|
4433 |
0C4A: MOVF 28,W |
|
|
4434 |
0C4B: BSF 03.5 |
|
|
4435 |
0C4C: MOVWF 07 |
|
|
4436 |
0C4D: NOP |
|
|
4437 |
0C4E: BCF 03.5 |
|
|
4438 |
0C4F: BCF 07.4 |
|
|
4439 |
0C50: BCF 28.4 |
|
|
4440 |
0C51: MOVF 28,W |
|
|
4441 |
0C52: BSF 03.5 |
|
|
4442 |
0C53: MOVWF 07 |
960 |
jacho |
4443 |
.................... I2C_Write(SHT25_ADDR); |
1045 |
jacho |
4444 |
0C54: MOVLW 80 |
|
|
4445 |
0C55: BCF 03.5 |
|
|
4446 |
0C56: BSF 03.6 |
|
|
4447 |
0C57: MOVWF 12 |
|
|
4448 |
0C58: BCF 0A.3 |
|
|
4449 |
0C59: BCF 03.6 |
|
|
4450 |
0C5A: CALL 22E |
|
|
4451 |
0C5B: BSF 0A.3 |
960 |
jacho |
4452 |
.................... I2C_write(0xE5); |
1045 |
jacho |
4453 |
0C5C: MOVLW E5 |
|
|
4454 |
0C5D: BSF 03.6 |
|
|
4455 |
0C5E: MOVWF 12 |
|
|
4456 |
0C5F: BCF 0A.3 |
|
|
4457 |
0C60: BCF 03.6 |
|
|
4458 |
0C61: CALL 22E |
|
|
4459 |
0C62: BSF 0A.3 |
960 |
jacho |
4460 |
.................... |
|
|
4461 |
.................... delay_ms(100); |
1045 |
jacho |
4462 |
0C63: MOVLW 64 |
|
|
4463 |
0C64: BSF 03.5 |
|
|
4464 |
0C65: MOVWF 62 |
|
|
4465 |
0C66: BCF 0A.3 |
|
|
4466 |
0C67: BCF 03.5 |
|
|
4467 |
0C68: CALL 303 |
|
|
4468 |
0C69: BSF 0A.3 |
960 |
jacho |
4469 |
.................... |
|
|
4470 |
.................... i2c_start(); |
1045 |
jacho |
4471 |
0C6A: BSF 28.3 |
|
|
4472 |
0C6B: MOVF 28,W |
|
|
4473 |
0C6C: BSF 03.5 |
|
|
4474 |
0C6D: MOVWF 07 |
|
|
4475 |
0C6E: NOP |
|
|
4476 |
0C6F: BCF 03.5 |
|
|
4477 |
0C70: BSF 28.4 |
|
|
4478 |
0C71: MOVF 28,W |
|
|
4479 |
0C72: BSF 03.5 |
|
|
4480 |
0C73: MOVWF 07 |
|
|
4481 |
0C74: NOP |
|
|
4482 |
0C75: BCF 03.5 |
|
|
4483 |
0C76: BTFSS 07.4 |
|
|
4484 |
0C77: GOTO 476 |
|
|
4485 |
0C78: BCF 07.3 |
|
|
4486 |
0C79: BCF 28.3 |
|
|
4487 |
0C7A: MOVF 28,W |
|
|
4488 |
0C7B: BSF 03.5 |
|
|
4489 |
0C7C: MOVWF 07 |
|
|
4490 |
0C7D: NOP |
|
|
4491 |
0C7E: BCF 03.5 |
|
|
4492 |
0C7F: BCF 07.4 |
|
|
4493 |
0C80: BCF 28.4 |
|
|
4494 |
0C81: MOVF 28,W |
|
|
4495 |
0C82: BSF 03.5 |
|
|
4496 |
0C83: MOVWF 07 |
960 |
jacho |
4497 |
.................... I2C_Write(SHT25_ADDR+1); |
1045 |
jacho |
4498 |
0C84: MOVLW 81 |
|
|
4499 |
0C85: BCF 03.5 |
|
|
4500 |
0C86: BSF 03.6 |
|
|
4501 |
0C87: MOVWF 12 |
|
|
4502 |
0C88: BCF 0A.3 |
|
|
4503 |
0C89: BCF 03.6 |
|
|
4504 |
0C8A: CALL 22E |
|
|
4505 |
0C8B: BSF 0A.3 |
960 |
jacho |
4506 |
.................... MSB=i2c_read(1); |
1045 |
jacho |
4507 |
0C8C: MOVLW 01 |
|
|
4508 |
0C8D: MOVWF 77 |
|
|
4509 |
0C8E: BCF 0A.3 |
|
|
4510 |
0C8F: CALL 2B6 |
|
|
4511 |
0C90: BSF 0A.3 |
|
|
4512 |
0C91: MOVF 78,W |
|
|
4513 |
0C92: BSF 03.5 |
|
|
4514 |
0C93: MOVWF 5D |
960 |
jacho |
4515 |
.................... LSB=i2c_read(1); |
1045 |
jacho |
4516 |
0C94: MOVLW 01 |
|
|
4517 |
0C95: MOVWF 77 |
|
|
4518 |
0C96: BCF 0A.3 |
|
|
4519 |
0C97: BCF 03.5 |
|
|
4520 |
0C98: CALL 2B6 |
|
|
4521 |
0C99: BSF 0A.3 |
|
|
4522 |
0C9A: MOVF 78,W |
|
|
4523 |
0C9B: BSF 03.5 |
|
|
4524 |
0C9C: MOVWF 5E |
960 |
jacho |
4525 |
.................... Check=i2c_read(0); |
1045 |
jacho |
4526 |
0C9D: CLRF 77 |
|
|
4527 |
0C9E: BCF 0A.3 |
|
|
4528 |
0C9F: BCF 03.5 |
|
|
4529 |
0CA0: CALL 2B6 |
|
|
4530 |
0CA1: BSF 0A.3 |
|
|
4531 |
0CA2: MOVF 78,W |
|
|
4532 |
0CA3: BSF 03.5 |
|
|
4533 |
0CA4: MOVWF 5F |
960 |
jacho |
4534 |
.................... i2c_stop(); |
1045 |
jacho |
4535 |
0CA5: BCF 03.5 |
|
|
4536 |
0CA6: BCF 28.3 |
|
|
4537 |
0CA7: MOVF 28,W |
|
|
4538 |
0CA8: BSF 03.5 |
|
|
4539 |
0CA9: MOVWF 07 |
|
|
4540 |
0CAA: NOP |
|
|
4541 |
0CAB: BCF 03.5 |
|
|
4542 |
0CAC: BSF 28.4 |
|
|
4543 |
0CAD: MOVF 28,W |
|
|
4544 |
0CAE: BSF 03.5 |
|
|
4545 |
0CAF: MOVWF 07 |
|
|
4546 |
0CB0: BCF 03.5 |
|
|
4547 |
0CB1: BTFSS 07.4 |
|
|
4548 |
0CB2: GOTO 4B1 |
|
|
4549 |
0CB3: NOP |
|
|
4550 |
0CB4: GOTO 4B5 |
|
|
4551 |
0CB5: NOP |
|
|
4552 |
0CB6: BSF 28.3 |
|
|
4553 |
0CB7: MOVF 28,W |
|
|
4554 |
0CB8: BSF 03.5 |
|
|
4555 |
0CB9: MOVWF 07 |
|
|
4556 |
0CBA: NOP |
960 |
jacho |
4557 |
.................... |
|
|
4558 |
.................... LSB = LSB >> 2; // trow out status bits |
1045 |
jacho |
4559 |
0CBB: RRF 5E,F |
|
|
4560 |
0CBC: RRF 5E,F |
|
|
4561 |
0CBD: MOVLW 3F |
|
|
4562 |
0CBE: ANDWF 5E,F |
960 |
jacho |
4563 |
.................... |
|
|
4564 |
.................... data = (((unsigned int16) MSB << 8) + (LSB << 4) ); |
1045 |
jacho |
4565 |
0CBF: CLRF 63 |
|
|
4566 |
0CC0: MOVF 5D,W |
|
|
4567 |
0CC1: MOVWF 62 |
|
|
4568 |
0CC2: MOVWF 63 |
|
|
4569 |
0CC3: CLRF 62 |
|
|
4570 |
0CC4: SWAPF 5E,W |
|
|
4571 |
0CC5: MOVWF 77 |
|
|
4572 |
0CC6: MOVLW F0 |
|
|
4573 |
0CC7: ANDWF 77,F |
|
|
4574 |
0CC8: MOVF 77,W |
|
|
4575 |
0CC9: ADDWF 62,W |
|
|
4576 |
0CCA: MOVWF 60 |
|
|
4577 |
0CCB: MOVF 63,W |
|
|
4578 |
0CCC: MOVWF 61 |
|
|
4579 |
0CCD: BTFSC 03.0 |
|
|
4580 |
0CCE: INCF 61,F |
|
|
4581 |
0CCF: BCF 03.5 |
|
|
4582 |
0CD0: CLRF 27 |
|
|
4583 |
0CD1: BTFSC 0B.7 |
|
|
4584 |
0CD2: BSF 27.7 |
|
|
4585 |
0CD3: BCF 0B.7 |
960 |
jacho |
4586 |
.................... return( -6.0 + 125.0*((float)data/0xFFFF)); |
1045 |
jacho |
4587 |
0CD4: BSF 03.5 |
|
|
4588 |
0CD5: MOVF 61,W |
|
|
4589 |
0CD6: BCF 03.5 |
|
|
4590 |
0CD7: BSF 03.6 |
|
|
4591 |
0CD8: MOVWF 45 |
|
|
4592 |
0CD9: BSF 03.5 |
|
|
4593 |
0CDA: BCF 03.6 |
|
|
4594 |
0CDB: MOVF 60,W |
|
|
4595 |
0CDC: BCF 03.5 |
|
|
4596 |
0CDD: BSF 03.6 |
|
|
4597 |
0CDE: MOVWF 44 |
|
|
4598 |
0CDF: BCF 0A.3 |
|
|
4599 |
0CE0: BCF 03.6 |
|
|
4600 |
0CE1: CALL 038 |
|
|
4601 |
0CE2: BSF 0A.3 |
|
|
4602 |
0CE3: BTFSC 27.7 |
|
|
4603 |
0CE4: BSF 0B.7 |
|
|
4604 |
0CE5: MOVF 77,W |
|
|
4605 |
0CE6: BSF 03.5 |
|
|
4606 |
0CE7: MOVWF 62 |
|
|
4607 |
0CE8: MOVF 78,W |
|
|
4608 |
0CE9: MOVWF 63 |
|
|
4609 |
0CEA: MOVF 79,W |
|
|
4610 |
0CEB: MOVWF 64 |
|
|
4611 |
0CEC: MOVF 7A,W |
|
|
4612 |
0CED: MOVWF 65 |
|
|
4613 |
0CEE: BCF 03.5 |
|
|
4614 |
0CEF: CLRF 27 |
|
|
4615 |
0CF0: BTFSC 0B.7 |
|
|
4616 |
0CF1: BSF 27.7 |
|
|
4617 |
0CF2: BCF 0B.7 |
|
|
4618 |
0CF3: BSF 03.5 |
|
|
4619 |
0CF4: MOVF 65,W |
|
|
4620 |
0CF5: BCF 03.5 |
|
|
4621 |
0CF6: BSF 03.6 |
|
|
4622 |
0CF7: MOVWF 59 |
|
|
4623 |
0CF8: BSF 03.5 |
|
|
4624 |
0CF9: BCF 03.6 |
|
|
4625 |
0CFA: MOVF 64,W |
|
|
4626 |
0CFB: BCF 03.5 |
|
|
4627 |
0CFC: BSF 03.6 |
|
|
4628 |
0CFD: MOVWF 58 |
|
|
4629 |
0CFE: BSF 03.5 |
|
|
4630 |
0CFF: BCF 03.6 |
|
|
4631 |
0D00: MOVF 63,W |
|
|
4632 |
0D01: BCF 03.5 |
|
|
4633 |
0D02: BSF 03.6 |
|
|
4634 |
0D03: MOVWF 57 |
|
|
4635 |
0D04: BSF 03.5 |
|
|
4636 |
0D05: BCF 03.6 |
|
|
4637 |
0D06: MOVF 62,W |
|
|
4638 |
0D07: BCF 03.5 |
|
|
4639 |
0D08: BSF 03.6 |
|
|
4640 |
0D09: MOVWF 56 |
|
|
4641 |
0D0A: CLRF 5D |
|
|
4642 |
0D0B: MOVLW FF |
|
|
4643 |
0D0C: MOVWF 5C |
|
|
4644 |
0D0D: MOVLW 7F |
|
|
4645 |
0D0E: MOVWF 5B |
|
|
4646 |
0D0F: MOVLW 8E |
|
|
4647 |
0D10: MOVWF 5A |
|
|
4648 |
0D11: BCF 0A.3 |
|
|
4649 |
0D12: BCF 03.6 |
|
|
4650 |
0D13: CALL 057 |
|
|
4651 |
0D14: BSF 0A.3 |
|
|
4652 |
0D15: BTFSC 27.7 |
|
|
4653 |
0D16: BSF 0B.7 |
|
|
4654 |
0D17: BSF 03.6 |
|
|
4655 |
0D18: CLRF 24 |
|
|
4656 |
0D19: CLRF 23 |
|
|
4657 |
0D1A: MOVLW 7A |
|
|
4658 |
0D1B: MOVWF 22 |
|
|
4659 |
0D1C: MOVLW 85 |
|
|
4660 |
0D1D: MOVWF 21 |
|
|
4661 |
0D1E: MOVF 7A,W |
|
|
4662 |
0D1F: MOVWF 28 |
960 |
jacho |
4663 |
0D20: MOVF 79,W |
1045 |
jacho |
4664 |
0D21: MOVWF 27 |
|
|
4665 |
0D22: MOVF 78,W |
|
|
4666 |
0D23: MOVWF 26 |
|
|
4667 |
0D24: MOVF 77,W |
|
|
4668 |
0D25: MOVWF 25 |
|
|
4669 |
0D26: BCF 03.6 |
|
|
4670 |
0D27: CALL 2AB |
|
|
4671 |
0D28: BCF 03.1 |
|
|
4672 |
0D29: BSF 03.6 |
|
|
4673 |
0D2A: CLRF 24 |
|
|
4674 |
0D2B: CLRF 23 |
|
|
4675 |
0D2C: MOVLW C0 |
|
|
4676 |
0D2D: MOVWF 22 |
|
|
4677 |
0D2E: MOVLW 81 |
|
|
4678 |
0D2F: MOVWF 21 |
|
|
4679 |
0D30: MOVF 7A,W |
|
|
4680 |
0D31: MOVWF 28 |
|
|
4681 |
0D32: MOVF 79,W |
|
|
4682 |
0D33: MOVWF 27 |
|
|
4683 |
0D34: MOVF 78,W |
|
|
4684 |
0D35: MOVWF 26 |
|
|
4685 |
0D36: MOVF 77,W |
|
|
4686 |
0D37: MOVWF 25 |
|
|
4687 |
0D38: BCF 0A.3 |
|
|
4688 |
0D39: BCF 03.6 |
|
|
4689 |
0D3A: CALL 5DC |
|
|
4690 |
0D3B: BSF 0A.3 |
960 |
jacho |
4691 |
.................... } |
1045 |
jacho |
4692 |
0D3C: BCF 0A.3 |
|
|
4693 |
0D3D: BSF 0A.4 |
|
|
4694 |
0D3E: GOTO 61E (RETURN) |
960 |
jacho |
4695 |
.................... |
|
|
4696 |
.................... |
|
|
4697 |
.................... |
|
|
4698 |
.................... |
|
|
4699 |
.................... #include "MPL3115.h" |
|
|
4700 |
.................... #define MPL3115_ADDR_R 0xC1 //addresa pro cteni |
|
|
4701 |
.................... #define MPL3115_ADDR_W 0xC0 |
|
|
4702 |
.................... |
|
|
4703 |
.................... #include "MPL3115.c" |
|
|
4704 |
.................... void mpl3115_setA (void) //nastavení pro výku |
|
|
4705 |
.................... { |
|
|
4706 |
.................... |
|
|
4707 |
.................... |
|
|
4708 |
.................... i2c_start(); //STANDBY mode |
|
|
4709 |
* |
1045 |
jacho |
4710 |
090A: BSF 28.3 |
|
|
4711 |
090B: MOVF 28,W |
|
|
4712 |
090C: BSF 03.5 |
|
|
4713 |
090D: MOVWF 07 |
|
|
4714 |
090E: NOP |
|
|
4715 |
090F: BCF 03.5 |
|
|
4716 |
0910: BSF 28.4 |
|
|
4717 |
0911: MOVF 28,W |
|
|
4718 |
0912: BSF 03.5 |
|
|
4719 |
0913: MOVWF 07 |
|
|
4720 |
0914: NOP |
|
|
4721 |
0915: BCF 03.5 |
|
|
4722 |
0916: BCF 07.3 |
|
|
4723 |
0917: BCF 28.3 |
|
|
4724 |
0918: MOVF 28,W |
|
|
4725 |
0919: BSF 03.5 |
|
|
4726 |
091A: MOVWF 07 |
|
|
4727 |
091B: NOP |
|
|
4728 |
091C: BCF 03.5 |
|
|
4729 |
091D: BCF 07.4 |
|
|
4730 |
091E: BCF 28.4 |
|
|
4731 |
091F: MOVF 28,W |
|
|
4732 |
0920: BSF 03.5 |
|
|
4733 |
0921: MOVWF 07 |
960 |
jacho |
4734 |
.................... I2C_Write(MPL3115_ADDR_W); |
1045 |
jacho |
4735 |
0922: MOVLW C0 |
|
|
4736 |
0923: BCF 03.5 |
|
|
4737 |
0924: BSF 03.6 |
|
|
4738 |
0925: MOVWF 12 |
|
|
4739 |
0926: BCF 0A.3 |
|
|
4740 |
0927: BCF 03.6 |
|
|
4741 |
0928: CALL 22E |
|
|
4742 |
0929: BSF 0A.3 |
960 |
jacho |
4743 |
.................... I2C_write(0x26); |
1045 |
jacho |
4744 |
092A: MOVLW 26 |
|
|
4745 |
092B: BSF 03.6 |
|
|
4746 |
092C: MOVWF 12 |
|
|
4747 |
092D: BCF 0A.3 |
|
|
4748 |
092E: BCF 03.6 |
|
|
4749 |
092F: CALL 22E |
|
|
4750 |
0930: BSF 0A.3 |
960 |
jacho |
4751 |
.................... I2C_write(0xB8); |
1045 |
jacho |
4752 |
0931: MOVLW B8 |
|
|
4753 |
0932: BSF 03.6 |
|
|
4754 |
0933: MOVWF 12 |
|
|
4755 |
0934: BCF 0A.3 |
|
|
4756 |
0935: BCF 03.6 |
|
|
4757 |
0936: CALL 22E |
|
|
4758 |
0937: BSF 0A.3 |
960 |
jacho |
4759 |
.................... i2c_stop(); |
1045 |
jacho |
4760 |
0938: BCF 28.3 |
|
|
4761 |
0939: MOVF 28,W |
|
|
4762 |
093A: BSF 03.5 |
|
|
4763 |
093B: MOVWF 07 |
|
|
4764 |
093C: NOP |
|
|
4765 |
093D: BCF 03.5 |
|
|
4766 |
093E: BSF 28.4 |
|
|
4767 |
093F: MOVF 28,W |
|
|
4768 |
0940: BSF 03.5 |
|
|
4769 |
0941: MOVWF 07 |
|
|
4770 |
0942: BCF 03.5 |
|
|
4771 |
0943: BTFSS 07.4 |
|
|
4772 |
0944: GOTO 143 |
|
|
4773 |
0945: NOP |
|
|
4774 |
0946: GOTO 147 |
|
|
4775 |
0947: NOP |
|
|
4776 |
0948: BSF 28.3 |
|
|
4777 |
0949: MOVF 28,W |
|
|
4778 |
094A: BSF 03.5 |
|
|
4779 |
094B: MOVWF 07 |
|
|
4780 |
094C: NOP |
960 |
jacho |
4781 |
.................... |
|
|
4782 |
.................... i2c_start(); //PT_DATA_CFG set |
1045 |
jacho |
4783 |
094D: BCF 03.5 |
|
|
4784 |
094E: BSF 28.3 |
|
|
4785 |
094F: MOVF 28,W |
|
|
4786 |
0950: BSF 03.5 |
|
|
4787 |
0951: MOVWF 07 |
|
|
4788 |
0952: NOP |
|
|
4789 |
0953: BCF 03.5 |
|
|
4790 |
0954: BSF 28.4 |
|
|
4791 |
0955: MOVF 28,W |
|
|
4792 |
0956: BSF 03.5 |
|
|
4793 |
0957: MOVWF 07 |
|
|
4794 |
0958: NOP |
|
|
4795 |
0959: BCF 03.5 |
|
|
4796 |
095A: BCF 07.3 |
|
|
4797 |
095B: BCF 28.3 |
|
|
4798 |
095C: MOVF 28,W |
|
|
4799 |
095D: BSF 03.5 |
|
|
4800 |
095E: MOVWF 07 |
|
|
4801 |
095F: NOP |
|
|
4802 |
0960: BCF 03.5 |
|
|
4803 |
0961: BCF 07.4 |
|
|
4804 |
0962: BCF 28.4 |
|
|
4805 |
0963: MOVF 28,W |
|
|
4806 |
0964: BSF 03.5 |
|
|
4807 |
0965: MOVWF 07 |
960 |
jacho |
4808 |
.................... I2C_Write(MPL3115_ADDR_W); |
1045 |
jacho |
4809 |
0966: MOVLW C0 |
|
|
4810 |
0967: BCF 03.5 |
|
|
4811 |
0968: BSF 03.6 |
|
|
4812 |
0969: MOVWF 12 |
|
|
4813 |
096A: BCF 0A.3 |
|
|
4814 |
096B: BCF 03.6 |
|
|
4815 |
096C: CALL 22E |
|
|
4816 |
096D: BSF 0A.3 |
960 |
jacho |
4817 |
.................... I2C_write(0x13); |
1045 |
jacho |
4818 |
096E: MOVLW 13 |
|
|
4819 |
096F: BSF 03.6 |
|
|
4820 |
0970: MOVWF 12 |
|
|
4821 |
0971: BCF 0A.3 |
|
|
4822 |
0972: BCF 03.6 |
|
|
4823 |
0973: CALL 22E |
|
|
4824 |
0974: BSF 0A.3 |
960 |
jacho |
4825 |
.................... I2C_write(0x07); //hodnota |
1045 |
jacho |
4826 |
0975: MOVLW 07 |
|
|
4827 |
0976: BSF 03.6 |
|
|
4828 |
0977: MOVWF 12 |
|
|
4829 |
0978: BCF 0A.3 |
|
|
4830 |
0979: BCF 03.6 |
|
|
4831 |
097A: CALL 22E |
|
|
4832 |
097B: BSF 0A.3 |
960 |
jacho |
4833 |
.................... i2c_stop(); |
1045 |
jacho |
4834 |
097C: BCF 28.3 |
|
|
4835 |
097D: MOVF 28,W |
|
|
4836 |
097E: BSF 03.5 |
|
|
4837 |
097F: MOVWF 07 |
|
|
4838 |
0980: NOP |
|
|
4839 |
0981: BCF 03.5 |
|
|
4840 |
0982: BSF 28.4 |
|
|
4841 |
0983: MOVF 28,W |
|
|
4842 |
0984: BSF 03.5 |
|
|
4843 |
0985: MOVWF 07 |
|
|
4844 |
0986: BCF 03.5 |
|
|
4845 |
0987: BTFSS 07.4 |
|
|
4846 |
0988: GOTO 187 |
|
|
4847 |
0989: NOP |
|
|
4848 |
098A: GOTO 18B |
|
|
4849 |
098B: NOP |
|
|
4850 |
098C: BSF 28.3 |
|
|
4851 |
098D: MOVF 28,W |
|
|
4852 |
098E: BSF 03.5 |
|
|
4853 |
098F: MOVWF 07 |
|
|
4854 |
0990: NOP |
960 |
jacho |
4855 |
.................... |
|
|
4856 |
.................... i2c_start(); //ACTIVE mode |
1045 |
jacho |
4857 |
0991: BCF 03.5 |
|
|
4858 |
0992: BSF 28.3 |
|
|
4859 |
0993: MOVF 28,W |
|
|
4860 |
0994: BSF 03.5 |
|
|
4861 |
0995: MOVWF 07 |
|
|
4862 |
0996: NOP |
|
|
4863 |
0997: BCF 03.5 |
|
|
4864 |
0998: BSF 28.4 |
|
|
4865 |
0999: MOVF 28,W |
|
|
4866 |
099A: BSF 03.5 |
|
|
4867 |
099B: MOVWF 07 |
|
|
4868 |
099C: NOP |
|
|
4869 |
099D: BCF 03.5 |
|
|
4870 |
099E: BCF 07.3 |
|
|
4871 |
099F: BCF 28.3 |
|
|
4872 |
09A0: MOVF 28,W |
|
|
4873 |
09A1: BSF 03.5 |
|
|
4874 |
09A2: MOVWF 07 |
|
|
4875 |
09A3: NOP |
|
|
4876 |
09A4: BCF 03.5 |
|
|
4877 |
09A5: BCF 07.4 |
|
|
4878 |
09A6: BCF 28.4 |
|
|
4879 |
09A7: MOVF 28,W |
|
|
4880 |
09A8: BSF 03.5 |
|
|
4881 |
09A9: MOVWF 07 |
960 |
jacho |
4882 |
.................... I2C_Write(MPL3115_ADDR_W); |
1045 |
jacho |
4883 |
09AA: MOVLW C0 |
|
|
4884 |
09AB: BCF 03.5 |
|
|
4885 |
09AC: BSF 03.6 |
|
|
4886 |
09AD: MOVWF 12 |
|
|
4887 |
09AE: BCF 0A.3 |
|
|
4888 |
09AF: BCF 03.6 |
|
|
4889 |
09B0: CALL 22E |
|
|
4890 |
09B1: BSF 0A.3 |
960 |
jacho |
4891 |
.................... I2C_write(0x26); |
1045 |
jacho |
4892 |
09B2: MOVLW 26 |
|
|
4893 |
09B3: BSF 03.6 |
|
|
4894 |
09B4: MOVWF 12 |
|
|
4895 |
09B5: BCF 0A.3 |
|
|
4896 |
09B6: BCF 03.6 |
|
|
4897 |
09B7: CALL 22E |
|
|
4898 |
09B8: BSF 0A.3 |
960 |
jacho |
4899 |
.................... I2C_write(0xB9); |
1045 |
jacho |
4900 |
09B9: MOVLW B9 |
|
|
4901 |
09BA: BSF 03.6 |
|
|
4902 |
09BB: MOVWF 12 |
|
|
4903 |
09BC: BCF 0A.3 |
|
|
4904 |
09BD: BCF 03.6 |
|
|
4905 |
09BE: CALL 22E |
|
|
4906 |
09BF: BSF 0A.3 |
960 |
jacho |
4907 |
.................... i2c_stop(); |
1045 |
jacho |
4908 |
09C0: BCF 28.3 |
|
|
4909 |
09C1: MOVF 28,W |
|
|
4910 |
09C2: BSF 03.5 |
|
|
4911 |
09C3: MOVWF 07 |
|
|
4912 |
09C4: NOP |
|
|
4913 |
09C5: BCF 03.5 |
|
|
4914 |
09C6: BSF 28.4 |
|
|
4915 |
09C7: MOVF 28,W |
|
|
4916 |
09C8: BSF 03.5 |
|
|
4917 |
09C9: MOVWF 07 |
|
|
4918 |
09CA: BCF 03.5 |
|
|
4919 |
09CB: BTFSS 07.4 |
|
|
4920 |
09CC: GOTO 1CB |
|
|
4921 |
09CD: NOP |
|
|
4922 |
09CE: GOTO 1CF |
|
|
4923 |
09CF: NOP |
|
|
4924 |
09D0: BSF 28.3 |
|
|
4925 |
09D1: MOVF 28,W |
|
|
4926 |
09D2: BSF 03.5 |
|
|
4927 |
09D3: MOVWF 07 |
|
|
4928 |
09D4: NOP |
960 |
jacho |
4929 |
.................... } |
1045 |
jacho |
4930 |
09D5: BCF 03.5 |
|
|
4931 |
09D6: BCF 0A.3 |
|
|
4932 |
09D7: BSF 0A.4 |
|
|
4933 |
09D8: GOTO 5F4 (RETURN) |
960 |
jacho |
4934 |
.................... |
|
|
4935 |
.................... void mpl3115_setP (void) //nastavení pro tlak |
|
|
4936 |
.................... { |
|
|
4937 |
.................... |
|
|
4938 |
.................... |
|
|
4939 |
.................... i2c_start(); //STANDBY mode |
|
|
4940 |
* |
1045 |
jacho |
4941 |
04BB: BSF 28.3 |
|
|
4942 |
04BC: MOVF 28,W |
|
|
4943 |
04BD: BSF 03.5 |
|
|
4944 |
04BE: MOVWF 07 |
|
|
4945 |
04BF: NOP |
|
|
4946 |
04C0: BCF 03.5 |
|
|
4947 |
04C1: BSF 28.4 |
|
|
4948 |
04C2: MOVF 28,W |
|
|
4949 |
04C3: BSF 03.5 |
|
|
4950 |
04C4: MOVWF 07 |
|
|
4951 |
04C5: NOP |
|
|
4952 |
04C6: BCF 03.5 |
|
|
4953 |
04C7: BCF 07.3 |
|
|
4954 |
04C8: BCF 28.3 |
|
|
4955 |
04C9: MOVF 28,W |
|
|
4956 |
04CA: BSF 03.5 |
|
|
4957 |
04CB: MOVWF 07 |
|
|
4958 |
04CC: NOP |
|
|
4959 |
04CD: BCF 03.5 |
|
|
4960 |
04CE: BCF 07.4 |
|
|
4961 |
04CF: BCF 28.4 |
|
|
4962 |
04D0: MOVF 28,W |
|
|
4963 |
04D1: BSF 03.5 |
|
|
4964 |
04D2: MOVWF 07 |
960 |
jacho |
4965 |
.................... I2C_Write(MPL3115_ADDR_W); |
1045 |
jacho |
4966 |
04D3: MOVLW C0 |
|
|
4967 |
04D4: BCF 03.5 |
|
|
4968 |
04D5: BSF 03.6 |
|
|
4969 |
04D6: MOVWF 12 |
|
|
4970 |
04D7: BCF 03.6 |
|
|
4971 |
04D8: CALL 22E |
960 |
jacho |
4972 |
.................... I2C_write(0x26); |
1045 |
jacho |
4973 |
04D9: MOVLW 26 |
|
|
4974 |
04DA: BSF 03.6 |
|
|
4975 |
04DB: MOVWF 12 |
|
|
4976 |
04DC: BCF 03.6 |
|
|
4977 |
04DD: CALL 22E |
960 |
jacho |
4978 |
.................... I2C_write(0xB8); |
1045 |
jacho |
4979 |
04DE: MOVLW B8 |
|
|
4980 |
04DF: BSF 03.6 |
|
|
4981 |
04E0: MOVWF 12 |
|
|
4982 |
04E1: BCF 03.6 |
|
|
4983 |
04E2: CALL 22E |
960 |
jacho |
4984 |
.................... i2c_stop(); |
1045 |
jacho |
4985 |
04E3: BCF 28.3 |
|
|
4986 |
04E4: MOVF 28,W |
|
|
4987 |
04E5: BSF 03.5 |
|
|
4988 |
04E6: MOVWF 07 |
|
|
4989 |
04E7: NOP |
|
|
4990 |
04E8: BCF 03.5 |
|
|
4991 |
04E9: BSF 28.4 |
|
|
4992 |
04EA: MOVF 28,W |
|
|
4993 |
04EB: BSF 03.5 |
|
|
4994 |
04EC: MOVWF 07 |
|
|
4995 |
04ED: BCF 03.5 |
|
|
4996 |
04EE: BTFSS 07.4 |
|
|
4997 |
04EF: GOTO 4EE |
|
|
4998 |
04F0: NOP |
|
|
4999 |
04F1: GOTO 4F2 |
|
|
5000 |
04F2: NOP |
|
|
5001 |
04F3: BSF 28.3 |
|
|
5002 |
04F4: MOVF 28,W |
|
|
5003 |
04F5: BSF 03.5 |
|
|
5004 |
04F6: MOVWF 07 |
|
|
5005 |
04F7: NOP |
960 |
jacho |
5006 |
.................... |
|
|
5007 |
.................... i2c_start(); //PT_DATA_CFG set |
1045 |
jacho |
5008 |
04F8: BCF 03.5 |
|
|
5009 |
04F9: BSF 28.3 |
|
|
5010 |
04FA: MOVF 28,W |
|
|
5011 |
04FB: BSF 03.5 |
|
|
5012 |
04FC: MOVWF 07 |
|
|
5013 |
04FD: NOP |
|
|
5014 |
04FE: BCF 03.5 |
|
|
5015 |
04FF: BSF 28.4 |
|
|
5016 |
0500: MOVF 28,W |
|
|
5017 |
0501: BSF 03.5 |
|
|
5018 |
0502: MOVWF 07 |
|
|
5019 |
0503: NOP |
|
|
5020 |
0504: BCF 03.5 |
|
|
5021 |
0505: BCF 07.3 |
|
|
5022 |
0506: BCF 28.3 |
|
|
5023 |
0507: MOVF 28,W |
|
|
5024 |
0508: BSF 03.5 |
|
|
5025 |
0509: MOVWF 07 |
|
|
5026 |
050A: NOP |
|
|
5027 |
050B: BCF 03.5 |
|
|
5028 |
050C: BCF 07.4 |
|
|
5029 |
050D: BCF 28.4 |
|
|
5030 |
050E: MOVF 28,W |
|
|
5031 |
050F: BSF 03.5 |
|
|
5032 |
0510: MOVWF 07 |
960 |
jacho |
5033 |
.................... I2C_Write(MPL3115_ADDR_W); |
1045 |
jacho |
5034 |
0511: MOVLW C0 |
|
|
5035 |
0512: BCF 03.5 |
|
|
5036 |
0513: BSF 03.6 |
|
|
5037 |
0514: MOVWF 12 |
|
|
5038 |
0515: BCF 03.6 |
|
|
5039 |
0516: CALL 22E |
960 |
jacho |
5040 |
.................... I2C_write(0x13); |
1045 |
jacho |
5041 |
0517: MOVLW 13 |
|
|
5042 |
0518: BSF 03.6 |
|
|
5043 |
0519: MOVWF 12 |
|
|
5044 |
051A: BCF 03.6 |
|
|
5045 |
051B: CALL 22E |
960 |
jacho |
5046 |
.................... I2C_write(0x07); //hodnota |
1045 |
jacho |
5047 |
051C: MOVLW 07 |
|
|
5048 |
051D: BSF 03.6 |
|
|
5049 |
051E: MOVWF 12 |
|
|
5050 |
051F: BCF 03.6 |
|
|
5051 |
0520: CALL 22E |
960 |
jacho |
5052 |
.................... i2c_stop(); |
1045 |
jacho |
5053 |
0521: BCF 28.3 |
|
|
5054 |
0522: MOVF 28,W |
|
|
5055 |
0523: BSF 03.5 |
|
|
5056 |
0524: MOVWF 07 |
|
|
5057 |
0525: NOP |
|
|
5058 |
0526: BCF 03.5 |
|
|
5059 |
0527: BSF 28.4 |
|
|
5060 |
0528: MOVF 28,W |
|
|
5061 |
0529: BSF 03.5 |
|
|
5062 |
052A: MOVWF 07 |
|
|
5063 |
052B: BCF 03.5 |
|
|
5064 |
052C: BTFSS 07.4 |
|
|
5065 |
052D: GOTO 52C |
|
|
5066 |
052E: NOP |
|
|
5067 |
052F: GOTO 530 |
|
|
5068 |
0530: NOP |
|
|
5069 |
0531: BSF 28.3 |
|
|
5070 |
0532: MOVF 28,W |
|
|
5071 |
0533: BSF 03.5 |
|
|
5072 |
0534: MOVWF 07 |
|
|
5073 |
0535: NOP |
960 |
jacho |
5074 |
.................... |
|
|
5075 |
.................... i2c_start(); //ACTIVE mode |
1045 |
jacho |
5076 |
0536: BCF 03.5 |
|
|
5077 |
0537: BSF 28.3 |
|
|
5078 |
0538: MOVF 28,W |
|
|
5079 |
0539: BSF 03.5 |
|
|
5080 |
053A: MOVWF 07 |
|
|
5081 |
053B: NOP |
|
|
5082 |
053C: BCF 03.5 |
|
|
5083 |
053D: BSF 28.4 |
|
|
5084 |
053E: MOVF 28,W |
|
|
5085 |
053F: BSF 03.5 |
|
|
5086 |
0540: MOVWF 07 |
|
|
5087 |
0541: NOP |
|
|
5088 |
0542: BCF 03.5 |
|
|
5089 |
0543: BCF 07.3 |
|
|
5090 |
0544: BCF 28.3 |
|
|
5091 |
0545: MOVF 28,W |
|
|
5092 |
0546: BSF 03.5 |
|
|
5093 |
0547: MOVWF 07 |
|
|
5094 |
0548: NOP |
|
|
5095 |
0549: BCF 03.5 |
|
|
5096 |
054A: BCF 07.4 |
|
|
5097 |
054B: BCF 28.4 |
|
|
5098 |
054C: MOVF 28,W |
|
|
5099 |
054D: BSF 03.5 |
|
|
5100 |
054E: MOVWF 07 |
960 |
jacho |
5101 |
.................... I2C_Write(MPL3115_ADDR_W); |
1045 |
jacho |
5102 |
054F: MOVLW C0 |
|
|
5103 |
0550: BCF 03.5 |
|
|
5104 |
0551: BSF 03.6 |
|
|
5105 |
0552: MOVWF 12 |
|
|
5106 |
0553: BCF 03.6 |
|
|
5107 |
0554: CALL 22E |
960 |
jacho |
5108 |
.................... I2C_write(0x26); |
1045 |
jacho |
5109 |
0555: MOVLW 26 |
|
|
5110 |
0556: BSF 03.6 |
|
|
5111 |
0557: MOVWF 12 |
|
|
5112 |
0558: BCF 03.6 |
|
|
5113 |
0559: CALL 22E |
960 |
jacho |
5114 |
.................... I2C_write(0x39); |
1045 |
jacho |
5115 |
055A: MOVLW 39 |
|
|
5116 |
055B: BSF 03.6 |
|
|
5117 |
055C: MOVWF 12 |
|
|
5118 |
055D: BCF 03.6 |
|
|
5119 |
055E: CALL 22E |
960 |
jacho |
5120 |
.................... i2c_stop(); |
1045 |
jacho |
5121 |
055F: BCF 28.3 |
|
|
5122 |
0560: MOVF 28,W |
|
|
5123 |
0561: BSF 03.5 |
|
|
5124 |
0562: MOVWF 07 |
|
|
5125 |
0563: NOP |
|
|
5126 |
0564: BCF 03.5 |
|
|
5127 |
0565: BSF 28.4 |
|
|
5128 |
0566: MOVF 28,W |
|
|
5129 |
0567: BSF 03.5 |
|
|
5130 |
0568: MOVWF 07 |
|
|
5131 |
0569: BCF 03.5 |
|
|
5132 |
056A: BTFSS 07.4 |
|
|
5133 |
056B: GOTO 56A |
|
|
5134 |
056C: NOP |
|
|
5135 |
056D: GOTO 56E |
|
|
5136 |
056E: NOP |
|
|
5137 |
056F: BSF 28.3 |
|
|
5138 |
0570: MOVF 28,W |
|
|
5139 |
0571: BSF 03.5 |
|
|
5140 |
0572: MOVWF 07 |
|
|
5141 |
0573: NOP |
960 |
jacho |
5142 |
.................... } |
1045 |
jacho |
5143 |
0574: BCF 03.5 |
|
|
5144 |
0575: BCF 0A.3 |
|
|
5145 |
0576: BSF 0A.4 |
|
|
5146 |
0577: GOTO 5CD (RETURN) |
960 |
jacho |
5147 |
.................... |
|
|
5148 |
.................... |
|
|
5149 |
.................... byte mpl3115_read (byte reg) |
|
|
5150 |
.................... { |
|
|
5151 |
.................... byte i; |
|
|
5152 |
.................... |
|
|
5153 |
.................... i2c_start(); |
1045 |
jacho |
5154 |
0578: BSF 28.3 |
|
|
5155 |
0579: MOVF 28,W |
|
|
5156 |
057A: BSF 03.5 |
|
|
5157 |
057B: MOVWF 07 |
|
|
5158 |
057C: NOP |
|
|
5159 |
057D: BCF 03.5 |
|
|
5160 |
057E: BSF 28.4 |
|
|
5161 |
057F: MOVF 28,W |
|
|
5162 |
0580: BSF 03.5 |
|
|
5163 |
0581: MOVWF 07 |
|
|
5164 |
0582: NOP |
|
|
5165 |
0583: BCF 03.5 |
|
|
5166 |
0584: BCF 07.3 |
|
|
5167 |
0585: BCF 28.3 |
|
|
5168 |
0586: MOVF 28,W |
|
|
5169 |
0587: BSF 03.5 |
|
|
5170 |
0588: MOVWF 07 |
|
|
5171 |
0589: NOP |
|
|
5172 |
058A: BCF 03.5 |
|
|
5173 |
058B: BCF 07.4 |
|
|
5174 |
058C: BCF 28.4 |
|
|
5175 |
058D: MOVF 28,W |
|
|
5176 |
058E: BSF 03.5 |
|
|
5177 |
058F: MOVWF 07 |
960 |
jacho |
5178 |
.................... I2C_Write(MPL3115_ADDR_W); |
1045 |
jacho |
5179 |
0590: MOVLW C0 |
|
|
5180 |
0591: BCF 03.5 |
|
|
5181 |
0592: BSF 03.6 |
|
|
5182 |
0593: MOVWF 12 |
|
|
5183 |
0594: BCF 03.6 |
|
|
5184 |
0595: CALL 22E |
960 |
jacho |
5185 |
.................... I2C_write(reg); |
1045 |
jacho |
5186 |
0596: BSF 03.6 |
|
|
5187 |
0597: MOVF 10,W |
|
|
5188 |
0598: MOVWF 12 |
|
|
5189 |
0599: BCF 03.6 |
|
|
5190 |
059A: CALL 22E |
960 |
jacho |
5191 |
.................... i2c_start(); |
1045 |
jacho |
5192 |
059B: BSF 28.3 |
|
|
5193 |
059C: MOVF 28,W |
|
|
5194 |
059D: BSF 03.5 |
|
|
5195 |
059E: MOVWF 07 |
|
|
5196 |
059F: NOP |
|
|
5197 |
05A0: BCF 03.5 |
|
|
5198 |
05A1: BSF 28.4 |
|
|
5199 |
05A2: MOVF 28,W |
|
|
5200 |
05A3: BSF 03.5 |
|
|
5201 |
05A4: MOVWF 07 |
|
|
5202 |
05A5: NOP |
|
|
5203 |
05A6: BCF 03.5 |
|
|
5204 |
05A7: BTFSS 07.4 |
|
|
5205 |
05A8: GOTO 5A7 |
|
|
5206 |
05A9: BCF 07.3 |
|
|
5207 |
05AA: BCF 28.3 |
|
|
5208 |
05AB: MOVF 28,W |
|
|
5209 |
05AC: BSF 03.5 |
|
|
5210 |
05AD: MOVWF 07 |
|
|
5211 |
05AE: NOP |
|
|
5212 |
05AF: BCF 03.5 |
|
|
5213 |
05B0: BCF 07.4 |
|
|
5214 |
05B1: BCF 28.4 |
|
|
5215 |
05B2: MOVF 28,W |
|
|
5216 |
05B3: BSF 03.5 |
|
|
5217 |
05B4: MOVWF 07 |
960 |
jacho |
5218 |
.................... I2C_Write(MPL3115_ADDR_R); |
1045 |
jacho |
5219 |
05B5: MOVLW C1 |
|
|
5220 |
05B6: BCF 03.5 |
|
|
5221 |
05B7: BSF 03.6 |
|
|
5222 |
05B8: MOVWF 12 |
|
|
5223 |
05B9: BCF 03.6 |
|
|
5224 |
05BA: CALL 22E |
960 |
jacho |
5225 |
.................... i=i2c_read(0); |
1045 |
jacho |
5226 |
05BB: CLRF 77 |
|
|
5227 |
05BC: CALL 2B6 |
|
|
5228 |
05BD: MOVF 78,W |
|
|
5229 |
05BE: BSF 03.6 |
|
|
5230 |
05BF: MOVWF 11 |
960 |
jacho |
5231 |
.................... i2c_stop(); |
1045 |
jacho |
5232 |
05C0: BCF 03.6 |
|
|
5233 |
05C1: BCF 28.3 |
|
|
5234 |
05C2: MOVF 28,W |
|
|
5235 |
05C3: BSF 03.5 |
|
|
5236 |
05C4: MOVWF 07 |
|
|
5237 |
05C5: NOP |
|
|
5238 |
05C6: BCF 03.5 |
|
|
5239 |
05C7: BSF 28.4 |
|
|
5240 |
05C8: MOVF 28,W |
|
|
5241 |
05C9: BSF 03.5 |
|
|
5242 |
05CA: MOVWF 07 |
|
|
5243 |
05CB: BCF 03.5 |
|
|
5244 |
05CC: BTFSS 07.4 |
|
|
5245 |
05CD: GOTO 5CC |
|
|
5246 |
05CE: NOP |
|
|
5247 |
05CF: GOTO 5D0 |
|
|
5248 |
05D0: NOP |
|
|
5249 |
05D1: BSF 28.3 |
|
|
5250 |
05D2: MOVF 28,W |
|
|
5251 |
05D3: BSF 03.5 |
|
|
5252 |
05D4: MOVWF 07 |
|
|
5253 |
05D5: NOP |
960 |
jacho |
5254 |
.................... |
|
|
5255 |
.................... return i; |
1045 |
jacho |
5256 |
05D6: BCF 03.5 |
|
|
5257 |
05D7: BSF 03.6 |
|
|
5258 |
05D8: MOVF 11,W |
|
|
5259 |
05D9: MOVWF 78 |
960 |
jacho |
5260 |
.................... } |
1045 |
jacho |
5261 |
05DA: BCF 03.6 |
|
|
5262 |
05DB: RETURN |
960 |
jacho |
5263 |
.................... |
|
|
5264 |
.................... |
|
|
5265 |
.................... float mpl3115_T (void) //teplota ve stupnich |
|
|
5266 |
.................... { |
|
|
5267 |
.................... int m; |
|
|
5268 |
.................... float l, t; |
|
|
5269 |
.................... |
|
|
5270 |
.................... m= mpl3115_read (0x04); |
1045 |
jacho |
5271 |
* |
|
|
5272 |
0722: MOVLW 04 |
|
|
5273 |
0723: BSF 03.6 |
|
|
5274 |
0724: MOVWF 10 |
|
|
5275 |
0725: BCF 03.6 |
|
|
5276 |
0726: CALL 578 |
|
|
5277 |
0727: MOVF 78,W |
|
|
5278 |
0728: BSF 03.5 |
|
|
5279 |
0729: MOVWF 5D |
960 |
jacho |
5280 |
.................... l= (float)(mpl3115_read(0x05)>>4)/16.0; |
1045 |
jacho |
5281 |
072A: MOVLW 05 |
|
|
5282 |
072B: BCF 03.5 |
|
|
5283 |
072C: BSF 03.6 |
|
|
5284 |
072D: MOVWF 10 |
|
|
5285 |
072E: BCF 03.6 |
|
|
5286 |
072F: CALL 578 |
|
|
5287 |
0730: SWAPF 78,W |
|
|
5288 |
0731: MOVWF 77 |
|
|
5289 |
0732: MOVLW 0F |
|
|
5290 |
0733: ANDWF 77,F |
|
|
5291 |
0734: MOVF 77,W |
|
|
5292 |
0735: CLRF 27 |
|
|
5293 |
0736: BTFSC 0B.7 |
|
|
5294 |
0737: BSF 27.7 |
|
|
5295 |
0738: BCF 0B.7 |
|
|
5296 |
0739: BSF 03.6 |
|
|
5297 |
073A: CLRF 45 |
|
|
5298 |
073B: MOVWF 44 |
|
|
5299 |
073C: BCF 03.6 |
|
|
5300 |
073D: CALL 038 |
|
|
5301 |
073E: BTFSC 27.7 |
|
|
5302 |
073F: BSF 0B.7 |
|
|
5303 |
0740: MOVF 77,W |
|
|
5304 |
0741: BSF 03.5 |
|
|
5305 |
0742: MOVWF 66 |
|
|
5306 |
0743: MOVF 78,W |
|
|
5307 |
0744: MOVWF 67 |
|
|
5308 |
0745: MOVF 79,W |
|
|
5309 |
0746: MOVWF 68 |
|
|
5310 |
0747: MOVF 7A,W |
|
|
5311 |
0748: MOVWF 69 |
|
|
5312 |
0749: BCF 03.5 |
|
|
5313 |
074A: CLRF 27 |
|
|
5314 |
074B: BTFSC 0B.7 |
|
|
5315 |
074C: BSF 27.7 |
|
|
5316 |
074D: BCF 0B.7 |
|
|
5317 |
074E: BSF 03.5 |
|
|
5318 |
074F: MOVF 69,W |
|
|
5319 |
0750: BCF 03.5 |
|
|
5320 |
0751: BSF 03.6 |
|
|
5321 |
0752: MOVWF 59 |
|
|
5322 |
0753: BSF 03.5 |
|
|
5323 |
0754: BCF 03.6 |
|
|
5324 |
0755: MOVF 68,W |
|
|
5325 |
0756: BCF 03.5 |
|
|
5326 |
0757: BSF 03.6 |
|
|
5327 |
0758: MOVWF 58 |
|
|
5328 |
0759: BSF 03.5 |
|
|
5329 |
075A: BCF 03.6 |
|
|
5330 |
075B: MOVF 67,W |
|
|
5331 |
075C: BCF 03.5 |
|
|
5332 |
075D: BSF 03.6 |
|
|
5333 |
075E: MOVWF 57 |
|
|
5334 |
075F: BSF 03.5 |
|
|
5335 |
0760: BCF 03.6 |
|
|
5336 |
0761: MOVF 66,W |
|
|
5337 |
0762: BCF 03.5 |
|
|
5338 |
0763: BSF 03.6 |
|
|
5339 |
0764: MOVWF 56 |
|
|
5340 |
0765: CLRF 5D |
|
|
5341 |
0766: CLRF 5C |
|
|
5342 |
0767: CLRF 5B |
|
|
5343 |
0768: MOVLW 83 |
|
|
5344 |
0769: MOVWF 5A |
|
|
5345 |
076A: BCF 03.6 |
|
|
5346 |
076B: CALL 057 |
|
|
5347 |
076C: BTFSC 27.7 |
|
|
5348 |
076D: BSF 0B.7 |
|
|
5349 |
076E: MOVF 7A,W |
|
|
5350 |
076F: BSF 03.5 |
|
|
5351 |
0770: MOVWF 61 |
|
|
5352 |
0771: MOVF 79,W |
|
|
5353 |
0772: MOVWF 60 |
|
|
5354 |
0773: MOVF 78,W |
|
|
5355 |
0774: MOVWF 5F |
|
|
5356 |
0775: MOVF 77,W |
|
|
5357 |
0776: MOVWF 5E |
|
|
5358 |
0777: BCF 03.5 |
|
|
5359 |
0778: CLRF 27 |
|
|
5360 |
0779: BTFSC 0B.7 |
|
|
5361 |
077A: BSF 27.7 |
|
|
5362 |
077B: BCF 0B.7 |
960 |
jacho |
5363 |
.................... t = (float)(M + L); |
1045 |
jacho |
5364 |
077C: BSF 03.6 |
|
|
5365 |
077D: CLRF 45 |
|
|
5366 |
077E: BSF 03.5 |
|
|
5367 |
077F: BCF 03.6 |
|
|
5368 |
0780: MOVF 5D,W |
|
|
5369 |
0781: BCF 03.5 |
|
|
5370 |
0782: BSF 03.6 |
|
|
5371 |
0783: MOVWF 44 |
|
|
5372 |
0784: BCF 03.6 |
|
|
5373 |
0785: CALL 038 |
|
|
5374 |
0786: BTFSC 27.7 |
|
|
5375 |
0787: BSF 0B.7 |
|
|
5376 |
0788: BCF 03.1 |
|
|
5377 |
0789: MOVF 7A,W |
|
|
5378 |
078A: BSF 03.6 |
|
|
5379 |
078B: MOVWF 24 |
|
|
5380 |
078C: MOVF 79,W |
|
|
5381 |
078D: MOVWF 23 |
|
|
5382 |
078E: MOVF 78,W |
|
|
5383 |
078F: MOVWF 22 |
|
|
5384 |
0790: MOVF 77,W |
|
|
5385 |
0791: MOVWF 21 |
|
|
5386 |
0792: BSF 03.5 |
|
|
5387 |
0793: BCF 03.6 |
|
|
5388 |
0794: MOVF 61,W |
|
|
5389 |
0795: BCF 03.5 |
|
|
5390 |
0796: BSF 03.6 |
|
|
5391 |
0797: MOVWF 28 |
|
|
5392 |
0798: BSF 03.5 |
|
|
5393 |
0799: BCF 03.6 |
|
|
5394 |
079A: MOVF 60,W |
|
|
5395 |
079B: BCF 03.5 |
|
|
5396 |
079C: BSF 03.6 |
|
|
5397 |
079D: MOVWF 27 |
|
|
5398 |
079E: BSF 03.5 |
|
|
5399 |
079F: BCF 03.6 |
|
|
5400 |
07A0: MOVF 5F,W |
|
|
5401 |
07A1: BCF 03.5 |
|
|
5402 |
07A2: BSF 03.6 |
|
|
5403 |
07A3: MOVWF 26 |
|
|
5404 |
07A4: BSF 03.5 |
|
|
5405 |
07A5: BCF 03.6 |
|
|
5406 |
07A6: MOVF 5E,W |
|
|
5407 |
07A7: BCF 03.5 |
|
|
5408 |
07A8: BSF 03.6 |
|
|
5409 |
07A9: MOVWF 25 |
|
|
5410 |
07AA: BCF 03.6 |
|
|
5411 |
07AB: CALL 5DC |
|
|
5412 |
07AC: MOVF 7A,W |
|
|
5413 |
07AD: BSF 03.5 |
|
|
5414 |
07AE: MOVWF 65 |
|
|
5415 |
07AF: MOVF 79,W |
|
|
5416 |
07B0: MOVWF 64 |
|
|
5417 |
07B1: MOVF 78,W |
|
|
5418 |
07B2: MOVWF 63 |
|
|
5419 |
07B3: MOVF 77,W |
|
|
5420 |
07B4: MOVWF 62 |
960 |
jacho |
5421 |
.................... return t; |
1045 |
jacho |
5422 |
07B5: MOVF 62,W |
|
|
5423 |
07B6: MOVWF 77 |
|
|
5424 |
07B7: MOVF 63,W |
|
|
5425 |
07B8: MOVWF 78 |
|
|
5426 |
07B9: MOVF 64,W |
|
|
5427 |
07BA: MOVWF 79 |
|
|
5428 |
07BB: MOVF 65,W |
|
|
5429 |
07BC: MOVWF 7A |
960 |
jacho |
5430 |
.................... } |
1045 |
jacho |
5431 |
07BD: BCF 03.5 |
|
|
5432 |
07BE: BCF 0A.3 |
|
|
5433 |
07BF: BSF 0A.4 |
|
|
5434 |
07C0: GOTO 5DB (RETURN) |
960 |
jacho |
5435 |
.................... |
|
|
5436 |
.................... float mpl3115_A (void) //vyska v m |
|
|
5437 |
.................... { |
|
|
5438 |
.................... |
|
|
5439 |
.................... int16 m; |
|
|
5440 |
.................... unsigned int8 c; |
|
|
5441 |
.................... float l, a; |
|
|
5442 |
.................... |
|
|
5443 |
.................... m= mpl3115_read (0x01); |
|
|
5444 |
* |
1045 |
jacho |
5445 |
09D9: MOVLW 01 |
|
|
5446 |
09DA: BSF 03.6 |
|
|
5447 |
09DB: MOVWF 10 |
|
|
5448 |
09DC: BCF 0A.3 |
|
|
5449 |
09DD: BCF 03.6 |
|
|
5450 |
09DE: CALL 578 |
|
|
5451 |
09DF: BSF 0A.3 |
|
|
5452 |
09E0: BSF 03.5 |
|
|
5453 |
09E1: CLRF 5E |
|
|
5454 |
09E2: MOVF 78,W |
|
|
5455 |
09E3: MOVWF 5D |
960 |
jacho |
5456 |
.................... c= mpl3115_read (0x02); |
1045 |
jacho |
5457 |
09E4: MOVLW 02 |
|
|
5458 |
09E5: BCF 03.5 |
|
|
5459 |
09E6: BSF 03.6 |
|
|
5460 |
09E7: MOVWF 10 |
|
|
5461 |
09E8: BCF 0A.3 |
|
|
5462 |
09E9: BCF 03.6 |
|
|
5463 |
09EA: CALL 578 |
|
|
5464 |
09EB: BSF 0A.3 |
|
|
5465 |
09EC: MOVF 78,W |
|
|
5466 |
09ED: BSF 03.5 |
|
|
5467 |
09EE: MOVWF 5F |
960 |
jacho |
5468 |
.................... l= (float)(mpl3115_read(0x03)>>4)/16.0; |
1045 |
jacho |
5469 |
09EF: MOVLW 03 |
|
|
5470 |
09F0: BCF 03.5 |
|
|
5471 |
09F1: BSF 03.6 |
|
|
5472 |
09F2: MOVWF 10 |
|
|
5473 |
09F3: BCF 0A.3 |
|
|
5474 |
09F4: BCF 03.6 |
|
|
5475 |
09F5: CALL 578 |
|
|
5476 |
09F6: BSF 0A.3 |
|
|
5477 |
09F7: SWAPF 78,W |
|
|
5478 |
09F8: MOVWF 77 |
|
|
5479 |
09F9: MOVLW 0F |
|
|
5480 |
09FA: ANDWF 77,F |
|
|
5481 |
09FB: MOVF 77,W |
|
|
5482 |
09FC: CLRF 27 |
|
|
5483 |
09FD: BTFSC 0B.7 |
|
|
5484 |
09FE: BSF 27.7 |
|
|
5485 |
09FF: BCF 0B.7 |
|
|
5486 |
0A00: BSF 03.6 |
|
|
5487 |
0A01: CLRF 45 |
|
|
5488 |
0A02: MOVWF 44 |
|
|
5489 |
0A03: BCF 0A.3 |
|
|
5490 |
0A04: BCF 03.6 |
|
|
5491 |
0A05: CALL 038 |
|
|
5492 |
0A06: BSF 0A.3 |
|
|
5493 |
0A07: BTFSC 27.7 |
|
|
5494 |
0A08: BSF 0B.7 |
|
|
5495 |
0A09: MOVF 77,W |
|
|
5496 |
0A0A: BSF 03.5 |
|
|
5497 |
0A0B: MOVWF 68 |
|
|
5498 |
0A0C: MOVF 78,W |
|
|
5499 |
0A0D: MOVWF 69 |
|
|
5500 |
0A0E: MOVF 79,W |
|
|
5501 |
0A0F: MOVWF 6A |
|
|
5502 |
0A10: MOVF 7A,W |
|
|
5503 |
0A11: MOVWF 6B |
|
|
5504 |
0A12: BCF 03.5 |
|
|
5505 |
0A13: CLRF 27 |
|
|
5506 |
0A14: BTFSC 0B.7 |
|
|
5507 |
0A15: BSF 27.7 |
|
|
5508 |
0A16: BCF 0B.7 |
|
|
5509 |
0A17: BSF 03.5 |
|
|
5510 |
0A18: MOVF 6B,W |
|
|
5511 |
0A19: BCF 03.5 |
|
|
5512 |
0A1A: BSF 03.6 |
|
|
5513 |
0A1B: MOVWF 59 |
|
|
5514 |
0A1C: BSF 03.5 |
|
|
5515 |
0A1D: BCF 03.6 |
|
|
5516 |
0A1E: MOVF 6A,W |
|
|
5517 |
0A1F: BCF 03.5 |
|
|
5518 |
0A20: BSF 03.6 |
|
|
5519 |
0A21: MOVWF 58 |
|
|
5520 |
0A22: BSF 03.5 |
|
|
5521 |
0A23: BCF 03.6 |
|
|
5522 |
0A24: MOVF 69,W |
|
|
5523 |
0A25: BCF 03.5 |
|
|
5524 |
0A26: BSF 03.6 |
|
|
5525 |
0A27: MOVWF 57 |
|
|
5526 |
0A28: BSF 03.5 |
|
|
5527 |
0A29: BCF 03.6 |
|
|
5528 |
0A2A: MOVF 68,W |
|
|
5529 |
0A2B: BCF 03.5 |
|
|
5530 |
0A2C: BSF 03.6 |
|
|
5531 |
0A2D: MOVWF 56 |
|
|
5532 |
0A2E: CLRF 5D |
|
|
5533 |
0A2F: CLRF 5C |
|
|
5534 |
0A30: CLRF 5B |
|
|
5535 |
0A31: MOVLW 83 |
|
|
5536 |
0A32: MOVWF 5A |
|
|
5537 |
0A33: BCF 0A.3 |
|
|
5538 |
0A34: BCF 03.6 |
|
|
5539 |
0A35: CALL 057 |
|
|
5540 |
0A36: BSF 0A.3 |
|
|
5541 |
0A37: BTFSC 27.7 |
|
|
5542 |
0A38: BSF 0B.7 |
|
|
5543 |
0A39: MOVF 7A,W |
|
|
5544 |
0A3A: BSF 03.5 |
|
|
5545 |
0A3B: MOVWF 63 |
|
|
5546 |
0A3C: MOVF 79,W |
|
|
5547 |
0A3D: MOVWF 62 |
|
|
5548 |
0A3E: MOVF 78,W |
|
|
5549 |
0A3F: MOVWF 61 |
|
|
5550 |
0A40: MOVF 77,W |
|
|
5551 |
0A41: MOVWF 60 |
960 |
jacho |
5552 |
.................... a = (float)((m << 8)|c) + l; |
1045 |
jacho |
5553 |
0A42: MOVF 5D,W |
|
|
5554 |
0A43: MOVWF 6A |
|
|
5555 |
0A44: CLRF 69 |
|
|
5556 |
0A45: MOVF 69,W |
|
|
5557 |
0A46: IORWF 5F,W |
|
|
5558 |
0A47: MOVWF 77 |
|
|
5559 |
0A48: MOVF 5D,W |
|
|
5560 |
0A49: MOVWF 7A |
|
|
5561 |
0A4A: MOVF 77,W |
|
|
5562 |
0A4B: BCF 03.5 |
|
|
5563 |
0A4C: CLRF 27 |
|
|
5564 |
0A4D: BTFSC 0B.7 |
|
|
5565 |
0A4E: BSF 27.7 |
|
|
5566 |
0A4F: BCF 0B.7 |
|
|
5567 |
0A50: BSF 03.6 |
|
|
5568 |
0A51: MOVWF 44 |
|
|
5569 |
0A52: MOVF 7A,W |
|
|
5570 |
0A53: MOVWF 45 |
|
|
5571 |
0A54: BCF 0A.3 |
|
|
5572 |
0A55: BCF 03.6 |
|
|
5573 |
0A56: CALL 038 |
|
|
5574 |
0A57: BSF 0A.3 |
|
|
5575 |
0A58: BTFSC 27.7 |
|
|
5576 |
0A59: BSF 0B.7 |
|
|
5577 |
0A5A: MOVF 77,W |
|
|
5578 |
0A5B: BSF 03.5 |
|
|
5579 |
0A5C: MOVWF 69 |
|
|
5580 |
0A5D: MOVF 78,W |
|
|
5581 |
0A5E: MOVWF 6A |
|
|
5582 |
0A5F: MOVF 79,W |
|
|
5583 |
0A60: MOVWF 6B |
|
|
5584 |
0A61: MOVF 7A,W |
|
|
5585 |
0A62: MOVWF 6C |
|
|
5586 |
0A63: BCF 03.1 |
|
|
5587 |
0A64: MOVF 6C,W |
|
|
5588 |
0A65: BCF 03.5 |
|
|
5589 |
0A66: BSF 03.6 |
|
|
5590 |
0A67: MOVWF 24 |
|
|
5591 |
0A68: BSF 03.5 |
|
|
5592 |
0A69: BCF 03.6 |
|
|
5593 |
0A6A: MOVF 6B,W |
|
|
5594 |
0A6B: BCF 03.5 |
|
|
5595 |
0A6C: BSF 03.6 |
|
|
5596 |
0A6D: MOVWF 23 |
|
|
5597 |
0A6E: BSF 03.5 |
|
|
5598 |
0A6F: BCF 03.6 |
|
|
5599 |
0A70: MOVF 6A,W |
|
|
5600 |
0A71: BCF 03.5 |
|
|
5601 |
0A72: BSF 03.6 |
|
|
5602 |
0A73: MOVWF 22 |
|
|
5603 |
0A74: BSF 03.5 |
|
|
5604 |
0A75: BCF 03.6 |
|
|
5605 |
0A76: MOVF 69,W |
|
|
5606 |
0A77: BCF 03.5 |
|
|
5607 |
0A78: BSF 03.6 |
|
|
5608 |
0A79: MOVWF 21 |
|
|
5609 |
0A7A: BSF 03.5 |
|
|
5610 |
0A7B: BCF 03.6 |
|
|
5611 |
0A7C: MOVF 63,W |
|
|
5612 |
0A7D: BCF 03.5 |
|
|
5613 |
0A7E: BSF 03.6 |
|
|
5614 |
0A7F: MOVWF 28 |
|
|
5615 |
0A80: BSF 03.5 |
|
|
5616 |
0A81: BCF 03.6 |
|
|
5617 |
0A82: MOVF 62,W |
|
|
5618 |
0A83: BCF 03.5 |
|
|
5619 |
0A84: BSF 03.6 |
|
|
5620 |
0A85: MOVWF 27 |
|
|
5621 |
0A86: BSF 03.5 |
|
|
5622 |
0A87: BCF 03.6 |
|
|
5623 |
0A88: MOVF 61,W |
|
|
5624 |
0A89: BCF 03.5 |
|
|
5625 |
0A8A: BSF 03.6 |
|
|
5626 |
0A8B: MOVWF 26 |
|
|
5627 |
0A8C: BSF 03.5 |
|
|
5628 |
0A8D: BCF 03.6 |
|
|
5629 |
0A8E: MOVF 60,W |
|
|
5630 |
0A8F: BCF 03.5 |
|
|
5631 |
0A90: BSF 03.6 |
|
|
5632 |
0A91: MOVWF 25 |
|
|
5633 |
0A92: BCF 0A.3 |
|
|
5634 |
0A93: BCF 03.6 |
|
|
5635 |
0A94: CALL 5DC |
|
|
5636 |
0A95: BSF 0A.3 |
|
|
5637 |
0A96: MOVF 7A,W |
|
|
5638 |
0A97: BSF 03.5 |
|
|
5639 |
0A98: MOVWF 67 |
|
|
5640 |
0A99: MOVF 79,W |
|
|
5641 |
0A9A: MOVWF 66 |
|
|
5642 |
0A9B: MOVF 78,W |
|
|
5643 |
0A9C: MOVWF 65 |
|
|
5644 |
0A9D: MOVF 77,W |
|
|
5645 |
0A9E: MOVWF 64 |
960 |
jacho |
5646 |
.................... return a; |
1045 |
jacho |
5647 |
0A9F: MOVF 64,W |
|
|
5648 |
0AA0: MOVWF 77 |
|
|
5649 |
0AA1: MOVF 65,W |
|
|
5650 |
0AA2: MOVWF 78 |
|
|
5651 |
0AA3: MOVF 66,W |
|
|
5652 |
0AA4: MOVWF 79 |
|
|
5653 |
0AA5: MOVF 67,W |
|
|
5654 |
0AA6: MOVWF 7A |
960 |
jacho |
5655 |
.................... } |
1045 |
jacho |
5656 |
0AA7: BCF 03.5 |
|
|
5657 |
0AA8: BCF 0A.3 |
|
|
5658 |
0AA9: BSF 0A.4 |
|
|
5659 |
0AAA: GOTO 604 (RETURN) |
960 |
jacho |
5660 |
.................... |
|
|
5661 |
.................... |
|
|
5662 |
.................... float mpl3115_P (void) //tlak v Pa |
|
|
5663 |
.................... { |
|
|
5664 |
.................... unsigned int32 m; |
|
|
5665 |
.................... unsigned int16 c; |
|
|
5666 |
.................... unsigned int8 l,l2; |
|
|
5667 |
.................... float p, l1; |
|
|
5668 |
.................... |
|
|
5669 |
.................... m= mpl3115_read (0x01); |
|
|
5670 |
* |
1045 |
jacho |
5671 |
0800: MOVLW 01 |
|
|
5672 |
0801: BSF 03.6 |
|
|
5673 |
0802: MOVWF 10 |
|
|
5674 |
0803: BCF 0A.3 |
|
|
5675 |
0804: BCF 03.6 |
|
|
5676 |
0805: CALL 578 |
|
|
5677 |
0806: BSF 0A.3 |
|
|
5678 |
0807: BSF 03.5 |
|
|
5679 |
0808: CLRF 60 |
|
|
5680 |
0809: CLRF 5F |
|
|
5681 |
080A: CLRF 5E |
|
|
5682 |
080B: MOVF 78,W |
|
|
5683 |
080C: MOVWF 5D |
960 |
jacho |
5684 |
.................... c= mpl3115_read (0x02); |
1045 |
jacho |
5685 |
080D: MOVLW 02 |
|
|
5686 |
080E: BCF 03.5 |
|
|
5687 |
080F: BSF 03.6 |
|
|
5688 |
0810: MOVWF 10 |
|
|
5689 |
0811: BCF 0A.3 |
|
|
5690 |
0812: BCF 03.6 |
|
|
5691 |
0813: CALL 578 |
|
|
5692 |
0814: BSF 0A.3 |
|
|
5693 |
0815: BSF 03.5 |
|
|
5694 |
0816: CLRF 62 |
|
|
5695 |
0817: MOVF 78,W |
|
|
5696 |
0818: MOVWF 61 |
960 |
jacho |
5697 |
.................... l=mpl3115_read(0x03); |
1045 |
jacho |
5698 |
0819: MOVLW 03 |
|
|
5699 |
081A: BCF 03.5 |
|
|
5700 |
081B: BSF 03.6 |
|
|
5701 |
081C: MOVWF 10 |
|
|
5702 |
081D: BCF 0A.3 |
|
|
5703 |
081E: BCF 03.6 |
|
|
5704 |
081F: CALL 578 |
|
|
5705 |
0820: BSF 0A.3 |
|
|
5706 |
0821: MOVF 78,W |
|
|
5707 |
0822: BSF 03.5 |
|
|
5708 |
0823: MOVWF 63 |
960 |
jacho |
5709 |
.................... l2=l<<2; |
1045 |
jacho |
5710 |
0824: RLF 63,W |
|
|
5711 |
0825: MOVWF 64 |
|
|
5712 |
0826: RLF 64,F |
|
|
5713 |
0827: MOVLW FC |
|
|
5714 |
0828: ANDWF 64,F |
960 |
jacho |
5715 |
.................... l1= (float)(l>>6)/4.0; |
1045 |
jacho |
5716 |
0829: SWAPF 63,W |
|
|
5717 |
082A: MOVWF 77 |
|
|
5718 |
082B: RRF 77,F |
|
|
5719 |
082C: RRF 77,F |
|
|
5720 |
082D: MOVLW 03 |
|
|
5721 |
082E: ANDWF 77,F |
|
|
5722 |
082F: MOVF 77,W |
|
|
5723 |
0830: BCF 03.5 |
|
|
5724 |
0831: CLRF 27 |
|
|
5725 |
0832: BTFSC 0B.7 |
|
|
5726 |
0833: BSF 27.7 |
|
|
5727 |
0834: BCF 0B.7 |
|
|
5728 |
0835: BSF 03.6 |
|
|
5729 |
0836: CLRF 45 |
|
|
5730 |
0837: MOVWF 44 |
|
|
5731 |
0838: BCF 0A.3 |
|
|
5732 |
0839: BCF 03.6 |
|
|
5733 |
083A: CALL 038 |
|
|
5734 |
083B: BSF 0A.3 |
|
|
5735 |
083C: BTFSC 27.7 |
|
|
5736 |
083D: BSF 0B.7 |
|
|
5737 |
083E: MOVF 77,W |
|
|
5738 |
083F: BSF 03.6 |
|
|
5739 |
0840: MOVWF 11 |
|
|
5740 |
0841: MOVF 78,W |
|
|
5741 |
0842: MOVWF 12 |
|
|
5742 |
0843: MOVF 79,W |
|
|
5743 |
0844: MOVWF 13 |
|
|
5744 |
0845: MOVF 7A,W |
|
|
5745 |
0846: MOVWF 14 |
|
|
5746 |
0847: BCF 03.6 |
|
|
5747 |
0848: CLRF 27 |
|
|
5748 |
0849: BTFSC 0B.7 |
|
|
5749 |
084A: BSF 27.7 |
|
|
5750 |
084B: BCF 0B.7 |
|
|
5751 |
084C: BSF 03.6 |
|
|
5752 |
084D: MOVF 14,W |
|
|
5753 |
084E: MOVWF 59 |
|
|
5754 |
084F: MOVF 13,W |
|
|
5755 |
0850: MOVWF 58 |
|
|
5756 |
0851: MOVF 12,W |
|
|
5757 |
0852: MOVWF 57 |
|
|
5758 |
0853: MOVF 11,W |
|
|
5759 |
0854: MOVWF 56 |
|
|
5760 |
0855: CLRF 5D |
|
|
5761 |
0856: CLRF 5C |
|
|
5762 |
0857: CLRF 5B |
|
|
5763 |
0858: MOVLW 81 |
|
|
5764 |
0859: MOVWF 5A |
|
|
5765 |
085A: BCF 0A.3 |
|
|
5766 |
085B: BCF 03.6 |
|
|
5767 |
085C: CALL 057 |
|
|
5768 |
085D: BSF 0A.3 |
|
|
5769 |
085E: BTFSC 27.7 |
|
|
5770 |
085F: BSF 0B.7 |
|
|
5771 |
0860: MOVF 7A,W |
|
|
5772 |
0861: BSF 03.5 |
|
|
5773 |
0862: MOVWF 6C |
|
|
5774 |
0863: MOVF 79,W |
|
|
5775 |
0864: MOVWF 6B |
|
|
5776 |
0865: MOVF 78,W |
|
|
5777 |
0866: MOVWF 6A |
|
|
5778 |
0867: MOVF 77,W |
|
|
5779 |
0868: MOVWF 69 |
960 |
jacho |
5780 |
.................... p = (float)((m << 10)|(c<<2)|(l>>6)) + l1; |
1045 |
jacho |
5781 |
0869: BCF 03.5 |
|
|
5782 |
086A: BSF 03.6 |
|
|
5783 |
086B: CLRF 11 |
|
|
5784 |
086C: BSF 03.5 |
|
|
5785 |
086D: BCF 03.6 |
|
|
5786 |
086E: RLF 5D,W |
|
|
5787 |
086F: BCF 03.5 |
|
|
5788 |
0870: BSF 03.6 |
|
|
5789 |
0871: MOVWF 12 |
|
|
5790 |
0872: BSF 03.5 |
|
|
5791 |
0873: BCF 03.6 |
|
|
5792 |
0874: RLF 5E,W |
|
|
5793 |
0875: BCF 03.5 |
|
|
5794 |
0876: BSF 03.6 |
|
|
5795 |
0877: MOVWF 13 |
|
|
5796 |
0878: BSF 03.5 |
|
|
5797 |
0879: BCF 03.6 |
|
|
5798 |
087A: RLF 5F,W |
|
|
5799 |
087B: BCF 03.5 |
|
|
5800 |
087C: BSF 03.6 |
|
|
5801 |
087D: MOVWF 14 |
|
|
5802 |
087E: RLF 12,F |
|
|
5803 |
087F: RLF 13,F |
|
|
5804 |
0880: RLF 14,F |
|
|
5805 |
0881: MOVLW FC |
|
|
5806 |
0882: ANDWF 12,F |
|
|
5807 |
0883: BSF 03.5 |
|
|
5808 |
0884: BCF 03.6 |
|
|
5809 |
0885: RLF 61,W |
|
|
5810 |
0886: MOVWF 79 |
|
|
5811 |
0887: RLF 62,W |
|
|
5812 |
0888: MOVWF 7A |
|
|
5813 |
0889: RLF 79,F |
|
|
5814 |
088A: RLF 7A,F |
|
|
5815 |
088B: MOVLW FC |
|
|
5816 |
088C: ANDWF 79,F |
|
|
5817 |
088D: MOVF 79,W |
|
|
5818 |
088E: BCF 03.5 |
|
|
5819 |
088F: BSF 03.6 |
|
|
5820 |
0890: IORWF 11,F |
|
|
5821 |
0891: MOVF 7A,W |
|
|
5822 |
0892: IORWF 12,F |
|
|
5823 |
0893: BSF 03.5 |
|
|
5824 |
0894: BCF 03.6 |
|
|
5825 |
0895: SWAPF 63,W |
|
|
5826 |
0896: MOVWF 77 |
|
|
5827 |
0897: RRF 77,F |
|
|
5828 |
0898: RRF 77,F |
|
|
5829 |
0899: MOVLW 03 |
|
|
5830 |
089A: ANDWF 77,F |
|
|
5831 |
089B: MOVF 77,W |
|
|
5832 |
089C: BCF 03.5 |
|
|
5833 |
089D: BSF 03.6 |
|
|
5834 |
089E: IORWF 11,W |
|
|
5835 |
089F: MOVWF 77 |
|
|
5836 |
08A0: MOVF 12,W |
|
|
5837 |
08A1: MOVWF 78 |
|
|
5838 |
08A2: MOVF 13,W |
|
|
5839 |
08A3: MOVWF 79 |
|
|
5840 |
08A4: MOVF 14,W |
|
|
5841 |
08A5: MOVWF 7A |
|
|
5842 |
08A6: MOVF 7A,W |
|
|
5843 |
08A7: MOVWF 1A |
|
|
5844 |
08A8: MOVF 79,W |
|
|
5845 |
08A9: MOVWF 19 |
|
|
5846 |
08AA: MOVF 78,W |
|
|
5847 |
08AB: MOVWF 18 |
|
|
5848 |
08AC: MOVF 77,W |
|
|
5849 |
08AD: MOVWF 17 |
960 |
jacho |
5850 |
* |
1045 |
jacho |
5851 |
08C8: MOVF 77,W |
|
|
5852 |
08C9: MOVWF 11 |
|
|
5853 |
08CA: MOVF 78,W |
|
|
5854 |
08CB: MOVWF 12 |
|
|
5855 |
08CC: MOVF 79,W |
|
|
5856 |
08CD: MOVWF 13 |
|
|
5857 |
08CE: MOVF 7A,W |
|
|
5858 |
08CF: MOVWF 14 |
|
|
5859 |
08D0: BCF 03.1 |
|
|
5860 |
08D1: MOVF 14,W |
|
|
5861 |
08D2: MOVWF 24 |
|
|
5862 |
08D3: MOVF 13,W |
|
|
5863 |
08D4: MOVWF 23 |
|
|
5864 |
08D5: MOVF 12,W |
|
|
5865 |
08D6: MOVWF 22 |
|
|
5866 |
08D7: MOVF 11,W |
|
|
5867 |
08D8: MOVWF 21 |
|
|
5868 |
08D9: BSF 03.5 |
|
|
5869 |
08DA: BCF 03.6 |
|
|
5870 |
08DB: MOVF 6C,W |
|
|
5871 |
08DC: BCF 03.5 |
|
|
5872 |
08DD: BSF 03.6 |
|
|
5873 |
08DE: MOVWF 28 |
|
|
5874 |
08DF: BSF 03.5 |
|
|
5875 |
08E0: BCF 03.6 |
|
|
5876 |
08E1: MOVF 6B,W |
|
|
5877 |
08E2: BCF 03.5 |
|
|
5878 |
08E3: BSF 03.6 |
|
|
5879 |
08E4: MOVWF 27 |
|
|
5880 |
08E5: BSF 03.5 |
|
|
5881 |
08E6: BCF 03.6 |
|
|
5882 |
08E7: MOVF 6A,W |
|
|
5883 |
08E8: BCF 03.5 |
|
|
5884 |
08E9: BSF 03.6 |
|
|
5885 |
08EA: MOVWF 26 |
|
|
5886 |
08EB: BSF 03.5 |
|
|
5887 |
08EC: BCF 03.6 |
|
|
5888 |
08ED: MOVF 69,W |
|
|
5889 |
08EE: BCF 03.5 |
|
|
5890 |
08EF: BSF 03.6 |
|
|
5891 |
08F0: MOVWF 25 |
|
|
5892 |
08F1: BCF 0A.3 |
|
|
5893 |
08F2: BCF 03.6 |
|
|
5894 |
08F3: CALL 5DC |
|
|
5895 |
08F4: BSF 0A.3 |
|
|
5896 |
08F5: MOVF 7A,W |
|
|
5897 |
08F6: BSF 03.5 |
|
|
5898 |
08F7: MOVWF 68 |
|
|
5899 |
08F8: MOVF 79,W |
|
|
5900 |
08F9: MOVWF 67 |
|
|
5901 |
08FA: MOVF 78,W |
|
|
5902 |
08FB: MOVWF 66 |
|
|
5903 |
08FC: MOVF 77,W |
|
|
5904 |
08FD: MOVWF 65 |
960 |
jacho |
5905 |
.................... |
|
|
5906 |
.................... return p; |
1045 |
jacho |
5907 |
08FE: MOVF 65,W |
|
|
5908 |
08FF: MOVWF 77 |
|
|
5909 |
0900: MOVF 66,W |
|
|
5910 |
0901: MOVWF 78 |
|
|
5911 |
0902: MOVF 67,W |
|
|
5912 |
0903: MOVWF 79 |
|
|
5913 |
0904: MOVF 68,W |
|
|
5914 |
0905: MOVWF 7A |
960 |
jacho |
5915 |
.................... } |
1045 |
jacho |
5916 |
0906: BCF 03.5 |
|
|
5917 |
0907: BCF 0A.3 |
|
|
5918 |
0908: BSF 0A.4 |
|
|
5919 |
0909: GOTO 5E7 (RETURN) |
960 |
jacho |
5920 |
.................... |
|
|
5921 |
.................... |
|
|
5922 |
.................... |
|
|
5923 |
.................... #include "HMC5883L.h" |
|
|
5924 |
.................... #define MAG_ADDR_R 0x3D //addresa pro cteni |
|
|
5925 |
.................... #define MAG_ADDR_W 0x3C |
|
|
5926 |
.................... |
|
|
5927 |
.................... |
|
|
5928 |
.................... //Konstanty nastavujici rozsah |
|
|
5929 |
.................... //pro void set_mag_roz (unsigned int8 h) |
|
|
5930 |
.................... #define MAG_ROZ088 0x00 |
|
|
5931 |
.................... #define MAG_ROZ130 0x20 |
|
|
5932 |
.................... #define MAG_ROZ190 0x40 |
|
|
5933 |
.................... #define MAG_ROZ250 0x60 |
|
|
5934 |
.................... #define MAG_ROZ400 0x80 |
|
|
5935 |
.................... #define MAG_ROZ470 0xA0 |
|
|
5936 |
.................... #define MAG_ROZ560 0xC0 |
|
|
5937 |
.................... #define MAG_ROZ810 0xE0 |
|
|
5938 |
.................... |
|
|
5939 |
.................... |
|
|
5940 |
.................... #include "HMC5883L.c" |
|
|
5941 |
.................... void set_mag (void) //uvodni nastaveni na kontinualni mereni, rozsah ± 8.1 Ga, frekvence mereni 15HZ |
|
|
5942 |
.................... { |
|
|
5943 |
.................... i2c_start(); //nastavení Configuration Register A |
|
|
5944 |
* |
1045 |
jacho |
5945 |
03F7: BSF 28.3 |
|
|
5946 |
03F8: MOVF 28,W |
|
|
5947 |
03F9: BSF 03.5 |
|
|
5948 |
03FA: MOVWF 07 |
|
|
5949 |
03FB: NOP |
|
|
5950 |
03FC: BCF 03.5 |
|
|
5951 |
03FD: BSF 28.4 |
|
|
5952 |
03FE: MOVF 28,W |
|
|
5953 |
03FF: BSF 03.5 |
|
|
5954 |
0400: MOVWF 07 |
|
|
5955 |
0401: NOP |
|
|
5956 |
0402: BCF 03.5 |
|
|
5957 |
0403: BCF 07.3 |
|
|
5958 |
0404: BCF 28.3 |
|
|
5959 |
0405: MOVF 28,W |
|
|
5960 |
0406: BSF 03.5 |
|
|
5961 |
0407: MOVWF 07 |
|
|
5962 |
0408: NOP |
|
|
5963 |
0409: BCF 03.5 |
|
|
5964 |
040A: BCF 07.4 |
|
|
5965 |
040B: BCF 28.4 |
|
|
5966 |
040C: MOVF 28,W |
|
|
5967 |
040D: BSF 03.5 |
|
|
5968 |
040E: MOVWF 07 |
960 |
jacho |
5969 |
.................... I2C_Write(MAG_ADDR_W); |
1045 |
jacho |
5970 |
040F: MOVLW 3C |
|
|
5971 |
0410: BCF 03.5 |
|
|
5972 |
0411: BSF 03.6 |
|
|
5973 |
0412: MOVWF 12 |
|
|
5974 |
0413: BCF 03.6 |
|
|
5975 |
0414: CALL 22E |
960 |
jacho |
5976 |
.................... I2C_Write(0x00); |
1045 |
jacho |
5977 |
0415: BSF 03.6 |
|
|
5978 |
0416: CLRF 12 |
|
|
5979 |
0417: BCF 03.6 |
|
|
5980 |
0418: CALL 22E |
960 |
jacho |
5981 |
.................... I2C_Write(0x70); |
1045 |
jacho |
5982 |
0419: MOVLW 70 |
|
|
5983 |
041A: BSF 03.6 |
|
|
5984 |
041B: MOVWF 12 |
|
|
5985 |
041C: BCF 03.6 |
|
|
5986 |
041D: CALL 22E |
960 |
jacho |
5987 |
.................... i2c_stop(); |
1045 |
jacho |
5988 |
041E: BCF 28.3 |
|
|
5989 |
041F: MOVF 28,W |
|
|
5990 |
0420: BSF 03.5 |
|
|
5991 |
0421: MOVWF 07 |
|
|
5992 |
0422: NOP |
|
|
5993 |
0423: BCF 03.5 |
|
|
5994 |
0424: BSF 28.4 |
|
|
5995 |
0425: MOVF 28,W |
|
|
5996 |
0426: BSF 03.5 |
|
|
5997 |
0427: MOVWF 07 |
|
|
5998 |
0428: BCF 03.5 |
|
|
5999 |
0429: BTFSS 07.4 |
|
|
6000 |
042A: GOTO 429 |
|
|
6001 |
042B: NOP |
|
|
6002 |
042C: GOTO 42D |
|
|
6003 |
042D: NOP |
|
|
6004 |
042E: BSF 28.3 |
|
|
6005 |
042F: MOVF 28,W |
|
|
6006 |
0430: BSF 03.5 |
|
|
6007 |
0431: MOVWF 07 |
|
|
6008 |
0432: NOP |
960 |
jacho |
6009 |
.................... Delay_ms(6); |
1045 |
jacho |
6010 |
0433: MOVLW 06 |
|
|
6011 |
0434: MOVWF 62 |
|
|
6012 |
0435: BCF 03.5 |
|
|
6013 |
0436: CALL 303 |
960 |
jacho |
6014 |
.................... |
|
|
6015 |
.................... i2c_start(); //nastavení Configuration Register B |
1045 |
jacho |
6016 |
0437: BSF 28.3 |
|
|
6017 |
0438: MOVF 28,W |
|
|
6018 |
0439: BSF 03.5 |
|
|
6019 |
043A: MOVWF 07 |
|
|
6020 |
043B: NOP |
|
|
6021 |
043C: BCF 03.5 |
|
|
6022 |
043D: BSF 28.4 |
|
|
6023 |
043E: MOVF 28,W |
|
|
6024 |
043F: BSF 03.5 |
|
|
6025 |
0440: MOVWF 07 |
|
|
6026 |
0441: NOP |
|
|
6027 |
0442: BCF 03.5 |
|
|
6028 |
0443: BCF 07.3 |
|
|
6029 |
0444: BCF 28.3 |
|
|
6030 |
0445: MOVF 28,W |
|
|
6031 |
0446: BSF 03.5 |
|
|
6032 |
0447: MOVWF 07 |
|
|
6033 |
0448: NOP |
|
|
6034 |
0449: BCF 03.5 |
|
|
6035 |
044A: BCF 07.4 |
|
|
6036 |
044B: BCF 28.4 |
|
|
6037 |
044C: MOVF 28,W |
|
|
6038 |
044D: BSF 03.5 |
|
|
6039 |
044E: MOVWF 07 |
960 |
jacho |
6040 |
.................... I2C_Write(MAG_ADDR_W); |
1045 |
jacho |
6041 |
044F: MOVLW 3C |
|
|
6042 |
0450: BCF 03.5 |
|
|
6043 |
0451: BSF 03.6 |
|
|
6044 |
0452: MOVWF 12 |
|
|
6045 |
0453: BCF 03.6 |
|
|
6046 |
0454: CALL 22E |
960 |
jacho |
6047 |
.................... I2C_Write(0x01); |
1045 |
jacho |
6048 |
0455: MOVLW 01 |
|
|
6049 |
0456: BSF 03.6 |
|
|
6050 |
0457: MOVWF 12 |
|
|
6051 |
0458: BCF 03.6 |
|
|
6052 |
0459: CALL 22E |
960 |
jacho |
6053 |
.................... I2C_Write(MAG_ROZ810); |
1045 |
jacho |
6054 |
045A: MOVLW E0 |
|
|
6055 |
045B: BSF 03.6 |
|
|
6056 |
045C: MOVWF 12 |
|
|
6057 |
045D: BCF 03.6 |
|
|
6058 |
045E: CALL 22E |
960 |
jacho |
6059 |
.................... i2c_stop(); |
1045 |
jacho |
6060 |
045F: BCF 28.3 |
|
|
6061 |
0460: MOVF 28,W |
|
|
6062 |
0461: BSF 03.5 |
|
|
6063 |
0462: MOVWF 07 |
|
|
6064 |
0463: NOP |
|
|
6065 |
0464: BCF 03.5 |
|
|
6066 |
0465: BSF 28.4 |
|
|
6067 |
0466: MOVF 28,W |
|
|
6068 |
0467: BSF 03.5 |
|
|
6069 |
0468: MOVWF 07 |
|
|
6070 |
0469: BCF 03.5 |
|
|
6071 |
046A: BTFSS 07.4 |
|
|
6072 |
046B: GOTO 46A |
|
|
6073 |
046C: NOP |
|
|
6074 |
046D: GOTO 46E |
|
|
6075 |
046E: NOP |
|
|
6076 |
046F: BSF 28.3 |
|
|
6077 |
0470: MOVF 28,W |
|
|
6078 |
0471: BSF 03.5 |
|
|
6079 |
0472: MOVWF 07 |
|
|
6080 |
0473: NOP |
960 |
jacho |
6081 |
.................... |
|
|
6082 |
.................... Delay_ms(6); |
1045 |
jacho |
6083 |
0474: MOVLW 06 |
|
|
6084 |
0475: MOVWF 62 |
|
|
6085 |
0476: BCF 03.5 |
|
|
6086 |
0477: CALL 303 |
960 |
jacho |
6087 |
.................... |
|
|
6088 |
.................... i2c_start(); //nastveni Mode Register |
1045 |
jacho |
6089 |
0478: BSF 28.3 |
|
|
6090 |
0479: MOVF 28,W |
|
|
6091 |
047A: BSF 03.5 |
|
|
6092 |
047B: MOVWF 07 |
|
|
6093 |
047C: NOP |
|
|
6094 |
047D: BCF 03.5 |
|
|
6095 |
047E: BSF 28.4 |
|
|
6096 |
047F: MOVF 28,W |
|
|
6097 |
0480: BSF 03.5 |
|
|
6098 |
0481: MOVWF 07 |
|
|
6099 |
0482: NOP |
|
|
6100 |
0483: BCF 03.5 |
|
|
6101 |
0484: BCF 07.3 |
|
|
6102 |
0485: BCF 28.3 |
|
|
6103 |
0486: MOVF 28,W |
|
|
6104 |
0487: BSF 03.5 |
|
|
6105 |
0488: MOVWF 07 |
|
|
6106 |
0489: NOP |
|
|
6107 |
048A: BCF 03.5 |
|
|
6108 |
048B: BCF 07.4 |
|
|
6109 |
048C: BCF 28.4 |
|
|
6110 |
048D: MOVF 28,W |
|
|
6111 |
048E: BSF 03.5 |
|
|
6112 |
048F: MOVWF 07 |
960 |
jacho |
6113 |
.................... I2C_Write(MAG_ADDR_W); |
1045 |
jacho |
6114 |
0490: MOVLW 3C |
|
|
6115 |
0491: BCF 03.5 |
|
|
6116 |
0492: BSF 03.6 |
|
|
6117 |
0493: MOVWF 12 |
|
|
6118 |
0494: BCF 03.6 |
|
|
6119 |
0495: CALL 22E |
960 |
jacho |
6120 |
.................... I2C_Write(0x02); |
1045 |
jacho |
6121 |
0496: MOVLW 02 |
|
|
6122 |
0497: BSF 03.6 |
|
|
6123 |
0498: MOVWF 12 |
|
|
6124 |
0499: BCF 03.6 |
|
|
6125 |
049A: CALL 22E |
960 |
jacho |
6126 |
.................... I2C_Write(0x00); |
1045 |
jacho |
6127 |
049B: BSF 03.6 |
|
|
6128 |
049C: CLRF 12 |
|
|
6129 |
049D: BCF 03.6 |
|
|
6130 |
049E: CALL 22E |
960 |
jacho |
6131 |
.................... i2c_stop(); |
1045 |
jacho |
6132 |
049F: BCF 28.3 |
|
|
6133 |
04A0: MOVF 28,W |
|
|
6134 |
04A1: BSF 03.5 |
|
|
6135 |
04A2: MOVWF 07 |
|
|
6136 |
04A3: NOP |
|
|
6137 |
04A4: BCF 03.5 |
|
|
6138 |
04A5: BSF 28.4 |
|
|
6139 |
04A6: MOVF 28,W |
|
|
6140 |
04A7: BSF 03.5 |
|
|
6141 |
04A8: MOVWF 07 |
|
|
6142 |
04A9: BCF 03.5 |
|
|
6143 |
04AA: BTFSS 07.4 |
|
|
6144 |
04AB: GOTO 4AA |
|
|
6145 |
04AC: NOP |
|
|
6146 |
04AD: GOTO 4AE |
|
|
6147 |
04AE: NOP |
|
|
6148 |
04AF: BSF 28.3 |
|
|
6149 |
04B0: MOVF 28,W |
|
|
6150 |
04B1: BSF 03.5 |
|
|
6151 |
04B2: MOVWF 07 |
|
|
6152 |
04B3: NOP |
960 |
jacho |
6153 |
.................... Delay_ms(6); |
1045 |
jacho |
6154 |
04B4: MOVLW 06 |
|
|
6155 |
04B5: MOVWF 62 |
|
|
6156 |
04B6: BCF 03.5 |
|
|
6157 |
04B7: CALL 303 |
960 |
jacho |
6158 |
.................... } |
1045 |
jacho |
6159 |
04B8: BCF 0A.3 |
|
|
6160 |
04B9: BSF 0A.4 |
|
|
6161 |
04BA: GOTO 5C1 (RETURN) |
960 |
jacho |
6162 |
.................... |
|
|
6163 |
.................... void set_mag_roz (unsigned int8 h) //nastavy rozsah |
|
|
6164 |
.................... { |
|
|
6165 |
.................... |
|
|
6166 |
.................... // |
|
|
6167 |
.................... |
|
|
6168 |
.................... |
|
|
6169 |
.................... i2c_start(); |
|
|
6170 |
.................... I2C_Write(MAG_ADDR_W); |
|
|
6171 |
.................... I2C_Write(0x01); |
|
|
6172 |
.................... I2C_Write(h); |
|
|
6173 |
.................... i2c_stop(); |
|
|
6174 |
.................... |
|
|
6175 |
.................... Delay_ms(6); |
|
|
6176 |
.................... |
|
|
6177 |
.................... |
|
|
6178 |
.................... } |
|
|
6179 |
.................... |
|
|
6180 |
.................... |
|
|
6181 |
.................... byte mag_read(byte reg) //pro cteni reg |
|
|
6182 |
.................... { |
|
|
6183 |
.................... |
|
|
6184 |
.................... i2c_start(); |
|
|
6185 |
* |
1045 |
jacho |
6186 |
0D3F: BSF 28.3 |
|
|
6187 |
0D40: MOVF 28,W |
|
|
6188 |
0D41: BSF 03.5 |
|
|
6189 |
0D42: MOVWF 07 |
|
|
6190 |
0D43: NOP |
|
|
6191 |
0D44: BCF 03.5 |
|
|
6192 |
0D45: BSF 28.4 |
|
|
6193 |
0D46: MOVF 28,W |
|
|
6194 |
0D47: BSF 03.5 |
|
|
6195 |
0D48: MOVWF 07 |
|
|
6196 |
0D49: NOP |
|
|
6197 |
0D4A: BCF 03.5 |
|
|
6198 |
0D4B: BCF 07.3 |
|
|
6199 |
0D4C: BCF 28.3 |
|
|
6200 |
0D4D: MOVF 28,W |
|
|
6201 |
0D4E: BSF 03.5 |
|
|
6202 |
0D4F: MOVWF 07 |
|
|
6203 |
0D50: NOP |
|
|
6204 |
0D51: BCF 03.5 |
|
|
6205 |
0D52: BCF 07.4 |
|
|
6206 |
0D53: BCF 28.4 |
|
|
6207 |
0D54: MOVF 28,W |
|
|
6208 |
0D55: BSF 03.5 |
|
|
6209 |
0D56: MOVWF 07 |
960 |
jacho |
6210 |
.................... I2C_Write(MAG_ADDR_W); |
1045 |
jacho |
6211 |
0D57: MOVLW 3C |
|
|
6212 |
0D58: BCF 03.5 |
|
|
6213 |
0D59: BSF 03.6 |
|
|
6214 |
0D5A: MOVWF 12 |
|
|
6215 |
0D5B: BCF 0A.3 |
|
|
6216 |
0D5C: BCF 03.6 |
|
|
6217 |
0D5D: CALL 22E |
|
|
6218 |
0D5E: BSF 0A.3 |
960 |
jacho |
6219 |
.................... I2C_write(reg); |
1045 |
jacho |
6220 |
0D5F: BSF 03.5 |
|
|
6221 |
0D60: MOVF 6F,W |
|
|
6222 |
0D61: BCF 03.5 |
|
|
6223 |
0D62: BSF 03.6 |
|
|
6224 |
0D63: MOVWF 12 |
|
|
6225 |
0D64: BCF 0A.3 |
|
|
6226 |
0D65: BCF 03.6 |
|
|
6227 |
0D66: CALL 22E |
|
|
6228 |
0D67: BSF 0A.3 |
960 |
jacho |
6229 |
.................... i2c_stop(); |
1045 |
jacho |
6230 |
0D68: BCF 28.3 |
|
|
6231 |
0D69: MOVF 28,W |
|
|
6232 |
0D6A: BSF 03.5 |
|
|
6233 |
0D6B: MOVWF 07 |
|
|
6234 |
0D6C: NOP |
|
|
6235 |
0D6D: BCF 03.5 |
|
|
6236 |
0D6E: BSF 28.4 |
|
|
6237 |
0D6F: MOVF 28,W |
|
|
6238 |
0D70: BSF 03.5 |
|
|
6239 |
0D71: MOVWF 07 |
|
|
6240 |
0D72: BCF 03.5 |
|
|
6241 |
0D73: BTFSS 07.4 |
|
|
6242 |
0D74: GOTO 573 |
|
|
6243 |
0D75: NOP |
|
|
6244 |
0D76: GOTO 577 |
|
|
6245 |
0D77: NOP |
|
|
6246 |
0D78: BSF 28.3 |
|
|
6247 |
0D79: MOVF 28,W |
|
|
6248 |
0D7A: BSF 03.5 |
|
|
6249 |
0D7B: MOVWF 07 |
|
|
6250 |
0D7C: NOP |
960 |
jacho |
6251 |
.................... i2c_start(); |
1045 |
jacho |
6252 |
0D7D: BCF 03.5 |
|
|
6253 |
0D7E: BSF 28.3 |
|
|
6254 |
0D7F: MOVF 28,W |
|
|
6255 |
0D80: BSF 03.5 |
|
|
6256 |
0D81: MOVWF 07 |
|
|
6257 |
0D82: NOP |
|
|
6258 |
0D83: BCF 03.5 |
|
|
6259 |
0D84: BSF 28.4 |
|
|
6260 |
0D85: MOVF 28,W |
|
|
6261 |
0D86: BSF 03.5 |
|
|
6262 |
0D87: MOVWF 07 |
|
|
6263 |
0D88: NOP |
|
|
6264 |
0D89: BCF 03.5 |
|
|
6265 |
0D8A: BCF 07.3 |
|
|
6266 |
0D8B: BCF 28.3 |
|
|
6267 |
0D8C: MOVF 28,W |
|
|
6268 |
0D8D: BSF 03.5 |
|
|
6269 |
0D8E: MOVWF 07 |
|
|
6270 |
0D8F: NOP |
|
|
6271 |
0D90: BCF 03.5 |
|
|
6272 |
0D91: BCF 07.4 |
|
|
6273 |
0D92: BCF 28.4 |
|
|
6274 |
0D93: MOVF 28,W |
|
|
6275 |
0D94: BSF 03.5 |
|
|
6276 |
0D95: MOVWF 07 |
960 |
jacho |
6277 |
.................... I2C_Write(MAG_ADDR_R); |
1045 |
jacho |
6278 |
0D96: MOVLW 3D |
|
|
6279 |
0D97: BCF 03.5 |
|
|
6280 |
0D98: BSF 03.6 |
|
|
6281 |
0D99: MOVWF 12 |
|
|
6282 |
0D9A: BCF 0A.3 |
|
|
6283 |
0D9B: BCF 03.6 |
|
|
6284 |
0D9C: CALL 22E |
|
|
6285 |
0D9D: BSF 0A.3 |
960 |
jacho |
6286 |
.................... reg=i2c_read(0); |
1045 |
jacho |
6287 |
0D9E: CLRF 77 |
|
|
6288 |
0D9F: BCF 0A.3 |
|
|
6289 |
0DA0: CALL 2B6 |
|
|
6290 |
0DA1: BSF 0A.3 |
|
|
6291 |
0DA2: MOVF 78,W |
|
|
6292 |
0DA3: BSF 03.5 |
|
|
6293 |
0DA4: MOVWF 6F |
960 |
jacho |
6294 |
.................... return reg; |
1045 |
jacho |
6295 |
0DA5: MOVF 6F,W |
|
|
6296 |
0DA6: MOVWF 78 |
960 |
jacho |
6297 |
.................... } |
1045 |
jacho |
6298 |
0DA7: BCF 03.5 |
|
|
6299 |
0DA8: RETURN |
960 |
jacho |
6300 |
.................... |
|
|
6301 |
.................... |
|
|
6302 |
.................... signed int16 mag_vypocet(unsigned int8 h, unsigned int8 l) //prepocet na 16bit cislo |
|
|
6303 |
.................... { |
|
|
6304 |
.................... signed int16 x; |
|
|
6305 |
.................... x = (((unsigned int16) h << 8) + l ); |
|
|
6306 |
* |
1045 |
jacho |
6307 |
07C1: BSF 03.6 |
|
|
6308 |
07C2: CLRF 14 |
|
|
6309 |
07C3: BSF 03.5 |
|
|
6310 |
07C4: BCF 03.6 |
|
|
6311 |
07C5: MOVF 6F,W |
|
|
6312 |
07C6: BCF 03.5 |
|
|
6313 |
07C7: BSF 03.6 |
|
|
6314 |
07C8: MOVWF 13 |
|
|
6315 |
07C9: MOVWF 14 |
|
|
6316 |
07CA: CLRF 13 |
|
|
6317 |
07CB: MOVF 10,W |
|
|
6318 |
07CC: ADDWF 13,W |
|
|
6319 |
07CD: MOVWF 11 |
|
|
6320 |
07CE: MOVF 14,W |
|
|
6321 |
07CF: MOVWF 12 |
|
|
6322 |
07D0: BTFSC 03.0 |
|
|
6323 |
07D1: INCF 12,F |
960 |
jacho |
6324 |
.................... return x; |
1045 |
jacho |
6325 |
07D2: MOVF 11,W |
|
|
6326 |
07D3: MOVWF 78 |
|
|
6327 |
07D4: MOVF 12,W |
|
|
6328 |
07D5: MOVWF 79 |
960 |
jacho |
6329 |
.................... } |
1045 |
jacho |
6330 |
07D6: BCF 03.6 |
|
|
6331 |
07D7: RETURN |
960 |
jacho |
6332 |
.................... |
|
|
6333 |
.................... |
|
|
6334 |
.................... signed int16 mag_readX(void) //nacteni osy x |
|
|
6335 |
.................... { |
|
|
6336 |
.................... unsigned int8 h,l; |
|
|
6337 |
.................... signed int16 x; |
|
|
6338 |
.................... h=mag_read(0x03); |
|
|
6339 |
* |
|
|
6340 |
1000: MOVLW 03 |
1045 |
jacho |
6341 |
1001: BSF 03.5 |
|
|
6342 |
1002: MOVWF 6F |
|
|
6343 |
1003: BCF 0A.4 |
|
|
6344 |
1004: BSF 0A.3 |
|
|
6345 |
1005: BCF 03.5 |
|
|
6346 |
1006: CALL 53F |
|
|
6347 |
1007: BSF 0A.4 |
|
|
6348 |
1008: BCF 0A.3 |
|
|
6349 |
1009: MOVF 78,W |
|
|
6350 |
100A: BSF 03.5 |
|
|
6351 |
100B: MOVWF 6B |
960 |
jacho |
6352 |
.................... l=mag_read(0x04); |
1045 |
jacho |
6353 |
100C: MOVLW 04 |
|
|
6354 |
100D: MOVWF 6F |
|
|
6355 |
100E: BCF 0A.4 |
|
|
6356 |
100F: BSF 0A.3 |
|
|
6357 |
1010: BCF 03.5 |
|
|
6358 |
1011: CALL 53F |
|
|
6359 |
1012: BSF 0A.4 |
|
|
6360 |
1013: BCF 0A.3 |
|
|
6361 |
1014: MOVF 78,W |
|
|
6362 |
1015: BSF 03.5 |
|
|
6363 |
1016: MOVWF 6C |
960 |
jacho |
6364 |
.................... x=mag_vypocet(h,l); |
1045 |
jacho |
6365 |
1017: MOVF 6B,W |
|
|
6366 |
1018: MOVWF 6F |
|
|
6367 |
1019: MOVF 6C,W |
|
|
6368 |
101A: BCF 03.5 |
|
|
6369 |
101B: BSF 03.6 |
|
|
6370 |
101C: MOVWF 10 |
|
|
6371 |
101D: BCF 0A.4 |
|
|
6372 |
101E: BCF 03.6 |
|
|
6373 |
101F: CALL 7C1 |
|
|
6374 |
1020: BSF 0A.4 |
|
|
6375 |
1021: MOVF 79,W |
|
|
6376 |
1022: BSF 03.5 |
|
|
6377 |
1023: MOVWF 6E |
|
|
6378 |
1024: MOVF 78,W |
|
|
6379 |
1025: MOVWF 6D |
960 |
jacho |
6380 |
.................... return x; |
1045 |
jacho |
6381 |
1026: MOVF 6D,W |
|
|
6382 |
1027: MOVWF 78 |
|
|
6383 |
1028: MOVF 6E,W |
|
|
6384 |
1029: MOVWF 79 |
960 |
jacho |
6385 |
.................... |
|
|
6386 |
.................... } |
|
|
6387 |
.................... |
|
|
6388 |
.................... |
|
|
6389 |
.................... signed int16 mag_readY(void) //nacteni osy x |
|
|
6390 |
.................... { |
|
|
6391 |
.................... unsigned int8 h,l; |
|
|
6392 |
.................... signed int16 x; |
|
|
6393 |
.................... h=mag_read(0x07); |
|
|
6394 |
* |
1045 |
jacho |
6395 |
102E: MOVLW 07 |
|
|
6396 |
102F: MOVWF 6F |
960 |
jacho |
6397 |
1030: BCF 0A.4 |
|
|
6398 |
1031: BSF 0A.3 |
1045 |
jacho |
6399 |
1032: BCF 03.5 |
|
|
6400 |
1033: CALL 53F |
|
|
6401 |
1034: BSF 0A.4 |
|
|
6402 |
1035: BCF 0A.3 |
|
|
6403 |
1036: MOVF 78,W |
|
|
6404 |
1037: BSF 03.5 |
|
|
6405 |
1038: MOVWF 6B |
|
|
6406 |
.................... l=mag_read(0x08); |
|
|
6407 |
1039: MOVLW 08 |
|
|
6408 |
103A: MOVWF 6F |
|
|
6409 |
103B: BCF 0A.4 |
|
|
6410 |
103C: BSF 0A.3 |
|
|
6411 |
103D: BCF 03.5 |
|
|
6412 |
103E: CALL 53F |
|
|
6413 |
103F: BSF 0A.4 |
|
|
6414 |
1040: BCF 0A.3 |
|
|
6415 |
1041: MOVF 78,W |
|
|
6416 |
1042: BSF 03.5 |
|
|
6417 |
1043: MOVWF 6C |
960 |
jacho |
6418 |
.................... x=mag_vypocet(h,l); |
1045 |
jacho |
6419 |
1044: MOVF 6B,W |
|
|
6420 |
1045: MOVWF 6F |
|
|
6421 |
1046: MOVF 6C,W |
|
|
6422 |
1047: BCF 03.5 |
|
|
6423 |
1048: BSF 03.6 |
|
|
6424 |
1049: MOVWF 10 |
|
|
6425 |
104A: BCF 0A.4 |
|
|
6426 |
104B: BCF 03.6 |
|
|
6427 |
104C: CALL 7C1 |
|
|
6428 |
104D: BSF 0A.4 |
|
|
6429 |
104E: MOVF 79,W |
|
|
6430 |
104F: BSF 03.5 |
|
|
6431 |
1050: MOVWF 6E |
|
|
6432 |
1051: MOVF 78,W |
|
|
6433 |
1052: MOVWF 6D |
960 |
jacho |
6434 |
.................... return x; |
1045 |
jacho |
6435 |
1053: MOVF 6D,W |
|
|
6436 |
1054: MOVWF 78 |
|
|
6437 |
1055: MOVF 6E,W |
|
|
6438 |
1056: MOVWF 79 |
960 |
jacho |
6439 |
.................... |
|
|
6440 |
.................... } |
|
|
6441 |
.................... |
|
|
6442 |
.................... |
|
|
6443 |
.................... signed int16 mag_readZ(void) //nacteni osy x |
|
|
6444 |
.................... { |
|
|
6445 |
.................... unsigned int8 h,l; |
|
|
6446 |
.................... signed int16 x; |
|
|
6447 |
.................... h=mag_read(0x05); |
|
|
6448 |
* |
1045 |
jacho |
6449 |
105B: MOVLW 05 |
|
|
6450 |
105C: MOVWF 6F |
|
|
6451 |
105D: BCF 0A.4 |
|
|
6452 |
105E: BSF 0A.3 |
|
|
6453 |
105F: BCF 03.5 |
|
|
6454 |
1060: CALL 53F |
|
|
6455 |
1061: BSF 0A.4 |
|
|
6456 |
1062: BCF 0A.3 |
|
|
6457 |
1063: MOVF 78,W |
|
|
6458 |
1064: BSF 03.5 |
|
|
6459 |
1065: MOVWF 6B |
960 |
jacho |
6460 |
.................... l=mag_read(0x06); |
1045 |
jacho |
6461 |
1066: MOVLW 06 |
|
|
6462 |
1067: MOVWF 6F |
|
|
6463 |
1068: BCF 0A.4 |
|
|
6464 |
1069: BSF 0A.3 |
|
|
6465 |
106A: BCF 03.5 |
|
|
6466 |
106B: CALL 53F |
|
|
6467 |
106C: BSF 0A.4 |
|
|
6468 |
106D: BCF 0A.3 |
|
|
6469 |
106E: MOVF 78,W |
|
|
6470 |
106F: BSF 03.5 |
|
|
6471 |
1070: MOVWF 6C |
960 |
jacho |
6472 |
.................... x=mag_vypocet(h,l); |
1045 |
jacho |
6473 |
1071: MOVF 6B,W |
|
|
6474 |
1072: MOVWF 6F |
|
|
6475 |
1073: MOVF 6C,W |
|
|
6476 |
1074: BCF 03.5 |
|
|
6477 |
1075: BSF 03.6 |
|
|
6478 |
1076: MOVWF 10 |
|
|
6479 |
1077: BCF 0A.4 |
|
|
6480 |
1078: BCF 03.6 |
|
|
6481 |
1079: CALL 7C1 |
|
|
6482 |
107A: BSF 0A.4 |
|
|
6483 |
107B: MOVF 79,W |
|
|
6484 |
107C: BSF 03.5 |
|
|
6485 |
107D: MOVWF 6E |
|
|
6486 |
107E: MOVF 78,W |
|
|
6487 |
107F: MOVWF 6D |
960 |
jacho |
6488 |
.................... return x; |
1045 |
jacho |
6489 |
1080: MOVF 6D,W |
|
|
6490 |
1081: MOVWF 78 |
|
|
6491 |
1082: MOVF 6E,W |
|
|
6492 |
1083: MOVWF 79 |
960 |
jacho |
6493 |
.................... |
|
|
6494 |
.................... } |
|
|
6495 |
.................... |
|
|
6496 |
.................... |
|
|
6497 |
.................... |
|
|
6498 |
.................... |
|
|
6499 |
.................... |
|
|
6500 |
.................... |
|
|
6501 |
.................... |
|
|
6502 |
.................... |
1045 |
jacho |
6503 |
.................... |
960 |
jacho |
6504 |
.................... unsigned int16 timer0_overflow_count; |
|
|
6505 |
.................... float anemo=0; |
|
|
6506 |
.................... |
|
|
6507 |
.................... |
|
|
6508 |
.................... |
|
|
6509 |
.................... #int_TIMER1 |
|
|
6510 |
.................... void TIMER1_isr(void) |
|
|
6511 |
.................... { |
|
|
6512 |
.................... // 32.768 kHz krystal pro timer1 oscilátor |
|
|
6513 |
.................... anemo = ((timer0_overflow_count * 0xFF) + get_timer0())/(32768.0/0xFFFF); // pocet pulzu za 1s |
|
|
6514 |
* |
1045 |
jacho |
6515 |
0123: MOVF 2C,W |
|
|
6516 |
0124: BSF 03.6 |
|
|
6517 |
0125: MOVWF 38 |
|
|
6518 |
0126: BCF 03.6 |
|
|
6519 |
0127: MOVF 2B,W |
|
|
6520 |
0128: BSF 03.6 |
|
|
6521 |
0129: MOVWF 37 |
|
|
6522 |
012A: CLRF 3A |
960 |
jacho |
6523 |
012B: MOVLW FF |
1045 |
jacho |
6524 |
012C: MOVWF 39 |
960 |
jacho |
6525 |
* |
|
|
6526 |
0141: MOVF 79,W |
1045 |
jacho |
6527 |
0142: MOVWF 38 |
960 |
jacho |
6528 |
0143: MOVF 78,W |
1045 |
jacho |
6529 |
0144: MOVWF 37 |
|
|
6530 |
0145: BCF 03.6 |
960 |
jacho |
6531 |
0146: MOVF 01,W |
1045 |
jacho |
6532 |
0147: BSF 03.6 |
|
|
6533 |
0148: ADDWF 37,F |
960 |
jacho |
6534 |
0149: BTFSC 03.0 |
1045 |
jacho |
6535 |
014A: INCF 38,F |
|
|
6536 |
014B: MOVF 38,W |
|
|
6537 |
014C: MOVWF 45 |
|
|
6538 |
014D: MOVF 37,W |
|
|
6539 |
014E: MOVWF 44 |
|
|
6540 |
014F: BCF 03.6 |
960 |
jacho |
6541 |
0150: CALL 038 |
|
|
6542 |
0151: MOVF 7A,W |
1045 |
jacho |
6543 |
0152: BSF 03.6 |
|
|
6544 |
0153: MOVWF 59 |
960 |
jacho |
6545 |
0154: MOVF 79,W |
1045 |
jacho |
6546 |
0155: MOVWF 58 |
960 |
jacho |
6547 |
0156: MOVF 78,W |
1045 |
jacho |
6548 |
0157: MOVWF 57 |
960 |
jacho |
6549 |
0158: MOVF 77,W |
1045 |
jacho |
6550 |
0159: MOVWF 56 |
960 |
jacho |
6551 |
015A: MOVLW 80 |
1045 |
jacho |
6552 |
015B: MOVWF 5D |
|
|
6553 |
015C: CLRF 5C |
|
|
6554 |
015D: CLRF 5B |
960 |
jacho |
6555 |
015E: MOVLW 7E |
1045 |
jacho |
6556 |
015F: MOVWF 5A |
|
|
6557 |
0160: BCF 03.6 |
960 |
jacho |
6558 |
0161: CALL 057 |
|
|
6559 |
0162: MOVF 7A,W |
1045 |
jacho |
6560 |
0163: MOVWF 30 |
960 |
jacho |
6561 |
0164: MOVF 79,W |
1045 |
jacho |
6562 |
0165: MOVWF 2F |
960 |
jacho |
6563 |
0166: MOVF 78,W |
1045 |
jacho |
6564 |
0167: MOVWF 2E |
960 |
jacho |
6565 |
0168: MOVF 77,W |
1045 |
jacho |
6566 |
0169: MOVWF 2D |
960 |
jacho |
6567 |
.................... anemo = anemo / 2; //pocet otacek za sekundu |
1045 |
jacho |
6568 |
016A: MOVF 30,W |
|
|
6569 |
016B: BSF 03.6 |
|
|
6570 |
016C: MOVWF 59 |
|
|
6571 |
016D: BCF 03.6 |
|
|
6572 |
016E: MOVF 2F,W |
|
|
6573 |
016F: BSF 03.6 |
|
|
6574 |
0170: MOVWF 58 |
|
|
6575 |
0171: BCF 03.6 |
|
|
6576 |
0172: MOVF 2E,W |
|
|
6577 |
0173: BSF 03.6 |
|
|
6578 |
0174: MOVWF 57 |
|
|
6579 |
0175: BCF 03.6 |
|
|
6580 |
0176: MOVF 2D,W |
|
|
6581 |
0177: BSF 03.6 |
|
|
6582 |
0178: MOVWF 56 |
|
|
6583 |
0179: CLRF 5D |
|
|
6584 |
017A: CLRF 5C |
|
|
6585 |
017B: CLRF 5B |
960 |
jacho |
6586 |
017C: MOVLW 80 |
1045 |
jacho |
6587 |
017D: MOVWF 5A |
|
|
6588 |
017E: BCF 03.6 |
960 |
jacho |
6589 |
017F: CALL 057 |
|
|
6590 |
0180: MOVF 7A,W |
1045 |
jacho |
6591 |
0181: MOVWF 30 |
960 |
jacho |
6592 |
0182: MOVF 79,W |
1045 |
jacho |
6593 |
0183: MOVWF 2F |
960 |
jacho |
6594 |
0184: MOVF 78,W |
1045 |
jacho |
6595 |
0185: MOVWF 2E |
960 |
jacho |
6596 |
0186: MOVF 77,W |
1045 |
jacho |
6597 |
0187: MOVWF 2D |
960 |
jacho |
6598 |
.................... |
|
|
6599 |
.................... timer0_overflow_count=0; //nulovani |
1045 |
jacho |
6600 |
0188: CLRF 2C |
|
|
6601 |
0189: CLRF 2B |
960 |
jacho |
6602 |
.................... set_timer0(0); |
|
|
6603 |
018A: CLRF 01 |
|
|
6604 |
.................... set_timer1(0); |
|
|
6605 |
018B: CLRF 0F |
|
|
6606 |
018C: CLRF 0E |
|
|
6607 |
.................... |
|
|
6608 |
.................... } |
|
|
6609 |
.................... |
|
|
6610 |
018D: BCF 0C.0 |
|
|
6611 |
018E: BCF 0A.3 |
|
|
6612 |
018F: BCF 0A.4 |
|
|
6613 |
0190: GOTO 021 |
|
|
6614 |
.................... #int_TIMER0 //pro preteceni èítaèe pùlzù od anemometru (RA4) |
|
|
6615 |
.................... void TIMER0_isr(void) |
|
|
6616 |
.................... { |
|
|
6617 |
.................... timer0_overflow_count++; |
1045 |
jacho |
6618 |
0191: INCF 2B,F |
960 |
jacho |
6619 |
0192: BTFSC 03.2 |
1045 |
jacho |
6620 |
0193: INCF 2C,F |
960 |
jacho |
6621 |
.................... } |
|
|
6622 |
.................... |
|
|
6623 |
.................... |
|
|
6624 |
0194: BCF 0B.2 |
|
|
6625 |
0195: BCF 0A.3 |
|
|
6626 |
0196: BCF 0A.4 |
|
|
6627 |
0197: GOTO 021 |
|
|
6628 |
.................... float azimut (void) //vypocet azimutu smeru vetru |
|
|
6629 |
.................... { |
|
|
6630 |
.................... signed int16 X,Y,Z; |
|
|
6631 |
.................... X= mag_readX(); |
|
|
6632 |
* |
1045 |
jacho |
6633 |
102A: MOVF 79,W |
|
|
6634 |
102B: MOVWF 5E |
|
|
6635 |
102C: MOVF 78,W |
|
|
6636 |
102D: MOVWF 5D |
960 |
jacho |
6637 |
.................... Y= mag_readY(); |
|
|
6638 |
* |
1045 |
jacho |
6639 |
1057: MOVF 79,W |
|
|
6640 |
1058: MOVWF 60 |
|
|
6641 |
1059: MOVF 78,W |
|
|
6642 |
105A: MOVWF 5F |
960 |
jacho |
6643 |
.................... Z= mag_readZ(); |
|
|
6644 |
* |
1045 |
jacho |
6645 |
1084: MOVF 79,W |
|
|
6646 |
1085: MOVWF 62 |
|
|
6647 |
1086: MOVF 78,W |
|
|
6648 |
1087: MOVWF 61 |
960 |
jacho |
6649 |
.................... |
|
|
6650 |
.................... float a, b; |
|
|
6651 |
.................... a=(float)Y/X; |
1045 |
jacho |
6652 |
1088: MOVF 60,W |
|
|
6653 |
1089: BCF 03.5 |
|
|
6654 |
108A: BSF 03.6 |
|
|
6655 |
108B: MOVWF 11 |
|
|
6656 |
108C: BSF 03.5 |
|
|
6657 |
108D: BCF 03.6 |
|
|
6658 |
108E: MOVF 5F,W |
|
|
6659 |
108F: BCF 03.5 |
|
|
6660 |
1090: BSF 03.6 |
|
|
6661 |
1091: MOVWF 10 |
|
|
6662 |
1092: BCF 0A.4 |
|
|
6663 |
1093: BCF 03.6 |
|
|
6664 |
1094: CALL 7D8 |
|
|
6665 |
1095: BSF 0A.4 |
|
|
6666 |
1096: MOVF 77,W |
|
|
6667 |
1097: BSF 03.5 |
|
|
6668 |
1098: MOVWF 6B |
|
|
6669 |
1099: MOVF 78,W |
|
|
6670 |
109A: MOVWF 6C |
|
|
6671 |
109B: MOVF 79,W |
|
|
6672 |
109C: MOVWF 6D |
|
|
6673 |
109D: MOVF 7A,W |
|
|
6674 |
109E: MOVWF 6E |
|
|
6675 |
109F: MOVF 5E,W |
|
|
6676 |
10A0: BCF 03.5 |
|
|
6677 |
10A1: BSF 03.6 |
|
|
6678 |
10A2: MOVWF 11 |
|
|
6679 |
10A3: BSF 03.5 |
|
|
6680 |
10A4: BCF 03.6 |
|
|
6681 |
10A5: MOVF 5D,W |
|
|
6682 |
10A6: BCF 03.5 |
|
|
6683 |
10A7: BSF 03.6 |
|
|
6684 |
10A8: MOVWF 10 |
|
|
6685 |
10A9: BCF 0A.4 |
|
|
6686 |
10AA: BCF 03.6 |
|
|
6687 |
10AB: CALL 7D8 |
|
|
6688 |
10AC: BSF 0A.4 |
|
|
6689 |
10AD: CLRF 27 |
|
|
6690 |
10AE: BTFSC 0B.7 |
|
|
6691 |
10AF: BSF 27.7 |
|
|
6692 |
10B0: BCF 0B.7 |
|
|
6693 |
10B1: BSF 03.5 |
|
|
6694 |
10B2: MOVF 6E,W |
|
|
6695 |
10B3: BCF 03.5 |
|
|
6696 |
10B4: BSF 03.6 |
|
|
6697 |
10B5: MOVWF 59 |
|
|
6698 |
10B6: BSF 03.5 |
|
|
6699 |
10B7: BCF 03.6 |
|
|
6700 |
10B8: MOVF 6D,W |
|
|
6701 |
10B9: BCF 03.5 |
|
|
6702 |
10BA: BSF 03.6 |
|
|
6703 |
10BB: MOVWF 58 |
|
|
6704 |
10BC: BSF 03.5 |
|
|
6705 |
10BD: BCF 03.6 |
|
|
6706 |
10BE: MOVF 6C,W |
|
|
6707 |
10BF: BCF 03.5 |
|
|
6708 |
10C0: BSF 03.6 |
|
|
6709 |
10C1: MOVWF 57 |
|
|
6710 |
10C2: BSF 03.5 |
|
|
6711 |
10C3: BCF 03.6 |
|
|
6712 |
10C4: MOVF 6B,W |
|
|
6713 |
10C5: BCF 03.5 |
|
|
6714 |
10C6: BSF 03.6 |
|
|
6715 |
10C7: MOVWF 56 |
|
|
6716 |
10C8: MOVF 7A,W |
|
|
6717 |
10C9: MOVWF 5D |
|
|
6718 |
10CA: MOVF 79,W |
|
|
6719 |
10CB: MOVWF 5C |
|
|
6720 |
10CC: MOVF 78,W |
|
|
6721 |
10CD: MOVWF 5B |
|
|
6722 |
10CE: MOVF 77,W |
|
|
6723 |
10CF: MOVWF 5A |
|
|
6724 |
10D0: BCF 0A.4 |
|
|
6725 |
10D1: BCF 03.6 |
|
|
6726 |
10D2: CALL 057 |
|
|
6727 |
10D3: BSF 0A.4 |
|
|
6728 |
10D4: BTFSC 27.7 |
|
|
6729 |
10D5: BSF 0B.7 |
|
|
6730 |
10D6: MOVF 7A,W |
|
|
6731 |
10D7: BSF 03.5 |
|
|
6732 |
10D8: MOVWF 66 |
|
|
6733 |
10D9: MOVF 79,W |
|
|
6734 |
10DA: MOVWF 65 |
|
|
6735 |
10DB: MOVF 78,W |
|
|
6736 |
10DC: MOVWF 64 |
|
|
6737 |
10DD: MOVF 77,W |
|
|
6738 |
10DE: MOVWF 63 |
960 |
jacho |
6739 |
.................... b=atan(a); |
1045 |
jacho |
6740 |
10DF: MOVF 66,W |
|
|
6741 |
10E0: MOVWF 6E |
|
|
6742 |
10E1: MOVF 65,W |
|
|
6743 |
10E2: MOVWF 6D |
|
|
6744 |
10E3: MOVF 64,W |
|
|
6745 |
10E4: MOVWF 6C |
|
|
6746 |
10E5: MOVF 63,W |
|
|
6747 |
10E6: MOVWF 6B |
960 |
jacho |
6748 |
* |
1045 |
jacho |
6749 |
1403: MOVF 7A,W |
|
|
6750 |
1404: BSF 03.5 |
|
|
6751 |
1405: BCF 03.6 |
|
|
6752 |
1406: MOVWF 6A |
|
|
6753 |
1407: MOVF 79,W |
|
|
6754 |
1408: MOVWF 69 |
|
|
6755 |
1409: MOVF 78,W |
|
|
6756 |
140A: MOVWF 68 |
|
|
6757 |
140B: MOVF 77,W |
|
|
6758 |
140C: MOVWF 67 |
|
|
6759 |
140D: BCF 03.5 |
|
|
6760 |
140E: CLRF 27 |
|
|
6761 |
140F: BTFSC 0B.7 |
|
|
6762 |
1410: BSF 27.7 |
|
|
6763 |
1411: BCF 0B.7 |
960 |
jacho |
6764 |
.................... b = (b/3.14)*180; |
1045 |
jacho |
6765 |
1412: BSF 03.5 |
|
|
6766 |
1413: MOVF 6A,W |
|
|
6767 |
1414: BCF 03.5 |
|
|
6768 |
1415: BSF 03.6 |
|
|
6769 |
1416: MOVWF 59 |
|
|
6770 |
1417: BSF 03.5 |
|
|
6771 |
1418: BCF 03.6 |
|
|
6772 |
1419: MOVF 69,W |
|
|
6773 |
141A: BCF 03.5 |
|
|
6774 |
141B: BSF 03.6 |
|
|
6775 |
141C: MOVWF 58 |
|
|
6776 |
141D: BSF 03.5 |
|
|
6777 |
141E: BCF 03.6 |
|
|
6778 |
141F: MOVF 68,W |
|
|
6779 |
1420: BCF 03.5 |
|
|
6780 |
1421: BSF 03.6 |
|
|
6781 |
1422: MOVWF 57 |
|
|
6782 |
1423: BSF 03.5 |
|
|
6783 |
1424: BCF 03.6 |
|
|
6784 |
1425: MOVF 67,W |
|
|
6785 |
1426: BCF 03.5 |
|
|
6786 |
1427: BSF 03.6 |
|
|
6787 |
1428: MOVWF 56 |
|
|
6788 |
1429: MOVLW C3 |
|
|
6789 |
142A: MOVWF 5D |
|
|
6790 |
142B: MOVLW F5 |
|
|
6791 |
142C: MOVWF 5C |
|
|
6792 |
142D: MOVLW 48 |
|
|
6793 |
142E: MOVWF 5B |
|
|
6794 |
142F: MOVLW 80 |
|
|
6795 |
1430: MOVWF 5A |
|
|
6796 |
1431: BCF 0A.4 |
|
|
6797 |
1432: BCF 03.6 |
|
|
6798 |
1433: CALL 057 |
|
|
6799 |
1434: BSF 0A.4 |
|
|
6800 |
1435: BTFSC 27.7 |
|
|
6801 |
1436: BSF 0B.7 |
|
|
6802 |
1437: MOVF 77,W |
|
|
6803 |
1438: BSF 03.5 |
|
|
6804 |
1439: MOVWF 6B |
|
|
6805 |
143A: MOVF 78,W |
|
|
6806 |
143B: MOVWF 6C |
|
|
6807 |
143C: MOVF 79,W |
|
|
6808 |
143D: MOVWF 6D |
|
|
6809 |
143E: MOVF 7A,W |
|
|
6810 |
143F: MOVWF 6E |
|
|
6811 |
1440: BCF 03.5 |
|
|
6812 |
1441: BSF 03.6 |
|
|
6813 |
1442: MOVWF 24 |
|
|
6814 |
1443: BSF 03.5 |
|
|
6815 |
1444: BCF 03.6 |
|
|
6816 |
1445: MOVF 6D,W |
|
|
6817 |
1446: BCF 03.5 |
|
|
6818 |
1447: BSF 03.6 |
|
|
6819 |
1448: MOVWF 23 |
|
|
6820 |
1449: BSF 03.5 |
|
|
6821 |
144A: BCF 03.6 |
|
|
6822 |
144B: MOVF 6C,W |
|
|
6823 |
144C: BCF 03.5 |
|
|
6824 |
144D: BSF 03.6 |
|
|
6825 |
144E: MOVWF 22 |
|
|
6826 |
144F: BSF 03.5 |
|
|
6827 |
1450: BCF 03.6 |
|
|
6828 |
1451: MOVF 6B,W |
|
|
6829 |
1452: BCF 03.5 |
|
|
6830 |
1453: BSF 03.6 |
|
|
6831 |
1454: MOVWF 21 |
|
|
6832 |
1455: CLRF 28 |
|
|
6833 |
1456: CLRF 27 |
|
|
6834 |
1457: MOVLW 34 |
|
|
6835 |
1458: MOVWF 26 |
|
|
6836 |
1459: MOVLW 86 |
|
|
6837 |
145A: MOVWF 25 |
|
|
6838 |
145B: BCF 0A.4 |
|
|
6839 |
145C: BSF 0A.3 |
|
|
6840 |
145D: BCF 03.6 |
|
|
6841 |
145E: CALL 2AB |
|
|
6842 |
145F: BSF 0A.4 |
|
|
6843 |
1460: BCF 0A.3 |
|
|
6844 |
1461: MOVF 7A,W |
|
|
6845 |
1462: BSF 03.5 |
|
|
6846 |
1463: MOVWF 6A |
|
|
6847 |
1464: MOVF 79,W |
|
|
6848 |
1465: MOVWF 69 |
|
|
6849 |
1466: MOVF 78,W |
|
|
6850 |
1467: MOVWF 68 |
|
|
6851 |
1468: MOVF 77,W |
|
|
6852 |
1469: MOVWF 67 |
960 |
jacho |
6853 |
.................... b=abs(b); |
1045 |
jacho |
6854 |
146A: MOVF 67,W |
|
|
6855 |
146B: MOVWF 77 |
|
|
6856 |
146C: MOVF 68,W |
|
|
6857 |
146D: MOVWF 78 |
|
|
6858 |
146E: MOVF 69,W |
|
|
6859 |
146F: MOVWF 79 |
|
|
6860 |
1470: MOVF 6A,W |
|
|
6861 |
1471: MOVWF 7A |
|
|
6862 |
1472: BCF 78.7 |
|
|
6863 |
1473: MOVF 6A,W |
|
|
6864 |
1474: MOVWF 6A |
|
|
6865 |
1475: MOVF 69,W |
|
|
6866 |
1476: MOVWF 69 |
|
|
6867 |
1477: MOVF 78,W |
|
|
6868 |
1478: MOVWF 68 |
|
|
6869 |
1479: MOVF 67,W |
|
|
6870 |
147A: MOVWF 67 |
960 |
jacho |
6871 |
.................... |
|
|
6872 |
.................... if(X==0) //osetreni proti deleni 0 |
1045 |
jacho |
6873 |
147B: MOVF 5D,F |
|
|
6874 |
147C: BTFSS 03.2 |
|
|
6875 |
147D: GOTO 498 |
|
|
6876 |
147E: MOVF 5E,F |
|
|
6877 |
147F: BTFSS 03.2 |
|
|
6878 |
1480: GOTO 498 |
960 |
jacho |
6879 |
.................... { |
|
|
6880 |
.................... if(Y>0) |
1045 |
jacho |
6881 |
1481: BTFSC 60.7 |
|
|
6882 |
1482: GOTO 491 |
|
|
6883 |
1483: MOVF 60,F |
|
|
6884 |
1484: BTFSS 03.2 |
|
|
6885 |
1485: GOTO 48A |
|
|
6886 |
1486: MOVF 5F,W |
|
|
6887 |
1487: SUBLW 00 |
|
|
6888 |
1488: BTFSC 03.0 |
|
|
6889 |
1489: GOTO 491 |
960 |
jacho |
6890 |
.................... { |
|
|
6891 |
.................... b=90; |
1045 |
jacho |
6892 |
148A: CLRF 6A |
|
|
6893 |
148B: CLRF 69 |
|
|
6894 |
148C: MOVLW 34 |
|
|
6895 |
148D: MOVWF 68 |
|
|
6896 |
148E: MOVLW 85 |
|
|
6897 |
148F: MOVWF 67 |
960 |
jacho |
6898 |
.................... } |
|
|
6899 |
.................... else |
1045 |
jacho |
6900 |
1490: GOTO 497 |
960 |
jacho |
6901 |
.................... { |
|
|
6902 |
.................... b=270; |
1045 |
jacho |
6903 |
1491: CLRF 6A |
|
|
6904 |
1492: CLRF 69 |
|
|
6905 |
1493: MOVLW 07 |
|
|
6906 |
1494: MOVWF 68 |
|
|
6907 |
1495: MOVLW 87 |
|
|
6908 |
1496: MOVWF 67 |
960 |
jacho |
6909 |
.................... } |
|
|
6910 |
.................... } |
|
|
6911 |
.................... else |
1045 |
jacho |
6912 |
1497: GOTO 532 |
960 |
jacho |
6913 |
.................... { |
|
|
6914 |
.................... if(X>0) |
1045 |
jacho |
6915 |
1498: BTFSC 5E.7 |
|
|
6916 |
1499: GOTO 501 |
|
|
6917 |
149A: MOVF 5E,F |
|
|
6918 |
149B: BTFSS 03.2 |
|
|
6919 |
149C: GOTO 4A1 |
|
|
6920 |
149D: MOVF 5D,W |
|
|
6921 |
149E: SUBLW 00 |
|
|
6922 |
149F: BTFSC 03.0 |
|
|
6923 |
14A0: GOTO 501 |
960 |
jacho |
6924 |
.................... { |
|
|
6925 |
.................... if(Y>=0) |
1045 |
jacho |
6926 |
14A1: BTFSC 60.7 |
|
|
6927 |
14A2: GOTO 4D2 |
960 |
jacho |
6928 |
.................... { |
|
|
6929 |
.................... b=180+b; |
1045 |
jacho |
6930 |
14A3: BCF 03.1 |
|
|
6931 |
14A4: BCF 03.5 |
|
|
6932 |
14A5: BSF 03.6 |
|
|
6933 |
14A6: CLRF 24 |
|
|
6934 |
14A7: CLRF 23 |
|
|
6935 |
14A8: MOVLW 34 |
|
|
6936 |
14A9: MOVWF 22 |
|
|
6937 |
14AA: MOVLW 86 |
|
|
6938 |
14AB: MOVWF 21 |
|
|
6939 |
14AC: BSF 03.5 |
|
|
6940 |
14AD: BCF 03.6 |
|
|
6941 |
14AE: MOVF 6A,W |
|
|
6942 |
14AF: BCF 03.5 |
|
|
6943 |
14B0: BSF 03.6 |
|
|
6944 |
14B1: MOVWF 28 |
|
|
6945 |
14B2: BSF 03.5 |
|
|
6946 |
14B3: BCF 03.6 |
|
|
6947 |
14B4: MOVF 69,W |
|
|
6948 |
14B5: BCF 03.5 |
|
|
6949 |
14B6: BSF 03.6 |
|
|
6950 |
14B7: MOVWF 27 |
|
|
6951 |
14B8: BSF 03.5 |
|
|
6952 |
14B9: BCF 03.6 |
|
|
6953 |
14BA: MOVF 68,W |
|
|
6954 |
14BB: BCF 03.5 |
|
|
6955 |
14BC: BSF 03.6 |
|
|
6956 |
14BD: MOVWF 26 |
|
|
6957 |
14BE: BSF 03.5 |
|
|
6958 |
14BF: BCF 03.6 |
|
|
6959 |
14C0: MOVF 67,W |
|
|
6960 |
14C1: BCF 03.5 |
|
|
6961 |
14C2: BSF 03.6 |
|
|
6962 |
14C3: MOVWF 25 |
|
|
6963 |
14C4: BCF 0A.4 |
|
|
6964 |
14C5: BCF 03.6 |
|
|
6965 |
14C6: CALL 5DC |
|
|
6966 |
14C7: BSF 0A.4 |
|
|
6967 |
14C8: MOVF 7A,W |
|
|
6968 |
14C9: BSF 03.5 |
|
|
6969 |
14CA: MOVWF 6A |
|
|
6970 |
14CB: MOVF 79,W |
|
|
6971 |
14CC: MOVWF 69 |
|
|
6972 |
14CD: MOVF 78,W |
|
|
6973 |
14CE: MOVWF 68 |
|
|
6974 |
14CF: MOVF 77,W |
|
|
6975 |
14D0: MOVWF 67 |
960 |
jacho |
6976 |
.................... |
|
|
6977 |
.................... } |
|
|
6978 |
.................... else |
1045 |
jacho |
6979 |
14D1: GOTO 500 |
960 |
jacho |
6980 |
.................... { |
|
|
6981 |
.................... b=180-b; |
1045 |
jacho |
6982 |
14D2: BSF 03.1 |
|
|
6983 |
14D3: BCF 03.5 |
|
|
6984 |
14D4: BSF 03.6 |
|
|
6985 |
14D5: CLRF 24 |
|
|
6986 |
14D6: CLRF 23 |
|
|
6987 |
14D7: MOVLW 34 |
|
|
6988 |
14D8: MOVWF 22 |
|
|
6989 |
14D9: MOVLW 86 |
|
|
6990 |
14DA: MOVWF 21 |
|
|
6991 |
14DB: BSF 03.5 |
|
|
6992 |
14DC: BCF 03.6 |
|
|
6993 |
14DD: MOVF 6A,W |
|
|
6994 |
14DE: BCF 03.5 |
|
|
6995 |
14DF: BSF 03.6 |
|
|
6996 |
14E0: MOVWF 28 |
|
|
6997 |
14E1: BSF 03.5 |
|
|
6998 |
14E2: BCF 03.6 |
|
|
6999 |
14E3: MOVF 69,W |
|
|
7000 |
14E4: BCF 03.5 |
|
|
7001 |
14E5: BSF 03.6 |
|
|
7002 |
14E6: MOVWF 27 |
|
|
7003 |
14E7: BSF 03.5 |
|
|
7004 |
14E8: BCF 03.6 |
|
|
7005 |
14E9: MOVF 68,W |
|
|
7006 |
14EA: BCF 03.5 |
|
|
7007 |
14EB: BSF 03.6 |
|
|
7008 |
14EC: MOVWF 26 |
|
|
7009 |
14ED: BSF 03.5 |
|
|
7010 |
14EE: BCF 03.6 |
|
|
7011 |
14EF: MOVF 67,W |
|
|
7012 |
14F0: BCF 03.5 |
|
|
7013 |
14F1: BSF 03.6 |
|
|
7014 |
14F2: MOVWF 25 |
|
|
7015 |
14F3: BCF 0A.4 |
|
|
7016 |
14F4: BCF 03.6 |
|
|
7017 |
14F5: CALL 5DC |
|
|
7018 |
14F6: BSF 0A.4 |
|
|
7019 |
14F7: MOVF 7A,W |
|
|
7020 |
14F8: BSF 03.5 |
|
|
7021 |
14F9: MOVWF 6A |
|
|
7022 |
14FA: MOVF 79,W |
|
|
7023 |
14FB: MOVWF 69 |
|
|
7024 |
14FC: MOVF 78,W |
|
|
7025 |
14FD: MOVWF 68 |
|
|
7026 |
14FE: MOVF 77,W |
|
|
7027 |
14FF: MOVWF 67 |
960 |
jacho |
7028 |
.................... |
|
|
7029 |
.................... } |
|
|
7030 |
.................... } |
|
|
7031 |
.................... else |
1045 |
jacho |
7032 |
1500: GOTO 532 |
960 |
jacho |
7033 |
.................... { |
|
|
7034 |
.................... if(Y>=0) |
1045 |
jacho |
7035 |
1501: BTFSC 60.7 |
|
|
7036 |
1502: GOTO 532 |
960 |
jacho |
7037 |
.................... { |
|
|
7038 |
.................... b=360-b; |
1045 |
jacho |
7039 |
1503: BSF 03.1 |
|
|
7040 |
1504: BCF 03.5 |
|
|
7041 |
1505: BSF 03.6 |
|
|
7042 |
1506: CLRF 24 |
|
|
7043 |
1507: CLRF 23 |
|
|
7044 |
1508: MOVLW 34 |
|
|
7045 |
1509: MOVWF 22 |
|
|
7046 |
150A: MOVLW 87 |
|
|
7047 |
150B: MOVWF 21 |
|
|
7048 |
150C: BSF 03.5 |
|
|
7049 |
150D: BCF 03.6 |
|
|
7050 |
150E: MOVF 6A,W |
|
|
7051 |
150F: BCF 03.5 |
|
|
7052 |
1510: BSF 03.6 |
|
|
7053 |
1511: MOVWF 28 |
|
|
7054 |
1512: BSF 03.5 |
|
|
7055 |
1513: BCF 03.6 |
|
|
7056 |
1514: MOVF 69,W |
|
|
7057 |
1515: BCF 03.5 |
|
|
7058 |
1516: BSF 03.6 |
|
|
7059 |
1517: MOVWF 27 |
|
|
7060 |
1518: BSF 03.5 |
|
|
7061 |
1519: BCF 03.6 |
|
|
7062 |
151A: MOVF 68,W |
|
|
7063 |
151B: BCF 03.5 |
|
|
7064 |
151C: BSF 03.6 |
|
|
7065 |
151D: MOVWF 26 |
|
|
7066 |
151E: BSF 03.5 |
|
|
7067 |
151F: BCF 03.6 |
|
|
7068 |
1520: MOVF 67,W |
|
|
7069 |
1521: BCF 03.5 |
|
|
7070 |
1522: BSF 03.6 |
|
|
7071 |
1523: MOVWF 25 |
|
|
7072 |
1524: BCF 0A.4 |
|
|
7073 |
1525: BCF 03.6 |
|
|
7074 |
1526: CALL 5DC |
|
|
7075 |
1527: BSF 0A.4 |
|
|
7076 |
1528: MOVF 7A,W |
|
|
7077 |
1529: BSF 03.5 |
|
|
7078 |
152A: MOVWF 6A |
|
|
7079 |
152B: MOVF 79,W |
|
|
7080 |
152C: MOVWF 69 |
|
|
7081 |
152D: MOVF 78,W |
|
|
7082 |
152E: MOVWF 68 |
|
|
7083 |
152F: MOVF 77,W |
|
|
7084 |
1530: MOVWF 67 |
960 |
jacho |
7085 |
.................... |
|
|
7086 |
.................... } |
|
|
7087 |
.................... else |
1045 |
jacho |
7088 |
1531: GOTO 532 |
960 |
jacho |
7089 |
.................... { |
|
|
7090 |
.................... b=b; |
|
|
7091 |
.................... |
|
|
7092 |
.................... } |
|
|
7093 |
.................... } |
|
|
7094 |
.................... |
|
|
7095 |
.................... } |
|
|
7096 |
.................... |
|
|
7097 |
.................... return b; |
1045 |
jacho |
7098 |
1532: MOVF 67,W |
|
|
7099 |
1533: MOVWF 77 |
|
|
7100 |
1534: MOVF 68,W |
|
|
7101 |
1535: MOVWF 78 |
|
|
7102 |
1536: MOVF 69,W |
|
|
7103 |
1537: MOVWF 79 |
|
|
7104 |
1538: MOVF 6A,W |
|
|
7105 |
1539: MOVWF 7A |
960 |
jacho |
7106 |
.................... |
|
|
7107 |
.................... } |
1045 |
jacho |
7108 |
153A: BCF 03.5 |
|
|
7109 |
153B: BCF 0A.3 |
|
|
7110 |
153C: BSF 0A.4 |
|
|
7111 |
153D: GOTO 629 (RETURN) |
960 |
jacho |
7112 |
.................... |
|
|
7113 |
.................... |
|
|
7114 |
.................... |
|
|
7115 |
.................... |
|
|
7116 |
.................... |
|
|
7117 |
.................... |
|
|
7118 |
.................... void uvitani(void) // uvodni zprava |
|
|
7119 |
.................... { |
|
|
7120 |
.................... printf("\r\n\r\n# Meteorologicka stanice %s (C) 2013 www.mlab.cz \r\n",VERSION); |
|
|
7121 |
.................... printf("\r\n# Autor: %s Posledni uprava: %s \r\n",AUTOR, DATE);// Welcome message |
|
|
7122 |
.................... printf("# ver poradi "); |
|
|
7123 |
.................... printf("altimet_t[°C] altimet_a[m] altimet_p[Pa] "); |
|
|
7124 |
.................... printf("sht_t[°C] sht_h[%%] Anemo[m/s]check\r\n\r\n"); |
|
|
7125 |
.................... } |
|
|
7126 |
.................... |
|
|
7127 |
.................... void main() |
|
|
7128 |
.................... { |
1045 |
jacho |
7129 |
153E: CLRF 04 |
|
|
7130 |
153F: BCF 03.7 |
|
|
7131 |
1540: MOVLW 1F |
|
|
7132 |
1541: ANDWF 03,F |
|
|
7133 |
1542: MOVLW 71 |
|
|
7134 |
1543: BSF 03.5 |
|
|
7135 |
1544: MOVWF 0F |
|
|
7136 |
1545: MOVF 0F,W |
|
|
7137 |
1546: BCF 03.5 |
|
|
7138 |
1547: BCF 28.7 |
|
|
7139 |
1548: MOVF 28,W |
|
|
7140 |
1549: BSF 03.5 |
|
|
7141 |
154A: MOVWF 07 |
|
|
7142 |
154B: BCF 03.5 |
|
|
7143 |
154C: BSF 07.7 |
|
|
7144 |
154D: CLRF 30 |
|
|
7145 |
154E: CLRF 2F |
|
|
7146 |
154F: CLRF 2E |
|
|
7147 |
1550: CLRF 2D |
|
|
7148 |
1551: BSF 03.5 |
|
|
7149 |
1552: BSF 03.6 |
|
|
7150 |
1553: MOVF 09,W |
|
|
7151 |
1554: ANDLW C0 |
|
|
7152 |
1555: MOVWF 09 |
|
|
7153 |
1556: BCF 03.6 |
|
|
7154 |
1557: BCF 1F.4 |
|
|
7155 |
1558: BCF 1F.5 |
|
|
7156 |
1559: MOVLW 00 |
|
|
7157 |
155A: BSF 03.6 |
|
|
7158 |
155B: MOVWF 08 |
|
|
7159 |
155C: BCF 03.5 |
|
|
7160 |
155D: CLRF 07 |
|
|
7161 |
155E: CLRF 08 |
|
|
7162 |
155F: CLRF 09 |
|
|
7163 |
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD); |
960 |
jacho |
7164 |
* |
1045 |
jacho |
7165 |
1567: BSF 03.5 |
|
|
7166 |
1568: BSF 03.6 |
|
|
7167 |
1569: MOVF 09,W |
|
|
7168 |
156A: ANDLW C0 |
|
|
7169 |
156B: MOVWF 09 |
|
|
7170 |
156C: BCF 03.6 |
|
|
7171 |
156D: BCF 1F.4 |
|
|
7172 |
156E: BCF 1F.5 |
|
|
7173 |
156F: MOVLW 00 |
|
|
7174 |
1570: BSF 03.6 |
|
|
7175 |
1571: MOVWF 08 |
960 |
jacho |
7176 |
.................... setup_adc(ADC_CLOCK_DIV_2); |
1045 |
jacho |
7177 |
1572: BCF 03.5 |
|
|
7178 |
1573: BCF 03.6 |
|
|
7179 |
1574: BCF 1F.6 |
|
|
7180 |
1575: BCF 1F.7 |
|
|
7181 |
1576: BSF 03.5 |
|
|
7182 |
1577: BCF 1F.7 |
|
|
7183 |
1578: BCF 03.5 |
|
|
7184 |
1579: BSF 1F.0 |
960 |
jacho |
7185 |
.................... setup_spi(SPI_SS_DISABLED); |
1045 |
jacho |
7186 |
157A: BCF 14.5 |
|
|
7187 |
157B: BCF 28.5 |
|
|
7188 |
157C: MOVF 28,W |
|
|
7189 |
157D: BSF 03.5 |
|
|
7190 |
157E: MOVWF 07 |
|
|
7191 |
157F: BCF 03.5 |
|
|
7192 |
1580: BSF 28.4 |
|
|
7193 |
1581: MOVF 28,W |
|
|
7194 |
1582: BSF 03.5 |
|
|
7195 |
1583: MOVWF 07 |
|
|
7196 |
1584: BCF 03.5 |
|
|
7197 |
1585: BCF 28.3 |
|
|
7198 |
1586: MOVF 28,W |
|
|
7199 |
1587: BSF 03.5 |
|
|
7200 |
1588: MOVWF 07 |
|
|
7201 |
1589: MOVLW 01 |
|
|
7202 |
158A: BCF 03.5 |
|
|
7203 |
158B: MOVWF 14 |
|
|
7204 |
158C: MOVLW 00 |
|
|
7205 |
158D: BSF 03.5 |
|
|
7206 |
158E: MOVWF 14 |
960 |
jacho |
7207 |
.................... setup_timer_0(RTCC_EXT_L_TO_H|RTCC_DIV_1); |
1045 |
jacho |
7208 |
158F: MOVF 01,W |
|
|
7209 |
1590: ANDLW C7 |
|
|
7210 |
1591: IORLW 28 |
|
|
7211 |
1592: MOVWF 01 |
960 |
jacho |
7212 |
.................... setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1|T1_CLK_OUT); |
1045 |
jacho |
7213 |
1593: MOVLW 0F |
|
|
7214 |
1594: BCF 03.5 |
|
|
7215 |
1595: MOVWF 10 |
960 |
jacho |
7216 |
.................... setup_timer_2(T2_DISABLED,0,1); |
1045 |
jacho |
7217 |
1596: MOVLW 00 |
|
|
7218 |
1597: MOVWF 78 |
|
|
7219 |
1598: MOVWF 12 |
|
|
7220 |
1599: MOVLW 00 |
|
|
7221 |
159A: BSF 03.5 |
|
|
7222 |
159B: MOVWF 12 |
960 |
jacho |
7223 |
.................... setup_ccp1(CCP_OFF); |
1045 |
jacho |
7224 |
159C: BCF 03.5 |
|
|
7225 |
159D: BSF 28.2 |
|
|
7226 |
159E: MOVF 28,W |
|
|
7227 |
159F: BSF 03.5 |
|
|
7228 |
15A0: MOVWF 07 |
|
|
7229 |
15A1: BCF 03.5 |
|
|
7230 |
15A2: CLRF 17 |
|
|
7231 |
15A3: BSF 03.5 |
|
|
7232 |
15A4: CLRF 1B |
|
|
7233 |
15A5: CLRF 1C |
|
|
7234 |
15A6: MOVLW 01 |
|
|
7235 |
15A7: MOVWF 1D |
960 |
jacho |
7236 |
.................... setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard |
1045 |
jacho |
7237 |
15A8: BCF 03.5 |
|
|
7238 |
15A9: BSF 03.6 |
|
|
7239 |
15AA: CLRF 07 |
|
|
7240 |
15AB: CLRF 08 |
|
|
7241 |
15AC: CLRF 09 |
960 |
jacho |
7242 |
.................... |
|
|
7243 |
.................... |
|
|
7244 |
.................... float altimet_t; //teplota z MPL3115 |
|
|
7245 |
.................... float altimet_p; //tlak z MPL3115 |
|
|
7246 |
.................... float altimet_a; //vyska z MPL3115 |
|
|
7247 |
.................... float sht25_t; //teplota z SHT25 |
|
|
7248 |
.................... float sht25_h; //relativni vlhkost z SHT25 |
|
|
7249 |
.................... float smer_v; //smer vetru |
|
|
7250 |
.................... |
1045 |
jacho |
7251 |
.................... |
960 |
jacho |
7252 |
.................... unsigned int8 sht_config; |
|
|
7253 |
.................... |
1045 |
jacho |
7254 |
.................... |
|
|
7255 |
.................... |
960 |
jacho |
7256 |
.................... //nastaveni SHT25 |
|
|
7257 |
.................... SHT25_soft_reset(); |
1045 |
jacho |
7258 |
15AD: BCF 0A.4 |
|
|
7259 |
15AE: BCF 03.6 |
|
|
7260 |
15AF: GOTO 27A |
|
|
7261 |
15B0: BSF 0A.4 |
960 |
jacho |
7262 |
.................... sht_config = SHT25_RH12_T14 | SHT25_HEATER_OFF; //vypnuti topeni v SHT25 |
1045 |
jacho |
7263 |
15B1: CLRF 4B |
960 |
jacho |
7264 |
.................... SHT25_setup(sht_config); |
1045 |
jacho |
7265 |
15B2: MOVF 4B,W |
|
|
7266 |
15B3: BSF 03.5 |
|
|
7267 |
15B4: MOVWF 5D |
|
|
7268 |
15B5: BCF 0A.4 |
|
|
7269 |
15B6: BCF 03.5 |
|
|
7270 |
15B7: GOTO 317 |
|
|
7271 |
15B8: BSF 0A.4 |
960 |
jacho |
7272 |
.................... |
|
|
7273 |
.................... //nastavení pøeruení pro anemometr |
|
|
7274 |
.................... enable_interrupts(INT_TIMER1); |
1045 |
jacho |
7275 |
15B9: BSF 03.5 |
|
|
7276 |
15BA: BSF 0C.0 |
960 |
jacho |
7277 |
.................... enable_interrupts(INT_TIMER0); |
1045 |
jacho |
7278 |
15BB: BCF 03.5 |
|
|
7279 |
15BC: BSF 0B.5 |
960 |
jacho |
7280 |
.................... enable_interrupts(GLOBAL); |
1045 |
jacho |
7281 |
15BD: MOVLW C0 |
|
|
7282 |
15BE: IORWF 0B,F |
960 |
jacho |
7283 |
.................... |
1045 |
jacho |
7284 |
.................... |
|
|
7285 |
.................... //uvitani(); |
960 |
jacho |
7286 |
.................... set_mag(); //nastaveni magnetometru pro smer vetru |
1045 |
jacho |
7287 |
15BF: BCF 0A.4 |
|
|
7288 |
15C0: GOTO 3F7 |
|
|
7289 |
15C1: BSF 0A.4 |
960 |
jacho |
7290 |
.................... |
|
|
7291 |
.................... // vynulovani promenych pro anemometr |
|
|
7292 |
.................... set_timer0(0); |
1045 |
jacho |
7293 |
15C2: CLRF 01 |
960 |
jacho |
7294 |
.................... set_timer1(0); |
1045 |
jacho |
7295 |
15C3: CLRF 0F |
|
|
7296 |
15C4: CLRF 0E |
960 |
jacho |
7297 |
.................... timer0_overflow_count=0; |
1045 |
jacho |
7298 |
15C5: CLRF 2C |
|
|
7299 |
15C6: CLRF 2B |
960 |
jacho |
7300 |
.................... anemo=0; |
1045 |
jacho |
7301 |
15C7: CLRF 30 |
|
|
7302 |
15C8: CLRF 2F |
|
|
7303 |
15C9: CLRF 2E |
|
|
7304 |
15CA: CLRF 2D |
960 |
jacho |
7305 |
.................... |
1045 |
jacho |
7306 |
.................... |
960 |
jacho |
7307 |
.................... |
|
|
7308 |
.................... while(TRUE) |
|
|
7309 |
.................... { |
|
|
7310 |
.................... |
1045 |
jacho |
7311 |
.................... char dataOUT[60]; |
|
|
7312 |
.................... |
960 |
jacho |
7313 |
.................... mpl3115_setP(); //nastaveni pro tlak a teplotu |
1045 |
jacho |
7314 |
15CB: BCF 0A.4 |
|
|
7315 |
15CC: GOTO 4BB |
|
|
7316 |
15CD: BSF 0A.4 |
960 |
jacho |
7317 |
.................... delay_ms (500); |
1045 |
jacho |
7318 |
15CE: MOVLW 02 |
|
|
7319 |
15CF: MOVWF 4D |
|
|
7320 |
15D0: MOVLW FA |
|
|
7321 |
15D1: BSF 03.5 |
|
|
7322 |
15D2: MOVWF 62 |
|
|
7323 |
15D3: BCF 0A.4 |
|
|
7324 |
15D4: BCF 03.5 |
|
|
7325 |
15D5: CALL 303 |
|
|
7326 |
15D6: BSF 0A.4 |
|
|
7327 |
15D7: DECFSZ 4D,F |
|
|
7328 |
15D8: GOTO 5D0 |
960 |
jacho |
7329 |
.................... altimet_t=mpl3115_T(); |
1045 |
jacho |
7330 |
15D9: BCF 0A.4 |
|
|
7331 |
15DA: GOTO 722 |
|
|
7332 |
15DB: BSF 0A.4 |
|
|
7333 |
15DC: MOVF 7A,W |
|
|
7334 |
15DD: MOVWF 36 |
|
|
7335 |
15DE: MOVF 79,W |
|
|
7336 |
15DF: MOVWF 35 |
|
|
7337 |
15E0: MOVF 78,W |
|
|
7338 |
15E1: MOVWF 34 |
|
|
7339 |
15E2: MOVF 77,W |
|
|
7340 |
15E3: MOVWF 33 |
960 |
jacho |
7341 |
.................... altimet_p=mpl3115_P(); |
1045 |
jacho |
7342 |
15E4: BCF 0A.4 |
|
|
7343 |
15E5: BSF 0A.3 |
|
|
7344 |
15E6: GOTO 000 |
|
|
7345 |
15E7: BSF 0A.4 |
|
|
7346 |
15E8: BCF 0A.3 |
|
|
7347 |
15E9: MOVF 7A,W |
|
|
7348 |
15EA: MOVWF 3A |
|
|
7349 |
15EB: MOVF 79,W |
|
|
7350 |
15EC: MOVWF 39 |
|
|
7351 |
15ED: MOVF 78,W |
|
|
7352 |
15EE: MOVWF 38 |
|
|
7353 |
15EF: MOVF 77,W |
|
|
7354 |
15F0: MOVWF 37 |
960 |
jacho |
7355 |
.................... |
|
|
7356 |
.................... mpl3115_setA(); //nastaveni pro vysku a teplotu |
1045 |
jacho |
7357 |
15F1: BCF 0A.4 |
|
|
7358 |
15F2: BSF 0A.3 |
|
|
7359 |
15F3: GOTO 10A |
|
|
7360 |
15F4: BSF 0A.4 |
|
|
7361 |
15F5: BCF 0A.3 |
960 |
jacho |
7362 |
.................... delay_ms (500); |
1045 |
jacho |
7363 |
15F6: MOVLW 02 |
|
|
7364 |
15F7: MOVWF 4D |
|
|
7365 |
15F8: MOVLW FA |
|
|
7366 |
15F9: BSF 03.5 |
|
|
7367 |
15FA: MOVWF 62 |
|
|
7368 |
15FB: BCF 0A.4 |
|
|
7369 |
15FC: BCF 03.5 |
|
|
7370 |
15FD: CALL 303 |
|
|
7371 |
15FE: BSF 0A.4 |
|
|
7372 |
15FF: DECFSZ 4D,F |
|
|
7373 |
1600: GOTO 5F8 |
960 |
jacho |
7374 |
.................... altimet_a=mpl3115_A(); |
1045 |
jacho |
7375 |
1601: BCF 0A.4 |
|
|
7376 |
1602: BSF 0A.3 |
|
|
7377 |
1603: GOTO 1D9 |
|
|
7378 |
1604: BSF 0A.4 |
|
|
7379 |
1605: BCF 0A.3 |
|
|
7380 |
1606: MOVF 7A,W |
|
|
7381 |
1607: MOVWF 3E |
|
|
7382 |
1608: MOVF 79,W |
|
|
7383 |
1609: MOVWF 3D |
|
|
7384 |
160A: MOVF 78,W |
|
|
7385 |
160B: MOVWF 3C |
|
|
7386 |
160C: MOVF 77,W |
|
|
7387 |
160D: MOVWF 3B |
|
|
7388 |
.................... |
960 |
jacho |
7389 |
.................... sht25_t=SHT25_get_temp(); //mereni hodnot z SHT25 |
1045 |
jacho |
7390 |
160E: BCF 0A.4 |
|
|
7391 |
160F: BSF 0A.3 |
|
|
7392 |
1610: GOTO 322 |
|
|
7393 |
1611: BSF 0A.4 |
|
|
7394 |
1612: BCF 0A.3 |
|
|
7395 |
1613: MOVF 7A,W |
|
|
7396 |
1614: MOVWF 42 |
|
|
7397 |
1615: MOVF 79,W |
|
|
7398 |
1616: MOVWF 41 |
|
|
7399 |
1617: MOVF 78,W |
|
|
7400 |
1618: MOVWF 40 |
|
|
7401 |
1619: MOVF 77,W |
|
|
7402 |
161A: MOVWF 3F |
960 |
jacho |
7403 |
.................... sht25_h=SHT25_get_hum(); |
1045 |
jacho |
7404 |
161B: BCF 0A.4 |
|
|
7405 |
161C: BSF 0A.3 |
|
|
7406 |
161D: GOTO 43C |
|
|
7407 |
161E: BSF 0A.4 |
|
|
7408 |
161F: BCF 0A.3 |
|
|
7409 |
1620: MOVF 7A,W |
|
|
7410 |
1621: MOVWF 46 |
|
|
7411 |
1622: MOVF 79,W |
|
|
7412 |
1623: MOVWF 45 |
|
|
7413 |
1624: MOVF 78,W |
|
|
7414 |
1625: MOVWF 44 |
|
|
7415 |
1626: MOVF 77,W |
|
|
7416 |
1627: MOVWF 43 |
|
|
7417 |
.................... |
960 |
jacho |
7418 |
.................... smer_v=azimut(); //vrati azimut aktualniho smeru vetru |
1045 |
jacho |
7419 |
1628: GOTO 000 |
|
|
7420 |
1629: MOVF 7A,W |
|
|
7421 |
162A: MOVWF 4A |
|
|
7422 |
162B: MOVF 79,W |
|
|
7423 |
162C: MOVWF 49 |
|
|
7424 |
162D: MOVF 78,W |
|
|
7425 |
162E: MOVWF 48 |
|
|
7426 |
162F: MOVF 77,W |
|
|
7427 |
1630: MOVWF 47 |
960 |
jacho |
7428 |
.................... |
1045 |
jacho |
7429 |
.................... sprintf(dataOUT, " %6.2f %7.2f %9.2f %6.2f %6.2f %5.2f %6.2f", altimet_t, altimet_a, altimet_p, sht25_t, sht25_h, smer_v, anemo); |
|
|
7430 |
1631: CLRF 32 |
|
|
7431 |
1632: MOVLW A0 |
|
|
7432 |
1633: MOVWF 31 |
|
|
7433 |
1634: MOVLW 20 |
|
|
7434 |
1635: BSF 03.5 |
|
|
7435 |
1636: MOVWF 6A |
|
|
7436 |
1637: BCF 0A.4 |
|
|
7437 |
1638: BSF 0A.3 |
|
|
7438 |
1639: BCF 03.5 |
|
|
7439 |
163A: CALL 5EA |
|
|
7440 |
163B: BSF 0A.4 |
|
|
7441 |
163C: BCF 0A.3 |
|
|
7442 |
163D: MOVLW 05 |
|
|
7443 |
163E: MOVWF 04 |
|
|
7444 |
163F: MOVF 36,W |
|
|
7445 |
1640: BSF 03.5 |
|
|
7446 |
1641: MOVWF 60 |
|
|
7447 |
1642: BCF 03.5 |
|
|
7448 |
1643: MOVF 35,W |
|
|
7449 |
1644: BSF 03.5 |
|
|
7450 |
1645: MOVWF 5F |
|
|
7451 |
1646: BCF 03.5 |
|
|
7452 |
1647: MOVF 34,W |
|
|
7453 |
1648: BSF 03.5 |
|
|
7454 |
1649: MOVWF 5E |
|
|
7455 |
164A: BCF 03.5 |
|
|
7456 |
164B: MOVF 33,W |
|
|
7457 |
164C: BSF 03.5 |
|
|
7458 |
164D: MOVWF 5D |
|
|
7459 |
164E: MOVLW 02 |
|
|
7460 |
164F: MOVWF 61 |
|
|
7461 |
1650: BCF 0A.4 |
|
|
7462 |
1651: BSF 0A.3 |
|
|
7463 |
1652: BCF 03.5 |
|
|
7464 |
1653: CALL 641 |
|
|
7465 |
1654: BSF 0A.4 |
|
|
7466 |
1655: BCF 0A.3 |
|
|
7467 |
1656: MOVLW 20 |
|
|
7468 |
1657: BSF 03.5 |
|
|
7469 |
1658: MOVWF 6A |
|
|
7470 |
1659: BCF 0A.4 |
|
|
7471 |
165A: BSF 0A.3 |
|
|
7472 |
165B: BCF 03.5 |
|
|
7473 |
165C: CALL 5EA |
|
|
7474 |
165D: BSF 0A.4 |
|
|
7475 |
165E: BCF 0A.3 |
|
|
7476 |
165F: MOVLW 06 |
|
|
7477 |
1660: MOVWF 04 |
|
|
7478 |
1661: MOVF 3E,W |
|
|
7479 |
1662: BSF 03.5 |
|
|
7480 |
1663: MOVWF 60 |
|
|
7481 |
1664: BCF 03.5 |
|
|
7482 |
1665: MOVF 3D,W |
|
|
7483 |
1666: BSF 03.5 |
|
|
7484 |
1667: MOVWF 5F |
|
|
7485 |
1668: BCF 03.5 |
|
|
7486 |
1669: MOVF 3C,W |
|
|
7487 |
166A: BSF 03.5 |
|
|
7488 |
166B: MOVWF 5E |
|
|
7489 |
166C: BCF 03.5 |
|
|
7490 |
166D: MOVF 3B,W |
|
|
7491 |
166E: BSF 03.5 |
|
|
7492 |
166F: MOVWF 5D |
|
|
7493 |
1670: MOVLW 02 |
|
|
7494 |
1671: MOVWF 61 |
|
|
7495 |
1672: BCF 0A.4 |
|
|
7496 |
1673: BSF 0A.3 |
|
|
7497 |
1674: BCF 03.5 |
|
|
7498 |
1675: CALL 641 |
|
|
7499 |
1676: BSF 0A.4 |
|
|
7500 |
1677: BCF 0A.3 |
|
|
7501 |
1678: MOVLW 20 |
|
|
7502 |
1679: BSF 03.5 |
|
|
7503 |
167A: MOVWF 6A |
|
|
7504 |
167B: BCF 0A.4 |
|
|
7505 |
167C: BSF 0A.3 |
|
|
7506 |
167D: BCF 03.5 |
|
|
7507 |
167E: CALL 5EA |
|
|
7508 |
167F: BSF 0A.4 |
|
|
7509 |
1680: BCF 0A.3 |
|
|
7510 |
1681: MOVLW 08 |
|
|
7511 |
1682: MOVWF 04 |
|
|
7512 |
1683: MOVF 3A,W |
|
|
7513 |
1684: BSF 03.5 |
|
|
7514 |
1685: MOVWF 60 |
|
|
7515 |
1686: BCF 03.5 |
|
|
7516 |
1687: MOVF 39,W |
|
|
7517 |
1688: BSF 03.5 |
|
|
7518 |
1689: MOVWF 5F |
|
|
7519 |
168A: BCF 03.5 |
|
|
7520 |
168B: MOVF 38,W |
|
|
7521 |
168C: BSF 03.5 |
|
|
7522 |
168D: MOVWF 5E |
|
|
7523 |
168E: BCF 03.5 |
|
|
7524 |
168F: MOVF 37,W |
|
|
7525 |
1690: BSF 03.5 |
|
|
7526 |
1691: MOVWF 5D |
|
|
7527 |
1692: MOVLW 02 |
|
|
7528 |
1693: MOVWF 61 |
|
|
7529 |
1694: BCF 0A.4 |
|
|
7530 |
1695: BSF 0A.3 |
|
|
7531 |
1696: BCF 03.5 |
|
|
7532 |
1697: CALL 641 |
|
|
7533 |
1698: BSF 0A.4 |
|
|
7534 |
1699: BCF 0A.3 |
|
|
7535 |
169A: MOVLW 20 |
|
|
7536 |
169B: BSF 03.5 |
|
|
7537 |
169C: MOVWF 6A |
|
|
7538 |
169D: BCF 0A.4 |
|
|
7539 |
169E: BSF 0A.3 |
|
|
7540 |
169F: BCF 03.5 |
|
|
7541 |
16A0: CALL 5EA |
|
|
7542 |
16A1: BSF 0A.4 |
|
|
7543 |
16A2: BCF 0A.3 |
|
|
7544 |
16A3: MOVLW 05 |
|
|
7545 |
16A4: MOVWF 04 |
|
|
7546 |
16A5: MOVF 42,W |
|
|
7547 |
16A6: BSF 03.5 |
|
|
7548 |
16A7: MOVWF 60 |
|
|
7549 |
16A8: BCF 03.5 |
|
|
7550 |
16A9: MOVF 41,W |
|
|
7551 |
16AA: BSF 03.5 |
|
|
7552 |
16AB: MOVWF 5F |
|
|
7553 |
16AC: BCF 03.5 |
|
|
7554 |
16AD: MOVF 40,W |
|
|
7555 |
16AE: BSF 03.5 |
|
|
7556 |
16AF: MOVWF 5E |
|
|
7557 |
16B0: BCF 03.5 |
|
|
7558 |
16B1: MOVF 3F,W |
|
|
7559 |
16B2: BSF 03.5 |
|
|
7560 |
16B3: MOVWF 5D |
|
|
7561 |
16B4: MOVLW 02 |
|
|
7562 |
16B5: MOVWF 61 |
|
|
7563 |
16B6: BCF 0A.4 |
|
|
7564 |
16B7: BSF 0A.3 |
|
|
7565 |
16B8: BCF 03.5 |
|
|
7566 |
16B9: CALL 641 |
|
|
7567 |
16BA: BSF 0A.4 |
|
|
7568 |
16BB: BCF 0A.3 |
|
|
7569 |
16BC: MOVLW 20 |
|
|
7570 |
16BD: BSF 03.5 |
|
|
7571 |
16BE: MOVWF 6A |
|
|
7572 |
16BF: BCF 0A.4 |
|
|
7573 |
16C0: BSF 0A.3 |
|
|
7574 |
16C1: BCF 03.5 |
|
|
7575 |
16C2: CALL 5EA |
|
|
7576 |
16C3: BSF 0A.4 |
|
|
7577 |
16C4: BCF 0A.3 |
|
|
7578 |
16C5: MOVLW 05 |
|
|
7579 |
16C6: MOVWF 04 |
|
|
7580 |
16C7: MOVF 46,W |
|
|
7581 |
16C8: BSF 03.5 |
|
|
7582 |
16C9: MOVWF 60 |
|
|
7583 |
16CA: BCF 03.5 |
|
|
7584 |
16CB: MOVF 45,W |
|
|
7585 |
16CC: BSF 03.5 |
|
|
7586 |
16CD: MOVWF 5F |
|
|
7587 |
16CE: BCF 03.5 |
|
|
7588 |
16CF: MOVF 44,W |
|
|
7589 |
16D0: BSF 03.5 |
|
|
7590 |
16D1: MOVWF 5E |
|
|
7591 |
16D2: BCF 03.5 |
|
|
7592 |
16D3: MOVF 43,W |
|
|
7593 |
16D4: BSF 03.5 |
|
|
7594 |
16D5: MOVWF 5D |
|
|
7595 |
16D6: MOVLW 02 |
|
|
7596 |
16D7: MOVWF 61 |
|
|
7597 |
16D8: BCF 0A.4 |
|
|
7598 |
16D9: BSF 0A.3 |
|
|
7599 |
16DA: BCF 03.5 |
|
|
7600 |
16DB: CALL 641 |
|
|
7601 |
16DC: BSF 0A.4 |
|
|
7602 |
16DD: BCF 0A.3 |
|
|
7603 |
16DE: MOVLW 20 |
|
|
7604 |
16DF: BSF 03.5 |
|
|
7605 |
16E0: MOVWF 6A |
|
|
7606 |
16E1: BCF 0A.4 |
|
|
7607 |
16E2: BSF 0A.3 |
|
|
7608 |
16E3: BCF 03.5 |
|
|
7609 |
16E4: CALL 5EA |
|
|
7610 |
16E5: BSF 0A.4 |
|
|
7611 |
16E6: BCF 0A.3 |
|
|
7612 |
16E7: MOVLW 04 |
|
|
7613 |
16E8: MOVWF 04 |
|
|
7614 |
16E9: MOVF 4A,W |
|
|
7615 |
16EA: BSF 03.5 |
|
|
7616 |
16EB: MOVWF 60 |
|
|
7617 |
16EC: BCF 03.5 |
|
|
7618 |
16ED: MOVF 49,W |
|
|
7619 |
16EE: BSF 03.5 |
|
|
7620 |
16EF: MOVWF 5F |
|
|
7621 |
16F0: BCF 03.5 |
|
|
7622 |
16F1: MOVF 48,W |
|
|
7623 |
16F2: BSF 03.5 |
|
|
7624 |
16F3: MOVWF 5E |
|
|
7625 |
16F4: BCF 03.5 |
|
|
7626 |
16F5: MOVF 47,W |
|
|
7627 |
16F6: BSF 03.5 |
|
|
7628 |
16F7: MOVWF 5D |
|
|
7629 |
16F8: MOVLW 02 |
|
|
7630 |
16F9: MOVWF 61 |
|
|
7631 |
16FA: BCF 0A.4 |
|
|
7632 |
16FB: BSF 0A.3 |
|
|
7633 |
16FC: BCF 03.5 |
|
|
7634 |
16FD: CALL 641 |
|
|
7635 |
16FE: BSF 0A.4 |
|
|
7636 |
16FF: BCF 0A.3 |
|
|
7637 |
1700: MOVLW 20 |
|
|
7638 |
1701: BSF 03.5 |
|
|
7639 |
1702: MOVWF 6A |
|
|
7640 |
1703: BCF 0A.4 |
|
|
7641 |
1704: BSF 0A.3 |
|
|
7642 |
1705: BCF 03.5 |
|
|
7643 |
1706: CALL 5EA |
|
|
7644 |
1707: BSF 0A.4 |
|
|
7645 |
1708: BCF 0A.3 |
|
|
7646 |
1709: MOVLW 05 |
|
|
7647 |
170A: MOVWF 04 |
|
|
7648 |
170B: MOVF 30,W |
|
|
7649 |
170C: BSF 03.5 |
|
|
7650 |
170D: MOVWF 60 |
|
|
7651 |
170E: BCF 03.5 |
|
|
7652 |
170F: MOVF 2F,W |
|
|
7653 |
1710: BSF 03.5 |
|
|
7654 |
1711: MOVWF 5F |
|
|
7655 |
1712: BCF 03.5 |
|
|
7656 |
1713: MOVF 2E,W |
|
|
7657 |
1714: BSF 03.5 |
|
|
7658 |
1715: MOVWF 5E |
|
|
7659 |
1716: BCF 03.5 |
|
|
7660 |
1717: MOVF 2D,W |
|
|
7661 |
1718: BSF 03.5 |
|
|
7662 |
1719: MOVWF 5D |
|
|
7663 |
171A: MOVLW 02 |
|
|
7664 |
171B: MOVWF 61 |
|
|
7665 |
171C: BCF 0A.4 |
|
|
7666 |
171D: BSF 0A.3 |
|
|
7667 |
171E: BCF 03.5 |
|
|
7668 |
171F: CALL 641 |
|
|
7669 |
1720: BSF 0A.4 |
|
|
7670 |
1721: BCF 0A.3 |
|
|
7671 |
.................... |
|
|
7672 |
.................... printf(dataOUT); |
|
|
7673 |
1722: MOVLW A0 |
|
|
7674 |
1723: MOVWF 04 |
|
|
7675 |
1724: BCF 03.7 |
|
|
7676 |
1725: BCF 0A.4 |
|
|
7677 |
1726: BSF 0A.3 |
|
|
7678 |
1727: GOTO 756 |
|
|
7679 |
1728: BSF 0A.4 |
|
|
7680 |
1729: BCF 0A.3 |
|
|
7681 |
.................... int i=0; |
|
|
7682 |
172A: CLRF 4C |
|
|
7683 |
.................... for(i=0;i<40;i++) |
|
|
7684 |
172B: CLRF 4C |
|
|
7685 |
172C: MOVF 4C,W |
|
|
7686 |
172D: SUBLW 27 |
|
|
7687 |
172E: BTFSS 03.0 |
|
|
7688 |
172F: GOTO 73D |
|
|
7689 |
.................... { |
|
|
7690 |
.................... delay_ms(1000); |
|
|
7691 |
1730: MOVLW 04 |
|
|
7692 |
1731: MOVWF 4D |
|
|
7693 |
1732: MOVLW FA |
|
|
7694 |
1733: BSF 03.5 |
|
|
7695 |
1734: MOVWF 62 |
|
|
7696 |
1735: BCF 0A.4 |
|
|
7697 |
1736: BCF 03.5 |
|
|
7698 |
1737: CALL 303 |
|
|
7699 |
1738: BSF 0A.4 |
|
|
7700 |
1739: DECFSZ 4D,F |
|
|
7701 |
173A: GOTO 732 |
960 |
jacho |
7702 |
.................... } |
1045 |
jacho |
7703 |
173B: INCF 4C,F |
|
|
7704 |
173C: GOTO 72C |
|
|
7705 |
.................... } |
|
|
7706 |
173D: GOTO 5CB |
960 |
jacho |
7707 |
.................... |
|
|
7708 |
.................... } |
|
|
7709 |
.................... |
1045 |
jacho |
7710 |
173E: SLEEP |
960 |
jacho |
7711 |
|
|
|
7712 |
Configuration Fuses: |
1045 |
jacho |
7713 |
Word 1: 2CF5 INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG |
960 |
jacho |
7714 |
Word 2: 3FFF NOWRT BORV40 |