1045 |
jacho |
1 |
CCS PCM C Compiler, Version 4.106, 47914 16-4-13 20:38 |
|
|
2 |
|
|
|
3 |
Filename: C:\Users\Honza\Documents\pic\kompas\main.lst |
|
|
4 |
|
|
|
5 |
ROM used: 3214 words (39%) |
|
|
6 |
Largest free fragment is 2048 |
|
|
7 |
RAM used: 7 (2%) at main() level |
|
|
8 |
71 (19%) worst case |
|
|
9 |
Stack: 3 locations |
|
|
10 |
|
|
|
11 |
* |
|
|
12 |
0000: MOVLW 0C |
|
|
13 |
0001: MOVWF 0A |
|
|
14 |
0002: GOTO 42E |
|
|
15 |
0003: NOP |
|
|
16 |
.................... #include <main.h> |
|
|
17 |
.................... #include <16F887.h> |
|
|
18 |
.................... //////// Standard Header file for the PIC16F887 device //////////////// |
|
|
19 |
.................... #device PIC16F887 |
|
|
20 |
.................... #list |
|
|
21 |
.................... |
|
|
22 |
.................... #device adc=8 |
|
|
23 |
.................... |
|
|
24 |
.................... #FUSES NOWDT //No Watch Dog Timer |
|
|
25 |
.................... #FUSES INTRC //Internal RC Osc |
|
|
26 |
.................... #FUSES NOPUT //No Power Up Timer |
|
|
27 |
.................... #FUSES MCLR //Master Clear pin enabled |
|
|
28 |
.................... #FUSES NOPROTECT //Code not protected from reading |
|
|
29 |
.................... #FUSES NOCPD //No EE protection |
|
|
30 |
.................... #FUSES NOBROWNOUT //No brownout reset |
|
|
31 |
.................... #FUSES IESO //Internal External Switch Over mode enabled |
|
|
32 |
.................... #FUSES FCMEN //Fail-safe clock monitor enabled |
|
|
33 |
.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O |
|
|
34 |
.................... #FUSES NODEBUG //No Debug mode for ICD |
|
|
35 |
.................... #FUSES NOWRT //Program memory not write protected |
|
|
36 |
.................... #FUSES BORV40 //Brownout reset at 4.0V |
|
|
37 |
.................... |
|
|
38 |
.................... #use delay(clock=8000000) |
|
|
39 |
* |
|
|
40 |
0108: MOVLW 30 |
|
|
41 |
0109: MOVWF 04 |
|
|
42 |
010A: BCF 03.7 |
|
|
43 |
010B: MOVF 00,W |
|
|
44 |
010C: BTFSC 03.2 |
|
|
45 |
010D: GOTO 11B |
|
|
46 |
010E: MOVLW 02 |
|
|
47 |
010F: MOVWF 78 |
|
|
48 |
0110: CLRF 77 |
|
|
49 |
0111: DECFSZ 77,F |
|
|
50 |
0112: GOTO 111 |
|
|
51 |
0113: DECFSZ 78,F |
|
|
52 |
0114: GOTO 110 |
|
|
53 |
0115: MOVLW 97 |
|
|
54 |
0116: MOVWF 77 |
|
|
55 |
0117: DECFSZ 77,F |
|
|
56 |
0118: GOTO 117 |
|
|
57 |
0119: DECFSZ 00,F |
|
|
58 |
011A: GOTO 10E |
|
|
59 |
011B: RETURN |
|
|
60 |
.................... |
|
|
61 |
.................... |
|
|
62 |
.................... #define EEPROM_SDA PIN_B0 |
|
|
63 |
.................... #define EEPROM_SCL PIN_B1 |
|
|
64 |
.................... #use i2c(master, sda=EEPROM_SDA, scl=EEPROM_SCL) |
|
|
65 |
* |
|
|
66 |
00D4: MOVLW 08 |
|
|
67 |
00D5: MOVWF 78 |
|
|
68 |
00D6: NOP |
|
|
69 |
00D7: BCF 06.1 |
|
|
70 |
00D8: BSF 03.5 |
|
|
71 |
00D9: BCF 06.1 |
|
|
72 |
00DA: NOP |
|
|
73 |
00DB: BCF 03.5 |
|
|
74 |
00DC: RLF 42,F |
|
|
75 |
00DD: BCF 06.0 |
|
|
76 |
00DE: BTFSS 03.0 |
|
|
77 |
00DF: GOTO 0E3 |
|
|
78 |
00E0: BSF 03.5 |
|
|
79 |
00E1: BSF 06.0 |
|
|
80 |
00E2: BCF 03.5 |
|
|
81 |
00E3: BTFSC 03.0 |
|
|
82 |
00E4: GOTO 0E8 |
|
|
83 |
00E5: BSF 03.5 |
|
|
84 |
00E6: BCF 06.0 |
|
|
85 |
00E7: BCF 03.5 |
|
|
86 |
00E8: BSF 03.5 |
|
|
87 |
00E9: BSF 06.1 |
|
|
88 |
00EA: BCF 03.5 |
|
|
89 |
00EB: BTFSS 06.1 |
|
|
90 |
00EC: GOTO 0EB |
|
|
91 |
00ED: DECFSZ 78,F |
|
|
92 |
00EE: GOTO 0D6 |
|
|
93 |
00EF: NOP |
|
|
94 |
00F0: BCF 06.1 |
|
|
95 |
00F1: BSF 03.5 |
|
|
96 |
00F2: BCF 06.1 |
|
|
97 |
00F3: NOP |
|
|
98 |
00F4: BSF 06.0 |
|
|
99 |
00F5: NOP |
|
|
100 |
00F6: NOP |
|
|
101 |
00F7: BSF 06.1 |
|
|
102 |
00F8: BCF 03.5 |
|
|
103 |
00F9: BTFSS 06.1 |
|
|
104 |
00FA: GOTO 0F9 |
|
|
105 |
00FB: CLRF 78 |
|
|
106 |
00FC: NOP |
|
|
107 |
00FD: BTFSC 06.0 |
|
|
108 |
00FE: BSF 78.0 |
|
|
109 |
00FF: BCF 06.1 |
|
|
110 |
0100: BSF 03.5 |
|
|
111 |
0101: BCF 06.1 |
|
|
112 |
0102: BCF 03.5 |
|
|
113 |
0103: BCF 06.0 |
|
|
114 |
0104: BSF 03.5 |
|
|
115 |
0105: BCF 06.0 |
|
|
116 |
0106: BCF 03.5 |
|
|
117 |
0107: RETURN |
|
|
118 |
* |
|
|
119 |
01CC: MOVLW 08 |
|
|
120 |
01CD: MOVWF 43 |
|
|
121 |
01CE: MOVF 77,W |
|
|
122 |
01CF: MOVWF 44 |
|
|
123 |
01D0: BSF 03.5 |
|
|
124 |
01D1: BSF 06.0 |
|
|
125 |
01D2: NOP |
|
|
126 |
01D3: BSF 06.1 |
|
|
127 |
01D4: BCF 03.5 |
|
|
128 |
01D5: BTFSS 06.1 |
|
|
129 |
01D6: GOTO 1D5 |
|
|
130 |
01D7: BTFSC 06.0 |
|
|
131 |
01D8: BSF 03.0 |
|
|
132 |
01D9: BTFSS 06.0 |
|
|
133 |
01DA: BCF 03.0 |
|
|
134 |
01DB: RLF 78,F |
|
|
135 |
01DC: NOP |
|
|
136 |
01DD: BSF 03.5 |
|
|
137 |
01DE: BCF 06.1 |
|
|
138 |
01DF: BCF 03.5 |
|
|
139 |
01E0: BCF 06.1 |
|
|
140 |
01E1: DECFSZ 43,F |
|
|
141 |
01E2: GOTO 1D0 |
|
|
142 |
01E3: BSF 03.5 |
|
|
143 |
01E4: BSF 06.0 |
|
|
144 |
01E5: NOP |
|
|
145 |
01E6: BCF 03.5 |
|
|
146 |
01E7: BCF 06.0 |
|
|
147 |
01E8: MOVF 44,W |
|
|
148 |
01E9: BTFSC 03.2 |
|
|
149 |
01EA: GOTO 1EE |
|
|
150 |
01EB: BSF 03.5 |
|
|
151 |
01EC: BCF 06.0 |
|
|
152 |
01ED: BCF 03.5 |
|
|
153 |
01EE: NOP |
|
|
154 |
01EF: BSF 03.5 |
|
|
155 |
01F0: BSF 06.1 |
|
|
156 |
01F1: BCF 03.5 |
|
|
157 |
01F2: BTFSS 06.1 |
|
|
158 |
01F3: GOTO 1F2 |
|
|
159 |
01F4: NOP |
|
|
160 |
01F5: BCF 06.1 |
|
|
161 |
01F6: BSF 03.5 |
|
|
162 |
01F7: BCF 06.1 |
|
|
163 |
01F8: NOP |
|
|
164 |
01F9: BCF 03.5 |
|
|
165 |
01FA: BCF 06.0 |
|
|
166 |
01FB: BSF 03.5 |
|
|
167 |
01FC: BCF 06.0 |
|
|
168 |
.................... #use rs232(baud=9600,parity=N,xmit=PIN_B3,rcv=PIN_B2,bits=8) //rcv TXD xmit RXD |
|
|
169 |
* |
|
|
170 |
008D: BSF 03.5 |
|
|
171 |
008E: BCF 06.3 |
|
|
172 |
008F: BCF 03.5 |
|
|
173 |
0090: BCF 06.3 |
|
|
174 |
0091: MOVLW 08 |
|
|
175 |
0092: MOVWF 78 |
|
|
176 |
0093: GOTO 094 |
|
|
177 |
0094: NOP |
|
|
178 |
0095: BSF 78.7 |
|
|
179 |
0096: GOTO 0A5 |
|
|
180 |
0097: BCF 78.7 |
|
|
181 |
0098: RRF 40,F |
|
|
182 |
0099: BTFSC 03.0 |
|
|
183 |
009A: BSF 06.3 |
|
|
184 |
009B: BTFSS 03.0 |
|
|
185 |
009C: BCF 06.3 |
|
|
186 |
009D: BSF 78.6 |
|
|
187 |
009E: GOTO 0A5 |
|
|
188 |
009F: BCF 78.6 |
|
|
189 |
00A0: DECFSZ 78,F |
|
|
190 |
00A1: GOTO 098 |
|
|
191 |
00A2: GOTO 0A3 |
|
|
192 |
00A3: NOP |
|
|
193 |
00A4: BSF 06.3 |
|
|
194 |
00A5: MOVLW 3F |
|
|
195 |
00A6: MOVWF 04 |
|
|
196 |
00A7: DECFSZ 04,F |
|
|
197 |
00A8: GOTO 0A7 |
|
|
198 |
00A9: NOP |
|
|
199 |
00AA: BTFSC 78.7 |
|
|
200 |
00AB: GOTO 097 |
|
|
201 |
00AC: BTFSC 78.6 |
|
|
202 |
00AD: GOTO 09F |
|
|
203 |
00AE: RETURN |
|
|
204 |
.................... #include <math.h> |
|
|
205 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
206 |
.................... //// (C) Copyright 1996,2008 Custom Computer Services //// |
|
|
207 |
.................... //// This source code may only be used by licensed users of the CCS C //// |
|
|
208 |
.................... //// compiler. This source code may only be distributed to other //// |
|
|
209 |
.................... //// licensed users of the CCS C compiler. No other use, reproduction //// |
|
|
210 |
.................... //// or distribution is permitted without written permission. //// |
|
|
211 |
.................... //// Derivative programs created using this software in object code //// |
|
|
212 |
.................... //// form are not restricted in any way. //// |
|
|
213 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
214 |
.................... //// //// |
|
|
215 |
.................... //// History: //// |
|
|
216 |
.................... //// * 9/20/2001 : Improvments are made to sin/cos code. //// |
|
|
217 |
.................... //// The code now is small, much faster, //// |
|
|
218 |
.................... //// and more accurate. //// |
|
|
219 |
.................... //// * 2/21/2007 : Compiler handles & operator differently and does |
|
|
220 |
.................... //// not return generic (int8 *) so type cast is done //// |
|
|
221 |
.................... //// //// |
|
|
222 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
223 |
.................... |
|
|
224 |
.................... #ifndef MATH_H |
|
|
225 |
.................... #define MATH_H |
|
|
226 |
.................... |
|
|
227 |
.................... #ifdef PI |
|
|
228 |
.................... #undef PI |
|
|
229 |
.................... #endif |
|
|
230 |
.................... #define PI 3.1415926535897932 |
|
|
231 |
.................... |
|
|
232 |
.................... |
|
|
233 |
.................... #define SQRT2 1.4142135623730950 |
|
|
234 |
.................... |
|
|
235 |
.................... //float const ps[4] = {5.9304945, 21.125224, 8.9403076, 0.29730279}; |
|
|
236 |
.................... //float const qs[4] = {1.0000000, 15.035723, 17.764134, 2.4934718}; |
|
|
237 |
.................... |
|
|
238 |
.................... ///////////////////////////// Round Functions ////////////////////////////// |
|
|
239 |
.................... |
|
|
240 |
.................... float32 CEIL_FLOOR(float32 x, unsigned int8 n) |
|
|
241 |
.................... { |
|
|
242 |
.................... float32 y, res; |
|
|
243 |
.................... unsigned int16 l; |
|
|
244 |
.................... int1 s; |
|
|
245 |
.................... |
|
|
246 |
.................... s = 0; |
|
|
247 |
.................... y = x; |
|
|
248 |
.................... |
|
|
249 |
.................... if (x < 0) |
|
|
250 |
.................... { |
|
|
251 |
.................... s = 1; |
|
|
252 |
.................... y = -y; |
|
|
253 |
.................... } |
|
|
254 |
.................... |
|
|
255 |
.................... if (y <= 32768.0) |
|
|
256 |
.................... res = (float32)(unsigned int16)y; |
|
|
257 |
.................... |
|
|
258 |
.................... else if (y < 10000000.0) |
|
|
259 |
.................... { |
|
|
260 |
.................... l = (unsigned int16)(y/32768.0); |
|
|
261 |
.................... y = 32768.0*(y/32768.0 - (float32)l); |
|
|
262 |
.................... res = 32768.0*(float32)l; |
|
|
263 |
.................... res += (float32)(unsigned int16)y; |
|
|
264 |
.................... } |
|
|
265 |
.................... |
|
|
266 |
.................... else |
|
|
267 |
.................... res = y; |
|
|
268 |
.................... |
|
|
269 |
.................... y = y - (float32)(unsigned int16)y; |
|
|
270 |
.................... |
|
|
271 |
.................... if (s) |
|
|
272 |
.................... res = -res; |
|
|
273 |
.................... |
|
|
274 |
.................... if (y != 0) |
|
|
275 |
.................... { |
|
|
276 |
.................... if (s == 1 && n == 0) |
|
|
277 |
.................... res -= 1.0; |
|
|
278 |
.................... |
|
|
279 |
.................... if (s == 0 && n == 1) |
|
|
280 |
.................... res += 1.0; |
|
|
281 |
.................... } |
|
|
282 |
.................... if (x == 0) |
|
|
283 |
.................... res = 0; |
|
|
284 |
.................... |
|
|
285 |
.................... return (res); |
|
|
286 |
.................... } |
|
|
287 |
.................... |
|
|
288 |
.................... // Overloaded Functions to take care for new Data types in PCD |
|
|
289 |
.................... // Overloaded function CEIL_FLOOR() for data type - Float48 |
|
|
290 |
.................... #if defined(__PCD__) |
|
|
291 |
.................... float48 CEIL_FLOOR(float48 x, unsigned int8 n) |
|
|
292 |
.................... { |
|
|
293 |
.................... float48 y, res; |
|
|
294 |
.................... unsigned int16 l; |
|
|
295 |
.................... int1 s; |
|
|
296 |
.................... |
|
|
297 |
.................... s = 0; |
|
|
298 |
.................... y = x; |
|
|
299 |
.................... |
|
|
300 |
.................... if (x < 0) |
|
|
301 |
.................... { |
|
|
302 |
.................... s = 1; |
|
|
303 |
.................... y = -y; |
|
|
304 |
.................... } |
|
|
305 |
.................... |
|
|
306 |
.................... if (y <= 32768.0) |
|
|
307 |
.................... res = (float48)(unsigned int16)y; |
|
|
308 |
.................... |
|
|
309 |
.................... else if (y < 10000000.0) |
|
|
310 |
.................... { |
|
|
311 |
.................... l = (unsigned int16)(y/32768.0); |
|
|
312 |
.................... y = 32768.0*(y/32768.0 - (float48)l); |
|
|
313 |
.................... res = 32768.0*(float32)l; |
|
|
314 |
.................... res += (float48)(unsigned int16)y; |
|
|
315 |
.................... } |
|
|
316 |
.................... |
|
|
317 |
.................... else |
|
|
318 |
.................... res = y; |
|
|
319 |
.................... |
|
|
320 |
.................... y = y - (float48)(unsigned int16)y; |
|
|
321 |
.................... |
|
|
322 |
.................... if (s) |
|
|
323 |
.................... res = -res; |
|
|
324 |
.................... |
|
|
325 |
.................... if (y != 0) |
|
|
326 |
.................... { |
|
|
327 |
.................... if (s == 1 && n == 0) |
|
|
328 |
.................... res -= 1.0; |
|
|
329 |
.................... |
|
|
330 |
.................... if (s == 0 && n == 1) |
|
|
331 |
.................... res += 1.0; |
|
|
332 |
.................... } |
|
|
333 |
.................... if (x == 0) |
|
|
334 |
.................... res = 0; |
|
|
335 |
.................... |
|
|
336 |
.................... return (res); |
|
|
337 |
.................... } |
|
|
338 |
.................... |
|
|
339 |
.................... |
|
|
340 |
.................... // Overloaded function CEIL_FLOOR() for data type - Float64 |
|
|
341 |
.................... float64 CEIL_FLOOR(float64 x, unsigned int8 n) |
|
|
342 |
.................... { |
|
|
343 |
.................... float64 y, res; |
|
|
344 |
.................... unsigned int16 l; |
|
|
345 |
.................... int1 s; |
|
|
346 |
.................... |
|
|
347 |
.................... s = 0; |
|
|
348 |
.................... y = x; |
|
|
349 |
.................... |
|
|
350 |
.................... if (x < 0) |
|
|
351 |
.................... { |
|
|
352 |
.................... s = 1; |
|
|
353 |
.................... y = -y; |
|
|
354 |
.................... } |
|
|
355 |
.................... |
|
|
356 |
.................... if (y <= 32768.0) |
|
|
357 |
.................... res = (float64)(unsigned int16)y; |
|
|
358 |
.................... |
|
|
359 |
.................... else if (y < 10000000.0) |
|
|
360 |
.................... { |
|
|
361 |
.................... l = (unsigned int16)(y/32768.0); |
|
|
362 |
.................... y = 32768.0*(y/32768.0 - (float64)l); |
|
|
363 |
.................... res = 32768.0*(float64)l; |
|
|
364 |
.................... res += (float64)(unsigned int16)y; |
|
|
365 |
.................... } |
|
|
366 |
.................... |
|
|
367 |
.................... else |
|
|
368 |
.................... res = y; |
|
|
369 |
.................... |
|
|
370 |
.................... y = y - (float64)(unsigned int16)y; |
|
|
371 |
.................... |
|
|
372 |
.................... if (s) |
|
|
373 |
.................... res = -res; |
|
|
374 |
.................... |
|
|
375 |
.................... if (y != 0) |
|
|
376 |
.................... { |
|
|
377 |
.................... if (s == 1 && n == 0) |
|
|
378 |
.................... res -= 1.0; |
|
|
379 |
.................... |
|
|
380 |
.................... if (s == 0 && n == 1) |
|
|
381 |
.................... res += 1.0; |
|
|
382 |
.................... } |
|
|
383 |
.................... if (x == 0) |
|
|
384 |
.................... res = 0; |
|
|
385 |
.................... |
|
|
386 |
.................... return (res); |
|
|
387 |
.................... } |
|
|
388 |
.................... #endif |
|
|
389 |
.................... |
|
|
390 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
391 |
.................... // float floor(float x) |
|
|
392 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
393 |
.................... // Description : rounds down the number x. |
|
|
394 |
.................... // Date : N/A |
|
|
395 |
.................... // |
|
|
396 |
.................... float32 floor(float32 x) |
|
|
397 |
.................... { |
|
|
398 |
.................... return CEIL_FLOOR(x, 0); |
|
|
399 |
.................... } |
|
|
400 |
.................... // Following 2 functions are overloaded functions of floor() for PCD |
|
|
401 |
.................... // Overloaded function floor() for data type - Float48 |
|
|
402 |
.................... #if defined(__PCD__) |
|
|
403 |
.................... float48 floor(float48 x) |
|
|
404 |
.................... { |
|
|
405 |
.................... return CEIL_FLOOR(x, 0); |
|
|
406 |
.................... } |
|
|
407 |
.................... |
|
|
408 |
.................... // Overloaded function floor() for data type - Float64 |
|
|
409 |
.................... float64 floor(float64 x) |
|
|
410 |
.................... { |
|
|
411 |
.................... return CEIL_FLOOR(x, 0); |
|
|
412 |
.................... } |
|
|
413 |
.................... #endif |
|
|
414 |
.................... |
|
|
415 |
.................... |
|
|
416 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
417 |
.................... // float ceil(float x) |
|
|
418 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
419 |
.................... // Description : rounds up the number x. |
|
|
420 |
.................... // Date : N/A |
|
|
421 |
.................... // |
|
|
422 |
.................... float32 ceil(float32 x) |
|
|
423 |
.................... { |
|
|
424 |
.................... return CEIL_FLOOR(x, 1); |
|
|
425 |
.................... } |
|
|
426 |
.................... // Following 2 functions are overloaded functions of ceil() for PCD |
|
|
427 |
.................... // Overloaded function ceil() for data type - Float48 |
|
|
428 |
.................... #if defined(__PCD__) |
|
|
429 |
.................... float48 ceil(float48 x) |
|
|
430 |
.................... { |
|
|
431 |
.................... return CEIL_FLOOR(x, 1); |
|
|
432 |
.................... } |
|
|
433 |
.................... |
|
|
434 |
.................... // Overloaded function ceil() for data type - Float64 |
|
|
435 |
.................... float64 ceil(float64 x) |
|
|
436 |
.................... { |
|
|
437 |
.................... return CEIL_FLOOR(x, 1); |
|
|
438 |
.................... } |
|
|
439 |
.................... #endif |
|
|
440 |
.................... |
|
|
441 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
442 |
.................... // float fabs(float x) |
|
|
443 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
444 |
.................... // Description : Computes the absolute value of floating point number x |
|
|
445 |
.................... // Returns : returns the absolute value of x |
|
|
446 |
.................... // Date : N/A |
|
|
447 |
.................... // |
|
|
448 |
.................... #define fabs abs |
|
|
449 |
.................... |
|
|
450 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
451 |
.................... // float fmod(float x) |
|
|
452 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
453 |
.................... // Description : Computes the floating point remainder of x/y |
|
|
454 |
.................... // Returns : returns the value of x= i*y, for some integer i such that, if y |
|
|
455 |
.................... // is non zero, the result has the same isgn of x na dmagnitude less than the |
|
|
456 |
.................... // magnitude of y. If y is zero then a domain error occurs. |
|
|
457 |
.................... // Date : N/A |
|
|
458 |
.................... // |
|
|
459 |
.................... |
|
|
460 |
.................... float fmod(float32 x,float32 y) |
|
|
461 |
.................... { |
|
|
462 |
.................... float32 i; |
|
|
463 |
.................... if (y!=0.0) |
|
|
464 |
.................... { |
|
|
465 |
.................... i=(x/y < 0.0)? ceil(x/y): floor(x/y); |
|
|
466 |
.................... return(x-(i*y)); |
|
|
467 |
.................... } |
|
|
468 |
.................... else |
|
|
469 |
.................... { |
|
|
470 |
.................... #ifdef _ERRNO |
|
|
471 |
.................... { |
|
|
472 |
.................... errno=EDOM; |
|
|
473 |
.................... } |
|
|
474 |
.................... #endif |
|
|
475 |
.................... } |
|
|
476 |
.................... } |
|
|
477 |
.................... //Overloaded function for fmod() for PCD |
|
|
478 |
.................... // Overloaded function fmod() for data type - Float48 |
|
|
479 |
.................... #if defined(__PCD__) |
|
|
480 |
.................... float48 fmod(float48 x,float48 y) |
|
|
481 |
.................... { |
|
|
482 |
.................... float48 i; |
|
|
483 |
.................... if (y!=0.0) |
|
|
484 |
.................... { |
|
|
485 |
.................... i=(x/y < 0.0)? ceil(x/y): floor(x/y); |
|
|
486 |
.................... return(x-(i*y)); |
|
|
487 |
.................... } |
|
|
488 |
.................... else |
|
|
489 |
.................... { |
|
|
490 |
.................... #ifdef _ERRNO |
|
|
491 |
.................... { |
|
|
492 |
.................... errno=EDOM; |
|
|
493 |
.................... } |
|
|
494 |
.................... #endif |
|
|
495 |
.................... } |
|
|
496 |
.................... } |
|
|
497 |
.................... // Overloaded function fmod() for data type - Float64 |
|
|
498 |
.................... float64 fmod(float64 x,float64 y) |
|
|
499 |
.................... { |
|
|
500 |
.................... float64 i; |
|
|
501 |
.................... if (y!=0.0) |
|
|
502 |
.................... { |
|
|
503 |
.................... i=(x/y < 0.0)? ceil(x/y): floor(x/y); |
|
|
504 |
.................... return(x-(i*y)); |
|
|
505 |
.................... } |
|
|
506 |
.................... else |
|
|
507 |
.................... { |
|
|
508 |
.................... #ifdef _ERRNO |
|
|
509 |
.................... { |
|
|
510 |
.................... errno=EDOM; |
|
|
511 |
.................... } |
|
|
512 |
.................... #endif |
|
|
513 |
.................... } |
|
|
514 |
.................... } |
|
|
515 |
.................... #endif |
|
|
516 |
.................... //////////////////// Exponential and logarithmic functions //////////////////// |
|
|
517 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
518 |
.................... // float exp(float x) |
|
|
519 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
520 |
.................... // Description : returns the value (e^x) |
|
|
521 |
.................... // Date : N/A |
|
|
522 |
.................... // |
|
|
523 |
.................... #define LN2 0.6931471805599453 |
|
|
524 |
.................... |
|
|
525 |
.................... float const pe[6] = {0.000207455774, 0.00127100575, 0.00965065093, |
|
|
526 |
.................... 0.0554965651, 0.240227138, 0.693147172}; |
|
|
527 |
.................... |
|
|
528 |
.................... |
|
|
529 |
.................... float32 exp(float32 x) |
|
|
530 |
.................... { |
|
|
531 |
.................... float32 y, res, r; |
|
|
532 |
.................... #if defined(__PCD__) |
|
|
533 |
.................... int8 data1; |
|
|
534 |
.................... #endif |
|
|
535 |
.................... signed int8 n; |
|
|
536 |
.................... int1 s; |
|
|
537 |
.................... #ifdef _ERRNO |
|
|
538 |
.................... if(x > 88.722838) |
|
|
539 |
.................... { |
|
|
540 |
.................... errno=ERANGE; |
|
|
541 |
.................... return(0); |
|
|
542 |
.................... } |
|
|
543 |
.................... #endif |
|
|
544 |
.................... n = (signed int16)(x/LN2); |
|
|
545 |
.................... s = 0; |
|
|
546 |
.................... y = x; |
|
|
547 |
.................... |
|
|
548 |
.................... if (x < 0) |
|
|
549 |
.................... { |
|
|
550 |
.................... s = 1; |
|
|
551 |
.................... n = -n; |
|
|
552 |
.................... y = -y; |
|
|
553 |
.................... } |
|
|
554 |
.................... |
|
|
555 |
.................... res = 0.0; |
|
|
556 |
.................... #if !defined(__PCD__) |
|
|
557 |
.................... *((unsigned int8 *)(&res)) = n + 0x7F; |
|
|
558 |
.................... #endif |
|
|
559 |
.................... |
|
|
560 |
.................... #if defined(__PCD__) // Takes care of IEEE format for PCD |
|
|
561 |
.................... data1 = n+0x7F; |
|
|
562 |
.................... if(bit_test(data1,0)) |
|
|
563 |
.................... bit_set(*(((unsigned int8 *)(&res)+2)),7); |
|
|
564 |
.................... rotate_right(&data1,1); |
|
|
565 |
.................... bit_clear(data1,7); |
|
|
566 |
.................... *(((unsigned int8 *)(&res)+3)) = data1; |
|
|
567 |
.................... #endif |
|
|
568 |
.................... |
|
|
569 |
.................... y = y/LN2 - (float32)n; |
|
|
570 |
.................... |
|
|
571 |
.................... r = pe[0]*y + pe[1]; |
|
|
572 |
.................... r = r*y + pe[2]; |
|
|
573 |
.................... r = r*y + pe[3]; |
|
|
574 |
.................... r = r*y + pe[4]; |
|
|
575 |
.................... r = r*y + pe[5]; |
|
|
576 |
.................... |
|
|
577 |
.................... res = res*(1.0 + y*r); |
|
|
578 |
.................... |
|
|
579 |
.................... if (s) |
|
|
580 |
.................... res = 1.0/res; |
|
|
581 |
.................... return(res); |
|
|
582 |
.................... } |
|
|
583 |
.................... |
|
|
584 |
.................... |
|
|
585 |
.................... //Overloaded function for exp() for PCD |
|
|
586 |
.................... // Overloaded function exp() for data type - Float48 |
|
|
587 |
.................... #if defined(__PCD__) |
|
|
588 |
.................... float48 exp(float48 x) |
|
|
589 |
.................... { |
|
|
590 |
.................... float48 y, res, r; |
|
|
591 |
.................... int8 data1; |
|
|
592 |
.................... signed int8 n; |
|
|
593 |
.................... int1 s; |
|
|
594 |
.................... #ifdef _ERRNO |
|
|
595 |
.................... if(x > 88.722838) |
|
|
596 |
.................... { |
|
|
597 |
.................... errno=ERANGE; |
|
|
598 |
.................... return(0); |
|
|
599 |
.................... } |
|
|
600 |
.................... #endif |
|
|
601 |
.................... n = (signed int16)(x/LN2); |
|
|
602 |
.................... s = 0; |
|
|
603 |
.................... y = x; |
|
|
604 |
.................... |
|
|
605 |
.................... if (x < 0) |
|
|
606 |
.................... { |
|
|
607 |
.................... s = 1; |
|
|
608 |
.................... n = -n; |
|
|
609 |
.................... y = -y; |
|
|
610 |
.................... } |
|
|
611 |
.................... |
|
|
612 |
.................... res = 0.0; |
|
|
613 |
.................... |
|
|
614 |
.................... data1 = n+0x7F; |
|
|
615 |
.................... if(bit_test(data1,0)) |
|
|
616 |
.................... bit_set(*(((unsigned int8 *)(&res)+4)),7); |
|
|
617 |
.................... rotate_right(&data1,1); |
|
|
618 |
.................... bit_clear(data1,7); |
|
|
619 |
.................... *(((unsigned int8 *)(&res)+5)) = data1; |
|
|
620 |
.................... |
|
|
621 |
.................... y = y/LN2 - (float48)n; |
|
|
622 |
.................... |
|
|
623 |
.................... r = pe[0]*y + pe[1]; |
|
|
624 |
.................... r = r*y + pe[2]; |
|
|
625 |
.................... r = r*y + pe[3]; |
|
|
626 |
.................... r = r*y + pe[4]; |
|
|
627 |
.................... r = r*y + pe[5]; |
|
|
628 |
.................... |
|
|
629 |
.................... res = res*(1.0 + y*r); |
|
|
630 |
.................... |
|
|
631 |
.................... if (s) |
|
|
632 |
.................... res = 1.0/res; |
|
|
633 |
.................... return(res); |
|
|
634 |
.................... } |
|
|
635 |
.................... |
|
|
636 |
.................... // Overloaded function exp() for data type - Float64 |
|
|
637 |
.................... float64 exp(float64 x) |
|
|
638 |
.................... { |
|
|
639 |
.................... float64 y, res, r; |
|
|
640 |
.................... unsigned int16 data1, data2; |
|
|
641 |
.................... unsigned int16 *p; |
|
|
642 |
.................... signed int16 n; |
|
|
643 |
.................... int1 s; |
|
|
644 |
.................... #ifdef _ERRNO |
|
|
645 |
.................... if(x > 709.7827128) |
|
|
646 |
.................... { |
|
|
647 |
.................... errno=ERANGE; |
|
|
648 |
.................... return(0); |
|
|
649 |
.................... } |
|
|
650 |
.................... #endif |
|
|
651 |
.................... n = (signed int16)(x/LN2); |
|
|
652 |
.................... s = 0; |
|
|
653 |
.................... y = x; |
|
|
654 |
.................... |
|
|
655 |
.................... if (x < 0) |
|
|
656 |
.................... { |
|
|
657 |
.................... s = 1; |
|
|
658 |
.................... n = -n; |
|
|
659 |
.................... y = -y; |
|
|
660 |
.................... } |
|
|
661 |
.................... |
|
|
662 |
.................... res = 0.0; |
|
|
663 |
.................... |
|
|
664 |
.................... #if !defined(__PCD__) |
|
|
665 |
.................... *((unsigned int16 *)(&res)) = n + 0x7F; |
|
|
666 |
.................... #endif |
|
|
667 |
.................... p= (((unsigned int16 *)(&res))+3); |
|
|
668 |
.................... data1 = *p; |
|
|
669 |
.................... data2 = *p; |
|
|
670 |
.................... data1 = n + 0x3FF; |
|
|
671 |
.................... data1 = data1 <<4; |
|
|
672 |
.................... if(bit_test(data2,15)) |
|
|
673 |
.................... bit_set(data1,15); |
|
|
674 |
.................... data2 = data2 & 0x000F; |
|
|
675 |
.................... data1 ^= data2; |
|
|
676 |
.................... |
|
|
677 |
.................... *(((unsigned int16 *)(&res)+3)) = data1; |
|
|
678 |
.................... |
|
|
679 |
.................... |
|
|
680 |
.................... y = y/LN2 - (float64)n; |
|
|
681 |
.................... |
|
|
682 |
.................... r = pe[0]*y + pe[1]; |
|
|
683 |
.................... r = r*y + pe[2]; |
|
|
684 |
.................... r = r*y + pe[3]; |
|
|
685 |
.................... r = r*y + pe[4]; |
|
|
686 |
.................... r = r*y + pe[5]; |
|
|
687 |
.................... |
|
|
688 |
.................... res = res*(1.0 + y*r); |
|
|
689 |
.................... |
|
|
690 |
.................... if (s) |
|
|
691 |
.................... res = 1.0/res; |
|
|
692 |
.................... return(res); |
|
|
693 |
.................... } |
|
|
694 |
.................... |
|
|
695 |
.................... #ENDIF |
|
|
696 |
.................... |
|
|
697 |
.................... |
|
|
698 |
.................... /************************************************************/ |
|
|
699 |
.................... |
|
|
700 |
.................... float32 const pl[4] = {0.45145214, -9.0558803, 26.940971, -19.860189}; |
|
|
701 |
.................... float32 const ql[4] = {1.0000000, -8.1354259, 16.780517, -9.9300943}; |
|
|
702 |
.................... |
|
|
703 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
704 |
.................... // float log(float x) |
|
|
705 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
706 |
.................... // Description : returns the the natural log of x |
|
|
707 |
.................... // Date : N/A |
|
|
708 |
.................... // |
|
|
709 |
.................... float32 log(float32 x) |
|
|
710 |
.................... { |
|
|
711 |
.................... float32 y, res, r, y2; |
|
|
712 |
.................... #if defined(__PCD__) |
|
|
713 |
.................... unsigned int8 data1,data2; |
|
|
714 |
.................... #endif |
|
|
715 |
.................... signed int8 n; |
|
|
716 |
.................... #ifdef _ERRNO |
|
|
717 |
.................... if(x <0) |
|
|
718 |
.................... { |
|
|
719 |
.................... errno=EDOM; |
|
|
720 |
.................... } |
|
|
721 |
.................... if(x ==0) |
|
|
722 |
.................... { |
|
|
723 |
.................... errno=ERANGE; |
|
|
724 |
.................... return(0); |
|
|
725 |
.................... } |
|
|
726 |
.................... #endif |
|
|
727 |
.................... y = x; |
|
|
728 |
.................... |
|
|
729 |
.................... if (y != 1.0) |
|
|
730 |
.................... { |
|
|
731 |
.................... #if !defined(__PCD__) |
|
|
732 |
.................... *((unsigned int8 *)(&y)) = 0x7E; |
|
|
733 |
.................... #endif |
|
|
734 |
.................... |
|
|
735 |
.................... #if defined(__PCD__) // Takes care of IEEE format |
|
|
736 |
.................... data2 = *(((unsigned int8 *)(&y))+3); |
|
|
737 |
.................... *(((unsigned int8 *)(&y))+3) = 0x3F; |
|
|
738 |
.................... data1 = *(((unsigned int8 *)(&y))+2); |
|
|
739 |
.................... bit_clear(data1,7); |
|
|
740 |
.................... *(((unsigned int8 *)(&y))+2) = data1; |
|
|
741 |
.................... if(bit_test(data2,7)) |
|
|
742 |
.................... bit_set(*(((unsigned int8 *)(&y))+3),7); |
|
|
743 |
.................... #endif |
|
|
744 |
.................... |
|
|
745 |
.................... y = (y - 1.0)/(y + 1.0); |
|
|
746 |
.................... |
|
|
747 |
.................... y2=y*y; |
|
|
748 |
.................... |
|
|
749 |
.................... res = pl[0]*y2 + pl[1]; |
|
|
750 |
.................... res = res*y2 + pl[2]; |
|
|
751 |
.................... res = res*y2 + pl[3]; |
|
|
752 |
.................... |
|
|
753 |
.................... r = ql[0]*y2 + ql[1]; |
|
|
754 |
.................... r = r*y2 + ql[2]; |
|
|
755 |
.................... r = r*y2 + ql[3]; |
|
|
756 |
.................... |
|
|
757 |
.................... res = y*res/r; |
|
|
758 |
.................... #if !defined(__PCD__) |
|
|
759 |
.................... n = *((unsigned int8 *)(&x)) - 0x7E; |
|
|
760 |
.................... #endif |
|
|
761 |
.................... #if defined(__PCD__) |
|
|
762 |
.................... data1 = *(((unsigned int8 *)(&x)+3)); |
|
|
763 |
.................... rotate_left(&data1,1); |
|
|
764 |
.................... data2 = *(((unsigned int8 *)(&x)+2)); |
|
|
765 |
.................... if(bit_test (data2,7)) |
|
|
766 |
.................... bit_set(data1,0); |
|
|
767 |
.................... n = data1 - 0x7E; |
|
|
768 |
.................... #endif |
|
|
769 |
.................... |
|
|
770 |
.................... if (n<0) |
|
|
771 |
.................... r = -(float32)-n; |
|
|
772 |
.................... else |
|
|
773 |
.................... r = (float32)n; |
|
|
774 |
.................... |
|
|
775 |
.................... res += r*LN2; |
|
|
776 |
.................... } |
|
|
777 |
.................... |
|
|
778 |
.................... else |
|
|
779 |
.................... res = 0.0; |
|
|
780 |
.................... |
|
|
781 |
.................... return(res); |
|
|
782 |
.................... } |
|
|
783 |
.................... |
|
|
784 |
.................... //Overloaded function for log() for PCD |
|
|
785 |
.................... // Overloaded function log() for data type - Float48 |
|
|
786 |
.................... #if defined(__PCD__) |
|
|
787 |
.................... float48 log(float48 x) |
|
|
788 |
.................... { |
|
|
789 |
.................... float48 y, res, r, y2; |
|
|
790 |
.................... unsigned int8 data1,data2; |
|
|
791 |
.................... signed int8 n; |
|
|
792 |
.................... #ifdef _ERRNO |
|
|
793 |
.................... if(x <0) |
|
|
794 |
.................... { |
|
|
795 |
.................... errno=EDOM; |
|
|
796 |
.................... } |
|
|
797 |
.................... if(x ==0) |
|
|
798 |
.................... { |
|
|
799 |
.................... errno=ERANGE; |
|
|
800 |
.................... return(0); |
|
|
801 |
.................... } |
|
|
802 |
.................... #endif |
|
|
803 |
.................... y = x; |
|
|
804 |
.................... |
|
|
805 |
.................... if (y != 1.0) |
|
|
806 |
.................... { |
|
|
807 |
.................... |
|
|
808 |
.................... #if !defined(__PCD__) |
|
|
809 |
.................... *((unsigned int8 *)(&y)) = 0x7E; |
|
|
810 |
.................... #endif |
|
|
811 |
.................... data2 = *(((unsigned int8 *)(&y))+5); |
|
|
812 |
.................... *(((unsigned int8 *)(&y))+5) = 0x3F; |
|
|
813 |
.................... data1 = *(((unsigned int8 *)(&y))+4); |
|
|
814 |
.................... bit_clear(data1,7); |
|
|
815 |
.................... *(((unsigned int8 *)(&y))+4) = data1; |
|
|
816 |
.................... |
|
|
817 |
.................... if(bit_test(data2,7)) |
|
|
818 |
.................... bit_set(*(((unsigned int8 *)(&y))+4),7); |
|
|
819 |
.................... y = (y - 1.0)/(y + 1.0); |
|
|
820 |
.................... |
|
|
821 |
.................... y2=y*y; |
|
|
822 |
.................... |
|
|
823 |
.................... res = pl[0]*y2 + pl[1]; |
|
|
824 |
.................... res = res*y2 + pl[2]; |
|
|
825 |
.................... res = res*y2 + pl[3]; |
|
|
826 |
.................... |
|
|
827 |
.................... r = ql[0]*y2 + ql[1]; |
|
|
828 |
.................... r = r*y2 + ql[2]; |
|
|
829 |
.................... r = r*y2 + ql[3]; |
|
|
830 |
.................... |
|
|
831 |
.................... res = y*res/r; |
|
|
832 |
.................... |
|
|
833 |
.................... data1 = *(((unsigned int8 *)(&x)+5)); |
|
|
834 |
.................... rotate_left(&data1,1); |
|
|
835 |
.................... data2 = *(((unsigned int8 *)(&x)+4)); |
|
|
836 |
.................... if(bit_test (data2,7)) |
|
|
837 |
.................... bit_set(data1,0); |
|
|
838 |
.................... |
|
|
839 |
.................... n = data1 - 0x7E; |
|
|
840 |
.................... |
|
|
841 |
.................... if (n<0) |
|
|
842 |
.................... r = -(float48)-n; |
|
|
843 |
.................... else |
|
|
844 |
.................... r = (float48)n; |
|
|
845 |
.................... |
|
|
846 |
.................... res += r*LN2; |
|
|
847 |
.................... } |
|
|
848 |
.................... |
|
|
849 |
.................... else |
|
|
850 |
.................... res = 0.0; |
|
|
851 |
.................... |
|
|
852 |
.................... return(res); |
|
|
853 |
.................... } |
|
|
854 |
.................... |
|
|
855 |
.................... // Overloaded function log() for data type - Float48 |
|
|
856 |
.................... #if defined(__PCD__) |
|
|
857 |
.................... float32 const pl_64[4] = {0.45145214, -9.0558803, 26.940971, -19.860189}; |
|
|
858 |
.................... float32 const ql_64[4] = {1.0000000, -8.1354259, 16.780517, -9.9300943}; |
|
|
859 |
.................... #endif |
|
|
860 |
.................... float64 log(float64 x) |
|
|
861 |
.................... { |
|
|
862 |
.................... float64 y, res, r, y2; |
|
|
863 |
.................... unsigned int16 data1,data2; |
|
|
864 |
.................... unsigned int16 *p; |
|
|
865 |
.................... signed int16 n; |
|
|
866 |
.................... #ifdef _ERRNO |
|
|
867 |
.................... if(x <0) |
|
|
868 |
.................... { |
|
|
869 |
.................... errno=EDOM; |
|
|
870 |
.................... } |
|
|
871 |
.................... if(x ==0) |
|
|
872 |
.................... { |
|
|
873 |
.................... errno=ERANGE; |
|
|
874 |
.................... return(0); |
|
|
875 |
.................... } |
|
|
876 |
.................... #endif |
|
|
877 |
.................... y = x; |
|
|
878 |
.................... |
|
|
879 |
.................... if (y != 1.0) |
|
|
880 |
.................... { |
|
|
881 |
.................... #if !defined(__PCD__) |
|
|
882 |
.................... *((unsigned int8 *)(&y)) = 0x7E; |
|
|
883 |
.................... #endif |
|
|
884 |
.................... p= (((unsigned int16 *)(&y))+3); |
|
|
885 |
.................... data1 = *p; |
|
|
886 |
.................... data2 = *p; |
|
|
887 |
.................... data1 = 0x3FE; |
|
|
888 |
.................... data1 = data1 <<4; |
|
|
889 |
.................... if(bit_test (data2,15)) |
|
|
890 |
.................... bit_set(data1,15); |
|
|
891 |
.................... data2 = data2 & 0x000F; |
|
|
892 |
.................... data1 ^=data2; |
|
|
893 |
.................... |
|
|
894 |
.................... *p = data1; |
|
|
895 |
.................... |
|
|
896 |
.................... y = (y - 1.0)/(y + 1.0); |
|
|
897 |
.................... |
|
|
898 |
.................... y2=y*y; |
|
|
899 |
.................... |
|
|
900 |
.................... res = pl_64[0]*y2 + pl_64[1]; |
|
|
901 |
.................... res = res*y2 + pl_64[2]; |
|
|
902 |
.................... res = res*y2 + pl_64[3]; |
|
|
903 |
.................... |
|
|
904 |
.................... r = ql_64[0]*y2 + ql_64[1]; |
|
|
905 |
.................... r = r*y2 + ql_64[2]; |
|
|
906 |
.................... r = r*y2 + ql_64[3]; |
|
|
907 |
.................... |
|
|
908 |
.................... res = y*res/r; |
|
|
909 |
.................... |
|
|
910 |
.................... p= (((unsigned int16 *)(&x))+3); |
|
|
911 |
.................... data1 = *p; |
|
|
912 |
.................... bit_clear(data1,15); |
|
|
913 |
.................... data1 = data1 >>4; |
|
|
914 |
.................... n = data1 - 0x3FE; |
|
|
915 |
.................... |
|
|
916 |
.................... |
|
|
917 |
.................... if (n<0) |
|
|
918 |
.................... r = -(float64)-n; |
|
|
919 |
.................... else |
|
|
920 |
.................... r = (float64)n; |
|
|
921 |
.................... |
|
|
922 |
.................... res += r*LN2; |
|
|
923 |
.................... } |
|
|
924 |
.................... |
|
|
925 |
.................... else |
|
|
926 |
.................... res = 0.0; |
|
|
927 |
.................... |
|
|
928 |
.................... return(res); |
|
|
929 |
.................... } |
|
|
930 |
.................... #endif |
|
|
931 |
.................... |
|
|
932 |
.................... |
|
|
933 |
.................... #define LN10 2.3025850929940456 |
|
|
934 |
.................... |
|
|
935 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
936 |
.................... // float log10(float x) |
|
|
937 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
938 |
.................... // Description : returns the the log base 10 of x |
|
|
939 |
.................... // Date : N/A |
|
|
940 |
.................... // |
|
|
941 |
.................... float32 log10(float32 x) |
|
|
942 |
.................... { |
|
|
943 |
.................... float32 r; |
|
|
944 |
.................... |
|
|
945 |
.................... r = log(x); |
|
|
946 |
.................... r = r/LN10; |
|
|
947 |
.................... return(r); |
|
|
948 |
.................... } |
|
|
949 |
.................... |
|
|
950 |
.................... //Overloaded functions for log10() for PCD |
|
|
951 |
.................... // Overloaded function log10() for data type - Float48 |
|
|
952 |
.................... #if defined(__PCD__) |
|
|
953 |
.................... float48 log10(float48 x) |
|
|
954 |
.................... { |
|
|
955 |
.................... float48 r; |
|
|
956 |
.................... |
|
|
957 |
.................... r = log(x); |
|
|
958 |
.................... r = r/LN10; |
|
|
959 |
.................... return(r); |
|
|
960 |
.................... } |
|
|
961 |
.................... |
|
|
962 |
.................... // Overloaded function log10() for data type - Float64 |
|
|
963 |
.................... float64 log10(float64 x) |
|
|
964 |
.................... { |
|
|
965 |
.................... float64 r; |
|
|
966 |
.................... |
|
|
967 |
.................... r = log(x); |
|
|
968 |
.................... r = r/LN10; |
|
|
969 |
.................... return(r); |
|
|
970 |
.................... } |
|
|
971 |
.................... #endif |
|
|
972 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
973 |
.................... // float modf(float x) |
|
|
974 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
975 |
.................... // Description :breaks the argument value int integral and fractional parts, |
|
|
976 |
.................... // ach of which have the same sign as the argument. It stores the integral part |
|
|
977 |
.................... // as a float in the object pointed to by the iptr |
|
|
978 |
.................... // Returns : returns the signed fractional part of value. |
|
|
979 |
.................... // Date : N/A |
|
|
980 |
.................... // |
|
|
981 |
.................... |
|
|
982 |
.................... float32 modf(float32 value,float32 *iptr) |
|
|
983 |
.................... { |
|
|
984 |
.................... *iptr=(value < 0.0)? ceil(value): floor(value); |
|
|
985 |
.................... return(value - *iptr); |
|
|
986 |
.................... } |
|
|
987 |
.................... //Overloaded functions for modf() for PCD |
|
|
988 |
.................... // Overloaded function modf() for data type - Float48 |
|
|
989 |
.................... #if defined(__PCD__) |
|
|
990 |
.................... float48 modf(float48 value,float48 *iptr) |
|
|
991 |
.................... { |
|
|
992 |
.................... *iptr=(value < 0.0)? ceil(value): floor(value); |
|
|
993 |
.................... return(value - *iptr); |
|
|
994 |
.................... } |
|
|
995 |
.................... // Overloaded function modf() for data type - Float64 |
|
|
996 |
.................... float64 modf(float64 value,float64 *iptr) |
|
|
997 |
.................... { |
|
|
998 |
.................... *iptr=(value < 0.0)? ceil(value): floor(value); |
|
|
999 |
.................... return(value - *iptr); |
|
|
1000 |
.................... } |
|
|
1001 |
.................... #endif |
|
|
1002 |
.................... |
|
|
1003 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1004 |
.................... // float pwr(float x,float y) |
|
|
1005 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1006 |
.................... // Description : returns the value (x^y) |
|
|
1007 |
.................... // Date : N/A |
|
|
1008 |
.................... // Note : 0 is returned when the function will generate an imaginary number |
|
|
1009 |
.................... // |
|
|
1010 |
.................... float32 pwr(float32 x,float32 y) |
|
|
1011 |
.................... { |
|
|
1012 |
.................... if(0 > x && fmod(y, 1) == 0) { |
|
|
1013 |
.................... if(fmod(y, 2) == 0) { |
|
|
1014 |
.................... return (exp(log(-x) * y)); |
|
|
1015 |
.................... } else { |
|
|
1016 |
.................... return (-exp(log(-x) * y)); |
|
|
1017 |
.................... } |
|
|
1018 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
|
|
1019 |
.................... return 0; |
|
|
1020 |
.................... } else { |
|
|
1021 |
.................... if(x != 0 || 0 >= y) { |
|
|
1022 |
.................... return (exp(log(x) * y)); |
|
|
1023 |
.................... } |
|
|
1024 |
.................... } |
|
|
1025 |
.................... } |
|
|
1026 |
.................... //Overloaded functions for pwr() for PCD |
|
|
1027 |
.................... // Overloaded function pwr() for data type - Float48 |
|
|
1028 |
.................... #if defined(__PCD__) |
|
|
1029 |
.................... float48 pwr(float48 x,float48 y) |
|
|
1030 |
.................... { |
|
|
1031 |
.................... if(0 > x && fmod(y, 1) == 0) { |
|
|
1032 |
.................... if(fmod(y, 2) == 0) { |
|
|
1033 |
.................... return (exp(log(-x) * y)); |
|
|
1034 |
.................... } else { |
|
|
1035 |
.................... return (-exp(log(-x) * y)); |
|
|
1036 |
.................... } |
|
|
1037 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
|
|
1038 |
.................... return 0; |
|
|
1039 |
.................... } else { |
|
|
1040 |
.................... if(x != 0 || 0 >= y) { |
|
|
1041 |
.................... return (exp(log(x) * y)); |
|
|
1042 |
.................... } |
|
|
1043 |
.................... } |
|
|
1044 |
.................... } |
|
|
1045 |
.................... // Overloaded function pwr() for data type - Float64 |
|
|
1046 |
.................... float64 pwr(float64 x,float64 y) |
|
|
1047 |
.................... { |
|
|
1048 |
.................... if(0 > x && fmod(y, 1) == 0) { |
|
|
1049 |
.................... if(fmod(y, 2) == 0) { |
|
|
1050 |
.................... return (exp(log(-x) * y)); |
|
|
1051 |
.................... } else { |
|
|
1052 |
.................... return (-exp(log(-x) * y)); |
|
|
1053 |
.................... } |
|
|
1054 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
|
|
1055 |
.................... return 0; |
|
|
1056 |
.................... } else { |
|
|
1057 |
.................... if(x != 0 || 0 >= y) { |
|
|
1058 |
.................... return (exp(log(x) * y)); |
|
|
1059 |
.................... } |
|
|
1060 |
.................... } |
|
|
1061 |
.................... } |
|
|
1062 |
.................... #endif |
|
|
1063 |
.................... |
|
|
1064 |
.................... //////////////////// Power functions //////////////////// |
|
|
1065 |
.................... |
|
|
1066 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1067 |
.................... // float pow(float x,float y) |
|
|
1068 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1069 |
.................... // Description : returns the value (x^y) |
|
|
1070 |
.................... // Date : N/A |
|
|
1071 |
.................... // Note : 0 is returned when the function will generate an imaginary number |
|
|
1072 |
.................... // |
|
|
1073 |
.................... float32 pow(float32 x,float32 y) |
|
|
1074 |
.................... { |
|
|
1075 |
.................... if(0 > x && fmod(y, 1) == 0) { |
|
|
1076 |
.................... if(fmod(y, 2) == 0) { |
|
|
1077 |
.................... return (exp(log(-x) * y)); |
|
|
1078 |
.................... } else { |
|
|
1079 |
.................... return (-exp(log(-x) * y)); |
|
|
1080 |
.................... } |
|
|
1081 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
|
|
1082 |
.................... return 0; |
|
|
1083 |
.................... } else { |
|
|
1084 |
.................... if(x != 0 || 0 >= y) { |
|
|
1085 |
.................... return (exp(log(x) * y)); |
|
|
1086 |
.................... } |
|
|
1087 |
.................... } |
|
|
1088 |
.................... } |
|
|
1089 |
.................... //Overloaded functions for pow() for PCD |
|
|
1090 |
.................... // Overloaded function for pow() data type - Float48 |
|
|
1091 |
.................... #if defined(__PCD__) |
|
|
1092 |
.................... float48 pow(float48 x,float48 y) |
|
|
1093 |
.................... { |
|
|
1094 |
.................... if(0 > x && fmod(y, 1) == 0) { |
|
|
1095 |
.................... if(fmod(y, 2) == 0) { |
|
|
1096 |
.................... return (exp(log(-x) * y)); |
|
|
1097 |
.................... } else { |
|
|
1098 |
.................... return (-exp(log(-x) * y)); |
|
|
1099 |
.................... } |
|
|
1100 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
|
|
1101 |
.................... return 0; |
|
|
1102 |
.................... } else { |
|
|
1103 |
.................... if(x != 0 || 0 >= y) { |
|
|
1104 |
.................... return (exp(log(x) * y)); |
|
|
1105 |
.................... } |
|
|
1106 |
.................... } |
|
|
1107 |
.................... } |
|
|
1108 |
.................... |
|
|
1109 |
.................... // Overloaded function pow() for data type - Float64 |
|
|
1110 |
.................... float64 pow(float64 x,float64 y) |
|
|
1111 |
.................... { |
|
|
1112 |
.................... if(0 > x && fmod(y, 1) == 0) { |
|
|
1113 |
.................... if(fmod(y, 2) == 0) { |
|
|
1114 |
.................... return (exp(log(-x) * y)); |
|
|
1115 |
.................... } else { |
|
|
1116 |
.................... return (-exp(log(-x) * y)); |
|
|
1117 |
.................... } |
|
|
1118 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
|
|
1119 |
.................... return 0; |
|
|
1120 |
.................... } else { |
|
|
1121 |
.................... if(x != 0 || 0 >= y) { |
|
|
1122 |
.................... return (exp(log(x) * y)); |
|
|
1123 |
.................... } |
|
|
1124 |
.................... } |
|
|
1125 |
.................... } |
|
|
1126 |
.................... #endif |
|
|
1127 |
.................... |
|
|
1128 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1129 |
.................... // float sqrt(float x) |
|
|
1130 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1131 |
.................... // Description : returns the square root of x |
|
|
1132 |
.................... // Date : N/A |
|
|
1133 |
.................... // |
|
|
1134 |
.................... float32 sqrt(float32 x) |
|
|
1135 |
.................... { |
|
|
1136 |
.................... float32 y, res; |
|
|
1137 |
.................... #if defined(__PCD__) |
|
|
1138 |
.................... unsigned int16 data1,data2; |
|
|
1139 |
.................... #endif |
|
|
1140 |
.................... BYTE *p; |
|
|
1141 |
.................... |
|
|
1142 |
.................... #ifdef _ERRNO |
|
|
1143 |
.................... if(x < 0) |
|
|
1144 |
.................... { |
|
|
1145 |
.................... errno=EDOM; |
|
|
1146 |
.................... } |
|
|
1147 |
.................... #endif |
|
|
1148 |
.................... |
|
|
1149 |
.................... if( x<=0.0) |
|
|
1150 |
.................... return(0.0); |
|
|
1151 |
.................... |
|
|
1152 |
.................... y=x; |
|
|
1153 |
.................... |
|
|
1154 |
.................... #if !defined(__PCD__) |
|
|
1155 |
.................... p=&y; |
|
|
1156 |
.................... (*p)=(BYTE)((((unsigned int16)(*p)) + 127) >> 1); |
|
|
1157 |
.................... #endif |
|
|
1158 |
.................... |
|
|
1159 |
.................... #if defined(__PCD__) |
|
|
1160 |
.................... p = (((unsigned int8 *)(&y))+3); |
|
|
1161 |
.................... data1 = *(((unsigned int8 *)(&y))+3); |
|
|
1162 |
.................... data2 = *(((unsigned int8 *)(&y))+2); |
|
|
1163 |
.................... rotate_left(&data1,1); |
|
|
1164 |
.................... if(bit_test(data2,7)) |
|
|
1165 |
.................... bit_set(data1,0); |
|
|
1166 |
.................... data1 = ((data1+127) >>1); |
|
|
1167 |
.................... bit_clear(data2,7); |
|
|
1168 |
.................... if(bit_test(data1,0)) |
|
|
1169 |
.................... bit_set(data2,7); |
|
|
1170 |
.................... data1 = data1 >>1; |
|
|
1171 |
.................... *(((unsigned int8 *)(&y))+3) = data1; |
|
|
1172 |
.................... *(((unsigned int8 *)(&y))+2) = data2; |
|
|
1173 |
.................... |
|
|
1174 |
.................... #endif |
|
|
1175 |
.................... |
|
|
1176 |
.................... do { |
|
|
1177 |
.................... res=y; |
|
|
1178 |
.................... y+=(x/y); |
|
|
1179 |
.................... |
|
|
1180 |
.................... #if !defined(__PCD__) |
|
|
1181 |
.................... (*p)--; |
|
|
1182 |
.................... #endif |
|
|
1183 |
.................... |
|
|
1184 |
.................... #if defined(__PCD__) |
|
|
1185 |
.................... data1 = *(((unsigned int8 *)(&y))+3); |
|
|
1186 |
.................... data2 = *(((unsigned int8 *)(&y))+2); |
|
|
1187 |
.................... rotate_left(&data1,1); |
|
|
1188 |
.................... if(bit_test(data2,7)) |
|
|
1189 |
.................... bit_set(data1,0); |
|
|
1190 |
.................... data1--; |
|
|
1191 |
.................... bit_clear(data2,7); |
|
|
1192 |
.................... if(bit_test(data1,0)) |
|
|
1193 |
.................... bit_set(data2,7); |
|
|
1194 |
.................... data1 = data1 >>1; |
|
|
1195 |
.................... *(((unsigned int8 *)(&y))+3) = data1; |
|
|
1196 |
.................... *(((unsigned int8 *)(&y))+2) = data2; |
|
|
1197 |
.................... |
|
|
1198 |
.................... #endif |
|
|
1199 |
.................... } while(res != y); |
|
|
1200 |
.................... |
|
|
1201 |
.................... return(res); |
|
|
1202 |
.................... } |
|
|
1203 |
.................... //Overloaded functions for sqrt() for PCD |
|
|
1204 |
.................... // Overloaded function sqrt() for data type - Float48 |
|
|
1205 |
.................... #if defined(__PCD__) |
|
|
1206 |
.................... float48 sqrt(float48 x) |
|
|
1207 |
.................... { |
|
|
1208 |
.................... float48 y, res; |
|
|
1209 |
.................... unsigned int16 data1,data2; |
|
|
1210 |
.................... BYTE *p; |
|
|
1211 |
.................... |
|
|
1212 |
.................... #ifdef _ERRNO |
|
|
1213 |
.................... if(x < 0) |
|
|
1214 |
.................... { |
|
|
1215 |
.................... errno=EDOM; |
|
|
1216 |
.................... } |
|
|
1217 |
.................... #endif |
|
|
1218 |
.................... |
|
|
1219 |
.................... if( x<=0.0) |
|
|
1220 |
.................... return(0.0); |
|
|
1221 |
.................... |
|
|
1222 |
.................... y=x; |
|
|
1223 |
.................... |
|
|
1224 |
.................... #if !defined(__PCD__) |
|
|
1225 |
.................... p=&y; |
|
|
1226 |
.................... (*p)=(BYTE)((((unsigned int16)(*p)) + 127) >> 1); |
|
|
1227 |
.................... #endif |
|
|
1228 |
.................... |
|
|
1229 |
.................... #if defined(__PCD__) |
|
|
1230 |
.................... p = (((unsigned int8 *)(&y))+5); |
|
|
1231 |
.................... data1 = *(((unsigned int8 *)(&y))+5); |
|
|
1232 |
.................... data2 = *(((unsigned int8 *)(&y))+4); |
|
|
1233 |
.................... rotate_left(&data1,1); |
|
|
1234 |
.................... if(bit_test(data2,7)) |
|
|
1235 |
.................... bit_set(data1,0); |
|
|
1236 |
.................... data1 = ((data1+127) >>1); |
|
|
1237 |
.................... bit_clear(data2,7); |
|
|
1238 |
.................... if(bit_test(data1,0)) |
|
|
1239 |
.................... bit_set(data2,7); |
|
|
1240 |
.................... data1 = data1 >>1; |
|
|
1241 |
.................... *(((unsigned int8 *)(&y))+5) = data1; |
|
|
1242 |
.................... *(((unsigned int8 *)(&y))+4) = data2; |
|
|
1243 |
.................... |
|
|
1244 |
.................... #endif |
|
|
1245 |
.................... |
|
|
1246 |
.................... do { |
|
|
1247 |
.................... res=y; |
|
|
1248 |
.................... y+=(x/y); |
|
|
1249 |
.................... |
|
|
1250 |
.................... #if !defined(__PCD__) |
|
|
1251 |
.................... (*p)--; |
|
|
1252 |
.................... #endif |
|
|
1253 |
.................... |
|
|
1254 |
.................... data1 = *(((unsigned int8 *)(&y))+5); |
|
|
1255 |
.................... data2 = *(((unsigned int8 *)(&y))+4); |
|
|
1256 |
.................... rotate_left(&data1,1); |
|
|
1257 |
.................... if(bit_test(data2,7)) |
|
|
1258 |
.................... bit_set(data1,0); |
|
|
1259 |
.................... data1--; |
|
|
1260 |
.................... bit_clear(data2,7); |
|
|
1261 |
.................... if(bit_test(data1,0)) |
|
|
1262 |
.................... bit_set(data2,7); |
|
|
1263 |
.................... data1 = data1 >>1; |
|
|
1264 |
.................... *(((unsigned int8 *)(&y))+5) = data1; |
|
|
1265 |
.................... *(((unsigned int8 *)(&y))+4) = data2; |
|
|
1266 |
.................... |
|
|
1267 |
.................... } while(res != y); |
|
|
1268 |
.................... |
|
|
1269 |
.................... return(res); |
|
|
1270 |
.................... } |
|
|
1271 |
.................... |
|
|
1272 |
.................... // Overloaded function sqrt() for data type - Float64 |
|
|
1273 |
.................... float64 sqrt(float64 x) |
|
|
1274 |
.................... { |
|
|
1275 |
.................... float64 y, res; |
|
|
1276 |
.................... unsigned int16 *p; |
|
|
1277 |
.................... unsigned int16 temp1,temp2; |
|
|
1278 |
.................... |
|
|
1279 |
.................... #ifdef _ERRNO |
|
|
1280 |
.................... if(x < 0) |
|
|
1281 |
.................... { |
|
|
1282 |
.................... errno=EDOM; |
|
|
1283 |
.................... } |
|
|
1284 |
.................... #endif |
|
|
1285 |
.................... |
|
|
1286 |
.................... if( x<=0.0) |
|
|
1287 |
.................... return(0.0); |
|
|
1288 |
.................... |
|
|
1289 |
.................... y=x; |
|
|
1290 |
.................... p= (((unsigned int16 *)(&y))+3); |
|
|
1291 |
.................... temp1 = *p; |
|
|
1292 |
.................... temp2 = *p; |
|
|
1293 |
.................... bit_clear(temp1,15); |
|
|
1294 |
.................... temp1 = (temp1>>4)+1023; |
|
|
1295 |
.................... temp1 = temp1 >> 1; |
|
|
1296 |
.................... temp1 = (temp1<<4) & 0xFFF0; |
|
|
1297 |
.................... if(bit_test(temp2,15)) |
|
|
1298 |
.................... bit_set(temp1,15); |
|
|
1299 |
.................... temp2 = temp2 & 0x000F; |
|
|
1300 |
.................... temp1 ^= temp2; |
|
|
1301 |
.................... |
|
|
1302 |
.................... (*p) = temp1; |
|
|
1303 |
.................... |
|
|
1304 |
.................... do { |
|
|
1305 |
.................... res=y; |
|
|
1306 |
.................... y+=(x/y); |
|
|
1307 |
.................... temp1 = *p; |
|
|
1308 |
.................... temp2 = *p; |
|
|
1309 |
.................... bit_clear(temp1,15); |
|
|
1310 |
.................... temp1 = (temp1>>4); |
|
|
1311 |
.................... temp1--; |
|
|
1312 |
.................... temp1 = (temp1<<4) & 0xFFF0; |
|
|
1313 |
.................... if(bit_test(temp2,15)) |
|
|
1314 |
.................... bit_set(temp1,15); |
|
|
1315 |
.................... temp2 = temp2 & 0x000F; |
|
|
1316 |
.................... temp1 ^= temp2; |
|
|
1317 |
.................... (*p) = temp1; |
|
|
1318 |
.................... |
|
|
1319 |
.................... } while(res != y); |
|
|
1320 |
.................... |
|
|
1321 |
.................... return(res); |
|
|
1322 |
.................... } |
|
|
1323 |
.................... #endif |
|
|
1324 |
.................... |
|
|
1325 |
.................... ////////////////////////////// Trig Functions ////////////////////////////// |
|
|
1326 |
.................... #ifdef PI_DIV_BY_TWO |
|
|
1327 |
.................... #undef PI_DIV_BY_TWO |
|
|
1328 |
.................... #endif |
|
|
1329 |
.................... #define PI_DIV_BY_TWO 1.5707963267948966 |
|
|
1330 |
.................... #ifdef TWOBYPI |
|
|
1331 |
.................... #undef TWOBYPI |
|
|
1332 |
.................... #define TWOBYPI 0.6366197723675813 |
|
|
1333 |
.................... #endif |
|
|
1334 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1335 |
.................... // float cos(float x) |
|
|
1336 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1337 |
.................... // Description : returns the cosine value of the angle x, which is in radian |
|
|
1338 |
.................... // Date : 9/20/2001 |
|
|
1339 |
.................... // |
|
|
1340 |
.................... float32 cos(float32 x) |
|
|
1341 |
.................... { |
|
|
1342 |
.................... float32 y, t, t2 = 1.0; |
|
|
1343 |
.................... unsigned int8 quad, i; |
|
|
1344 |
.................... float32 frac; |
|
|
1345 |
.................... float32 p[6] = { //by the series definition for cosine |
|
|
1346 |
.................... -0.5, // sum ( ( (-1)^n * x^2n )/(2n)! ) |
|
|
1347 |
.................... 0.04166666666667, |
|
|
1348 |
.................... -0.00138888888889, |
|
|
1349 |
.................... 0.00002480158730, |
|
|
1350 |
.................... -0.00000027557319, |
|
|
1351 |
.................... 0.00000000208767, |
|
|
1352 |
.................... //-0.00000000001147, |
|
|
1353 |
.................... // 0.00000000000005 |
|
|
1354 |
.................... }; |
|
|
1355 |
.................... |
|
|
1356 |
.................... if (x < 0) x = -x; // absolute value of input |
|
|
1357 |
.................... |
|
|
1358 |
.................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant |
|
|
1359 |
.................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input |
|
|
1360 |
.................... quad = quad % 4; // quadrant (0 to 3) |
|
|
1361 |
.................... |
|
|
1362 |
.................... if (quad == 0 || quad == 2) |
|
|
1363 |
.................... t = frac * PI_DIV_BY_TWO; |
|
|
1364 |
.................... else if (quad == 1) |
|
|
1365 |
.................... t = (1-frac) * PI_DIV_BY_TWO; |
|
|
1366 |
.................... else // should be 3 |
|
|
1367 |
.................... t = (frac-1) * PI_DIV_BY_TWO; |
|
|
1368 |
.................... |
|
|
1369 |
.................... y = 1.0; |
|
|
1370 |
.................... t = t * t; |
|
|
1371 |
.................... for (i = 0; i <= 5; i++) |
|
|
1372 |
.................... { |
|
|
1373 |
.................... t2 = t2 * t; |
|
|
1374 |
.................... y = y + p[i] * t2; |
|
|
1375 |
.................... } |
|
|
1376 |
.................... |
|
|
1377 |
.................... if (quad == 2 || quad == 1) |
|
|
1378 |
.................... y = -y; // correct sign |
|
|
1379 |
.................... |
|
|
1380 |
.................... return (y); |
|
|
1381 |
.................... } |
|
|
1382 |
.................... |
|
|
1383 |
.................... |
|
|
1384 |
.................... //Overloaded functions for cos() for PCD |
|
|
1385 |
.................... // Overloaded function cos() for data type - Float48 |
|
|
1386 |
.................... #if defined(__PCD__) |
|
|
1387 |
.................... float48 cos(float48 x) |
|
|
1388 |
.................... { |
|
|
1389 |
.................... float48 y, t, t2 = 1.0; |
|
|
1390 |
.................... unsigned int8 quad, i; |
|
|
1391 |
.................... float48 frac; |
|
|
1392 |
.................... float48 p[6] = { //by the series definition for cosine |
|
|
1393 |
.................... -0.5, // sum ( ( (-1)^n * x^2n )/(2n)! ) |
|
|
1394 |
.................... 0.04166666666667, |
|
|
1395 |
.................... -0.00138888888889, |
|
|
1396 |
.................... 0.00002480158730, |
|
|
1397 |
.................... -0.00000027557319, |
|
|
1398 |
.................... 0.00000000208767, |
|
|
1399 |
.................... //-0.00000000001147, |
|
|
1400 |
.................... // 0.00000000000005 |
|
|
1401 |
.................... }; |
|
|
1402 |
.................... |
|
|
1403 |
.................... if (x < 0) x = -x; // absolute value of input |
|
|
1404 |
.................... |
|
|
1405 |
.................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant |
|
|
1406 |
.................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input |
|
|
1407 |
.................... quad = quad % 4; // quadrant (0 to 3) |
|
|
1408 |
.................... |
|
|
1409 |
.................... if (quad == 0 || quad == 2) |
|
|
1410 |
.................... t = frac * PI_DIV_BY_TWO; |
|
|
1411 |
.................... else if (quad == 1) |
|
|
1412 |
.................... t = (1-frac) * PI_DIV_BY_TWO; |
|
|
1413 |
.................... else // should be 3 |
|
|
1414 |
.................... t = (frac-1) * PI_DIV_BY_TWO; |
|
|
1415 |
.................... |
|
|
1416 |
.................... y = 0.999999999781; |
|
|
1417 |
.................... t = t * t; |
|
|
1418 |
.................... for (i = 0; i <= 5; i++) |
|
|
1419 |
.................... { |
|
|
1420 |
.................... t2 = t2 * t; |
|
|
1421 |
.................... y = y + p[i] * t2; |
|
|
1422 |
.................... } |
|
|
1423 |
.................... |
|
|
1424 |
.................... if (quad == 2 || quad == 1) |
|
|
1425 |
.................... y = -y; // correct sign |
|
|
1426 |
.................... |
|
|
1427 |
.................... return (y); |
|
|
1428 |
.................... } |
|
|
1429 |
.................... |
|
|
1430 |
.................... // Overloaded function cos() for data type - Float48 |
|
|
1431 |
.................... float64 cos(float64 x) |
|
|
1432 |
.................... { |
|
|
1433 |
.................... float64 y, t, t2 = 1.0; |
|
|
1434 |
.................... unsigned int8 quad, i; |
|
|
1435 |
.................... float64 frac; |
|
|
1436 |
.................... float64 p[6] = { //by the series definition for cosine |
|
|
1437 |
.................... -0.5, // sum ( ( (-1)^n * x^2n )/(2n)! ) |
|
|
1438 |
.................... 0.04166666666667, |
|
|
1439 |
.................... -0.00138888888889, |
|
|
1440 |
.................... 0.00002480158730, |
|
|
1441 |
.................... -0.00000027557319, |
|
|
1442 |
.................... 0.00000000208767, |
|
|
1443 |
.................... //-0.00000000001147, |
|
|
1444 |
.................... // 0.00000000000005 |
|
|
1445 |
.................... }; |
|
|
1446 |
.................... |
|
|
1447 |
.................... if (x < 0) x = -x; // absolute value of input |
|
|
1448 |
.................... |
|
|
1449 |
.................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant |
|
|
1450 |
.................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input |
|
|
1451 |
.................... quad = quad % 4; // quadrant (0 to 3) |
|
|
1452 |
.................... |
|
|
1453 |
.................... if (quad == 0 || quad == 2) |
|
|
1454 |
.................... t = frac * PI_DIV_BY_TWO; |
|
|
1455 |
.................... else if (quad == 1) |
|
|
1456 |
.................... t = (1-frac) * PI_DIV_BY_TWO; |
|
|
1457 |
.................... else // should be 3 |
|
|
1458 |
.................... t = (frac-1) * PI_DIV_BY_TWO; |
|
|
1459 |
.................... |
|
|
1460 |
.................... y = 0.999999999781; |
|
|
1461 |
.................... t = t * t; |
|
|
1462 |
.................... for (i = 0; i <= 5; i++) |
|
|
1463 |
.................... { |
|
|
1464 |
.................... t2 = t2 * t; |
|
|
1465 |
.................... y = y + p[i] * t2; |
|
|
1466 |
.................... } |
|
|
1467 |
.................... |
|
|
1468 |
.................... if (quad == 2 || quad == 1) |
|
|
1469 |
.................... y = -y; // correct sign |
|
|
1470 |
.................... |
|
|
1471 |
.................... return (y); |
|
|
1472 |
.................... } |
|
|
1473 |
.................... |
|
|
1474 |
.................... #endif |
|
|
1475 |
.................... |
|
|
1476 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1477 |
.................... // float sin(float x) |
|
|
1478 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1479 |
.................... // Description : returns the sine value of the angle x, which is in radian |
|
|
1480 |
.................... // Date : 9/20/2001 |
|
|
1481 |
.................... // |
|
|
1482 |
.................... float32 sin(float32 x) |
|
|
1483 |
.................... { |
|
|
1484 |
.................... return cos(x - PI_DIV_BY_TWO); |
|
|
1485 |
.................... } |
|
|
1486 |
.................... |
|
|
1487 |
.................... //Overloaded functions for sin() for PCD |
|
|
1488 |
.................... // Overloaded function sin() for data type - Float48 |
|
|
1489 |
.................... #if defined(__PCD__) |
|
|
1490 |
.................... float48 sin(float48 x) |
|
|
1491 |
.................... { |
|
|
1492 |
.................... return cos(x - PI_DIV_BY_TWO); |
|
|
1493 |
.................... } |
|
|
1494 |
.................... |
|
|
1495 |
.................... // Overloaded function sin() for data type - Float48 |
|
|
1496 |
.................... float64 sin(float64 x) |
|
|
1497 |
.................... { |
|
|
1498 |
.................... return cos(x - PI_DIV_BY_TWO); |
|
|
1499 |
.................... } |
|
|
1500 |
.................... #endif |
|
|
1501 |
.................... |
|
|
1502 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1503 |
.................... // float tan(float x) |
|
|
1504 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1505 |
.................... // Description : returns the tangent value of the angle x, which is in radian |
|
|
1506 |
.................... // Date : 9/20/2001 |
|
|
1507 |
.................... // |
|
|
1508 |
.................... float32 tan(float32 x) |
|
|
1509 |
.................... { |
|
|
1510 |
.................... float32 c, s; |
|
|
1511 |
.................... |
|
|
1512 |
.................... c = cos(x); |
|
|
1513 |
.................... if (c == 0.0) |
|
|
1514 |
.................... return (1.0e+36); |
|
|
1515 |
.................... |
|
|
1516 |
.................... s = sin(x); |
|
|
1517 |
.................... return(s/c); |
|
|
1518 |
.................... } |
|
|
1519 |
.................... //Overloaded functions for tan() for PCD |
|
|
1520 |
.................... // Overloaded function tan() for data type - Float48 |
|
|
1521 |
.................... #if defined(__PCD__) |
|
|
1522 |
.................... float48 tan(float48 x) |
|
|
1523 |
.................... { |
|
|
1524 |
.................... float48 c, s; |
|
|
1525 |
.................... |
|
|
1526 |
.................... c = cos(x); |
|
|
1527 |
.................... if (c == 0.0) |
|
|
1528 |
.................... return (1.0e+36); |
|
|
1529 |
.................... |
|
|
1530 |
.................... s = sin(x); |
|
|
1531 |
.................... return(s/c); |
|
|
1532 |
.................... } |
|
|
1533 |
.................... |
|
|
1534 |
.................... // Overloaded function tan() for data type - Float48 |
|
|
1535 |
.................... float64 tan(float64 x) |
|
|
1536 |
.................... { |
|
|
1537 |
.................... float64 c, s; |
|
|
1538 |
.................... |
|
|
1539 |
.................... c = cos(x); |
|
|
1540 |
.................... if (c == 0.0) |
|
|
1541 |
.................... return (1.0e+36); |
|
|
1542 |
.................... |
|
|
1543 |
.................... s = sin(x); |
|
|
1544 |
.................... return(s/c); |
|
|
1545 |
.................... } |
|
|
1546 |
.................... #endif |
|
|
1547 |
.................... |
|
|
1548 |
.................... float32 const pas[3] = {0.49559947, -4.6145309, 5.6036290}; |
|
|
1549 |
.................... float32 const qas[3] = {1.0000000, -5.5484666, 5.6036290}; |
|
|
1550 |
.................... |
|
|
1551 |
.................... float32 ASIN_COS(float32 x, unsigned int8 n) |
|
|
1552 |
.................... { |
|
|
1553 |
.................... float32 y, res, r, y2; |
|
|
1554 |
.................... int1 s; |
|
|
1555 |
.................... #ifdef _ERRNO |
|
|
1556 |
.................... if(x <-1 || x > 1) |
|
|
1557 |
.................... { |
|
|
1558 |
.................... errno=EDOM; |
|
|
1559 |
.................... } |
|
|
1560 |
.................... #endif |
|
|
1561 |
.................... s = 0; |
|
|
1562 |
.................... y = x; |
|
|
1563 |
.................... |
|
|
1564 |
.................... if (x < 0) |
|
|
1565 |
.................... { |
|
|
1566 |
.................... s = 1; |
|
|
1567 |
.................... y = -y; |
|
|
1568 |
.................... } |
|
|
1569 |
.................... |
|
|
1570 |
.................... if (y > 0.5) |
|
|
1571 |
.................... { |
|
|
1572 |
.................... y = sqrt((1.0 - y)/2.0); |
|
|
1573 |
.................... n += 2; |
|
|
1574 |
.................... } |
|
|
1575 |
.................... |
|
|
1576 |
.................... y2=y*y; |
|
|
1577 |
.................... |
|
|
1578 |
.................... res = pas[0]*y2 + pas[1]; |
|
|
1579 |
.................... res = res*y2 + pas[2]; |
|
|
1580 |
.................... |
|
|
1581 |
.................... r = qas[0]*y2 + qas[1]; |
|
|
1582 |
.................... r = r*y2 + qas[2]; |
|
|
1583 |
.................... |
|
|
1584 |
.................... res = y*res/r; |
|
|
1585 |
.................... |
|
|
1586 |
.................... if (n & 2) // |x| > 0.5 |
|
|
1587 |
.................... res = PI_DIV_BY_TWO - 2.0*res; |
|
|
1588 |
.................... if (s) |
|
|
1589 |
.................... res = -res; |
|
|
1590 |
.................... if (n & 1) // take arccos |
|
|
1591 |
.................... res = PI_DIV_BY_TWO - res; |
|
|
1592 |
.................... |
|
|
1593 |
.................... return(res); |
|
|
1594 |
.................... } |
|
|
1595 |
.................... |
|
|
1596 |
.................... //Overloaded functions for ASIN_COS() for PCD |
|
|
1597 |
.................... // Overloaded function ASIN_COS() for data type - Float48 |
|
|
1598 |
.................... #if defined(__PCD__) |
|
|
1599 |
.................... float48 ASIN_COS(float48 x, unsigned int8 n) |
|
|
1600 |
.................... { |
|
|
1601 |
.................... float48 y, res, r, y2; |
|
|
1602 |
.................... int1 s; |
|
|
1603 |
.................... #ifdef _ERRNO |
|
|
1604 |
.................... if(x <-1 || x > 1) |
|
|
1605 |
.................... { |
|
|
1606 |
.................... errno=EDOM; |
|
|
1607 |
.................... } |
|
|
1608 |
.................... #endif |
|
|
1609 |
.................... s = 0; |
|
|
1610 |
.................... y = x; |
|
|
1611 |
.................... |
|
|
1612 |
.................... if (x < 0) |
|
|
1613 |
.................... { |
|
|
1614 |
.................... s = 1; |
|
|
1615 |
.................... y = -y; |
|
|
1616 |
.................... } |
|
|
1617 |
.................... |
|
|
1618 |
.................... if (y > 0.5) |
|
|
1619 |
.................... { |
|
|
1620 |
.................... y = sqrt((1.0 - y)/2.0); |
|
|
1621 |
.................... n += 2; |
|
|
1622 |
.................... } |
|
|
1623 |
.................... |
|
|
1624 |
.................... y2=y*y; |
|
|
1625 |
.................... |
|
|
1626 |
.................... res = pas[0]*y2 + pas[1]; |
|
|
1627 |
.................... res = res*y2 + pas[2]; |
|
|
1628 |
.................... |
|
|
1629 |
.................... r = qas[0]*y2 + qas[1]; |
|
|
1630 |
.................... r = r*y2 + qas[2]; |
|
|
1631 |
.................... |
|
|
1632 |
.................... res = y*res/r; |
|
|
1633 |
.................... |
|
|
1634 |
.................... if (n & 2) // |x| > 0.5 |
|
|
1635 |
.................... res = PI_DIV_BY_TWO - 2.0*res; |
|
|
1636 |
.................... if (s) |
|
|
1637 |
.................... res = -res; |
|
|
1638 |
.................... if (n & 1) // take arccos |
|
|
1639 |
.................... res = PI_DIV_BY_TWO - res; |
|
|
1640 |
.................... |
|
|
1641 |
.................... return(res); |
|
|
1642 |
.................... } |
|
|
1643 |
.................... |
|
|
1644 |
.................... // Overloaded function ASIN_COS() for data type - Float64 |
|
|
1645 |
.................... float64 ASIN_COS(float64 x, unsigned int8 n) |
|
|
1646 |
.................... { |
|
|
1647 |
.................... float64 y, res, r, y2; |
|
|
1648 |
.................... int1 s; |
|
|
1649 |
.................... #ifdef _ERRNO |
|
|
1650 |
.................... if(x <-1 || x > 1) |
|
|
1651 |
.................... { |
|
|
1652 |
.................... errno=EDOM; |
|
|
1653 |
.................... } |
|
|
1654 |
.................... #endif |
|
|
1655 |
.................... s = 0; |
|
|
1656 |
.................... y = x; |
|
|
1657 |
.................... |
|
|
1658 |
.................... if (x < 0) |
|
|
1659 |
.................... { |
|
|
1660 |
.................... s = 1; |
|
|
1661 |
.................... y = -y; |
|
|
1662 |
.................... } |
|
|
1663 |
.................... |
|
|
1664 |
.................... if (y > 0.5) |
|
|
1665 |
.................... { |
|
|
1666 |
.................... y = sqrt((1.0 - y)/2.0); |
|
|
1667 |
.................... n += 2; |
|
|
1668 |
.................... } |
|
|
1669 |
.................... |
|
|
1670 |
.................... y2=y*y; |
|
|
1671 |
.................... |
|
|
1672 |
.................... res = pas[0]*y2 + pas[1]; |
|
|
1673 |
.................... res = res*y2 + pas[2]; |
|
|
1674 |
.................... |
|
|
1675 |
.................... r = qas[0]*y2 + qas[1]; |
|
|
1676 |
.................... r = r*y2 + qas[2]; |
|
|
1677 |
.................... |
|
|
1678 |
.................... res = y*res/r; |
|
|
1679 |
.................... |
|
|
1680 |
.................... if (n & 2) // |x| > 0.5 |
|
|
1681 |
.................... res = PI_DIV_BY_TWO - 2.0*res; |
|
|
1682 |
.................... if (s) |
|
|
1683 |
.................... res = -res; |
|
|
1684 |
.................... if (n & 1) // take arccos |
|
|
1685 |
.................... res = PI_DIV_BY_TWO - res; |
|
|
1686 |
.................... |
|
|
1687 |
.................... return(res); |
|
|
1688 |
.................... } |
|
|
1689 |
.................... #endif |
|
|
1690 |
.................... |
|
|
1691 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1692 |
.................... // float asin(float x) |
|
|
1693 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1694 |
.................... // Description : returns the arcsine value of the value x. |
|
|
1695 |
.................... // Date : N/A |
|
|
1696 |
.................... // |
|
|
1697 |
.................... float32 asin(float32 x) |
|
|
1698 |
.................... { |
|
|
1699 |
.................... float32 r; |
|
|
1700 |
.................... |
|
|
1701 |
.................... r = ASIN_COS(x, 0); |
|
|
1702 |
.................... return(r); |
|
|
1703 |
.................... } |
|
|
1704 |
.................... //Overloaded functions for asin() for PCD |
|
|
1705 |
.................... // Overloaded function asin() for data type - Float48 |
|
|
1706 |
.................... #if defined(__PCD__) |
|
|
1707 |
.................... float48 asin(float48 x) |
|
|
1708 |
.................... { |
|
|
1709 |
.................... float48 r; |
|
|
1710 |
.................... |
|
|
1711 |
.................... r = ASIN_COS(x, 0); |
|
|
1712 |
.................... return(r); |
|
|
1713 |
.................... } |
|
|
1714 |
.................... |
|
|
1715 |
.................... // Overloaded function asin() for data type - Float64 |
|
|
1716 |
.................... float64 asin(float64 x) |
|
|
1717 |
.................... { |
|
|
1718 |
.................... float64 r; |
|
|
1719 |
.................... |
|
|
1720 |
.................... r = ASIN_COS(x, 0); |
|
|
1721 |
.................... return(r); |
|
|
1722 |
.................... } |
|
|
1723 |
.................... #endif |
|
|
1724 |
.................... |
|
|
1725 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1726 |
.................... // float acos(float x) |
|
|
1727 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1728 |
.................... // Description : returns the arccosine value of the value x. |
|
|
1729 |
.................... // Date : N/A |
|
|
1730 |
.................... // |
|
|
1731 |
.................... float32 acos(float32 x) |
|
|
1732 |
.................... { |
|
|
1733 |
.................... float32 r; |
|
|
1734 |
.................... |
|
|
1735 |
.................... r = ASIN_COS(x, 1); |
|
|
1736 |
.................... return(r); |
|
|
1737 |
.................... } |
|
|
1738 |
.................... //Overloaded functions for acos() for PCD |
|
|
1739 |
.................... // Overloaded function acos() for data type - Float48 |
|
|
1740 |
.................... #if defined(__PCD__) |
|
|
1741 |
.................... float48 acos(float48 x) |
|
|
1742 |
.................... { |
|
|
1743 |
.................... float48 r; |
|
|
1744 |
.................... |
|
|
1745 |
.................... r = ASIN_COS(x, 1); |
|
|
1746 |
.................... return(r); |
|
|
1747 |
.................... } |
|
|
1748 |
.................... |
|
|
1749 |
.................... // Overloaded function acos() for data type - Float64 |
|
|
1750 |
.................... float64 acos(float64 x) |
|
|
1751 |
.................... { |
|
|
1752 |
.................... float64 r; |
|
|
1753 |
.................... |
|
|
1754 |
.................... r = ASIN_COS(x, 1); |
|
|
1755 |
.................... return(r); |
|
|
1756 |
.................... } |
|
|
1757 |
.................... #endif |
|
|
1758 |
.................... |
|
|
1759 |
.................... float32 const pat[4] = {0.17630401, 5.6710795, 22.376096, 19.818457}; |
|
|
1760 |
.................... float32 const qat[4] = {1.0000000, 11.368190, 28.982246, 19.818457}; |
|
|
1761 |
.................... |
|
|
1762 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1763 |
.................... // float atan(float x) |
|
|
1764 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1765 |
.................... // Description : returns the arctangent value of the value x. |
|
|
1766 |
.................... // Date : N/A |
|
|
1767 |
.................... // |
|
|
1768 |
.................... float32 atan(float32 x) |
|
|
1769 |
.................... { |
|
|
1770 |
.................... float32 y, res, r; |
|
|
1771 |
.................... int1 s, flag; |
|
|
1772 |
.................... |
|
|
1773 |
.................... s = 0; |
|
|
1774 |
* |
|
|
1775 |
089C: BCF 4D.0 |
|
|
1776 |
.................... flag = 0; |
|
|
1777 |
089D: BCF 4D.1 |
|
|
1778 |
.................... y = x; |
|
|
1779 |
089E: MOVF 40,W |
|
|
1780 |
089F: MOVWF 44 |
|
|
1781 |
08A0: MOVF 3F,W |
|
|
1782 |
08A1: MOVWF 43 |
|
|
1783 |
08A2: MOVF 3E,W |
|
|
1784 |
08A3: MOVWF 42 |
|
|
1785 |
08A4: MOVF 3D,W |
|
|
1786 |
08A5: MOVWF 41 |
|
|
1787 |
.................... |
|
|
1788 |
.................... if (x < 0) |
|
|
1789 |
08A6: MOVF 40,W |
|
|
1790 |
08A7: MOVWF 51 |
|
|
1791 |
08A8: MOVF 3F,W |
|
|
1792 |
08A9: MOVWF 50 |
|
|
1793 |
08AA: MOVF 3E,W |
|
|
1794 |
08AB: MOVWF 4F |
|
|
1795 |
08AC: MOVF 3D,W |
|
|
1796 |
08AD: MOVWF 4E |
|
|
1797 |
08AE: CLRF 55 |
|
|
1798 |
08AF: CLRF 54 |
|
|
1799 |
08B0: CLRF 53 |
|
|
1800 |
08B1: CLRF 52 |
|
|
1801 |
08B2: BCF 0A.3 |
|
|
1802 |
08B3: CALL 307 |
|
|
1803 |
08B4: BSF 0A.3 |
|
|
1804 |
08B5: BTFSS 03.0 |
|
|
1805 |
08B6: GOTO 0BB |
|
|
1806 |
.................... { |
|
|
1807 |
.................... s = 1; |
|
|
1808 |
08B7: BSF 4D.0 |
|
|
1809 |
.................... y = -y; |
|
|
1810 |
08B8: MOVF 42,W |
|
|
1811 |
08B9: XORLW 80 |
|
|
1812 |
08BA: MOVWF 42 |
|
|
1813 |
.................... } |
|
|
1814 |
.................... |
|
|
1815 |
.................... if (y > 1.0) |
|
|
1816 |
08BB: CLRF 51 |
|
|
1817 |
08BC: CLRF 50 |
|
|
1818 |
08BD: CLRF 4F |
|
|
1819 |
08BE: MOVLW 7F |
|
|
1820 |
08BF: MOVWF 4E |
|
|
1821 |
08C0: MOVF 44,W |
|
|
1822 |
08C1: MOVWF 55 |
|
|
1823 |
08C2: MOVF 43,W |
|
|
1824 |
08C3: MOVWF 54 |
|
|
1825 |
08C4: MOVF 42,W |
|
|
1826 |
08C5: MOVWF 53 |
|
|
1827 |
08C6: MOVF 41,W |
|
|
1828 |
08C7: MOVWF 52 |
|
|
1829 |
08C8: BCF 0A.3 |
|
|
1830 |
08C9: CALL 307 |
|
|
1831 |
08CA: BSF 0A.3 |
|
|
1832 |
08CB: BTFSS 03.0 |
|
|
1833 |
08CC: GOTO 0E6 |
|
|
1834 |
.................... { |
|
|
1835 |
.................... y = 1.0/y; |
|
|
1836 |
08CD: CLRF 55 |
|
|
1837 |
08CE: CLRF 54 |
|
|
1838 |
08CF: CLRF 53 |
|
|
1839 |
08D0: MOVLW 7F |
|
|
1840 |
08D1: MOVWF 52 |
|
|
1841 |
08D2: MOVF 44,W |
|
|
1842 |
08D3: MOVWF 59 |
|
|
1843 |
08D4: MOVF 43,W |
|
|
1844 |
08D5: MOVWF 58 |
|
|
1845 |
08D6: MOVF 42,W |
|
|
1846 |
08D7: MOVWF 57 |
|
|
1847 |
08D8: MOVF 41,W |
|
|
1848 |
08D9: MOVWF 56 |
|
|
1849 |
08DA: BCF 0A.3 |
|
|
1850 |
08DB: CALL 23D |
|
|
1851 |
08DC: BSF 0A.3 |
|
|
1852 |
08DD: MOVF 7A,W |
|
|
1853 |
08DE: MOVWF 44 |
|
|
1854 |
08DF: MOVF 79,W |
|
|
1855 |
08E0: MOVWF 43 |
|
|
1856 |
08E1: MOVF 78,W |
|
|
1857 |
08E2: MOVWF 42 |
|
|
1858 |
08E3: MOVF 77,W |
|
|
1859 |
08E4: MOVWF 41 |
|
|
1860 |
.................... flag = 1; |
|
|
1861 |
08E5: BSF 4D.1 |
|
|
1862 |
.................... } |
|
|
1863 |
.................... |
|
|
1864 |
.................... res = pat[0]*y*y + pat[1]; |
|
|
1865 |
08E6: MOVLW 0A |
|
|
1866 |
08E7: MOVWF 55 |
|
|
1867 |
08E8: MOVLW 89 |
|
|
1868 |
08E9: MOVWF 54 |
|
|
1869 |
08EA: MOVLW 34 |
|
|
1870 |
08EB: MOVWF 53 |
|
|
1871 |
08EC: MOVLW 7C |
|
|
1872 |
08ED: MOVWF 52 |
|
|
1873 |
08EE: MOVF 44,W |
|
|
1874 |
08EF: MOVWF 59 |
|
|
1875 |
08F0: MOVF 43,W |
|
|
1876 |
08F1: MOVWF 58 |
|
|
1877 |
08F2: MOVF 42,W |
|
|
1878 |
08F3: MOVWF 57 |
|
|
1879 |
08F4: MOVF 41,W |
|
|
1880 |
08F5: MOVWF 56 |
|
|
1881 |
08F6: BCF 0A.3 |
|
|
1882 |
08F7: CALL 346 |
|
|
1883 |
08F8: BSF 0A.3 |
|
|
1884 |
08F9: MOVF 77,W |
|
|
1885 |
08FA: MOVWF 4E |
|
|
1886 |
08FB: MOVF 78,W |
|
|
1887 |
08FC: MOVWF 4F |
|
|
1888 |
08FD: MOVF 79,W |
|
|
1889 |
08FE: MOVWF 50 |
|
|
1890 |
08FF: MOVF 7A,W |
|
|
1891 |
0900: MOVWF 51 |
|
|
1892 |
0901: MOVWF 55 |
|
|
1893 |
0902: MOVF 79,W |
|
|
1894 |
0903: MOVWF 54 |
|
|
1895 |
0904: MOVF 78,W |
|
|
1896 |
0905: MOVWF 53 |
|
|
1897 |
0906: MOVF 77,W |
|
|
1898 |
0907: MOVWF 52 |
|
|
1899 |
0908: MOVF 44,W |
|
|
1900 |
0909: MOVWF 59 |
|
|
1901 |
090A: MOVF 43,W |
|
|
1902 |
090B: MOVWF 58 |
|
|
1903 |
090C: MOVF 42,W |
|
|
1904 |
090D: MOVWF 57 |
|
|
1905 |
090E: MOVF 41,W |
|
|
1906 |
090F: MOVWF 56 |
|
|
1907 |
0910: BCF 0A.3 |
|
|
1908 |
0911: CALL 346 |
|
|
1909 |
0912: BSF 0A.3 |
|
|
1910 |
0913: MOVF 77,W |
|
|
1911 |
0914: MOVWF 4E |
|
|
1912 |
0915: MOVF 78,W |
|
|
1913 |
0916: MOVWF 4F |
|
|
1914 |
0917: MOVF 79,W |
|
|
1915 |
0918: MOVWF 50 |
|
|
1916 |
0919: MOVF 7A,W |
|
|
1917 |
091A: MOVWF 51 |
|
|
1918 |
091B: BCF 03.1 |
|
|
1919 |
091C: MOVF 7A,W |
|
|
1920 |
091D: MOVWF 55 |
|
|
1921 |
091E: MOVF 79,W |
|
|
1922 |
091F: MOVWF 54 |
|
|
1923 |
0920: MOVF 78,W |
|
|
1924 |
0921: MOVWF 53 |
|
|
1925 |
0922: MOVF 77,W |
|
|
1926 |
0923: MOVWF 52 |
|
|
1927 |
0924: MOVLW 7C |
|
|
1928 |
0925: MOVWF 59 |
|
|
1929 |
0926: MOVLW 79 |
|
|
1930 |
0927: MOVWF 58 |
|
|
1931 |
0928: MOVLW 35 |
|
|
1932 |
0929: MOVWF 57 |
|
|
1933 |
092A: MOVLW 81 |
|
|
1934 |
092B: MOVWF 56 |
|
|
1935 |
092C: BCF 0A.3 |
|
|
1936 |
092D: CALL 3BB |
|
|
1937 |
092E: BSF 0A.3 |
|
|
1938 |
092F: MOVF 7A,W |
|
|
1939 |
0930: MOVWF 48 |
|
|
1940 |
0931: MOVF 79,W |
|
|
1941 |
0932: MOVWF 47 |
|
|
1942 |
0933: MOVF 78,W |
|
|
1943 |
0934: MOVWF 46 |
|
|
1944 |
0935: MOVF 77,W |
|
|
1945 |
0936: MOVWF 45 |
|
|
1946 |
.................... res = res*y*y + pat[2]; |
|
|
1947 |
0937: MOVF 48,W |
|
|
1948 |
0938: MOVWF 55 |
|
|
1949 |
0939: MOVF 47,W |
|
|
1950 |
093A: MOVWF 54 |
|
|
1951 |
093B: MOVF 46,W |
|
|
1952 |
093C: MOVWF 53 |
|
|
1953 |
093D: MOVF 45,W |
|
|
1954 |
093E: MOVWF 52 |
|
|
1955 |
093F: MOVF 44,W |
|
|
1956 |
0940: MOVWF 59 |
|
|
1957 |
0941: MOVF 43,W |
|
|
1958 |
0942: MOVWF 58 |
|
|
1959 |
0943: MOVF 42,W |
|
|
1960 |
0944: MOVWF 57 |
|
|
1961 |
0945: MOVF 41,W |
|
|
1962 |
0946: MOVWF 56 |
|
|
1963 |
0947: BCF 0A.3 |
|
|
1964 |
0948: CALL 346 |
|
|
1965 |
0949: BSF 0A.3 |
|
|
1966 |
094A: MOVF 77,W |
|
|
1967 |
094B: MOVWF 4E |
|
|
1968 |
094C: MOVF 78,W |
|
|
1969 |
094D: MOVWF 4F |
|
|
1970 |
094E: MOVF 79,W |
|
|
1971 |
094F: MOVWF 50 |
|
|
1972 |
0950: MOVF 7A,W |
|
|
1973 |
0951: MOVWF 51 |
|
|
1974 |
0952: MOVWF 55 |
|
|
1975 |
0953: MOVF 79,W |
|
|
1976 |
0954: MOVWF 54 |
|
|
1977 |
0955: MOVF 78,W |
|
|
1978 |
0956: MOVWF 53 |
|
|
1979 |
0957: MOVF 77,W |
|
|
1980 |
0958: MOVWF 52 |
|
|
1981 |
0959: MOVF 44,W |
|
|
1982 |
095A: MOVWF 59 |
|
|
1983 |
095B: MOVF 43,W |
|
|
1984 |
095C: MOVWF 58 |
|
|
1985 |
095D: MOVF 42,W |
|
|
1986 |
095E: MOVWF 57 |
|
|
1987 |
095F: MOVF 41,W |
|
|
1988 |
0960: MOVWF 56 |
|
|
1989 |
0961: BCF 0A.3 |
|
|
1990 |
0962: CALL 346 |
|
|
1991 |
0963: BSF 0A.3 |
|
|
1992 |
0964: MOVF 77,W |
|
|
1993 |
0965: MOVWF 4E |
|
|
1994 |
0966: MOVF 78,W |
|
|
1995 |
0967: MOVWF 4F |
|
|
1996 |
0968: MOVF 79,W |
|
|
1997 |
0969: MOVWF 50 |
|
|
1998 |
096A: MOVF 7A,W |
|
|
1999 |
096B: MOVWF 51 |
|
|
2000 |
096C: BCF 03.1 |
|
|
2001 |
096D: MOVF 7A,W |
|
|
2002 |
096E: MOVWF 55 |
|
|
2003 |
096F: MOVF 79,W |
|
|
2004 |
0970: MOVWF 54 |
|
|
2005 |
0971: MOVF 78,W |
|
|
2006 |
0972: MOVWF 53 |
|
|
2007 |
0973: MOVF 77,W |
|
|
2008 |
0974: MOVWF 52 |
|
|
2009 |
0975: MOVLW 3F |
|
|
2010 |
0976: MOVWF 59 |
|
|
2011 |
0977: MOVLW 02 |
|
|
2012 |
0978: MOVWF 58 |
|
|
2013 |
0979: MOVLW 33 |
|
|
2014 |
097A: MOVWF 57 |
|
|
2015 |
097B: MOVLW 83 |
|
|
2016 |
097C: MOVWF 56 |
|
|
2017 |
097D: BCF 0A.3 |
|
|
2018 |
097E: CALL 3BB |
|
|
2019 |
097F: BSF 0A.3 |
|
|
2020 |
0980: MOVF 7A,W |
|
|
2021 |
0981: MOVWF 48 |
|
|
2022 |
0982: MOVF 79,W |
|
|
2023 |
0983: MOVWF 47 |
|
|
2024 |
0984: MOVF 78,W |
|
|
2025 |
0985: MOVWF 46 |
|
|
2026 |
0986: MOVF 77,W |
|
|
2027 |
0987: MOVWF 45 |
|
|
2028 |
.................... res = res*y*y + pat[3]; |
|
|
2029 |
0988: MOVF 48,W |
|
|
2030 |
0989: MOVWF 55 |
|
|
2031 |
098A: MOVF 47,W |
|
|
2032 |
098B: MOVWF 54 |
|
|
2033 |
098C: MOVF 46,W |
|
|
2034 |
098D: MOVWF 53 |
|
|
2035 |
098E: MOVF 45,W |
|
|
2036 |
098F: MOVWF 52 |
|
|
2037 |
0990: MOVF 44,W |
|
|
2038 |
0991: MOVWF 59 |
|
|
2039 |
0992: MOVF 43,W |
|
|
2040 |
0993: MOVWF 58 |
|
|
2041 |
0994: MOVF 42,W |
|
|
2042 |
0995: MOVWF 57 |
|
|
2043 |
0996: MOVF 41,W |
|
|
2044 |
0997: MOVWF 56 |
|
|
2045 |
0998: BCF 0A.3 |
|
|
2046 |
0999: CALL 346 |
|
|
2047 |
099A: BSF 0A.3 |
|
|
2048 |
099B: MOVF 77,W |
|
|
2049 |
099C: MOVWF 4E |
|
|
2050 |
099D: MOVF 78,W |
|
|
2051 |
099E: MOVWF 4F |
|
|
2052 |
099F: MOVF 79,W |
|
|
2053 |
09A0: MOVWF 50 |
|
|
2054 |
09A1: MOVF 7A,W |
|
|
2055 |
09A2: MOVWF 51 |
|
|
2056 |
09A3: MOVWF 55 |
|
|
2057 |
09A4: MOVF 79,W |
|
|
2058 |
09A5: MOVWF 54 |
|
|
2059 |
09A6: MOVF 78,W |
|
|
2060 |
09A7: MOVWF 53 |
|
|
2061 |
09A8: MOVF 77,W |
|
|
2062 |
09A9: MOVWF 52 |
|
|
2063 |
09AA: MOVF 44,W |
|
|
2064 |
09AB: MOVWF 59 |
|
|
2065 |
09AC: MOVF 43,W |
|
|
2066 |
09AD: MOVWF 58 |
|
|
2067 |
09AE: MOVF 42,W |
|
|
2068 |
09AF: MOVWF 57 |
|
|
2069 |
09B0: MOVF 41,W |
|
|
2070 |
09B1: MOVWF 56 |
|
|
2071 |
09B2: BCF 0A.3 |
|
|
2072 |
09B3: CALL 346 |
|
|
2073 |
09B4: BSF 0A.3 |
|
|
2074 |
09B5: MOVF 77,W |
|
|
2075 |
09B6: MOVWF 4E |
|
|
2076 |
09B7: MOVF 78,W |
|
|
2077 |
09B8: MOVWF 4F |
|
|
2078 |
09B9: MOVF 79,W |
|
|
2079 |
09BA: MOVWF 50 |
|
|
2080 |
09BB: MOVF 7A,W |
|
|
2081 |
09BC: MOVWF 51 |
|
|
2082 |
09BD: BCF 03.1 |
|
|
2083 |
09BE: MOVF 7A,W |
|
|
2084 |
09BF: MOVWF 55 |
|
|
2085 |
09C0: MOVF 79,W |
|
|
2086 |
09C1: MOVWF 54 |
|
|
2087 |
09C2: MOVF 78,W |
|
|
2088 |
09C3: MOVWF 53 |
|
|
2089 |
09C4: MOVF 77,W |
|
|
2090 |
09C5: MOVWF 52 |
|
|
2091 |
09C6: MOVLW 33 |
|
|
2092 |
09C7: MOVWF 59 |
|
|
2093 |
09C8: MOVLW 8C |
|
|
2094 |
09C9: MOVWF 58 |
|
|
2095 |
09CA: MOVLW 1E |
|
|
2096 |
09CB: MOVWF 57 |
|
|
2097 |
09CC: MOVLW 83 |
|
|
2098 |
09CD: MOVWF 56 |
|
|
2099 |
09CE: BCF 0A.3 |
|
|
2100 |
09CF: CALL 3BB |
|
|
2101 |
09D0: BSF 0A.3 |
|
|
2102 |
09D1: MOVF 7A,W |
|
|
2103 |
09D2: MOVWF 48 |
|
|
2104 |
09D3: MOVF 79,W |
|
|
2105 |
09D4: MOVWF 47 |
|
|
2106 |
09D5: MOVF 78,W |
|
|
2107 |
09D6: MOVWF 46 |
|
|
2108 |
09D7: MOVF 77,W |
|
|
2109 |
09D8: MOVWF 45 |
|
|
2110 |
.................... |
|
|
2111 |
.................... r = qat[0]*y*y + qat[1]; |
|
|
2112 |
09D9: CLRF 55 |
|
|
2113 |
09DA: CLRF 54 |
|
|
2114 |
09DB: CLRF 53 |
|
|
2115 |
09DC: MOVLW 7F |
|
|
2116 |
09DD: MOVWF 52 |
|
|
2117 |
09DE: MOVF 44,W |
|
|
2118 |
09DF: MOVWF 59 |
|
|
2119 |
09E0: MOVF 43,W |
|
|
2120 |
09E1: MOVWF 58 |
|
|
2121 |
09E2: MOVF 42,W |
|
|
2122 |
09E3: MOVWF 57 |
|
|
2123 |
09E4: MOVF 41,W |
|
|
2124 |
09E5: MOVWF 56 |
|
|
2125 |
09E6: BCF 0A.3 |
|
|
2126 |
09E7: CALL 346 |
|
|
2127 |
09E8: BSF 0A.3 |
|
|
2128 |
09E9: MOVF 77,W |
|
|
2129 |
09EA: MOVWF 4E |
|
|
2130 |
09EB: MOVF 78,W |
|
|
2131 |
09EC: MOVWF 4F |
|
|
2132 |
09ED: MOVF 79,W |
|
|
2133 |
09EE: MOVWF 50 |
|
|
2134 |
09EF: MOVF 7A,W |
|
|
2135 |
09F0: MOVWF 51 |
|
|
2136 |
09F1: MOVWF 55 |
|
|
2137 |
09F2: MOVF 79,W |
|
|
2138 |
09F3: MOVWF 54 |
|
|
2139 |
09F4: MOVF 78,W |
|
|
2140 |
09F5: MOVWF 53 |
|
|
2141 |
09F6: MOVF 77,W |
|
|
2142 |
09F7: MOVWF 52 |
|
|
2143 |
09F8: MOVF 44,W |
|
|
2144 |
09F9: MOVWF 59 |
|
|
2145 |
09FA: MOVF 43,W |
|
|
2146 |
09FB: MOVWF 58 |
|
|
2147 |
09FC: MOVF 42,W |
|
|
2148 |
09FD: MOVWF 57 |
|
|
2149 |
09FE: MOVF 41,W |
|
|
2150 |
09FF: MOVWF 56 |
|
|
2151 |
0A00: BCF 0A.3 |
|
|
2152 |
0A01: CALL 346 |
|
|
2153 |
0A02: BSF 0A.3 |
|
|
2154 |
0A03: MOVF 77,W |
|
|
2155 |
0A04: MOVWF 4E |
|
|
2156 |
0A05: MOVF 78,W |
|
|
2157 |
0A06: MOVWF 4F |
|
|
2158 |
0A07: MOVF 79,W |
|
|
2159 |
0A08: MOVWF 50 |
|
|
2160 |
0A09: MOVF 7A,W |
|
|
2161 |
0A0A: MOVWF 51 |
|
|
2162 |
0A0B: BCF 03.1 |
|
|
2163 |
0A0C: MOVF 7A,W |
|
|
2164 |
0A0D: MOVWF 55 |
|
|
2165 |
0A0E: MOVF 79,W |
|
|
2166 |
0A0F: MOVWF 54 |
|
|
2167 |
0A10: MOVF 78,W |
|
|
2168 |
0A11: MOVWF 53 |
|
|
2169 |
0A12: MOVF 77,W |
|
|
2170 |
0A13: MOVWF 52 |
|
|
2171 |
0A14: MOVLW 1B |
|
|
2172 |
0A15: MOVWF 59 |
|
|
2173 |
0A16: MOVLW E4 |
|
|
2174 |
0A17: MOVWF 58 |
|
|
2175 |
0A18: MOVLW 35 |
|
|
2176 |
0A19: MOVWF 57 |
|
|
2177 |
0A1A: MOVLW 82 |
|
|
2178 |
0A1B: MOVWF 56 |
|
|
2179 |
0A1C: BCF 0A.3 |
|
|
2180 |
0A1D: CALL 3BB |
|
|
2181 |
0A1E: BSF 0A.3 |
|
|
2182 |
0A1F: MOVF 7A,W |
|
|
2183 |
0A20: MOVWF 4C |
|
|
2184 |
0A21: MOVF 79,W |
|
|
2185 |
0A22: MOVWF 4B |
|
|
2186 |
0A23: MOVF 78,W |
|
|
2187 |
0A24: MOVWF 4A |
|
|
2188 |
0A25: MOVF 77,W |
|
|
2189 |
0A26: MOVWF 49 |
|
|
2190 |
.................... r = r*y*y + qat[2]; |
|
|
2191 |
0A27: MOVF 4C,W |
|
|
2192 |
0A28: MOVWF 55 |
|
|
2193 |
0A29: MOVF 4B,W |
|
|
2194 |
0A2A: MOVWF 54 |
|
|
2195 |
0A2B: MOVF 4A,W |
|
|
2196 |
0A2C: MOVWF 53 |
|
|
2197 |
0A2D: MOVF 49,W |
|
|
2198 |
0A2E: MOVWF 52 |
|
|
2199 |
0A2F: MOVF 44,W |
|
|
2200 |
0A30: MOVWF 59 |
|
|
2201 |
0A31: MOVF 43,W |
|
|
2202 |
0A32: MOVWF 58 |
|
|
2203 |
0A33: MOVF 42,W |
|
|
2204 |
0A34: MOVWF 57 |
|
|
2205 |
0A35: MOVF 41,W |
|
|
2206 |
0A36: MOVWF 56 |
|
|
2207 |
0A37: BCF 0A.3 |
|
|
2208 |
0A38: CALL 346 |
|
|
2209 |
0A39: BSF 0A.3 |
|
|
2210 |
0A3A: MOVF 77,W |
|
|
2211 |
0A3B: MOVWF 4E |
|
|
2212 |
0A3C: MOVF 78,W |
|
|
2213 |
0A3D: MOVWF 4F |
|
|
2214 |
0A3E: MOVF 79,W |
|
|
2215 |
0A3F: MOVWF 50 |
|
|
2216 |
0A40: MOVF 7A,W |
|
|
2217 |
0A41: MOVWF 51 |
|
|
2218 |
0A42: MOVWF 55 |
|
|
2219 |
0A43: MOVF 79,W |
|
|
2220 |
0A44: MOVWF 54 |
|
|
2221 |
0A45: MOVF 78,W |
|
|
2222 |
0A46: MOVWF 53 |
|
|
2223 |
0A47: MOVF 77,W |
|
|
2224 |
0A48: MOVWF 52 |
|
|
2225 |
0A49: MOVF 44,W |
|
|
2226 |
0A4A: MOVWF 59 |
|
|
2227 |
0A4B: MOVF 43,W |
|
|
2228 |
0A4C: MOVWF 58 |
|
|
2229 |
0A4D: MOVF 42,W |
|
|
2230 |
0A4E: MOVWF 57 |
|
|
2231 |
0A4F: MOVF 41,W |
|
|
2232 |
0A50: MOVWF 56 |
|
|
2233 |
0A51: BCF 0A.3 |
|
|
2234 |
0A52: CALL 346 |
|
|
2235 |
0A53: BSF 0A.3 |
|
|
2236 |
0A54: MOVF 77,W |
|
|
2237 |
0A55: MOVWF 4E |
|
|
2238 |
0A56: MOVF 78,W |
|
|
2239 |
0A57: MOVWF 4F |
|
|
2240 |
0A58: MOVF 79,W |
|
|
2241 |
0A59: MOVWF 50 |
|
|
2242 |
0A5A: MOVF 7A,W |
|
|
2243 |
0A5B: MOVWF 51 |
|
|
2244 |
0A5C: BCF 03.1 |
|
|
2245 |
0A5D: MOVF 7A,W |
|
|
2246 |
0A5E: MOVWF 55 |
|
|
2247 |
0A5F: MOVF 79,W |
|
|
2248 |
0A60: MOVWF 54 |
|
|
2249 |
0A61: MOVF 78,W |
|
|
2250 |
0A62: MOVWF 53 |
|
|
2251 |
0A63: MOVF 77,W |
|
|
2252 |
0A64: MOVWF 52 |
|
|
2253 |
0A65: MOVLW A4 |
|
|
2254 |
0A66: MOVWF 59 |
|
|
2255 |
0A67: MOVLW DB |
|
|
2256 |
0A68: MOVWF 58 |
|
|
2257 |
0A69: MOVLW 67 |
|
|
2258 |
0A6A: MOVWF 57 |
|
|
2259 |
0A6B: MOVLW 83 |
|
|
2260 |
0A6C: MOVWF 56 |
|
|
2261 |
0A6D: BCF 0A.3 |
|
|
2262 |
0A6E: CALL 3BB |
|
|
2263 |
0A6F: BSF 0A.3 |
|
|
2264 |
0A70: MOVF 7A,W |
|
|
2265 |
0A71: MOVWF 4C |
|
|
2266 |
0A72: MOVF 79,W |
|
|
2267 |
0A73: MOVWF 4B |
|
|
2268 |
0A74: MOVF 78,W |
|
|
2269 |
0A75: MOVWF 4A |
|
|
2270 |
0A76: MOVF 77,W |
|
|
2271 |
0A77: MOVWF 49 |
|
|
2272 |
.................... r = r*y*y + qat[3]; |
|
|
2273 |
0A78: MOVF 4C,W |
|
|
2274 |
0A79: MOVWF 55 |
|
|
2275 |
0A7A: MOVF 4B,W |
|
|
2276 |
0A7B: MOVWF 54 |
|
|
2277 |
0A7C: MOVF 4A,W |
|
|
2278 |
0A7D: MOVWF 53 |
|
|
2279 |
0A7E: MOVF 49,W |
|
|
2280 |
0A7F: MOVWF 52 |
|
|
2281 |
0A80: MOVF 44,W |
|
|
2282 |
0A81: MOVWF 59 |
|
|
2283 |
0A82: MOVF 43,W |
|
|
2284 |
0A83: MOVWF 58 |
|
|
2285 |
0A84: MOVF 42,W |
|
|
2286 |
0A85: MOVWF 57 |
|
|
2287 |
0A86: MOVF 41,W |
|
|
2288 |
0A87: MOVWF 56 |
|
|
2289 |
0A88: BCF 0A.3 |
|
|
2290 |
0A89: CALL 346 |
|
|
2291 |
0A8A: BSF 0A.3 |
|
|
2292 |
0A8B: MOVF 77,W |
|
|
2293 |
0A8C: MOVWF 4E |
|
|
2294 |
0A8D: MOVF 78,W |
|
|
2295 |
0A8E: MOVWF 4F |
|
|
2296 |
0A8F: MOVF 79,W |
|
|
2297 |
0A90: MOVWF 50 |
|
|
2298 |
0A91: MOVF 7A,W |
|
|
2299 |
0A92: MOVWF 51 |
|
|
2300 |
0A93: MOVWF 55 |
|
|
2301 |
0A94: MOVF 79,W |
|
|
2302 |
0A95: MOVWF 54 |
|
|
2303 |
0A96: MOVF 78,W |
|
|
2304 |
0A97: MOVWF 53 |
|
|
2305 |
0A98: MOVF 77,W |
|
|
2306 |
0A99: MOVWF 52 |
|
|
2307 |
0A9A: MOVF 44,W |
|
|
2308 |
0A9B: MOVWF 59 |
|
|
2309 |
0A9C: MOVF 43,W |
|
|
2310 |
0A9D: MOVWF 58 |
|
|
2311 |
0A9E: MOVF 42,W |
|
|
2312 |
0A9F: MOVWF 57 |
|
|
2313 |
0AA0: MOVF 41,W |
|
|
2314 |
0AA1: MOVWF 56 |
|
|
2315 |
0AA2: BCF 0A.3 |
|
|
2316 |
0AA3: CALL 346 |
|
|
2317 |
0AA4: BSF 0A.3 |
|
|
2318 |
0AA5: MOVF 77,W |
|
|
2319 |
0AA6: MOVWF 4E |
|
|
2320 |
0AA7: MOVF 78,W |
|
|
2321 |
0AA8: MOVWF 4F |
|
|
2322 |
0AA9: MOVF 79,W |
|
|
2323 |
0AAA: MOVWF 50 |
|
|
2324 |
0AAB: MOVF 7A,W |
|
|
2325 |
0AAC: MOVWF 51 |
|
|
2326 |
0AAD: BCF 03.1 |
|
|
2327 |
0AAE: MOVF 7A,W |
|
|
2328 |
0AAF: MOVWF 55 |
|
|
2329 |
0AB0: MOVF 79,W |
|
|
2330 |
0AB1: MOVWF 54 |
|
|
2331 |
0AB2: MOVF 78,W |
|
|
2332 |
0AB3: MOVWF 53 |
|
|
2333 |
0AB4: MOVF 77,W |
|
|
2334 |
0AB5: MOVWF 52 |
|
|
2335 |
0AB6: MOVLW 33 |
|
|
2336 |
0AB7: MOVWF 59 |
|
|
2337 |
0AB8: MOVLW 8C |
|
|
2338 |
0AB9: MOVWF 58 |
|
|
2339 |
0ABA: MOVLW 1E |
|
|
2340 |
0ABB: MOVWF 57 |
|
|
2341 |
0ABC: MOVLW 83 |
|
|
2342 |
0ABD: MOVWF 56 |
|
|
2343 |
0ABE: BCF 0A.3 |
|
|
2344 |
0ABF: CALL 3BB |
|
|
2345 |
0AC0: BSF 0A.3 |
|
|
2346 |
0AC1: MOVF 7A,W |
|
|
2347 |
0AC2: MOVWF 4C |
|
|
2348 |
0AC3: MOVF 79,W |
|
|
2349 |
0AC4: MOVWF 4B |
|
|
2350 |
0AC5: MOVF 78,W |
|
|
2351 |
0AC6: MOVWF 4A |
|
|
2352 |
0AC7: MOVF 77,W |
|
|
2353 |
0AC8: MOVWF 49 |
|
|
2354 |
.................... |
|
|
2355 |
.................... res = y*res/r; |
|
|
2356 |
0AC9: MOVF 44,W |
|
|
2357 |
0ACA: MOVWF 55 |
|
|
2358 |
0ACB: MOVF 43,W |
|
|
2359 |
0ACC: MOVWF 54 |
|
|
2360 |
0ACD: MOVF 42,W |
|
|
2361 |
0ACE: MOVWF 53 |
|
|
2362 |
0ACF: MOVF 41,W |
|
|
2363 |
0AD0: MOVWF 52 |
|
|
2364 |
0AD1: MOVF 48,W |
|
|
2365 |
0AD2: MOVWF 59 |
|
|
2366 |
0AD3: MOVF 47,W |
|
|
2367 |
0AD4: MOVWF 58 |
|
|
2368 |
0AD5: MOVF 46,W |
|
|
2369 |
0AD6: MOVWF 57 |
|
|
2370 |
0AD7: MOVF 45,W |
|
|
2371 |
0AD8: MOVWF 56 |
|
|
2372 |
0AD9: BCF 0A.3 |
|
|
2373 |
0ADA: CALL 346 |
|
|
2374 |
0ADB: BSF 0A.3 |
|
|
2375 |
0ADC: MOVF 77,W |
|
|
2376 |
0ADD: MOVWF 4E |
|
|
2377 |
0ADE: MOVF 78,W |
|
|
2378 |
0ADF: MOVWF 4F |
|
|
2379 |
0AE0: MOVF 79,W |
|
|
2380 |
0AE1: MOVWF 50 |
|
|
2381 |
0AE2: MOVF 7A,W |
|
|
2382 |
0AE3: MOVWF 51 |
|
|
2383 |
0AE4: MOVWF 55 |
|
|
2384 |
0AE5: MOVF 79,W |
|
|
2385 |
0AE6: MOVWF 54 |
|
|
2386 |
0AE7: MOVF 78,W |
|
|
2387 |
0AE8: MOVWF 53 |
|
|
2388 |
0AE9: MOVF 77,W |
|
|
2389 |
0AEA: MOVWF 52 |
|
|
2390 |
0AEB: MOVF 4C,W |
|
|
2391 |
0AEC: MOVWF 59 |
|
|
2392 |
0AED: MOVF 4B,W |
|
|
2393 |
0AEE: MOVWF 58 |
|
|
2394 |
0AEF: MOVF 4A,W |
|
|
2395 |
0AF0: MOVWF 57 |
|
|
2396 |
0AF1: MOVF 49,W |
|
|
2397 |
0AF2: MOVWF 56 |
|
|
2398 |
0AF3: BCF 0A.3 |
|
|
2399 |
0AF4: CALL 23D |
|
|
2400 |
0AF5: BSF 0A.3 |
|
|
2401 |
0AF6: MOVF 7A,W |
|
|
2402 |
0AF7: MOVWF 48 |
|
|
2403 |
0AF8: MOVF 79,W |
|
|
2404 |
0AF9: MOVWF 47 |
|
|
2405 |
0AFA: MOVF 78,W |
|
|
2406 |
0AFB: MOVWF 46 |
|
|
2407 |
0AFC: MOVF 77,W |
|
|
2408 |
0AFD: MOVWF 45 |
|
|
2409 |
.................... |
|
|
2410 |
.................... |
|
|
2411 |
.................... if (flag) // for |x| > 1 |
|
|
2412 |
0AFE: BTFSS 4D.1 |
|
|
2413 |
0AFF: GOTO 31C |
|
|
2414 |
.................... res = PI_DIV_BY_TWO - res; |
|
|
2415 |
0B00: BSF 03.1 |
|
|
2416 |
0B01: MOVLW DB |
|
|
2417 |
0B02: MOVWF 55 |
|
|
2418 |
0B03: MOVLW 0F |
|
|
2419 |
0B04: MOVWF 54 |
|
|
2420 |
0B05: MOVLW 49 |
|
|
2421 |
0B06: MOVWF 53 |
|
|
2422 |
0B07: MOVLW 7F |
|
|
2423 |
0B08: MOVWF 52 |
|
|
2424 |
0B09: MOVF 48,W |
|
|
2425 |
0B0A: MOVWF 59 |
|
|
2426 |
0B0B: MOVF 47,W |
|
|
2427 |
0B0C: MOVWF 58 |
|
|
2428 |
0B0D: MOVF 46,W |
|
|
2429 |
0B0E: MOVWF 57 |
|
|
2430 |
0B0F: MOVF 45,W |
|
|
2431 |
0B10: MOVWF 56 |
|
|
2432 |
0B11: BCF 0A.3 |
|
|
2433 |
0B12: CALL 3BB |
|
|
2434 |
0B13: BSF 0A.3 |
|
|
2435 |
0B14: MOVF 7A,W |
|
|
2436 |
0B15: MOVWF 48 |
|
|
2437 |
0B16: MOVF 79,W |
|
|
2438 |
0B17: MOVWF 47 |
|
|
2439 |
0B18: MOVF 78,W |
|
|
2440 |
0B19: MOVWF 46 |
|
|
2441 |
0B1A: MOVF 77,W |
|
|
2442 |
0B1B: MOVWF 45 |
|
|
2443 |
.................... if (s) |
|
|
2444 |
0B1C: BTFSS 4D.0 |
|
|
2445 |
0B1D: GOTO 321 |
|
|
2446 |
.................... res = -res; |
|
|
2447 |
0B1E: MOVF 46,W |
|
|
2448 |
0B1F: XORLW 80 |
|
|
2449 |
0B20: MOVWF 46 |
|
|
2450 |
.................... |
|
|
2451 |
.................... return(res); |
|
|
2452 |
0B21: MOVF 45,W |
|
|
2453 |
0B22: MOVWF 77 |
|
|
2454 |
0B23: MOVF 46,W |
|
|
2455 |
0B24: MOVWF 78 |
|
|
2456 |
0B25: MOVF 47,W |
|
|
2457 |
0B26: MOVWF 79 |
|
|
2458 |
0B27: MOVF 48,W |
|
|
2459 |
0B28: MOVWF 7A |
|
|
2460 |
.................... } |
|
|
2461 |
.................... //Overloaded functions for atan() for PCD |
|
|
2462 |
.................... // Overloaded function atan() for data type - Float48 |
|
|
2463 |
.................... #if defined(__PCD__) |
|
|
2464 |
.................... float48 atan(float48 x) |
|
|
2465 |
.................... { |
|
|
2466 |
.................... float48 y, res, r; |
|
|
2467 |
.................... int1 s, flag; |
|
|
2468 |
.................... |
|
|
2469 |
.................... s = 0; |
|
|
2470 |
.................... flag = 0; |
|
|
2471 |
.................... y = x; |
|
|
2472 |
.................... |
|
|
2473 |
.................... if (x < 0) |
|
|
2474 |
.................... { |
|
|
2475 |
.................... s = 1; |
|
|
2476 |
.................... y = -y; |
|
|
2477 |
.................... } |
|
|
2478 |
.................... |
|
|
2479 |
.................... if (y > 1.0) |
|
|
2480 |
.................... { |
|
|
2481 |
.................... y = 1.0/y; |
|
|
2482 |
.................... flag = 1; |
|
|
2483 |
.................... } |
|
|
2484 |
.................... |
|
|
2485 |
.................... res = pat[0]*y*y + pat[1]; |
|
|
2486 |
.................... res = res*y*y + pat[2]; |
|
|
2487 |
.................... res = res*y*y + pat[3]; |
|
|
2488 |
.................... |
|
|
2489 |
.................... r = qat[0]*y*y + qat[1]; |
|
|
2490 |
.................... r = r*y*y + qat[2]; |
|
|
2491 |
.................... r = r*y*y + qat[3]; |
|
|
2492 |
.................... |
|
|
2493 |
.................... res = y*res/r; |
|
|
2494 |
.................... |
|
|
2495 |
.................... |
|
|
2496 |
.................... if (flag) // for |x| > 1 |
|
|
2497 |
.................... res = PI_DIV_BY_TWO - res; |
|
|
2498 |
.................... if (s) |
|
|
2499 |
.................... res = -res; |
|
|
2500 |
.................... |
|
|
2501 |
.................... return(res); |
|
|
2502 |
.................... } |
|
|
2503 |
.................... |
|
|
2504 |
.................... // Overloaded function atan() for data type - Float64 |
|
|
2505 |
.................... float64 atan(float64 x) |
|
|
2506 |
.................... { |
|
|
2507 |
.................... float64 y, res, r; |
|
|
2508 |
.................... int1 s, flag; |
|
|
2509 |
.................... |
|
|
2510 |
.................... s = 0; |
|
|
2511 |
.................... flag = 0; |
|
|
2512 |
.................... y = x; |
|
|
2513 |
.................... |
|
|
2514 |
.................... if (x < 0) |
|
|
2515 |
.................... { |
|
|
2516 |
.................... s = 1; |
|
|
2517 |
.................... y = -y; |
|
|
2518 |
.................... } |
|
|
2519 |
.................... |
|
|
2520 |
.................... if (y > 1.0) |
|
|
2521 |
.................... { |
|
|
2522 |
.................... y = 1.0/y; |
|
|
2523 |
.................... flag = 1; |
|
|
2524 |
.................... } |
|
|
2525 |
.................... |
|
|
2526 |
.................... res = pat[0]*y*y + pat[1]; |
|
|
2527 |
.................... res = res*y*y + pat[2]; |
|
|
2528 |
.................... res = res*y*y + pat[3]; |
|
|
2529 |
.................... |
|
|
2530 |
.................... r = qat[0]*y*y + qat[1]; |
|
|
2531 |
.................... r = r*y*y + qat[2]; |
|
|
2532 |
.................... r = r*y*y + qat[3]; |
|
|
2533 |
.................... |
|
|
2534 |
.................... res = y*res/r; |
|
|
2535 |
.................... |
|
|
2536 |
.................... |
|
|
2537 |
.................... if (flag) // for |x| > 1 |
|
|
2538 |
.................... res = PI_DIV_BY_TWO - res; |
|
|
2539 |
.................... if (s) |
|
|
2540 |
.................... res = -res; |
|
|
2541 |
.................... |
|
|
2542 |
.................... return(res); |
|
|
2543 |
.................... } |
|
|
2544 |
.................... #endif |
|
|
2545 |
.................... |
|
|
2546 |
.................... ///////////////////////////////////////////////////////////////////////////// |
|
|
2547 |
.................... // float atan2(float y, float x) |
|
|
2548 |
.................... ///////////////////////////////////////////////////////////////////////////// |
|
|
2549 |
.................... // Description :computes the principal value of arc tangent of y/x, using the |
|
|
2550 |
.................... // signs of both the arguments to determine the quadrant of the return value |
|
|
2551 |
.................... // Returns : returns the arc tangent of y/x. |
|
|
2552 |
.................... // Date : N/A |
|
|
2553 |
.................... // |
|
|
2554 |
.................... |
|
|
2555 |
.................... float32 atan2(float32 y,float32 x) |
|
|
2556 |
.................... { |
|
|
2557 |
.................... float32 z; |
|
|
2558 |
.................... int1 sign; |
|
|
2559 |
.................... unsigned int8 quad; |
|
|
2560 |
.................... sign=0; |
|
|
2561 |
.................... quad=0; //quadrant |
|
|
2562 |
.................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1)); |
|
|
2563 |
.................... if(y<0.0) |
|
|
2564 |
.................... { |
|
|
2565 |
.................... sign=1; |
|
|
2566 |
.................... y=-y; |
|
|
2567 |
.................... } |
|
|
2568 |
.................... if(x<0.0) |
|
|
2569 |
.................... { |
|
|
2570 |
.................... x=-x; |
|
|
2571 |
.................... } |
|
|
2572 |
.................... if (x==0.0) |
|
|
2573 |
.................... { |
|
|
2574 |
.................... if(y==0.0) |
|
|
2575 |
.................... { |
|
|
2576 |
.................... #ifdef _ERRNO |
|
|
2577 |
.................... { |
|
|
2578 |
.................... errno=EDOM; |
|
|
2579 |
.................... } |
|
|
2580 |
.................... #endif |
|
|
2581 |
.................... } |
|
|
2582 |
.................... else |
|
|
2583 |
.................... { |
|
|
2584 |
.................... if(sign) |
|
|
2585 |
.................... { |
|
|
2586 |
.................... return (-(PI_DIV_BY_TWO)); |
|
|
2587 |
.................... } |
|
|
2588 |
.................... else |
|
|
2589 |
.................... { |
|
|
2590 |
.................... return (PI_DIV_BY_TWO); |
|
|
2591 |
.................... } |
|
|
2592 |
.................... } |
|
|
2593 |
.................... } |
|
|
2594 |
.................... else |
|
|
2595 |
.................... { |
|
|
2596 |
.................... z=y/x; |
|
|
2597 |
.................... switch(quad) |
|
|
2598 |
.................... { |
|
|
2599 |
.................... case 1: |
|
|
2600 |
.................... { |
|
|
2601 |
.................... return atan(z); |
|
|
2602 |
.................... break; |
|
|
2603 |
.................... } |
|
|
2604 |
.................... case 2: |
|
|
2605 |
.................... { |
|
|
2606 |
.................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122 |
|
|
2607 |
.................... return (PI-atan(z)); |
|
|
2608 |
.................... break; |
|
|
2609 |
.................... } |
|
|
2610 |
.................... case 3: |
|
|
2611 |
.................... { |
|
|
2612 |
.................... return (atan(z)-PI); |
|
|
2613 |
.................... break; |
|
|
2614 |
.................... } |
|
|
2615 |
.................... case 4: |
|
|
2616 |
.................... { |
|
|
2617 |
.................... return (-atan(z)); |
|
|
2618 |
.................... break; |
|
|
2619 |
.................... } |
|
|
2620 |
.................... } |
|
|
2621 |
.................... } |
|
|
2622 |
.................... } |
|
|
2623 |
.................... |
|
|
2624 |
.................... //Overloaded functions for atan2() for PCD |
|
|
2625 |
.................... // Overloaded function atan2() for data type - Float48 |
|
|
2626 |
.................... #if defined(__PCD__) |
|
|
2627 |
.................... float48 atan2(float48 y,float48 x) |
|
|
2628 |
.................... { |
|
|
2629 |
.................... float48 z; |
|
|
2630 |
.................... int1 sign; |
|
|
2631 |
.................... unsigned int8 quad; |
|
|
2632 |
.................... sign=0; |
|
|
2633 |
.................... quad=0; //quadrant |
|
|
2634 |
.................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1)); |
|
|
2635 |
.................... if(y<0.0) |
|
|
2636 |
.................... { |
|
|
2637 |
.................... sign=1; |
|
|
2638 |
.................... y=-y; |
|
|
2639 |
.................... } |
|
|
2640 |
.................... if(x<0.0) |
|
|
2641 |
.................... { |
|
|
2642 |
.................... x=-x; |
|
|
2643 |
.................... } |
|
|
2644 |
.................... if (x==0.0) |
|
|
2645 |
.................... { |
|
|
2646 |
.................... if(y==0.0) |
|
|
2647 |
.................... { |
|
|
2648 |
.................... #ifdef _ERRNO |
|
|
2649 |
.................... { |
|
|
2650 |
.................... errno=EDOM; |
|
|
2651 |
.................... } |
|
|
2652 |
.................... #endif |
|
|
2653 |
.................... } |
|
|
2654 |
.................... else |
|
|
2655 |
.................... { |
|
|
2656 |
.................... if(sign) |
|
|
2657 |
.................... { |
|
|
2658 |
.................... return (-(PI_DIV_BY_TWO)); |
|
|
2659 |
.................... } |
|
|
2660 |
.................... else |
|
|
2661 |
.................... { |
|
|
2662 |
.................... return (PI_DIV_BY_TWO); |
|
|
2663 |
.................... } |
|
|
2664 |
.................... } |
|
|
2665 |
.................... } |
|
|
2666 |
.................... else |
|
|
2667 |
.................... { |
|
|
2668 |
.................... z=y/x; |
|
|
2669 |
.................... switch(quad) |
|
|
2670 |
.................... { |
|
|
2671 |
.................... case 1: |
|
|
2672 |
.................... { |
|
|
2673 |
.................... return atan(z); |
|
|
2674 |
.................... break; |
|
|
2675 |
.................... } |
|
|
2676 |
.................... case 2: |
|
|
2677 |
.................... { |
|
|
2678 |
.................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122 |
|
|
2679 |
.................... return (PI-atan(z)); |
|
|
2680 |
.................... break; |
|
|
2681 |
.................... } |
|
|
2682 |
.................... case 3: |
|
|
2683 |
.................... { |
|
|
2684 |
.................... return (atan(z)-PI); |
|
|
2685 |
.................... break; |
|
|
2686 |
.................... } |
|
|
2687 |
.................... case 4: |
|
|
2688 |
.................... { |
|
|
2689 |
.................... return (-atan(z)); |
|
|
2690 |
.................... break; |
|
|
2691 |
.................... } |
|
|
2692 |
.................... } |
|
|
2693 |
.................... } |
|
|
2694 |
.................... } |
|
|
2695 |
.................... |
|
|
2696 |
.................... // Overloaded function atan2() for data type - Float64 |
|
|
2697 |
.................... float64 atan2(float64 y,float64 x) |
|
|
2698 |
.................... { |
|
|
2699 |
.................... float64 z; |
|
|
2700 |
.................... int1 sign; |
|
|
2701 |
.................... unsigned int8 quad; |
|
|
2702 |
.................... sign=0; |
|
|
2703 |
.................... quad=0; //quadrant |
|
|
2704 |
.................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1)); |
|
|
2705 |
.................... if(y<0.0) |
|
|
2706 |
.................... { |
|
|
2707 |
.................... sign=1; |
|
|
2708 |
.................... y=-y; |
|
|
2709 |
.................... } |
|
|
2710 |
.................... if(x<0.0) |
|
|
2711 |
.................... { |
|
|
2712 |
.................... x=-x; |
|
|
2713 |
.................... } |
|
|
2714 |
.................... if (x==0.0) |
|
|
2715 |
.................... { |
|
|
2716 |
.................... if(y==0.0) |
|
|
2717 |
.................... { |
|
|
2718 |
.................... #ifdef _ERRNO |
|
|
2719 |
.................... { |
|
|
2720 |
.................... errno=EDOM; |
|
|
2721 |
.................... } |
|
|
2722 |
.................... #endif |
|
|
2723 |
.................... } |
|
|
2724 |
.................... else |
|
|
2725 |
.................... { |
|
|
2726 |
.................... if(sign) |
|
|
2727 |
.................... { |
|
|
2728 |
.................... return (-(PI_DIV_BY_TWO)); |
|
|
2729 |
.................... } |
|
|
2730 |
.................... else |
|
|
2731 |
.................... { |
|
|
2732 |
.................... return (PI_DIV_BY_TWO); |
|
|
2733 |
.................... } |
|
|
2734 |
.................... } |
|
|
2735 |
.................... } |
|
|
2736 |
.................... else |
|
|
2737 |
.................... { |
|
|
2738 |
.................... z=y/x; |
|
|
2739 |
.................... switch(quad) |
|
|
2740 |
.................... { |
|
|
2741 |
.................... case 1: |
|
|
2742 |
.................... { |
|
|
2743 |
.................... return atan(z); |
|
|
2744 |
.................... break; |
|
|
2745 |
.................... } |
|
|
2746 |
.................... case 2: |
|
|
2747 |
.................... { |
|
|
2748 |
.................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122 |
|
|
2749 |
.................... return (PI-atan(z)); |
|
|
2750 |
.................... break; |
|
|
2751 |
.................... } |
|
|
2752 |
.................... case 3: |
|
|
2753 |
.................... { |
|
|
2754 |
.................... return (atan(z)-PI); |
|
|
2755 |
.................... break; |
|
|
2756 |
.................... } |
|
|
2757 |
.................... case 4: |
|
|
2758 |
.................... { |
|
|
2759 |
.................... return (-atan(z)); |
|
|
2760 |
.................... break; |
|
|
2761 |
.................... } |
|
|
2762 |
.................... } |
|
|
2763 |
.................... } |
|
|
2764 |
.................... } |
|
|
2765 |
.................... #endif |
|
|
2766 |
.................... |
|
|
2767 |
.................... //////////////////// Hyperbolic functions //////////////////// |
|
|
2768 |
.................... |
|
|
2769 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2770 |
.................... // float cosh(float x) |
|
|
2771 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2772 |
.................... // Description : Computes the hyperbolic cosine value of x |
|
|
2773 |
.................... // Returns : returns the hyperbolic cosine value of x |
|
|
2774 |
.................... // Date : N/A |
|
|
2775 |
.................... // |
|
|
2776 |
.................... |
|
|
2777 |
.................... float32 cosh(float32 x) |
|
|
2778 |
.................... { |
|
|
2779 |
.................... return ((exp(x)+exp(-x))/2); |
|
|
2780 |
.................... } |
|
|
2781 |
.................... //Overloaded functions for cosh() for PCD |
|
|
2782 |
.................... // Overloaded function cosh() for data type - Float48 |
|
|
2783 |
.................... #if defined(__PCD__) |
|
|
2784 |
.................... float48 cosh(float48 x) |
|
|
2785 |
.................... { |
|
|
2786 |
.................... return ((exp(x)+exp(-x))/2); |
|
|
2787 |
.................... } |
|
|
2788 |
.................... |
|
|
2789 |
.................... // Overloaded function cosh() for data type - Float64 |
|
|
2790 |
.................... float64 cosh(float64 x) |
|
|
2791 |
.................... { |
|
|
2792 |
.................... return ((exp(x)+exp(-x))/2); |
|
|
2793 |
.................... } |
|
|
2794 |
.................... #endif |
|
|
2795 |
.................... |
|
|
2796 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2797 |
.................... // float sinh(float x) |
|
|
2798 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2799 |
.................... // Description : Computes the hyperbolic sine value of x |
|
|
2800 |
.................... // Returns : returns the hyperbolic sine value of x |
|
|
2801 |
.................... // Date : N/A |
|
|
2802 |
.................... // |
|
|
2803 |
.................... |
|
|
2804 |
.................... float32 sinh(float32 x) |
|
|
2805 |
.................... { |
|
|
2806 |
.................... |
|
|
2807 |
.................... return ((exp(x) - exp(-x))/2); |
|
|
2808 |
.................... } |
|
|
2809 |
.................... //Overloaded functions for sinh() for PCD |
|
|
2810 |
.................... // Overloaded function sinh() for data type - Float48 |
|
|
2811 |
.................... #if defined(__PCD__) |
|
|
2812 |
.................... float48 sinh(float48 x) |
|
|
2813 |
.................... { |
|
|
2814 |
.................... |
|
|
2815 |
.................... return ((exp(x) - exp(-x))/2); |
|
|
2816 |
.................... } |
|
|
2817 |
.................... |
|
|
2818 |
.................... // Overloaded function sinh() for data type - Float48 |
|
|
2819 |
.................... float64 sinh(float64 x) |
|
|
2820 |
.................... { |
|
|
2821 |
.................... |
|
|
2822 |
.................... return ((exp(x) - exp(-x))/2); |
|
|
2823 |
.................... } |
|
|
2824 |
.................... #endif |
|
|
2825 |
.................... |
|
|
2826 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2827 |
.................... // float tanh(float x) |
|
|
2828 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2829 |
.................... // Description : Computes the hyperbolic tangent value of x |
|
|
2830 |
.................... // Returns : returns the hyperbolic tangent value of x |
|
|
2831 |
.................... // Date : N/A |
|
|
2832 |
.................... // |
|
|
2833 |
.................... |
|
|
2834 |
.................... float32 tanh(float32 x) |
|
|
2835 |
.................... { |
|
|
2836 |
.................... return(sinh(x)/cosh(x)); |
|
|
2837 |
.................... } |
|
|
2838 |
.................... //Overloaded functions for tanh() for PCD |
|
|
2839 |
.................... // Overloaded function tanh() for data type - Float48 |
|
|
2840 |
.................... #if defined(__PCD__) |
|
|
2841 |
.................... float48 tanh(float48 x) |
|
|
2842 |
.................... { |
|
|
2843 |
.................... return(sinh(x)/cosh(x)); |
|
|
2844 |
.................... } |
|
|
2845 |
.................... |
|
|
2846 |
.................... // Overloaded function tanh() for data type - Float64 |
|
|
2847 |
.................... float64 tanh(float64 x) |
|
|
2848 |
.................... { |
|
|
2849 |
.................... return(sinh(x)/cosh(x)); |
|
|
2850 |
.................... } |
|
|
2851 |
.................... #endif |
|
|
2852 |
.................... |
|
|
2853 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2854 |
.................... // float frexp(float x, signed int *exp) |
|
|
2855 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2856 |
.................... // Description : breaks a floating point number into a normalized fraction and an integral |
|
|
2857 |
.................... // power of 2. It stores the integer in the signed int object pointed to by exp. |
|
|
2858 |
.................... // Returns : returns the value x, such that x is a double with magnitude in the interval |
|
|
2859 |
.................... // [1/2,1) or zero, and value equals x times 2 raised to the power *exp.If value is zero, |
|
|
2860 |
.................... // both parts of the result are zero. |
|
|
2861 |
.................... // Date : N/A |
|
|
2862 |
.................... // |
|
|
2863 |
.................... |
|
|
2864 |
.................... #define LOG2 .30102999566398119521 |
|
|
2865 |
.................... float32 frexp(float32 x, signed int8 *exp) |
|
|
2866 |
.................... { |
|
|
2867 |
.................... float32 res; |
|
|
2868 |
.................... int1 sign = 0; |
|
|
2869 |
.................... if(x == 0.0) |
|
|
2870 |
.................... { |
|
|
2871 |
.................... *exp=0; |
|
|
2872 |
.................... return (0.0); |
|
|
2873 |
.................... } |
|
|
2874 |
.................... if(x < 0.0) |
|
|
2875 |
.................... { |
|
|
2876 |
.................... x=-x; |
|
|
2877 |
.................... sign=1; |
|
|
2878 |
.................... } |
|
|
2879 |
.................... if (x > 1.0) |
|
|
2880 |
.................... { |
|
|
2881 |
.................... *exp=(ceil(log10(x)/LOG2)); |
|
|
2882 |
.................... res=x/(pow(2, *exp)); |
|
|
2883 |
.................... if (res == 1) |
|
|
2884 |
.................... { |
|
|
2885 |
.................... *exp=*exp+1; |
|
|
2886 |
.................... res=.5; |
|
|
2887 |
.................... } |
|
|
2888 |
.................... } |
|
|
2889 |
.................... else |
|
|
2890 |
.................... { |
|
|
2891 |
.................... if(x < 0.5) |
|
|
2892 |
.................... { |
|
|
2893 |
.................... *exp=-1; |
|
|
2894 |
.................... res=x*2; |
|
|
2895 |
.................... } |
|
|
2896 |
.................... else |
|
|
2897 |
.................... { |
|
|
2898 |
.................... *exp=0; |
|
|
2899 |
.................... res=x; |
|
|
2900 |
.................... } |
|
|
2901 |
.................... } |
|
|
2902 |
.................... if(sign) |
|
|
2903 |
.................... { |
|
|
2904 |
.................... res=-res; |
|
|
2905 |
.................... } |
|
|
2906 |
.................... return res; |
|
|
2907 |
.................... } |
|
|
2908 |
.................... |
|
|
2909 |
.................... //Overloaded functions for frexp() for PCD |
|
|
2910 |
.................... // Overloaded function frexp() for data type - Float48 |
|
|
2911 |
.................... #if defined(__PCD__) |
|
|
2912 |
.................... float48 frexp(float48 x, signed int8 *exp) |
|
|
2913 |
.................... { |
|
|
2914 |
.................... float48 res; |
|
|
2915 |
.................... int1 sign = 0; |
|
|
2916 |
.................... if(x == 0.0) |
|
|
2917 |
.................... { |
|
|
2918 |
.................... *exp=0; |
|
|
2919 |
.................... return (0.0); |
|
|
2920 |
.................... } |
|
|
2921 |
.................... if(x < 0.0) |
|
|
2922 |
.................... { |
|
|
2923 |
.................... x=-x; |
|
|
2924 |
.................... sign=1; |
|
|
2925 |
.................... } |
|
|
2926 |
.................... if (x > 1.0) |
|
|
2927 |
.................... { |
|
|
2928 |
.................... *exp=(ceil(log10(x)/LOG2)); |
|
|
2929 |
.................... res=x/(pow(2, *exp)); |
|
|
2930 |
.................... if (res == 1) |
|
|
2931 |
.................... { |
|
|
2932 |
.................... *exp=*exp+1; |
|
|
2933 |
.................... res=.5; |
|
|
2934 |
.................... } |
|
|
2935 |
.................... } |
|
|
2936 |
.................... else |
|
|
2937 |
.................... { |
|
|
2938 |
.................... if(x < 0.5) |
|
|
2939 |
.................... { |
|
|
2940 |
.................... *exp=-1; |
|
|
2941 |
.................... res=x*2; |
|
|
2942 |
.................... } |
|
|
2943 |
.................... else |
|
|
2944 |
.................... { |
|
|
2945 |
.................... *exp=0; |
|
|
2946 |
.................... res=x; |
|
|
2947 |
.................... } |
|
|
2948 |
.................... } |
|
|
2949 |
.................... if(sign) |
|
|
2950 |
.................... { |
|
|
2951 |
.................... res=-res; |
|
|
2952 |
.................... } |
|
|
2953 |
.................... return res; |
|
|
2954 |
.................... } |
|
|
2955 |
.................... |
|
|
2956 |
.................... // Overloaded function frexp() for data type - Float64 |
|
|
2957 |
.................... float64 frexp(float64 x, signed int8 *exp) |
|
|
2958 |
.................... { |
|
|
2959 |
.................... float64 res; |
|
|
2960 |
.................... int1 sign = 0; |
|
|
2961 |
.................... if(x == 0.0) |
|
|
2962 |
.................... { |
|
|
2963 |
.................... *exp=0; |
|
|
2964 |
.................... return (0.0); |
|
|
2965 |
.................... } |
|
|
2966 |
.................... if(x < 0.0) |
|
|
2967 |
.................... { |
|
|
2968 |
.................... x=-x; |
|
|
2969 |
.................... sign=1; |
|
|
2970 |
.................... } |
|
|
2971 |
.................... if (x > 1.0) |
|
|
2972 |
.................... { |
|
|
2973 |
.................... *exp=(ceil(log10(x)/LOG2)); |
|
|
2974 |
.................... res=x/(pow(2, *exp)); |
|
|
2975 |
.................... if (res == 1) |
|
|
2976 |
.................... { |
|
|
2977 |
.................... *exp=*exp+1; |
|
|
2978 |
.................... res=.5; |
|
|
2979 |
.................... } |
|
|
2980 |
.................... } |
|
|
2981 |
.................... else |
|
|
2982 |
.................... { |
|
|
2983 |
.................... if(x < 0.5) |
|
|
2984 |
.................... { |
|
|
2985 |
.................... *exp=-1; |
|
|
2986 |
.................... res=x*2; |
|
|
2987 |
.................... } |
|
|
2988 |
.................... else |
|
|
2989 |
.................... { |
|
|
2990 |
.................... *exp=0; |
|
|
2991 |
.................... res=x; |
|
|
2992 |
.................... } |
|
|
2993 |
.................... } |
|
|
2994 |
.................... if(sign) |
|
|
2995 |
.................... { |
|
|
2996 |
.................... res=-res; |
|
|
2997 |
.................... } |
|
|
2998 |
.................... return res; |
|
|
2999 |
.................... } |
|
|
3000 |
.................... #endif |
|
|
3001 |
.................... |
|
|
3002 |
.................... ////////////////////////////////////////////////////////////////////////////// |
|
|
3003 |
.................... // float ldexp(float x, signed int *exp) |
|
|
3004 |
.................... ////////////////////////////////////////////////////////////////////////////// |
|
|
3005 |
.................... // Description : multiplies a floating point number by an integral power of 2. |
|
|
3006 |
.................... // Returns : returns the value of x times 2 raised to the power exp. |
|
|
3007 |
.................... // Date : N/A |
|
|
3008 |
.................... // |
|
|
3009 |
.................... |
|
|
3010 |
.................... float32 ldexp(float32 value, signed int8 exp) |
|
|
3011 |
.................... { |
|
|
3012 |
.................... return (value * pow(2,exp)); |
|
|
3013 |
.................... } |
|
|
3014 |
.................... //Overloaded functions for ldexp() for PCD |
|
|
3015 |
.................... // Overloaded function ldexp() for data type - Float48 |
|
|
3016 |
.................... |
|
|
3017 |
.................... #if defined(__PCD__) |
|
|
3018 |
.................... float48 ldexp(float48 value, signed int8 exp) |
|
|
3019 |
.................... { |
|
|
3020 |
.................... return (value * pow(2,exp)); |
|
|
3021 |
.................... } |
|
|
3022 |
.................... // Overloaded function ldexp() for data type - Float64 |
|
|
3023 |
.................... float64 ldexp(float64 value, signed int8 exp) |
|
|
3024 |
.................... { |
|
|
3025 |
.................... return (value * pow(2,exp)); |
|
|
3026 |
.................... } |
|
|
3027 |
.................... #endif |
|
|
3028 |
.................... |
|
|
3029 |
.................... #endif |
|
|
3030 |
.................... |
|
|
3031 |
.................... #include <HMC5883L.h> |
|
|
3032 |
.................... #define MAG_ADDR_R 0x3D //addresa pro cteni |
|
|
3033 |
.................... #define MAG_ADDR_W 0x3C |
|
|
3034 |
.................... |
|
|
3035 |
.................... |
|
|
3036 |
.................... //Konstanty nastavujici rozsah |
|
|
3037 |
.................... //pro void set_mag_roz (unsigned int8 h) |
|
|
3038 |
.................... #define MAG_ROZ088 0x00 |
|
|
3039 |
.................... #define MAG_ROZ130 0x20 |
|
|
3040 |
.................... #define MAG_ROZ190 0x40 |
|
|
3041 |
.................... #define MAG_ROZ250 0x60 |
|
|
3042 |
.................... #define MAG_ROZ400 0x80 |
|
|
3043 |
.................... #define MAG_ROZ470 0xA0 |
|
|
3044 |
.................... #define MAG_ROZ560 0xC0 |
|
|
3045 |
.................... #define MAG_ROZ810 0xE0 |
|
|
3046 |
.................... |
|
|
3047 |
.................... |
|
|
3048 |
.................... #include "HMC5883L.c" |
|
|
3049 |
.................... void set_mag (void) //uvodni nastaveni na kontinualni mereni, rozsah ± 8.1 Ga, frekvence mereni 15HZ |
|
|
3050 |
.................... { |
|
|
3051 |
.................... i2c_start(); //nastavení Configuration Register A |
|
|
3052 |
* |
|
|
3053 |
011C: BSF 03.5 |
|
|
3054 |
011D: BSF 06.0 |
|
|
3055 |
011E: NOP |
|
|
3056 |
011F: BSF 06.1 |
|
|
3057 |
0120: NOP |
|
|
3058 |
0121: BCF 03.5 |
|
|
3059 |
0122: BCF 06.0 |
|
|
3060 |
0123: BSF 03.5 |
|
|
3061 |
0124: BCF 06.0 |
|
|
3062 |
0125: NOP |
|
|
3063 |
0126: BCF 03.5 |
|
|
3064 |
0127: BCF 06.1 |
|
|
3065 |
0128: BSF 03.5 |
|
|
3066 |
0129: BCF 06.1 |
|
|
3067 |
.................... I2C_Write(MAG_ADDR_W); |
|
|
3068 |
012A: MOVLW 3C |
|
|
3069 |
012B: BCF 03.5 |
|
|
3070 |
012C: MOVWF 42 |
|
|
3071 |
012D: CALL 0D4 |
|
|
3072 |
.................... I2C_Write(0x00); |
|
|
3073 |
012E: CLRF 42 |
|
|
3074 |
012F: CALL 0D4 |
|
|
3075 |
.................... I2C_Write(0x70); |
|
|
3076 |
0130: MOVLW 70 |
|
|
3077 |
0131: MOVWF 42 |
|
|
3078 |
0132: CALL 0D4 |
|
|
3079 |
.................... i2c_stop(); |
|
|
3080 |
0133: BSF 03.5 |
|
|
3081 |
0134: BCF 06.0 |
|
|
3082 |
0135: NOP |
|
|
3083 |
0136: BSF 06.1 |
|
|
3084 |
0137: BCF 03.5 |
|
|
3085 |
0138: BTFSS 06.1 |
|
|
3086 |
0139: GOTO 138 |
|
|
3087 |
013A: NOP |
|
|
3088 |
013B: GOTO 13C |
|
|
3089 |
013C: NOP |
|
|
3090 |
013D: BSF 03.5 |
|
|
3091 |
013E: BSF 06.0 |
|
|
3092 |
013F: NOP |
|
|
3093 |
.................... Delay_ms(6); |
|
|
3094 |
0140: MOVLW 06 |
|
|
3095 |
0141: BCF 03.5 |
|
|
3096 |
0142: MOVWF 30 |
|
|
3097 |
0143: CALL 108 |
|
|
3098 |
.................... |
|
|
3099 |
.................... i2c_start(); //nastavení Configuration Register B |
|
|
3100 |
0144: BSF 03.5 |
|
|
3101 |
0145: BSF 06.0 |
|
|
3102 |
0146: NOP |
|
|
3103 |
0147: BSF 06.1 |
|
|
3104 |
0148: NOP |
|
|
3105 |
0149: BCF 03.5 |
|
|
3106 |
014A: BCF 06.0 |
|
|
3107 |
014B: BSF 03.5 |
|
|
3108 |
014C: BCF 06.0 |
|
|
3109 |
014D: NOP |
|
|
3110 |
014E: BCF 03.5 |
|
|
3111 |
014F: BCF 06.1 |
|
|
3112 |
0150: BSF 03.5 |
|
|
3113 |
0151: BCF 06.1 |
|
|
3114 |
.................... I2C_Write(MAG_ADDR_W); |
|
|
3115 |
0152: MOVLW 3C |
|
|
3116 |
0153: BCF 03.5 |
|
|
3117 |
0154: MOVWF 42 |
|
|
3118 |
0155: CALL 0D4 |
|
|
3119 |
.................... I2C_Write(0x01); |
|
|
3120 |
0156: MOVLW 01 |
|
|
3121 |
0157: MOVWF 42 |
|
|
3122 |
0158: CALL 0D4 |
|
|
3123 |
.................... I2C_Write(MAG_ROZ810); |
|
|
3124 |
0159: MOVLW E0 |
|
|
3125 |
015A: MOVWF 42 |
|
|
3126 |
015B: CALL 0D4 |
|
|
3127 |
.................... i2c_stop(); |
|
|
3128 |
015C: BSF 03.5 |
|
|
3129 |
015D: BCF 06.0 |
|
|
3130 |
015E: NOP |
|
|
3131 |
015F: BSF 06.1 |
|
|
3132 |
0160: BCF 03.5 |
|
|
3133 |
0161: BTFSS 06.1 |
|
|
3134 |
0162: GOTO 161 |
|
|
3135 |
0163: NOP |
|
|
3136 |
0164: GOTO 165 |
|
|
3137 |
0165: NOP |
|
|
3138 |
0166: BSF 03.5 |
|
|
3139 |
0167: BSF 06.0 |
|
|
3140 |
0168: NOP |
|
|
3141 |
.................... |
|
|
3142 |
.................... Delay_ms(6); |
|
|
3143 |
0169: MOVLW 06 |
|
|
3144 |
016A: BCF 03.5 |
|
|
3145 |
016B: MOVWF 30 |
|
|
3146 |
016C: CALL 108 |
|
|
3147 |
.................... |
|
|
3148 |
.................... i2c_start(); //nastveni Mode Register |
|
|
3149 |
016D: BSF 03.5 |
|
|
3150 |
016E: BSF 06.0 |
|
|
3151 |
016F: NOP |
|
|
3152 |
0170: BSF 06.1 |
|
|
3153 |
0171: NOP |
|
|
3154 |
0172: BCF 03.5 |
|
|
3155 |
0173: BCF 06.0 |
|
|
3156 |
0174: BSF 03.5 |
|
|
3157 |
0175: BCF 06.0 |
|
|
3158 |
0176: NOP |
|
|
3159 |
0177: BCF 03.5 |
|
|
3160 |
0178: BCF 06.1 |
|
|
3161 |
0179: BSF 03.5 |
|
|
3162 |
017A: BCF 06.1 |
|
|
3163 |
.................... I2C_Write(MAG_ADDR_W); |
|
|
3164 |
017B: MOVLW 3C |
|
|
3165 |
017C: BCF 03.5 |
|
|
3166 |
017D: MOVWF 42 |
|
|
3167 |
017E: CALL 0D4 |
|
|
3168 |
.................... I2C_Write(0x02); |
|
|
3169 |
017F: MOVLW 02 |
|
|
3170 |
0180: MOVWF 42 |
|
|
3171 |
0181: CALL 0D4 |
|
|
3172 |
.................... I2C_Write(0x00); |
|
|
3173 |
0182: CLRF 42 |
|
|
3174 |
0183: CALL 0D4 |
|
|
3175 |
.................... i2c_stop(); |
|
|
3176 |
0184: BSF 03.5 |
|
|
3177 |
0185: BCF 06.0 |
|
|
3178 |
0186: NOP |
|
|
3179 |
0187: BSF 06.1 |
|
|
3180 |
0188: BCF 03.5 |
|
|
3181 |
0189: BTFSS 06.1 |
|
|
3182 |
018A: GOTO 189 |
|
|
3183 |
018B: NOP |
|
|
3184 |
018C: GOTO 18D |
|
|
3185 |
018D: NOP |
|
|
3186 |
018E: BSF 03.5 |
|
|
3187 |
018F: BSF 06.0 |
|
|
3188 |
0190: NOP |
|
|
3189 |
.................... Delay_ms(6); |
|
|
3190 |
0191: MOVLW 06 |
|
|
3191 |
0192: BCF 03.5 |
|
|
3192 |
0193: MOVWF 30 |
|
|
3193 |
0194: CALL 108 |
|
|
3194 |
.................... } |
|
|
3195 |
0195: BSF 0A.3 |
|
|
3196 |
0196: BCF 0A.4 |
|
|
3197 |
0197: GOTO 49E (RETURN) |
|
|
3198 |
.................... |
|
|
3199 |
.................... void set_mag_roz (unsigned int8 h) //nastavy rozsah |
|
|
3200 |
.................... { |
|
|
3201 |
.................... |
|
|
3202 |
.................... // |
|
|
3203 |
.................... |
|
|
3204 |
.................... |
|
|
3205 |
.................... i2c_start(); |
|
|
3206 |
.................... I2C_Write(MAG_ADDR_W); |
|
|
3207 |
.................... I2C_Write(0x01); |
|
|
3208 |
.................... I2C_Write(h); |
|
|
3209 |
.................... i2c_stop(); |
|
|
3210 |
.................... |
|
|
3211 |
.................... Delay_ms(6); |
|
|
3212 |
.................... |
|
|
3213 |
.................... |
|
|
3214 |
.................... } |
|
|
3215 |
.................... |
|
|
3216 |
.................... |
|
|
3217 |
.................... byte mag_read(byte reg) //pro cteni reg |
|
|
3218 |
.................... { |
|
|
3219 |
.................... |
|
|
3220 |
.................... i2c_start(); |
|
|
3221 |
0198: BSF 03.5 |
|
|
3222 |
0199: BSF 06.0 |
|
|
3223 |
019A: NOP |
|
|
3224 |
019B: BSF 06.1 |
|
|
3225 |
019C: NOP |
|
|
3226 |
019D: BCF 03.5 |
|
|
3227 |
019E: BCF 06.0 |
|
|
3228 |
019F: BSF 03.5 |
|
|
3229 |
01A0: BCF 06.0 |
|
|
3230 |
01A1: NOP |
|
|
3231 |
01A2: BCF 03.5 |
|
|
3232 |
01A3: BCF 06.1 |
|
|
3233 |
01A4: BSF 03.5 |
|
|
3234 |
01A5: BCF 06.1 |
|
|
3235 |
.................... I2C_Write(MAG_ADDR_W); |
|
|
3236 |
01A6: MOVLW 3C |
|
|
3237 |
01A7: BCF 03.5 |
|
|
3238 |
01A8: MOVWF 42 |
|
|
3239 |
01A9: CALL 0D4 |
|
|
3240 |
.................... I2C_write(reg); |
|
|
3241 |
01AA: MOVF 41,W |
|
|
3242 |
01AB: MOVWF 42 |
|
|
3243 |
01AC: CALL 0D4 |
|
|
3244 |
.................... i2c_stop(); |
|
|
3245 |
01AD: BSF 03.5 |
|
|
3246 |
01AE: BCF 06.0 |
|
|
3247 |
01AF: NOP |
|
|
3248 |
01B0: BSF 06.1 |
|
|
3249 |
01B1: BCF 03.5 |
|
|
3250 |
01B2: BTFSS 06.1 |
|
|
3251 |
01B3: GOTO 1B2 |
|
|
3252 |
01B4: NOP |
|
|
3253 |
01B5: GOTO 1B6 |
|
|
3254 |
01B6: NOP |
|
|
3255 |
01B7: BSF 03.5 |
|
|
3256 |
01B8: BSF 06.0 |
|
|
3257 |
01B9: NOP |
|
|
3258 |
.................... i2c_start(); |
|
|
3259 |
01BA: BSF 06.0 |
|
|
3260 |
01BB: NOP |
|
|
3261 |
01BC: BSF 06.1 |
|
|
3262 |
01BD: NOP |
|
|
3263 |
01BE: BCF 03.5 |
|
|
3264 |
01BF: BCF 06.0 |
|
|
3265 |
01C0: BSF 03.5 |
|
|
3266 |
01C1: BCF 06.0 |
|
|
3267 |
01C2: NOP |
|
|
3268 |
01C3: BCF 03.5 |
|
|
3269 |
01C4: BCF 06.1 |
|
|
3270 |
01C5: BSF 03.5 |
|
|
3271 |
01C6: BCF 06.1 |
|
|
3272 |
.................... I2C_Write(MAG_ADDR_R); |
|
|
3273 |
01C7: MOVLW 3D |
|
|
3274 |
01C8: BCF 03.5 |
|
|
3275 |
01C9: MOVWF 42 |
|
|
3276 |
01CA: CALL 0D4 |
|
|
3277 |
.................... reg=i2c_read(0); |
|
|
3278 |
01CB: CLRF 77 |
|
|
3279 |
* |
|
|
3280 |
01FD: MOVF 78,W |
|
|
3281 |
01FE: BCF 03.5 |
|
|
3282 |
01FF: MOVWF 41 |
|
|
3283 |
.................... return reg; |
|
|
3284 |
0200: MOVF 41,W |
|
|
3285 |
0201: MOVWF 78 |
|
|
3286 |
.................... } |
|
|
3287 |
0202: RETURN |
|
|
3288 |
.................... |
|
|
3289 |
.................... |
|
|
3290 |
.................... signed int16 mag_vypocet(unsigned int8 h, unsigned int8 l) //prepocet na 16bit cislo |
|
|
3291 |
.................... { |
|
|
3292 |
.................... signed int16 x; |
|
|
3293 |
.................... x = (((unsigned int16) h << 8) + l ); |
|
|
3294 |
0203: CLRF 46 |
|
|
3295 |
0204: MOVF 41,W |
|
|
3296 |
0205: MOVWF 45 |
|
|
3297 |
0206: MOVWF 46 |
|
|
3298 |
0207: CLRF 45 |
|
|
3299 |
0208: MOVF 42,W |
|
|
3300 |
0209: ADDWF 45,W |
|
|
3301 |
020A: MOVWF 78 |
|
|
3302 |
020B: MOVF 46,W |
|
|
3303 |
020C: MOVWF 7A |
|
|
3304 |
020D: BTFSC 03.0 |
|
|
3305 |
020E: INCF 7A,F |
|
|
3306 |
020F: MOVF 78,W |
|
|
3307 |
0210: MOVWF 43 |
|
|
3308 |
0211: MOVF 7A,W |
|
|
3309 |
0212: MOVWF 44 |
|
|
3310 |
.................... return x; |
|
|
3311 |
0213: MOVF 43,W |
|
|
3312 |
0214: MOVWF 78 |
|
|
3313 |
0215: MOVF 44,W |
|
|
3314 |
0216: MOVWF 79 |
|
|
3315 |
.................... } |
|
|
3316 |
0217: RETURN |
|
|
3317 |
.................... |
|
|
3318 |
.................... |
|
|
3319 |
.................... signed int16 mag_readX(void) //nacteni osy x |
|
|
3320 |
.................... { |
|
|
3321 |
.................... unsigned int8 h,l; |
|
|
3322 |
.................... signed int16 x; |
|
|
3323 |
.................... h=mag_read(0x03); |
|
|
3324 |
* |
|
|
3325 |
0800: MOVLW 03 |
|
|
3326 |
0801: MOVWF 41 |
|
|
3327 |
0802: BCF 0A.3 |
|
|
3328 |
0803: CALL 198 |
|
|
3329 |
0804: BSF 0A.3 |
|
|
3330 |
0805: MOVF 78,W |
|
|
3331 |
0806: MOVWF 3D |
|
|
3332 |
.................... l=mag_read(0x04); |
|
|
3333 |
0807: MOVLW 04 |
|
|
3334 |
0808: MOVWF 41 |
|
|
3335 |
0809: BCF 0A.3 |
|
|
3336 |
080A: CALL 198 |
|
|
3337 |
080B: BSF 0A.3 |
|
|
3338 |
080C: MOVF 78,W |
|
|
3339 |
080D: MOVWF 3E |
|
|
3340 |
.................... x=mag_vypocet(h,l); |
|
|
3341 |
080E: MOVF 3D,W |
|
|
3342 |
080F: MOVWF 41 |
|
|
3343 |
0810: MOVF 3E,W |
|
|
3344 |
0811: MOVWF 42 |
|
|
3345 |
0812: BCF 0A.3 |
|
|
3346 |
0813: CALL 203 |
|
|
3347 |
0814: BSF 0A.3 |
|
|
3348 |
0815: MOVF 79,W |
|
|
3349 |
0816: MOVWF 40 |
|
|
3350 |
0817: MOVF 78,W |
|
|
3351 |
0818: MOVWF 3F |
|
|
3352 |
.................... return x; |
|
|
3353 |
0819: MOVF 3F,W |
|
|
3354 |
081A: MOVWF 78 |
|
|
3355 |
081B: MOVF 40,W |
|
|
3356 |
081C: MOVWF 79 |
|
|
3357 |
.................... |
|
|
3358 |
.................... } |
|
|
3359 |
.................... |
|
|
3360 |
.................... |
|
|
3361 |
.................... signed int16 mag_readY(void) //nacteni osy x |
|
|
3362 |
.................... { |
|
|
3363 |
.................... unsigned int8 h,l; |
|
|
3364 |
.................... signed int16 x; |
|
|
3365 |
.................... h=mag_read(0x07); |
|
|
3366 |
* |
|
|
3367 |
0821: MOVLW 07 |
|
|
3368 |
0822: MOVWF 41 |
|
|
3369 |
0823: BCF 0A.3 |
|
|
3370 |
0824: CALL 198 |
|
|
3371 |
0825: BSF 0A.3 |
|
|
3372 |
0826: MOVF 78,W |
|
|
3373 |
0827: MOVWF 3D |
|
|
3374 |
.................... l=mag_read(0x08); |
|
|
3375 |
0828: MOVLW 08 |
|
|
3376 |
0829: MOVWF 41 |
|
|
3377 |
082A: BCF 0A.3 |
|
|
3378 |
082B: CALL 198 |
|
|
3379 |
082C: BSF 0A.3 |
|
|
3380 |
082D: MOVF 78,W |
|
|
3381 |
082E: MOVWF 3E |
|
|
3382 |
.................... x=mag_vypocet(h,l); |
|
|
3383 |
082F: MOVF 3D,W |
|
|
3384 |
0830: MOVWF 41 |
|
|
3385 |
0831: MOVF 3E,W |
|
|
3386 |
0832: MOVWF 42 |
|
|
3387 |
0833: BCF 0A.3 |
|
|
3388 |
0834: CALL 203 |
|
|
3389 |
0835: BSF 0A.3 |
|
|
3390 |
0836: MOVF 79,W |
|
|
3391 |
0837: MOVWF 40 |
|
|
3392 |
0838: MOVF 78,W |
|
|
3393 |
0839: MOVWF 3F |
|
|
3394 |
.................... return x; |
|
|
3395 |
083A: MOVF 3F,W |
|
|
3396 |
083B: MOVWF 78 |
|
|
3397 |
083C: MOVF 40,W |
|
|
3398 |
083D: MOVWF 79 |
|
|
3399 |
.................... |
|
|
3400 |
.................... } |
|
|
3401 |
.................... |
|
|
3402 |
.................... |
|
|
3403 |
.................... signed int16 mag_readZ(void) //nacteni osy x |
|
|
3404 |
.................... { |
|
|
3405 |
.................... unsigned int8 h,l; |
|
|
3406 |
.................... signed int16 x; |
|
|
3407 |
.................... h=mag_read(0x05); |
|
|
3408 |
* |
|
|
3409 |
0842: MOVLW 05 |
|
|
3410 |
0843: MOVWF 41 |
|
|
3411 |
0844: BCF 0A.3 |
|
|
3412 |
0845: CALL 198 |
|
|
3413 |
0846: BSF 0A.3 |
|
|
3414 |
0847: MOVF 78,W |
|
|
3415 |
0848: MOVWF 3D |
|
|
3416 |
.................... l=mag_read(0x06); |
|
|
3417 |
0849: MOVLW 06 |
|
|
3418 |
084A: MOVWF 41 |
|
|
3419 |
084B: BCF 0A.3 |
|
|
3420 |
084C: CALL 198 |
|
|
3421 |
084D: BSF 0A.3 |
|
|
3422 |
084E: MOVF 78,W |
|
|
3423 |
084F: MOVWF 3E |
|
|
3424 |
.................... x=mag_vypocet(h,l); |
|
|
3425 |
0850: MOVF 3D,W |
|
|
3426 |
0851: MOVWF 41 |
|
|
3427 |
0852: MOVF 3E,W |
|
|
3428 |
0853: MOVWF 42 |
|
|
3429 |
0854: BCF 0A.3 |
|
|
3430 |
0855: CALL 203 |
|
|
3431 |
0856: BSF 0A.3 |
|
|
3432 |
0857: MOVF 79,W |
|
|
3433 |
0858: MOVWF 40 |
|
|
3434 |
0859: MOVF 78,W |
|
|
3435 |
085A: MOVWF 3F |
|
|
3436 |
.................... return x; |
|
|
3437 |
085B: MOVF 3F,W |
|
|
3438 |
085C: MOVWF 78 |
|
|
3439 |
085D: MOVF 40,W |
|
|
3440 |
085E: MOVWF 79 |
|
|
3441 |
.................... |
|
|
3442 |
.................... } |
|
|
3443 |
.................... |
|
|
3444 |
.................... |
|
|
3445 |
.................... |
|
|
3446 |
.................... |
|
|
3447 |
.................... |
|
|
3448 |
.................... |
|
|
3449 |
.................... |
|
|
3450 |
.................... |
|
|
3451 |
.................... |
|
|
3452 |
.................... |
|
|
3453 |
.................... |
|
|
3454 |
.................... |
|
|
3455 |
.................... |
|
|
3456 |
.................... float azimut (void) //vypocet aktualni vysky panelu |
|
|
3457 |
.................... { |
|
|
3458 |
.................... signed int16 x,y,z; |
|
|
3459 |
.................... |
|
|
3460 |
.................... x= mag_readX(); |
|
|
3461 |
* |
|
|
3462 |
081D: MOVF 79,W |
|
|
3463 |
081E: MOVWF 30 |
|
|
3464 |
081F: MOVF 78,W |
|
|
3465 |
0820: MOVWF 2F |
|
|
3466 |
.................... y= mag_readY(); |
|
|
3467 |
* |
|
|
3468 |
083E: MOVF 79,W |
|
|
3469 |
083F: MOVWF 32 |
|
|
3470 |
0840: MOVF 78,W |
|
|
3471 |
0841: MOVWF 31 |
|
|
3472 |
.................... z= mag_readZ(); |
|
|
3473 |
* |
|
|
3474 |
085F: MOVF 79,W |
|
|
3475 |
0860: MOVWF 34 |
|
|
3476 |
0861: MOVF 78,W |
|
|
3477 |
0862: MOVWF 33 |
|
|
3478 |
.................... |
|
|
3479 |
.................... |
|
|
3480 |
.................... float a, b; |
|
|
3481 |
.................... a=(float)y/x; |
|
|
3482 |
0863: MOVF 32,W |
|
|
3483 |
0864: MOVWF 42 |
|
|
3484 |
0865: MOVF 31,W |
|
|
3485 |
0866: MOVWF 41 |
|
|
3486 |
0867: BCF 0A.3 |
|
|
3487 |
0868: CALL 218 |
|
|
3488 |
0869: BSF 0A.3 |
|
|
3489 |
086A: MOVF 77,W |
|
|
3490 |
086B: MOVWF 3D |
|
|
3491 |
086C: MOVF 78,W |
|
|
3492 |
086D: MOVWF 3E |
|
|
3493 |
086E: MOVF 79,W |
|
|
3494 |
086F: MOVWF 3F |
|
|
3495 |
0870: MOVF 7A,W |
|
|
3496 |
0871: MOVWF 40 |
|
|
3497 |
0872: MOVF 30,W |
|
|
3498 |
0873: MOVWF 42 |
|
|
3499 |
0874: MOVF 2F,W |
|
|
3500 |
0875: MOVWF 41 |
|
|
3501 |
0876: BCF 0A.3 |
|
|
3502 |
0877: CALL 218 |
|
|
3503 |
0878: BSF 0A.3 |
|
|
3504 |
0879: MOVF 40,W |
|
|
3505 |
087A: MOVWF 55 |
|
|
3506 |
087B: MOVF 3F,W |
|
|
3507 |
087C: MOVWF 54 |
|
|
3508 |
087D: MOVF 3E,W |
|
|
3509 |
087E: MOVWF 53 |
|
|
3510 |
087F: MOVF 3D,W |
|
|
3511 |
0880: MOVWF 52 |
|
|
3512 |
0881: MOVF 7A,W |
|
|
3513 |
0882: MOVWF 59 |
|
|
3514 |
0883: MOVF 79,W |
|
|
3515 |
0884: MOVWF 58 |
|
|
3516 |
0885: MOVF 78,W |
|
|
3517 |
0886: MOVWF 57 |
|
|
3518 |
0887: MOVF 77,W |
|
|
3519 |
0888: MOVWF 56 |
|
|
3520 |
0889: BCF 0A.3 |
|
|
3521 |
088A: CALL 23D |
|
|
3522 |
088B: BSF 0A.3 |
|
|
3523 |
088C: MOVF 7A,W |
|
|
3524 |
088D: MOVWF 38 |
|
|
3525 |
088E: MOVF 79,W |
|
|
3526 |
088F: MOVWF 37 |
|
|
3527 |
0890: MOVF 78,W |
|
|
3528 |
0891: MOVWF 36 |
|
|
3529 |
0892: MOVF 77,W |
|
|
3530 |
0893: MOVWF 35 |
|
|
3531 |
.................... b=atan(a); |
|
|
3532 |
0894: MOVF 38,W |
|
|
3533 |
0895: MOVWF 40 |
|
|
3534 |
0896: MOVF 37,W |
|
|
3535 |
0897: MOVWF 3F |
|
|
3536 |
0898: MOVF 36,W |
|
|
3537 |
0899: MOVWF 3E |
|
|
3538 |
089A: MOVF 35,W |
|
|
3539 |
089B: MOVWF 3D |
|
|
3540 |
* |
|
|
3541 |
0B29: MOVF 7A,W |
|
|
3542 |
0B2A: MOVWF 3C |
|
|
3543 |
0B2B: MOVF 79,W |
|
|
3544 |
0B2C: MOVWF 3B |
|
|
3545 |
0B2D: MOVF 78,W |
|
|
3546 |
0B2E: MOVWF 3A |
|
|
3547 |
0B2F: MOVF 77,W |
|
|
3548 |
0B30: MOVWF 39 |
|
|
3549 |
.................... b = (b/3.14)*180; |
|
|
3550 |
0B31: MOVF 3C,W |
|
|
3551 |
0B32: MOVWF 55 |
|
|
3552 |
0B33: MOVF 3B,W |
|
|
3553 |
0B34: MOVWF 54 |
|
|
3554 |
0B35: MOVF 3A,W |
|
|
3555 |
0B36: MOVWF 53 |
|
|
3556 |
0B37: MOVF 39,W |
|
|
3557 |
0B38: MOVWF 52 |
|
|
3558 |
0B39: MOVLW C3 |
|
|
3559 |
0B3A: MOVWF 59 |
|
|
3560 |
0B3B: MOVLW F5 |
|
|
3561 |
0B3C: MOVWF 58 |
|
|
3562 |
0B3D: MOVLW 48 |
|
|
3563 |
0B3E: MOVWF 57 |
|
|
3564 |
0B3F: MOVLW 80 |
|
|
3565 |
0B40: MOVWF 56 |
|
|
3566 |
0B41: BCF 0A.3 |
|
|
3567 |
0B42: CALL 23D |
|
|
3568 |
0B43: BSF 0A.3 |
|
|
3569 |
0B44: MOVF 77,W |
|
|
3570 |
0B45: MOVWF 3D |
|
|
3571 |
0B46: MOVF 78,W |
|
|
3572 |
0B47: MOVWF 3E |
|
|
3573 |
0B48: MOVF 79,W |
|
|
3574 |
0B49: MOVWF 3F |
|
|
3575 |
0B4A: MOVF 7A,W |
|
|
3576 |
0B4B: MOVWF 40 |
|
|
3577 |
0B4C: MOVWF 55 |
|
|
3578 |
0B4D: MOVF 3F,W |
|
|
3579 |
0B4E: MOVWF 54 |
|
|
3580 |
0B4F: MOVF 3E,W |
|
|
3581 |
0B50: MOVWF 53 |
|
|
3582 |
0B51: MOVF 3D,W |
|
|
3583 |
0B52: MOVWF 52 |
|
|
3584 |
0B53: CLRF 59 |
|
|
3585 |
0B54: CLRF 58 |
|
|
3586 |
0B55: MOVLW 34 |
|
|
3587 |
0B56: MOVWF 57 |
|
|
3588 |
0B57: MOVLW 86 |
|
|
3589 |
0B58: MOVWF 56 |
|
|
3590 |
0B59: BCF 0A.3 |
|
|
3591 |
0B5A: CALL 346 |
|
|
3592 |
0B5B: BSF 0A.3 |
|
|
3593 |
0B5C: MOVF 7A,W |
|
|
3594 |
0B5D: MOVWF 3C |
|
|
3595 |
0B5E: MOVF 79,W |
|
|
3596 |
0B5F: MOVWF 3B |
|
|
3597 |
0B60: MOVF 78,W |
|
|
3598 |
0B61: MOVWF 3A |
|
|
3599 |
0B62: MOVF 77,W |
|
|
3600 |
0B63: MOVWF 39 |
|
|
3601 |
.................... b=abs(b); |
|
|
3602 |
0B64: MOVF 39,W |
|
|
3603 |
0B65: MOVWF 77 |
|
|
3604 |
0B66: MOVF 3A,W |
|
|
3605 |
0B67: MOVWF 78 |
|
|
3606 |
0B68: MOVF 3B,W |
|
|
3607 |
0B69: MOVWF 79 |
|
|
3608 |
0B6A: MOVF 3C,W |
|
|
3609 |
0B6B: MOVWF 7A |
|
|
3610 |
0B6C: BCF 78.7 |
|
|
3611 |
0B6D: MOVF 3C,W |
|
|
3612 |
0B6E: MOVWF 3C |
|
|
3613 |
0B6F: MOVF 3B,W |
|
|
3614 |
0B70: MOVWF 3B |
|
|
3615 |
0B71: MOVF 78,W |
|
|
3616 |
0B72: MOVWF 3A |
|
|
3617 |
0B73: MOVF 39,W |
|
|
3618 |
0B74: MOVWF 39 |
|
|
3619 |
.................... |
|
|
3620 |
.................... |
|
|
3621 |
.................... |
|
|
3622 |
.................... |
|
|
3623 |
.................... if(x==0) //osetreni proti deleni 0 |
|
|
3624 |
0B75: MOVF 2F,F |
|
|
3625 |
0B76: BTFSS 03.2 |
|
|
3626 |
0B77: GOTO 39B |
|
|
3627 |
0B78: MOVF 30,F |
|
|
3628 |
0B79: BTFSS 03.2 |
|
|
3629 |
0B7A: GOTO 39B |
|
|
3630 |
.................... { |
|
|
3631 |
.................... printf("Elektronický kompas0\r\n",); |
|
|
3632 |
0B7B: MOVLW 04 |
|
|
3633 |
0B7C: BSF 03.6 |
|
|
3634 |
0B7D: MOVWF 0D |
|
|
3635 |
0B7E: MOVLW 00 |
|
|
3636 |
0B7F: MOVWF 0F |
|
|
3637 |
0B80: BCF 0A.3 |
|
|
3638 |
0B81: BCF 03.6 |
|
|
3639 |
0B82: CALL 0AF |
|
|
3640 |
0B83: BSF 0A.3 |
|
|
3641 |
.................... if(y>0) |
|
|
3642 |
0B84: BTFSC 32.7 |
|
|
3643 |
0B85: GOTO 394 |
|
|
3644 |
0B86: MOVF 32,F |
|
|
3645 |
0B87: BTFSS 03.2 |
|
|
3646 |
0B88: GOTO 38D |
|
|
3647 |
0B89: MOVF 31,W |
|
|
3648 |
0B8A: SUBLW 00 |
|
|
3649 |
0B8B: BTFSC 03.0 |
|
|
3650 |
0B8C: GOTO 394 |
|
|
3651 |
.................... { |
|
|
3652 |
.................... b=90; |
|
|
3653 |
0B8D: CLRF 3C |
|
|
3654 |
0B8E: CLRF 3B |
|
|
3655 |
0B8F: MOVLW 34 |
|
|
3656 |
0B90: MOVWF 3A |
|
|
3657 |
0B91: MOVLW 85 |
|
|
3658 |
0B92: MOVWF 39 |
|
|
3659 |
.................... } |
|
|
3660 |
.................... else |
|
|
3661 |
0B93: GOTO 39A |
|
|
3662 |
.................... { |
|
|
3663 |
.................... b=270; |
|
|
3664 |
0B94: CLRF 3C |
|
|
3665 |
0B95: CLRF 3B |
|
|
3666 |
0B96: MOVLW 07 |
|
|
3667 |
0B97: MOVWF 3A |
|
|
3668 |
0B98: MOVLW 87 |
|
|
3669 |
0B99: MOVWF 39 |
|
|
3670 |
.................... } |
|
|
3671 |
.................... } |
|
|
3672 |
.................... else |
|
|
3673 |
0B9A: GOTO 423 |
|
|
3674 |
.................... { |
|
|
3675 |
.................... if(x>0) |
|
|
3676 |
0B9B: BTFSC 30.7 |
|
|
3677 |
0B9C: GOTO 3EE |
|
|
3678 |
0B9D: MOVF 30,F |
|
|
3679 |
0B9E: BTFSS 03.2 |
|
|
3680 |
0B9F: GOTO 3A4 |
|
|
3681 |
0BA0: MOVF 2F,W |
|
|
3682 |
0BA1: SUBLW 00 |
|
|
3683 |
0BA2: BTFSC 03.0 |
|
|
3684 |
0BA3: GOTO 3EE |
|
|
3685 |
.................... { |
|
|
3686 |
.................... if(y>=0) |
|
|
3687 |
0BA4: BTFSC 32.7 |
|
|
3688 |
0BA5: GOTO 3CA |
|
|
3689 |
.................... { |
|
|
3690 |
.................... b=180+b; |
|
|
3691 |
0BA6: BCF 03.1 |
|
|
3692 |
0BA7: CLRF 55 |
|
|
3693 |
0BA8: CLRF 54 |
|
|
3694 |
0BA9: MOVLW 34 |
|
|
3695 |
0BAA: MOVWF 53 |
|
|
3696 |
0BAB: MOVLW 86 |
|
|
3697 |
0BAC: MOVWF 52 |
|
|
3698 |
0BAD: MOVF 3C,W |
|
|
3699 |
0BAE: MOVWF 59 |
|
|
3700 |
0BAF: MOVF 3B,W |
|
|
3701 |
0BB0: MOVWF 58 |
|
|
3702 |
0BB1: MOVF 3A,W |
|
|
3703 |
0BB2: MOVWF 57 |
|
|
3704 |
0BB3: MOVF 39,W |
|
|
3705 |
0BB4: MOVWF 56 |
|
|
3706 |
0BB5: BCF 0A.3 |
|
|
3707 |
0BB6: CALL 3BB |
|
|
3708 |
0BB7: BSF 0A.3 |
|
|
3709 |
0BB8: MOVF 7A,W |
|
|
3710 |
0BB9: MOVWF 3C |
|
|
3711 |
0BBA: MOVF 79,W |
|
|
3712 |
0BBB: MOVWF 3B |
|
|
3713 |
0BBC: MOVF 78,W |
|
|
3714 |
0BBD: MOVWF 3A |
|
|
3715 |
0BBE: MOVF 77,W |
|
|
3716 |
0BBF: MOVWF 39 |
|
|
3717 |
.................... printf("180+b\r\n",); |
|
|
3718 |
0BC0: MOVLW 1B |
|
|
3719 |
0BC1: BSF 03.6 |
|
|
3720 |
0BC2: MOVWF 0D |
|
|
3721 |
0BC3: MOVLW 00 |
|
|
3722 |
0BC4: MOVWF 0F |
|
|
3723 |
0BC5: BCF 0A.3 |
|
|
3724 |
0BC6: BCF 03.6 |
|
|
3725 |
0BC7: CALL 4FC |
|
|
3726 |
0BC8: BSF 0A.3 |
|
|
3727 |
.................... } |
|
|
3728 |
.................... else |
|
|
3729 |
0BC9: GOTO 3ED |
|
|
3730 |
.................... { |
|
|
3731 |
.................... b=180-b; |
|
|
3732 |
0BCA: BSF 03.1 |
|
|
3733 |
0BCB: CLRF 55 |
|
|
3734 |
0BCC: CLRF 54 |
|
|
3735 |
0BCD: MOVLW 34 |
|
|
3736 |
0BCE: MOVWF 53 |
|
|
3737 |
0BCF: MOVLW 86 |
|
|
3738 |
0BD0: MOVWF 52 |
|
|
3739 |
0BD1: MOVF 3C,W |
|
|
3740 |
0BD2: MOVWF 59 |
|
|
3741 |
0BD3: MOVF 3B,W |
|
|
3742 |
0BD4: MOVWF 58 |
|
|
3743 |
0BD5: MOVF 3A,W |
|
|
3744 |
0BD6: MOVWF 57 |
|
|
3745 |
0BD7: MOVF 39,W |
|
|
3746 |
0BD8: MOVWF 56 |
|
|
3747 |
0BD9: BCF 0A.3 |
|
|
3748 |
0BDA: CALL 3BB |
|
|
3749 |
0BDB: BSF 0A.3 |
|
|
3750 |
0BDC: MOVF 7A,W |
|
|
3751 |
0BDD: MOVWF 3C |
|
|
3752 |
0BDE: MOVF 79,W |
|
|
3753 |
0BDF: MOVWF 3B |
|
|
3754 |
0BE0: MOVF 78,W |
|
|
3755 |
0BE1: MOVWF 3A |
|
|
3756 |
0BE2: MOVF 77,W |
|
|
3757 |
0BE3: MOVWF 39 |
|
|
3758 |
.................... printf("180-b\r\n",); |
|
|
3759 |
0BE4: MOVLW 1F |
|
|
3760 |
0BE5: BSF 03.6 |
|
|
3761 |
0BE6: MOVWF 0D |
|
|
3762 |
0BE7: MOVLW 00 |
|
|
3763 |
0BE8: MOVWF 0F |
|
|
3764 |
0BE9: BCF 0A.3 |
|
|
3765 |
0BEA: BCF 03.6 |
|
|
3766 |
0BEB: CALL 4FC |
|
|
3767 |
0BEC: BSF 0A.3 |
|
|
3768 |
.................... } |
|
|
3769 |
.................... } |
|
|
3770 |
.................... else |
|
|
3771 |
0BED: GOTO 423 |
|
|
3772 |
.................... { |
|
|
3773 |
.................... if(y>=0) |
|
|
3774 |
0BEE: BTFSC 32.7 |
|
|
3775 |
0BEF: GOTO 414 |
|
|
3776 |
.................... { |
|
|
3777 |
.................... b=360-b; |
|
|
3778 |
0BF0: BSF 03.1 |
|
|
3779 |
0BF1: CLRF 55 |
|
|
3780 |
0BF2: CLRF 54 |
|
|
3781 |
0BF3: MOVLW 34 |
|
|
3782 |
0BF4: MOVWF 53 |
|
|
3783 |
0BF5: MOVLW 87 |
|
|
3784 |
0BF6: MOVWF 52 |
|
|
3785 |
0BF7: MOVF 3C,W |
|
|
3786 |
0BF8: MOVWF 59 |
|
|
3787 |
0BF9: MOVF 3B,W |
|
|
3788 |
0BFA: MOVWF 58 |
|
|
3789 |
0BFB: MOVF 3A,W |
|
|
3790 |
0BFC: MOVWF 57 |
|
|
3791 |
0BFD: MOVF 39,W |
|
|
3792 |
0BFE: MOVWF 56 |
|
|
3793 |
0BFF: BCF 0A.3 |
|
|
3794 |
0C00: CALL 3BB |
|
|
3795 |
0C01: BSF 0A.3 |
|
|
3796 |
0C02: MOVF 7A,W |
|
|
3797 |
0C03: MOVWF 3C |
|
|
3798 |
0C04: MOVF 79,W |
|
|
3799 |
0C05: MOVWF 3B |
|
|
3800 |
0C06: MOVF 78,W |
|
|
3801 |
0C07: MOVWF 3A |
|
|
3802 |
0C08: MOVF 77,W |
|
|
3803 |
0C09: MOVWF 39 |
|
|
3804 |
.................... printf("360-b\r\n",); |
|
|
3805 |
0C0A: MOVLW 23 |
|
|
3806 |
0C0B: BSF 03.6 |
|
|
3807 |
0C0C: MOVWF 0D |
|
|
3808 |
0C0D: MOVLW 00 |
|
|
3809 |
0C0E: MOVWF 0F |
|
|
3810 |
0C0F: BCF 0A.3 |
|
|
3811 |
0C10: BCF 03.6 |
|
|
3812 |
0C11: CALL 4FC |
|
|
3813 |
0C12: BSF 0A.3 |
|
|
3814 |
.................... } |
|
|
3815 |
.................... else |
|
|
3816 |
0C13: GOTO 423 |
|
|
3817 |
.................... { |
|
|
3818 |
.................... b=b; |
|
|
3819 |
.................... printf("b\r\n",); |
|
|
3820 |
0C14: MOVLW 62 |
|
|
3821 |
0C15: MOVWF 40 |
|
|
3822 |
0C16: BCF 0A.3 |
|
|
3823 |
0C17: CALL 08D |
|
|
3824 |
0C18: BSF 0A.3 |
|
|
3825 |
0C19: MOVLW 0D |
|
|
3826 |
0C1A: MOVWF 40 |
|
|
3827 |
0C1B: BCF 0A.3 |
|
|
3828 |
0C1C: CALL 08D |
|
|
3829 |
0C1D: BSF 0A.3 |
|
|
3830 |
0C1E: MOVLW 0A |
|
|
3831 |
0C1F: MOVWF 40 |
|
|
3832 |
0C20: BCF 0A.3 |
|
|
3833 |
0C21: CALL 08D |
|
|
3834 |
0C22: BSF 0A.3 |
|
|
3835 |
.................... } |
|
|
3836 |
.................... } |
|
|
3837 |
.................... |
|
|
3838 |
.................... } |
|
|
3839 |
.................... |
|
|
3840 |
.................... return b; |
|
|
3841 |
0C23: MOVF 39,W |
|
|
3842 |
0C24: MOVWF 77 |
|
|
3843 |
0C25: MOVF 3A,W |
|
|
3844 |
0C26: MOVWF 78 |
|
|
3845 |
0C27: MOVF 3B,W |
|
|
3846 |
0C28: MOVWF 79 |
|
|
3847 |
0C29: MOVF 3C,W |
|
|
3848 |
0C2A: MOVWF 7A |
|
|
3849 |
.................... |
|
|
3850 |
.................... } |
|
|
3851 |
0C2B: BSF 0A.3 |
|
|
3852 |
0C2C: BCF 0A.4 |
|
|
3853 |
0C2D: GOTO 4A0 (RETURN) |
|
|
3854 |
.................... |
|
|
3855 |
.................... void main() |
|
|
3856 |
.................... { |
|
|
3857 |
0C2E: CLRF 04 |
|
|
3858 |
0C2F: BCF 03.7 |
|
|
3859 |
0C30: MOVLW 1F |
|
|
3860 |
0C31: ANDWF 03,F |
|
|
3861 |
0C32: MOVLW 71 |
|
|
3862 |
0C33: BSF 03.5 |
|
|
3863 |
0C34: MOVWF 0F |
|
|
3864 |
0C35: MOVF 0F,W |
|
|
3865 |
0C36: BCF 06.3 |
|
|
3866 |
0C37: BCF 03.5 |
|
|
3867 |
0C38: BSF 06.3 |
|
|
3868 |
0C39: BSF 03.5 |
|
|
3869 |
0C3A: BSF 03.6 |
|
|
3870 |
0C3B: MOVF 09,W |
|
|
3871 |
0C3C: ANDLW C0 |
|
|
3872 |
0C3D: MOVWF 09 |
|
|
3873 |
0C3E: BCF 03.6 |
|
|
3874 |
0C3F: BCF 1F.4 |
|
|
3875 |
0C40: BCF 1F.5 |
|
|
3876 |
0C41: MOVLW 00 |
|
|
3877 |
0C42: BSF 03.6 |
|
|
3878 |
0C43: MOVWF 08 |
|
|
3879 |
0C44: BCF 03.5 |
|
|
3880 |
0C45: CLRF 07 |
|
|
3881 |
0C46: CLRF 08 |
|
|
3882 |
0C47: CLRF 09 |
|
|
3883 |
.................... |
|
|
3884 |
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD); |
|
|
3885 |
* |
|
|
3886 |
0C4B: BSF 03.5 |
|
|
3887 |
0C4C: BSF 03.6 |
|
|
3888 |
0C4D: MOVF 09,W |
|
|
3889 |
0C4E: ANDLW C0 |
|
|
3890 |
0C4F: MOVWF 09 |
|
|
3891 |
0C50: BCF 03.6 |
|
|
3892 |
0C51: BCF 1F.4 |
|
|
3893 |
0C52: BCF 1F.5 |
|
|
3894 |
0C53: MOVLW 00 |
|
|
3895 |
0C54: BSF 03.6 |
|
|
3896 |
0C55: MOVWF 08 |
|
|
3897 |
.................... setup_adc(ADC_CLOCK_DIV_2); |
|
|
3898 |
0C56: BCF 03.5 |
|
|
3899 |
0C57: BCF 03.6 |
|
|
3900 |
0C58: BCF 1F.6 |
|
|
3901 |
0C59: BCF 1F.7 |
|
|
3902 |
0C5A: BSF 03.5 |
|
|
3903 |
0C5B: BCF 1F.7 |
|
|
3904 |
0C5C: BCF 03.5 |
|
|
3905 |
0C5D: BSF 1F.0 |
|
|
3906 |
.................... setup_spi(SPI_SS_DISABLED); |
|
|
3907 |
0C5E: BCF 14.5 |
|
|
3908 |
0C5F: BCF 20.5 |
|
|
3909 |
0C60: MOVF 20,W |
|
|
3910 |
0C61: BSF 03.5 |
|
|
3911 |
0C62: MOVWF 07 |
|
|
3912 |
0C63: BCF 03.5 |
|
|
3913 |
0C64: BSF 20.4 |
|
|
3914 |
0C65: MOVF 20,W |
|
|
3915 |
0C66: BSF 03.5 |
|
|
3916 |
0C67: MOVWF 07 |
|
|
3917 |
0C68: BCF 03.5 |
|
|
3918 |
0C69: BCF 20.3 |
|
|
3919 |
0C6A: MOVF 20,W |
|
|
3920 |
0C6B: BSF 03.5 |
|
|
3921 |
0C6C: MOVWF 07 |
|
|
3922 |
0C6D: MOVLW 01 |
|
|
3923 |
0C6E: BCF 03.5 |
|
|
3924 |
0C6F: MOVWF 14 |
|
|
3925 |
0C70: MOVLW 00 |
|
|
3926 |
0C71: BSF 03.5 |
|
|
3927 |
0C72: MOVWF 14 |
|
|
3928 |
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
|
|
3929 |
0C73: MOVF 01,W |
|
|
3930 |
0C74: ANDLW C7 |
|
|
3931 |
0C75: IORLW 08 |
|
|
3932 |
0C76: MOVWF 01 |
|
|
3933 |
.................... setup_timer_1(T1_DISABLED); |
|
|
3934 |
0C77: BCF 03.5 |
|
|
3935 |
0C78: CLRF 10 |
|
|
3936 |
.................... setup_timer_2(T2_DISABLED,0,1); |
|
|
3937 |
0C79: MOVLW 00 |
|
|
3938 |
0C7A: MOVWF 78 |
|
|
3939 |
0C7B: MOVWF 12 |
|
|
3940 |
0C7C: MOVLW 00 |
|
|
3941 |
0C7D: BSF 03.5 |
|
|
3942 |
0C7E: MOVWF 12 |
|
|
3943 |
.................... setup_ccp1(CCP_OFF); |
|
|
3944 |
0C7F: BCF 03.5 |
|
|
3945 |
0C80: BSF 20.2 |
|
|
3946 |
0C81: MOVF 20,W |
|
|
3947 |
0C82: BSF 03.5 |
|
|
3948 |
0C83: MOVWF 07 |
|
|
3949 |
0C84: BCF 03.5 |
|
|
3950 |
0C85: CLRF 17 |
|
|
3951 |
0C86: BSF 03.5 |
|
|
3952 |
0C87: CLRF 1B |
|
|
3953 |
0C88: CLRF 1C |
|
|
3954 |
0C89: MOVLW 01 |
|
|
3955 |
0C8A: MOVWF 1D |
|
|
3956 |
.................... setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard |
|
|
3957 |
0C8B: BCF 03.5 |
|
|
3958 |
0C8C: BSF 03.6 |
|
|
3959 |
0C8D: CLRF 07 |
|
|
3960 |
0C8E: CLRF 08 |
|
|
3961 |
0C8F: CLRF 09 |
|
|
3962 |
.................... |
|
|
3963 |
.................... printf("Elektronický kompas\r\n",); |
|
|
3964 |
0C90: MOVLW 27 |
|
|
3965 |
0C91: MOVWF 0D |
|
|
3966 |
0C92: MOVLW 00 |
|
|
3967 |
0C93: MOVWF 0F |
|
|
3968 |
0C94: BCF 0A.3 |
|
|
3969 |
0C95: BCF 03.6 |
|
|
3970 |
0C96: CALL 0AF |
|
|
3971 |
0C97: BSF 0A.3 |
|
|
3972 |
.................... float az,k=0; |
|
|
3973 |
0C98: CLRF 28 |
|
|
3974 |
0C99: CLRF 27 |
|
|
3975 |
0C9A: CLRF 26 |
|
|
3976 |
0C9B: CLRF 25 |
|
|
3977 |
.................... set_mag(); |
|
|
3978 |
0C9C: BCF 0A.3 |
|
|
3979 |
0C9D: GOTO 11C |
|
|
3980 |
0C9E: BSF 0A.3 |
|
|
3981 |
.................... signed int16 X,Y,Z; |
|
|
3982 |
.................... while(true) |
|
|
3983 |
.................... { |
|
|
3984 |
.................... az=azimut(); |
|
|
3985 |
0C9F: GOTO 000 |
|
|
3986 |
0CA0: MOVF 7A,W |
|
|
3987 |
0CA1: MOVWF 24 |
|
|
3988 |
0CA2: MOVF 79,W |
|
|
3989 |
0CA3: MOVWF 23 |
|
|
3990 |
0CA4: MOVF 78,W |
|
|
3991 |
0CA5: MOVWF 22 |
|
|
3992 |
0CA6: MOVF 77,W |
|
|
3993 |
0CA7: MOVWF 21 |
|
|
3994 |
.................... |
|
|
3995 |
.................... |
|
|
3996 |
.................... |
|
|
3997 |
.................... |
|
|
3998 |
.................... printf("Elektronický kompas \r\n",); |
|
|
3999 |
0CA8: MOVLW 3D |
|
|
4000 |
0CA9: BSF 03.6 |
|
|
4001 |
0CAA: MOVWF 0D |
|
|
4002 |
0CAB: MOVLW 00 |
|
|
4003 |
0CAC: MOVWF 0F |
|
|
4004 |
0CAD: BCF 0A.3 |
|
|
4005 |
0CAE: BCF 03.6 |
|
|
4006 |
0CAF: CALL 0AF |
|
|
4007 |
0CB0: BSF 0A.3 |
|
|
4008 |
.................... printf("Simple Thermomether %10.2f \r\n", az); |
|
|
4009 |
0CB1: MOVLW 54 |
|
|
4010 |
0CB2: BSF 03.6 |
|
|
4011 |
0CB3: MOVWF 0D |
|
|
4012 |
0CB4: MOVLW 00 |
|
|
4013 |
0CB5: MOVWF 0F |
|
|
4014 |
0CB6: BCF 03.0 |
|
|
4015 |
0CB7: MOVLW 14 |
|
|
4016 |
0CB8: BCF 03.6 |
|
|
4017 |
0CB9: MOVWF 2F |
|
|
4018 |
0CBA: BCF 0A.3 |
|
|
4019 |
0CBB: CALL 542 |
|
|
4020 |
0CBC: BSF 0A.3 |
|
|
4021 |
0CBD: MOVLW 09 |
|
|
4022 |
0CBE: MOVWF 04 |
|
|
4023 |
0CBF: MOVF 24,W |
|
|
4024 |
0CC0: MOVWF 32 |
|
|
4025 |
0CC1: MOVF 23,W |
|
|
4026 |
0CC2: MOVWF 31 |
|
|
4027 |
0CC3: MOVF 22,W |
|
|
4028 |
0CC4: MOVWF 30 |
|
|
4029 |
0CC5: MOVF 21,W |
|
|
4030 |
0CC6: MOVWF 2F |
|
|
4031 |
0CC7: MOVLW 02 |
|
|
4032 |
0CC8: MOVWF 33 |
|
|
4033 |
0CC9: BCF 0A.3 |
|
|
4034 |
0CCA: GOTO 5D3 |
|
|
4035 |
0CCB: BSF 0A.3 |
|
|
4036 |
0CCC: MOVLW 20 |
|
|
4037 |
0CCD: MOVWF 40 |
|
|
4038 |
0CCE: BCF 0A.3 |
|
|
4039 |
0CCF: CALL 08D |
|
|
4040 |
0CD0: BSF 0A.3 |
|
|
4041 |
0CD1: MOVLW 0D |
|
|
4042 |
0CD2: MOVWF 40 |
|
|
4043 |
0CD3: BCF 0A.3 |
|
|
4044 |
0CD4: CALL 08D |
|
|
4045 |
0CD5: BSF 0A.3 |
|
|
4046 |
0CD6: MOVLW 0A |
|
|
4047 |
0CD7: MOVWF 40 |
|
|
4048 |
0CD8: BCF 0A.3 |
|
|
4049 |
0CD9: CALL 08D |
|
|
4050 |
0CDA: BSF 0A.3 |
|
|
4051 |
.................... |
|
|
4052 |
.................... //X=mag_readX(); |
|
|
4053 |
.................... //Y=mag_readY(); |
|
|
4054 |
.................... //Z=mag_readZ(); |
|
|
4055 |
.................... printf("Simple Thermometherx %Ld \r\n", X); |
|
|
4056 |
0CDB: MOVLW 63 |
|
|
4057 |
0CDC: BSF 03.6 |
|
|
4058 |
0CDD: MOVWF 0D |
|
|
4059 |
0CDE: MOVLW 00 |
|
|
4060 |
0CDF: MOVWF 0F |
|
|
4061 |
0CE0: BCF 03.0 |
|
|
4062 |
0CE1: MOVLW 15 |
|
|
4063 |
0CE2: BCF 03.6 |
|
|
4064 |
0CE3: MOVWF 2F |
|
|
4065 |
0CE4: BCF 0A.3 |
|
|
4066 |
0CE5: CALL 542 |
|
|
4067 |
0CE6: BSF 0A.3 |
|
|
4068 |
0CE7: MOVLW 10 |
|
|
4069 |
0CE8: MOVWF 04 |
|
|
4070 |
0CE9: MOVF 2A,W |
|
|
4071 |
0CEA: MOVWF 30 |
|
|
4072 |
0CEB: MOVF 29,W |
|
|
4073 |
0CEC: MOVWF 2F |
|
|
4074 |
0CED: BCF 0A.3 |
|
|
4075 |
0CEE: CALL 6BC |
|
|
4076 |
0CEF: BSF 0A.3 |
|
|
4077 |
0CF0: MOVLW 20 |
|
|
4078 |
0CF1: MOVWF 40 |
|
|
4079 |
0CF2: BCF 0A.3 |
|
|
4080 |
0CF3: CALL 08D |
|
|
4081 |
0CF4: BSF 0A.3 |
|
|
4082 |
0CF5: MOVLW 0D |
|
|
4083 |
0CF6: MOVWF 40 |
|
|
4084 |
0CF7: BCF 0A.3 |
|
|
4085 |
0CF8: CALL 08D |
|
|
4086 |
0CF9: BSF 0A.3 |
|
|
4087 |
0CFA: MOVLW 0A |
|
|
4088 |
0CFB: MOVWF 40 |
|
|
4089 |
0CFC: BCF 0A.3 |
|
|
4090 |
0CFD: CALL 08D |
|
|
4091 |
0CFE: BSF 0A.3 |
|
|
4092 |
.................... printf("Simple Thermomethery %Ld \r\n", Y); |
|
|
4093 |
0CFF: MOVLW 71 |
|
|
4094 |
0D00: BSF 03.6 |
|
|
4095 |
0D01: MOVWF 0D |
|
|
4096 |
0D02: MOVLW 00 |
|
|
4097 |
0D03: MOVWF 0F |
|
|
4098 |
0D04: BCF 03.0 |
|
|
4099 |
0D05: MOVLW 15 |
|
|
4100 |
0D06: BCF 03.6 |
|
|
4101 |
0D07: MOVWF 2F |
|
|
4102 |
0D08: BCF 0A.3 |
|
|
4103 |
0D09: CALL 542 |
|
|
4104 |
0D0A: BSF 0A.3 |
|
|
4105 |
0D0B: MOVLW 10 |
|
|
4106 |
0D0C: MOVWF 04 |
|
|
4107 |
0D0D: MOVF 2C,W |
|
|
4108 |
0D0E: MOVWF 30 |
|
|
4109 |
0D0F: MOVF 2B,W |
|
|
4110 |
0D10: MOVWF 2F |
|
|
4111 |
0D11: BCF 0A.3 |
|
|
4112 |
0D12: CALL 6BC |
|
|
4113 |
0D13: BSF 0A.3 |
|
|
4114 |
0D14: MOVLW 20 |
|
|
4115 |
0D15: MOVWF 40 |
|
|
4116 |
0D16: BCF 0A.3 |
|
|
4117 |
0D17: CALL 08D |
|
|
4118 |
0D18: BSF 0A.3 |
|
|
4119 |
0D19: MOVLW 0D |
|
|
4120 |
0D1A: MOVWF 40 |
|
|
4121 |
0D1B: BCF 0A.3 |
|
|
4122 |
0D1C: CALL 08D |
|
|
4123 |
0D1D: BSF 0A.3 |
|
|
4124 |
0D1E: MOVLW 0A |
|
|
4125 |
0D1F: MOVWF 40 |
|
|
4126 |
0D20: BCF 0A.3 |
|
|
4127 |
0D21: CALL 08D |
|
|
4128 |
0D22: BSF 0A.3 |
|
|
4129 |
.................... printf("Simple Thermometherz %Ld \r\n", Z); |
|
|
4130 |
0D23: MOVLW 7F |
|
|
4131 |
0D24: BSF 03.6 |
|
|
4132 |
0D25: MOVWF 0D |
|
|
4133 |
0D26: MOVLW 00 |
|
|
4134 |
0D27: MOVWF 0F |
|
|
4135 |
0D28: BCF 03.0 |
|
|
4136 |
0D29: MOVLW 15 |
|
|
4137 |
0D2A: BCF 03.6 |
|
|
4138 |
0D2B: MOVWF 2F |
|
|
4139 |
0D2C: BCF 0A.3 |
|
|
4140 |
0D2D: CALL 542 |
|
|
4141 |
0D2E: BSF 0A.3 |
|
|
4142 |
0D2F: MOVLW 10 |
|
|
4143 |
0D30: MOVWF 04 |
|
|
4144 |
0D31: MOVF 2E,W |
|
|
4145 |
0D32: MOVWF 30 |
|
|
4146 |
0D33: MOVF 2D,W |
|
|
4147 |
0D34: MOVWF 2F |
|
|
4148 |
0D35: BCF 0A.3 |
|
|
4149 |
0D36: CALL 6BC |
|
|
4150 |
0D37: BSF 0A.3 |
|
|
4151 |
0D38: MOVLW 20 |
|
|
4152 |
0D39: MOVWF 40 |
|
|
4153 |
0D3A: BCF 0A.3 |
|
|
4154 |
0D3B: CALL 08D |
|
|
4155 |
0D3C: BSF 0A.3 |
|
|
4156 |
0D3D: MOVLW 0D |
|
|
4157 |
0D3E: MOVWF 40 |
|
|
4158 |
0D3F: BCF 0A.3 |
|
|
4159 |
0D40: CALL 08D |
|
|
4160 |
0D41: BSF 0A.3 |
|
|
4161 |
0D42: MOVLW 0A |
|
|
4162 |
0D43: MOVWF 40 |
|
|
4163 |
0D44: BCF 0A.3 |
|
|
4164 |
0D45: CALL 08D |
|
|
4165 |
0D46: BSF 0A.3 |
|
|
4166 |
.................... Delay_ms(2000); |
|
|
4167 |
0D47: MOVLW 08 |
|
|
4168 |
0D48: MOVWF 2F |
|
|
4169 |
0D49: MOVLW FA |
|
|
4170 |
0D4A: MOVWF 30 |
|
|
4171 |
0D4B: BCF 0A.3 |
|
|
4172 |
0D4C: CALL 108 |
|
|
4173 |
0D4D: BSF 0A.3 |
|
|
4174 |
0D4E: DECFSZ 2F,F |
|
|
4175 |
0D4F: GOTO 549 |
|
|
4176 |
.................... |
|
|
4177 |
.................... } |
|
|
4178 |
0D50: GOTO 49F |
|
|
4179 |
.................... } |
|
|
4180 |
0D51: SLEEP |
|
|
4181 |
|
|
|
4182 |
Configuration Fuses: |
|
|
4183 |
Word 1: 2CF5 INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG |
|
|
4184 |
Word 2: 3FFF NOWRT BORV40 |