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