1045 |
jacho |
1 |
CCS PCM C Compiler, Version 4.106, 47914 28-4-13 16:30 |
|
|
2 |
|
|
|
3 |
Filename: c:\users\honza\documents\pic\azimut\main.lst |
|
|
4 |
|
|
|
5 |
ROM used: 4748 words (58%) |
|
|
6 |
Largest free fragment is 2048 |
|
|
7 |
RAM used: 19 (5%) at main() level |
|
|
8 |
82 (22%) worst case |
|
|
9 |
Stack: 4 locations |
|
|
10 |
|
|
|
11 |
* |
|
|
12 |
0000: MOVLW 11 |
|
|
13 |
0001: MOVWF 0A |
|
|
14 |
0002: GOTO 1DA |
|
|
15 |
0003: NOP |
|
|
16 |
.................... #include "C:\Users\Honza\Documents\pic\azimut\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 |
01C8: MOVLW 40 |
|
|
41 |
01C9: MOVWF 04 |
|
|
42 |
01CA: BCF 03.7 |
|
|
43 |
01CB: MOVF 00,W |
|
|
44 |
01CC: BTFSC 03.2 |
|
|
45 |
01CD: GOTO 1DB |
|
|
46 |
01CE: MOVLW 02 |
|
|
47 |
01CF: MOVWF 78 |
|
|
48 |
01D0: CLRF 77 |
|
|
49 |
01D1: DECFSZ 77,F |
|
|
50 |
01D2: GOTO 1D1 |
|
|
51 |
01D3: DECFSZ 78,F |
|
|
52 |
01D4: GOTO 1D0 |
|
|
53 |
01D5: MOVLW 97 |
|
|
54 |
01D6: MOVWF 77 |
|
|
55 |
01D7: DECFSZ 77,F |
|
|
56 |
01D8: GOTO 1D7 |
|
|
57 |
01D9: DECFSZ 00,F |
|
|
58 |
01DA: GOTO 1CE |
|
|
59 |
01DB: RETURN |
|
|
60 |
.................... |
|
|
61 |
.................... |
|
|
62 |
.................... |
|
|
63 |
.................... |
|
|
64 |
.................... |
|
|
65 |
.................... #define PIN_SDA PIN_C4 |
|
|
66 |
.................... #define PIN_SCL PIN_C3 |
|
|
67 |
.................... #use i2c(master, sda=PIN_SDA, scl=PIN_SCL) |
|
|
68 |
* |
|
|
69 |
0143: MOVLW 08 |
|
|
70 |
0144: MOVWF 78 |
|
|
71 |
0145: NOP |
|
|
72 |
0146: BCF 07.3 |
|
|
73 |
0147: BCF 20.3 |
|
|
74 |
0148: MOVF 20,W |
|
|
75 |
0149: BSF 03.5 |
|
|
76 |
014A: MOVWF 07 |
|
|
77 |
014B: NOP |
|
|
78 |
014C: BCF 03.5 |
|
|
79 |
014D: RLF 4E,F |
|
|
80 |
014E: BCF 07.4 |
|
|
81 |
014F: BTFSS 03.0 |
|
|
82 |
0150: GOTO 157 |
|
|
83 |
0151: BSF 20.4 |
|
|
84 |
0152: MOVF 20,W |
|
|
85 |
0153: BSF 03.5 |
|
|
86 |
0154: MOVWF 07 |
|
|
87 |
0155: GOTO 15B |
|
|
88 |
0156: BCF 03.5 |
|
|
89 |
0157: BCF 20.4 |
|
|
90 |
0158: MOVF 20,W |
|
|
91 |
0159: BSF 03.5 |
|
|
92 |
015A: MOVWF 07 |
|
|
93 |
015B: NOP |
|
|
94 |
015C: BCF 03.5 |
|
|
95 |
015D: BSF 20.3 |
|
|
96 |
015E: MOVF 20,W |
|
|
97 |
015F: BSF 03.5 |
|
|
98 |
0160: MOVWF 07 |
|
|
99 |
0161: BCF 03.5 |
|
|
100 |
0162: BTFSS 07.3 |
|
|
101 |
0163: GOTO 162 |
|
|
102 |
0164: DECFSZ 78,F |
|
|
103 |
0165: GOTO 145 |
|
|
104 |
0166: NOP |
|
|
105 |
0167: BCF 07.3 |
|
|
106 |
0168: BCF 20.3 |
|
|
107 |
0169: MOVF 20,W |
|
|
108 |
016A: BSF 03.5 |
|
|
109 |
016B: MOVWF 07 |
|
|
110 |
016C: NOP |
|
|
111 |
016D: BCF 03.5 |
|
|
112 |
016E: BSF 20.4 |
|
|
113 |
016F: MOVF 20,W |
|
|
114 |
0170: BSF 03.5 |
|
|
115 |
0171: MOVWF 07 |
|
|
116 |
0172: NOP |
|
|
117 |
0173: NOP |
|
|
118 |
0174: BCF 03.5 |
|
|
119 |
0175: BSF 20.3 |
|
|
120 |
0176: MOVF 20,W |
|
|
121 |
0177: BSF 03.5 |
|
|
122 |
0178: MOVWF 07 |
|
|
123 |
0179: BCF 03.5 |
|
|
124 |
017A: BTFSS 07.3 |
|
|
125 |
017B: GOTO 17A |
|
|
126 |
017C: CLRF 78 |
|
|
127 |
017D: NOP |
|
|
128 |
017E: BTFSC 07.4 |
|
|
129 |
017F: BSF 78.0 |
|
|
130 |
0180: BCF 07.3 |
|
|
131 |
0181: BCF 20.3 |
|
|
132 |
0182: MOVF 20,W |
|
|
133 |
0183: BSF 03.5 |
|
|
134 |
0184: MOVWF 07 |
|
|
135 |
0185: BCF 03.5 |
|
|
136 |
0186: BCF 07.4 |
|
|
137 |
0187: BCF 20.4 |
|
|
138 |
0188: MOVF 20,W |
|
|
139 |
0189: BSF 03.5 |
|
|
140 |
018A: MOVWF 07 |
|
|
141 |
018B: BCF 03.5 |
|
|
142 |
018C: RETURN |
|
|
143 |
* |
|
|
144 |
028D: MOVLW 08 |
|
|
145 |
028E: MOVWF 4F |
|
|
146 |
028F: MOVF 77,W |
|
|
147 |
0290: MOVWF 50 |
|
|
148 |
0291: BSF 20.4 |
|
|
149 |
0292: MOVF 20,W |
|
|
150 |
0293: BSF 03.5 |
|
|
151 |
0294: MOVWF 07 |
|
|
152 |
0295: NOP |
|
|
153 |
0296: BCF 03.5 |
|
|
154 |
0297: BSF 20.3 |
|
|
155 |
0298: MOVF 20,W |
|
|
156 |
0299: BSF 03.5 |
|
|
157 |
029A: MOVWF 07 |
|
|
158 |
029B: BCF 03.5 |
|
|
159 |
029C: BTFSS 07.3 |
|
|
160 |
029D: GOTO 29C |
|
|
161 |
029E: BTFSC 07.4 |
|
|
162 |
029F: BSF 03.0 |
|
|
163 |
02A0: BTFSS 07.4 |
|
|
164 |
02A1: BCF 03.0 |
|
|
165 |
02A2: RLF 78,F |
|
|
166 |
02A3: NOP |
|
|
167 |
02A4: BCF 20.3 |
|
|
168 |
02A5: MOVF 20,W |
|
|
169 |
02A6: BSF 03.5 |
|
|
170 |
02A7: MOVWF 07 |
|
|
171 |
02A8: BCF 03.5 |
|
|
172 |
02A9: BCF 07.3 |
|
|
173 |
02AA: DECFSZ 4F,F |
|
|
174 |
02AB: GOTO 291 |
|
|
175 |
02AC: BSF 20.4 |
|
|
176 |
02AD: MOVF 20,W |
|
|
177 |
02AE: BSF 03.5 |
|
|
178 |
02AF: MOVWF 07 |
|
|
179 |
02B0: NOP |
|
|
180 |
02B1: BCF 03.5 |
|
|
181 |
02B2: BCF 07.4 |
|
|
182 |
02B3: MOVF 50,W |
|
|
183 |
02B4: BTFSC 03.2 |
|
|
184 |
02B5: GOTO 2BB |
|
|
185 |
02B6: BCF 20.4 |
|
|
186 |
02B7: MOVF 20,W |
|
|
187 |
02B8: BSF 03.5 |
|
|
188 |
02B9: MOVWF 07 |
|
|
189 |
02BA: BCF 03.5 |
|
|
190 |
02BB: NOP |
|
|
191 |
02BC: BSF 20.3 |
|
|
192 |
02BD: MOVF 20,W |
|
|
193 |
02BE: BSF 03.5 |
|
|
194 |
02BF: MOVWF 07 |
|
|
195 |
02C0: BCF 03.5 |
|
|
196 |
02C1: BTFSS 07.3 |
|
|
197 |
02C2: GOTO 2C1 |
|
|
198 |
02C3: NOP |
|
|
199 |
02C4: BCF 07.3 |
|
|
200 |
02C5: BCF 20.3 |
|
|
201 |
02C6: MOVF 20,W |
|
|
202 |
02C7: BSF 03.5 |
|
|
203 |
02C8: MOVWF 07 |
|
|
204 |
02C9: NOP |
|
|
205 |
02CA: BCF 03.5 |
|
|
206 |
02CB: BCF 07.4 |
|
|
207 |
02CC: BCF 20.4 |
|
|
208 |
02CD: MOVF 20,W |
|
|
209 |
02CE: BSF 03.5 |
|
|
210 |
02CF: MOVWF 07 |
|
|
211 |
02D0: BCF 03.5 |
|
|
212 |
02D1: RETURN |
|
|
213 |
.................... #use rs232(baud=9600,parity=N,xmit=PIN_C7,rcv=PIN_C6,bits=8) //rcv TXD xmit RXD |
|
|
214 |
* |
|
|
215 |
00B6: BCF 20.7 |
|
|
216 |
00B7: MOVF 20,W |
|
|
217 |
00B8: BSF 03.5 |
|
|
218 |
00B9: MOVWF 07 |
|
|
219 |
00BA: BCF 03.5 |
|
|
220 |
00BB: BCF 07.7 |
|
|
221 |
00BC: MOVLW 08 |
|
|
222 |
00BD: MOVWF 78 |
|
|
223 |
00BE: GOTO 0BF |
|
|
224 |
00BF: NOP |
|
|
225 |
00C0: BSF 78.7 |
|
|
226 |
00C1: GOTO 0D0 |
|
|
227 |
00C2: BCF 78.7 |
|
|
228 |
00C3: RRF 55,F |
|
|
229 |
00C4: BTFSC 03.0 |
|
|
230 |
00C5: BSF 07.7 |
|
|
231 |
00C6: BTFSS 03.0 |
|
|
232 |
00C7: BCF 07.7 |
|
|
233 |
00C8: BSF 78.6 |
|
|
234 |
00C9: GOTO 0D0 |
|
|
235 |
00CA: BCF 78.6 |
|
|
236 |
00CB: DECFSZ 78,F |
|
|
237 |
00CC: GOTO 0C3 |
|
|
238 |
00CD: GOTO 0CE |
|
|
239 |
00CE: NOP |
|
|
240 |
00CF: BSF 07.7 |
|
|
241 |
00D0: MOVLW 3F |
|
|
242 |
00D1: MOVWF 04 |
|
|
243 |
00D2: DECFSZ 04,F |
|
|
244 |
00D3: GOTO 0D2 |
|
|
245 |
00D4: NOP |
|
|
246 |
00D5: BTFSC 78.7 |
|
|
247 |
00D6: GOTO 0C2 |
|
|
248 |
00D7: BTFSC 78.6 |
|
|
249 |
00D8: GOTO 0CA |
|
|
250 |
00D9: RETURN |
|
|
251 |
.................... #include <math.h> |
|
|
252 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
253 |
.................... //// (C) Copyright 1996,2008 Custom Computer Services //// |
|
|
254 |
.................... //// This source code may only be used by licensed users of the CCS C //// |
|
|
255 |
.................... //// compiler. This source code may only be distributed to other //// |
|
|
256 |
.................... //// licensed users of the CCS C compiler. No other use, reproduction //// |
|
|
257 |
.................... //// or distribution is permitted without written permission. //// |
|
|
258 |
.................... //// Derivative programs created using this software in object code //// |
|
|
259 |
.................... //// form are not restricted in any way. //// |
|
|
260 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
261 |
.................... //// //// |
|
|
262 |
.................... //// History: //// |
|
|
263 |
.................... //// * 9/20/2001 : Improvments are made to sin/cos code. //// |
|
|
264 |
.................... //// The code now is small, much faster, //// |
|
|
265 |
.................... //// and more accurate. //// |
|
|
266 |
.................... //// * 2/21/2007 : Compiler handles & operator differently and does |
|
|
267 |
.................... //// not return generic (int8 *) so type cast is done //// |
|
|
268 |
.................... //// //// |
|
|
269 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
270 |
.................... |
|
|
271 |
.................... #ifndef MATH_H |
|
|
272 |
.................... #define MATH_H |
|
|
273 |
.................... |
|
|
274 |
.................... #ifdef PI |
|
|
275 |
.................... #undef PI |
|
|
276 |
.................... #endif |
|
|
277 |
.................... #define PI 3.1415926535897932 |
|
|
278 |
.................... |
|
|
279 |
.................... |
|
|
280 |
.................... #define SQRT2 1.4142135623730950 |
|
|
281 |
.................... |
|
|
282 |
.................... //float const ps[4] = {5.9304945, 21.125224, 8.9403076, 0.29730279}; |
|
|
283 |
.................... //float const qs[4] = {1.0000000, 15.035723, 17.764134, 2.4934718}; |
|
|
284 |
.................... |
|
|
285 |
.................... ///////////////////////////// Round Functions ////////////////////////////// |
|
|
286 |
.................... |
|
|
287 |
.................... float32 CEIL_FLOOR(float32 x, unsigned int8 n) |
|
|
288 |
.................... { |
|
|
289 |
.................... float32 y, res; |
|
|
290 |
.................... unsigned int16 l; |
|
|
291 |
.................... int1 s; |
|
|
292 |
.................... |
|
|
293 |
.................... s = 0; |
|
|
294 |
.................... y = x; |
|
|
295 |
.................... |
|
|
296 |
.................... if (x < 0) |
|
|
297 |
.................... { |
|
|
298 |
.................... s = 1; |
|
|
299 |
.................... y = -y; |
|
|
300 |
.................... } |
|
|
301 |
.................... |
|
|
302 |
.................... if (y <= 32768.0) |
|
|
303 |
.................... res = (float32)(unsigned int16)y; |
|
|
304 |
.................... |
|
|
305 |
.................... else if (y < 10000000.0) |
|
|
306 |
.................... { |
|
|
307 |
.................... l = (unsigned int16)(y/32768.0); |
|
|
308 |
.................... y = 32768.0*(y/32768.0 - (float32)l); |
|
|
309 |
.................... res = 32768.0*(float32)l; |
|
|
310 |
.................... res += (float32)(unsigned int16)y; |
|
|
311 |
.................... } |
|
|
312 |
.................... |
|
|
313 |
.................... else |
|
|
314 |
.................... res = y; |
|
|
315 |
.................... |
|
|
316 |
.................... y = y - (float32)(unsigned int16)y; |
|
|
317 |
.................... |
|
|
318 |
.................... if (s) |
|
|
319 |
.................... res = -res; |
|
|
320 |
.................... |
|
|
321 |
.................... if (y != 0) |
|
|
322 |
.................... { |
|
|
323 |
.................... if (s == 1 && n == 0) |
|
|
324 |
.................... res -= 1.0; |
|
|
325 |
.................... |
|
|
326 |
.................... if (s == 0 && n == 1) |
|
|
327 |
.................... res += 1.0; |
|
|
328 |
.................... } |
|
|
329 |
.................... if (x == 0) |
|
|
330 |
.................... res = 0; |
|
|
331 |
.................... |
|
|
332 |
.................... return (res); |
|
|
333 |
.................... } |
|
|
334 |
.................... |
|
|
335 |
.................... // Overloaded Functions to take care for new Data types in PCD |
|
|
336 |
.................... // Overloaded function CEIL_FLOOR() for data type - Float48 |
|
|
337 |
.................... #if defined(__PCD__) |
|
|
338 |
.................... float48 CEIL_FLOOR(float48 x, unsigned int8 n) |
|
|
339 |
.................... { |
|
|
340 |
.................... float48 y, res; |
|
|
341 |
.................... unsigned int16 l; |
|
|
342 |
.................... int1 s; |
|
|
343 |
.................... |
|
|
344 |
.................... s = 0; |
|
|
345 |
.................... y = x; |
|
|
346 |
.................... |
|
|
347 |
.................... if (x < 0) |
|
|
348 |
.................... { |
|
|
349 |
.................... s = 1; |
|
|
350 |
.................... y = -y; |
|
|
351 |
.................... } |
|
|
352 |
.................... |
|
|
353 |
.................... if (y <= 32768.0) |
|
|
354 |
.................... res = (float48)(unsigned int16)y; |
|
|
355 |
.................... |
|
|
356 |
.................... else if (y < 10000000.0) |
|
|
357 |
.................... { |
|
|
358 |
.................... l = (unsigned int16)(y/32768.0); |
|
|
359 |
.................... y = 32768.0*(y/32768.0 - (float48)l); |
|
|
360 |
.................... res = 32768.0*(float32)l; |
|
|
361 |
.................... res += (float48)(unsigned int16)y; |
|
|
362 |
.................... } |
|
|
363 |
.................... |
|
|
364 |
.................... else |
|
|
365 |
.................... res = y; |
|
|
366 |
.................... |
|
|
367 |
.................... y = y - (float48)(unsigned int16)y; |
|
|
368 |
.................... |
|
|
369 |
.................... if (s) |
|
|
370 |
.................... res = -res; |
|
|
371 |
.................... |
|
|
372 |
.................... if (y != 0) |
|
|
373 |
.................... { |
|
|
374 |
.................... if (s == 1 && n == 0) |
|
|
375 |
.................... res -= 1.0; |
|
|
376 |
.................... |
|
|
377 |
.................... if (s == 0 && n == 1) |
|
|
378 |
.................... res += 1.0; |
|
|
379 |
.................... } |
|
|
380 |
.................... if (x == 0) |
|
|
381 |
.................... res = 0; |
|
|
382 |
.................... |
|
|
383 |
.................... return (res); |
|
|
384 |
.................... } |
|
|
385 |
.................... |
|
|
386 |
.................... |
|
|
387 |
.................... // Overloaded function CEIL_FLOOR() for data type - Float64 |
|
|
388 |
.................... float64 CEIL_FLOOR(float64 x, unsigned int8 n) |
|
|
389 |
.................... { |
|
|
390 |
.................... float64 y, res; |
|
|
391 |
.................... unsigned int16 l; |
|
|
392 |
.................... int1 s; |
|
|
393 |
.................... |
|
|
394 |
.................... s = 0; |
|
|
395 |
.................... y = x; |
|
|
396 |
.................... |
|
|
397 |
.................... if (x < 0) |
|
|
398 |
.................... { |
|
|
399 |
.................... s = 1; |
|
|
400 |
.................... y = -y; |
|
|
401 |
.................... } |
|
|
402 |
.................... |
|
|
403 |
.................... if (y <= 32768.0) |
|
|
404 |
.................... res = (float64)(unsigned int16)y; |
|
|
405 |
.................... |
|
|
406 |
.................... else if (y < 10000000.0) |
|
|
407 |
.................... { |
|
|
408 |
.................... l = (unsigned int16)(y/32768.0); |
|
|
409 |
.................... y = 32768.0*(y/32768.0 - (float64)l); |
|
|
410 |
.................... res = 32768.0*(float64)l; |
|
|
411 |
.................... res += (float64)(unsigned int16)y; |
|
|
412 |
.................... } |
|
|
413 |
.................... |
|
|
414 |
.................... else |
|
|
415 |
.................... res = y; |
|
|
416 |
.................... |
|
|
417 |
.................... y = y - (float64)(unsigned int16)y; |
|
|
418 |
.................... |
|
|
419 |
.................... if (s) |
|
|
420 |
.................... res = -res; |
|
|
421 |
.................... |
|
|
422 |
.................... if (y != 0) |
|
|
423 |
.................... { |
|
|
424 |
.................... if (s == 1 && n == 0) |
|
|
425 |
.................... res -= 1.0; |
|
|
426 |
.................... |
|
|
427 |
.................... if (s == 0 && n == 1) |
|
|
428 |
.................... res += 1.0; |
|
|
429 |
.................... } |
|
|
430 |
.................... if (x == 0) |
|
|
431 |
.................... res = 0; |
|
|
432 |
.................... |
|
|
433 |
.................... return (res); |
|
|
434 |
.................... } |
|
|
435 |
.................... #endif |
|
|
436 |
.................... |
|
|
437 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
438 |
.................... // float floor(float x) |
|
|
439 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
440 |
.................... // Description : rounds down the number x. |
|
|
441 |
.................... // Date : N/A |
|
|
442 |
.................... // |
|
|
443 |
.................... float32 floor(float32 x) |
|
|
444 |
.................... { |
|
|
445 |
.................... return CEIL_FLOOR(x, 0); |
|
|
446 |
.................... } |
|
|
447 |
.................... // Following 2 functions are overloaded functions of floor() for PCD |
|
|
448 |
.................... // Overloaded function floor() for data type - Float48 |
|
|
449 |
.................... #if defined(__PCD__) |
|
|
450 |
.................... float48 floor(float48 x) |
|
|
451 |
.................... { |
|
|
452 |
.................... return CEIL_FLOOR(x, 0); |
|
|
453 |
.................... } |
|
|
454 |
.................... |
|
|
455 |
.................... // Overloaded function floor() for data type - Float64 |
|
|
456 |
.................... float64 floor(float64 x) |
|
|
457 |
.................... { |
|
|
458 |
.................... return CEIL_FLOOR(x, 0); |
|
|
459 |
.................... } |
|
|
460 |
.................... #endif |
|
|
461 |
.................... |
|
|
462 |
.................... |
|
|
463 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
464 |
.................... // float ceil(float x) |
|
|
465 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
466 |
.................... // Description : rounds up the number x. |
|
|
467 |
.................... // Date : N/A |
|
|
468 |
.................... // |
|
|
469 |
.................... float32 ceil(float32 x) |
|
|
470 |
.................... { |
|
|
471 |
.................... return CEIL_FLOOR(x, 1); |
|
|
472 |
.................... } |
|
|
473 |
.................... // Following 2 functions are overloaded functions of ceil() for PCD |
|
|
474 |
.................... // Overloaded function ceil() for data type - Float48 |
|
|
475 |
.................... #if defined(__PCD__) |
|
|
476 |
.................... float48 ceil(float48 x) |
|
|
477 |
.................... { |
|
|
478 |
.................... return CEIL_FLOOR(x, 1); |
|
|
479 |
.................... } |
|
|
480 |
.................... |
|
|
481 |
.................... // Overloaded function ceil() for data type - Float64 |
|
|
482 |
.................... float64 ceil(float64 x) |
|
|
483 |
.................... { |
|
|
484 |
.................... return CEIL_FLOOR(x, 1); |
|
|
485 |
.................... } |
|
|
486 |
.................... #endif |
|
|
487 |
.................... |
|
|
488 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
489 |
.................... // float fabs(float x) |
|
|
490 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
491 |
.................... // Description : Computes the absolute value of floating point number x |
|
|
492 |
.................... // Returns : returns the absolute value of x |
|
|
493 |
.................... // Date : N/A |
|
|
494 |
.................... // |
|
|
495 |
.................... #define fabs abs |
|
|
496 |
.................... |
|
|
497 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
498 |
.................... // float fmod(float x) |
|
|
499 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
500 |
.................... // Description : Computes the floating point remainder of x/y |
|
|
501 |
.................... // Returns : returns the value of x= i*y, for some integer i such that, if y |
|
|
502 |
.................... // is non zero, the result has the same isgn of x na dmagnitude less than the |
|
|
503 |
.................... // magnitude of y. If y is zero then a domain error occurs. |
|
|
504 |
.................... // Date : N/A |
|
|
505 |
.................... // |
|
|
506 |
.................... |
|
|
507 |
.................... float fmod(float32 x,float32 y) |
|
|
508 |
.................... { |
|
|
509 |
.................... float32 i; |
|
|
510 |
.................... if (y!=0.0) |
|
|
511 |
.................... { |
|
|
512 |
.................... i=(x/y < 0.0)? ceil(x/y): floor(x/y); |
|
|
513 |
.................... return(x-(i*y)); |
|
|
514 |
.................... } |
|
|
515 |
.................... else |
|
|
516 |
.................... { |
|
|
517 |
.................... #ifdef _ERRNO |
|
|
518 |
.................... { |
|
|
519 |
.................... errno=EDOM; |
|
|
520 |
.................... } |
|
|
521 |
.................... #endif |
|
|
522 |
.................... } |
|
|
523 |
.................... } |
|
|
524 |
.................... //Overloaded function for fmod() for PCD |
|
|
525 |
.................... // Overloaded function fmod() for data type - Float48 |
|
|
526 |
.................... #if defined(__PCD__) |
|
|
527 |
.................... float48 fmod(float48 x,float48 y) |
|
|
528 |
.................... { |
|
|
529 |
.................... float48 i; |
|
|
530 |
.................... if (y!=0.0) |
|
|
531 |
.................... { |
|
|
532 |
.................... i=(x/y < 0.0)? ceil(x/y): floor(x/y); |
|
|
533 |
.................... return(x-(i*y)); |
|
|
534 |
.................... } |
|
|
535 |
.................... else |
|
|
536 |
.................... { |
|
|
537 |
.................... #ifdef _ERRNO |
|
|
538 |
.................... { |
|
|
539 |
.................... errno=EDOM; |
|
|
540 |
.................... } |
|
|
541 |
.................... #endif |
|
|
542 |
.................... } |
|
|
543 |
.................... } |
|
|
544 |
.................... // Overloaded function fmod() for data type - Float64 |
|
|
545 |
.................... float64 fmod(float64 x,float64 y) |
|
|
546 |
.................... { |
|
|
547 |
.................... float64 i; |
|
|
548 |
.................... if (y!=0.0) |
|
|
549 |
.................... { |
|
|
550 |
.................... i=(x/y < 0.0)? ceil(x/y): floor(x/y); |
|
|
551 |
.................... return(x-(i*y)); |
|
|
552 |
.................... } |
|
|
553 |
.................... else |
|
|
554 |
.................... { |
|
|
555 |
.................... #ifdef _ERRNO |
|
|
556 |
.................... { |
|
|
557 |
.................... errno=EDOM; |
|
|
558 |
.................... } |
|
|
559 |
.................... #endif |
|
|
560 |
.................... } |
|
|
561 |
.................... } |
|
|
562 |
.................... #endif |
|
|
563 |
.................... //////////////////// Exponential and logarithmic functions //////////////////// |
|
|
564 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
565 |
.................... // float exp(float x) |
|
|
566 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
567 |
.................... // Description : returns the value (e^x) |
|
|
568 |
.................... // Date : N/A |
|
|
569 |
.................... // |
|
|
570 |
.................... #define LN2 0.6931471805599453 |
|
|
571 |
.................... |
|
|
572 |
.................... float const pe[6] = {0.000207455774, 0.00127100575, 0.00965065093, |
|
|
573 |
.................... 0.0554965651, 0.240227138, 0.693147172}; |
|
|
574 |
.................... |
|
|
575 |
.................... |
|
|
576 |
.................... float32 exp(float32 x) |
|
|
577 |
.................... { |
|
|
578 |
.................... float32 y, res, r; |
|
|
579 |
.................... #if defined(__PCD__) |
|
|
580 |
.................... int8 data1; |
|
|
581 |
.................... #endif |
|
|
582 |
.................... signed int8 n; |
|
|
583 |
.................... int1 s; |
|
|
584 |
.................... #ifdef _ERRNO |
|
|
585 |
.................... if(x > 88.722838) |
|
|
586 |
.................... { |
|
|
587 |
.................... errno=ERANGE; |
|
|
588 |
.................... return(0); |
|
|
589 |
.................... } |
|
|
590 |
.................... #endif |
|
|
591 |
.................... n = (signed int16)(x/LN2); |
|
|
592 |
.................... s = 0; |
|
|
593 |
.................... y = x; |
|
|
594 |
.................... |
|
|
595 |
.................... if (x < 0) |
|
|
596 |
.................... { |
|
|
597 |
.................... s = 1; |
|
|
598 |
.................... n = -n; |
|
|
599 |
.................... y = -y; |
|
|
600 |
.................... } |
|
|
601 |
.................... |
|
|
602 |
.................... res = 0.0; |
|
|
603 |
.................... #if !defined(__PCD__) |
|
|
604 |
.................... *((unsigned int8 *)(&res)) = n + 0x7F; |
|
|
605 |
.................... #endif |
|
|
606 |
.................... |
|
|
607 |
.................... #if defined(__PCD__) // Takes care of IEEE format for PCD |
|
|
608 |
.................... data1 = n+0x7F; |
|
|
609 |
.................... if(bit_test(data1,0)) |
|
|
610 |
.................... bit_set(*(((unsigned int8 *)(&res)+2)),7); |
|
|
611 |
.................... rotate_right(&data1,1); |
|
|
612 |
.................... bit_clear(data1,7); |
|
|
613 |
.................... *(((unsigned int8 *)(&res)+3)) = data1; |
|
|
614 |
.................... #endif |
|
|
615 |
.................... |
|
|
616 |
.................... y = y/LN2 - (float32)n; |
|
|
617 |
.................... |
|
|
618 |
.................... r = pe[0]*y + pe[1]; |
|
|
619 |
.................... r = r*y + pe[2]; |
|
|
620 |
.................... r = r*y + pe[3]; |
|
|
621 |
.................... r = r*y + pe[4]; |
|
|
622 |
.................... r = r*y + pe[5]; |
|
|
623 |
.................... |
|
|
624 |
.................... res = res*(1.0 + y*r); |
|
|
625 |
.................... |
|
|
626 |
.................... if (s) |
|
|
627 |
.................... res = 1.0/res; |
|
|
628 |
.................... return(res); |
|
|
629 |
.................... } |
|
|
630 |
.................... |
|
|
631 |
.................... |
|
|
632 |
.................... //Overloaded function for exp() for PCD |
|
|
633 |
.................... // Overloaded function exp() for data type - Float48 |
|
|
634 |
.................... #if defined(__PCD__) |
|
|
635 |
.................... float48 exp(float48 x) |
|
|
636 |
.................... { |
|
|
637 |
.................... float48 y, res, r; |
|
|
638 |
.................... int8 data1; |
|
|
639 |
.................... signed int8 n; |
|
|
640 |
.................... int1 s; |
|
|
641 |
.................... #ifdef _ERRNO |
|
|
642 |
.................... if(x > 88.722838) |
|
|
643 |
.................... { |
|
|
644 |
.................... errno=ERANGE; |
|
|
645 |
.................... return(0); |
|
|
646 |
.................... } |
|
|
647 |
.................... #endif |
|
|
648 |
.................... n = (signed int16)(x/LN2); |
|
|
649 |
.................... s = 0; |
|
|
650 |
.................... y = x; |
|
|
651 |
.................... |
|
|
652 |
.................... if (x < 0) |
|
|
653 |
.................... { |
|
|
654 |
.................... s = 1; |
|
|
655 |
.................... n = -n; |
|
|
656 |
.................... y = -y; |
|
|
657 |
.................... } |
|
|
658 |
.................... |
|
|
659 |
.................... res = 0.0; |
|
|
660 |
.................... |
|
|
661 |
.................... data1 = n+0x7F; |
|
|
662 |
.................... if(bit_test(data1,0)) |
|
|
663 |
.................... bit_set(*(((unsigned int8 *)(&res)+4)),7); |
|
|
664 |
.................... rotate_right(&data1,1); |
|
|
665 |
.................... bit_clear(data1,7); |
|
|
666 |
.................... *(((unsigned int8 *)(&res)+5)) = data1; |
|
|
667 |
.................... |
|
|
668 |
.................... y = y/LN2 - (float48)n; |
|
|
669 |
.................... |
|
|
670 |
.................... r = pe[0]*y + pe[1]; |
|
|
671 |
.................... r = r*y + pe[2]; |
|
|
672 |
.................... r = r*y + pe[3]; |
|
|
673 |
.................... r = r*y + pe[4]; |
|
|
674 |
.................... r = r*y + pe[5]; |
|
|
675 |
.................... |
|
|
676 |
.................... res = res*(1.0 + y*r); |
|
|
677 |
.................... |
|
|
678 |
.................... if (s) |
|
|
679 |
.................... res = 1.0/res; |
|
|
680 |
.................... return(res); |
|
|
681 |
.................... } |
|
|
682 |
.................... |
|
|
683 |
.................... // Overloaded function exp() for data type - Float64 |
|
|
684 |
.................... float64 exp(float64 x) |
|
|
685 |
.................... { |
|
|
686 |
.................... float64 y, res, r; |
|
|
687 |
.................... unsigned int16 data1, data2; |
|
|
688 |
.................... unsigned int16 *p; |
|
|
689 |
.................... signed int16 n; |
|
|
690 |
.................... int1 s; |
|
|
691 |
.................... #ifdef _ERRNO |
|
|
692 |
.................... if(x > 709.7827128) |
|
|
693 |
.................... { |
|
|
694 |
.................... errno=ERANGE; |
|
|
695 |
.................... return(0); |
|
|
696 |
.................... } |
|
|
697 |
.................... #endif |
|
|
698 |
.................... n = (signed int16)(x/LN2); |
|
|
699 |
.................... s = 0; |
|
|
700 |
.................... y = x; |
|
|
701 |
.................... |
|
|
702 |
.................... if (x < 0) |
|
|
703 |
.................... { |
|
|
704 |
.................... s = 1; |
|
|
705 |
.................... n = -n; |
|
|
706 |
.................... y = -y; |
|
|
707 |
.................... } |
|
|
708 |
.................... |
|
|
709 |
.................... res = 0.0; |
|
|
710 |
.................... |
|
|
711 |
.................... #if !defined(__PCD__) |
|
|
712 |
.................... *((unsigned int16 *)(&res)) = n + 0x7F; |
|
|
713 |
.................... #endif |
|
|
714 |
.................... p= (((unsigned int16 *)(&res))+3); |
|
|
715 |
.................... data1 = *p; |
|
|
716 |
.................... data2 = *p; |
|
|
717 |
.................... data1 = n + 0x3FF; |
|
|
718 |
.................... data1 = data1 <<4; |
|
|
719 |
.................... if(bit_test(data2,15)) |
|
|
720 |
.................... bit_set(data1,15); |
|
|
721 |
.................... data2 = data2 & 0x000F; |
|
|
722 |
.................... data1 ^= data2; |
|
|
723 |
.................... |
|
|
724 |
.................... *(((unsigned int16 *)(&res)+3)) = data1; |
|
|
725 |
.................... |
|
|
726 |
.................... |
|
|
727 |
.................... y = y/LN2 - (float64)n; |
|
|
728 |
.................... |
|
|
729 |
.................... r = pe[0]*y + pe[1]; |
|
|
730 |
.................... r = r*y + pe[2]; |
|
|
731 |
.................... r = r*y + pe[3]; |
|
|
732 |
.................... r = r*y + pe[4]; |
|
|
733 |
.................... r = r*y + pe[5]; |
|
|
734 |
.................... |
|
|
735 |
.................... res = res*(1.0 + y*r); |
|
|
736 |
.................... |
|
|
737 |
.................... if (s) |
|
|
738 |
.................... res = 1.0/res; |
|
|
739 |
.................... return(res); |
|
|
740 |
.................... } |
|
|
741 |
.................... |
|
|
742 |
.................... #ENDIF |
|
|
743 |
.................... |
|
|
744 |
.................... |
|
|
745 |
.................... /************************************************************/ |
|
|
746 |
.................... |
|
|
747 |
.................... float32 const pl[4] = {0.45145214, -9.0558803, 26.940971, -19.860189}; |
|
|
748 |
.................... float32 const ql[4] = {1.0000000, -8.1354259, 16.780517, -9.9300943}; |
|
|
749 |
.................... |
|
|
750 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
751 |
.................... // float log(float x) |
|
|
752 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
753 |
.................... // Description : returns the the natural log of x |
|
|
754 |
.................... // Date : N/A |
|
|
755 |
.................... // |
|
|
756 |
.................... float32 log(float32 x) |
|
|
757 |
.................... { |
|
|
758 |
.................... float32 y, res, r, y2; |
|
|
759 |
.................... #if defined(__PCD__) |
|
|
760 |
.................... unsigned int8 data1,data2; |
|
|
761 |
.................... #endif |
|
|
762 |
.................... signed int8 n; |
|
|
763 |
.................... #ifdef _ERRNO |
|
|
764 |
.................... if(x <0) |
|
|
765 |
.................... { |
|
|
766 |
.................... errno=EDOM; |
|
|
767 |
.................... } |
|
|
768 |
.................... if(x ==0) |
|
|
769 |
.................... { |
|
|
770 |
.................... errno=ERANGE; |
|
|
771 |
.................... return(0); |
|
|
772 |
.................... } |
|
|
773 |
.................... #endif |
|
|
774 |
.................... y = x; |
|
|
775 |
.................... |
|
|
776 |
.................... if (y != 1.0) |
|
|
777 |
.................... { |
|
|
778 |
.................... #if !defined(__PCD__) |
|
|
779 |
.................... *((unsigned int8 *)(&y)) = 0x7E; |
|
|
780 |
.................... #endif |
|
|
781 |
.................... |
|
|
782 |
.................... #if defined(__PCD__) // Takes care of IEEE format |
|
|
783 |
.................... data2 = *(((unsigned int8 *)(&y))+3); |
|
|
784 |
.................... *(((unsigned int8 *)(&y))+3) = 0x3F; |
|
|
785 |
.................... data1 = *(((unsigned int8 *)(&y))+2); |
|
|
786 |
.................... bit_clear(data1,7); |
|
|
787 |
.................... *(((unsigned int8 *)(&y))+2) = data1; |
|
|
788 |
.................... if(bit_test(data2,7)) |
|
|
789 |
.................... bit_set(*(((unsigned int8 *)(&y))+3),7); |
|
|
790 |
.................... #endif |
|
|
791 |
.................... |
|
|
792 |
.................... y = (y - 1.0)/(y + 1.0); |
|
|
793 |
.................... |
|
|
794 |
.................... y2=y*y; |
|
|
795 |
.................... |
|
|
796 |
.................... res = pl[0]*y2 + pl[1]; |
|
|
797 |
.................... res = res*y2 + pl[2]; |
|
|
798 |
.................... res = res*y2 + pl[3]; |
|
|
799 |
.................... |
|
|
800 |
.................... r = ql[0]*y2 + ql[1]; |
|
|
801 |
.................... r = r*y2 + ql[2]; |
|
|
802 |
.................... r = r*y2 + ql[3]; |
|
|
803 |
.................... |
|
|
804 |
.................... res = y*res/r; |
|
|
805 |
.................... #if !defined(__PCD__) |
|
|
806 |
.................... n = *((unsigned int8 *)(&x)) - 0x7E; |
|
|
807 |
.................... #endif |
|
|
808 |
.................... #if defined(__PCD__) |
|
|
809 |
.................... data1 = *(((unsigned int8 *)(&x)+3)); |
|
|
810 |
.................... rotate_left(&data1,1); |
|
|
811 |
.................... data2 = *(((unsigned int8 *)(&x)+2)); |
|
|
812 |
.................... if(bit_test (data2,7)) |
|
|
813 |
.................... bit_set(data1,0); |
|
|
814 |
.................... n = data1 - 0x7E; |
|
|
815 |
.................... #endif |
|
|
816 |
.................... |
|
|
817 |
.................... if (n<0) |
|
|
818 |
.................... r = -(float32)-n; |
|
|
819 |
.................... else |
|
|
820 |
.................... r = (float32)n; |
|
|
821 |
.................... |
|
|
822 |
.................... res += r*LN2; |
|
|
823 |
.................... } |
|
|
824 |
.................... |
|
|
825 |
.................... else |
|
|
826 |
.................... res = 0.0; |
|
|
827 |
.................... |
|
|
828 |
.................... return(res); |
|
|
829 |
.................... } |
|
|
830 |
.................... |
|
|
831 |
.................... //Overloaded function for log() for PCD |
|
|
832 |
.................... // Overloaded function log() for data type - Float48 |
|
|
833 |
.................... #if defined(__PCD__) |
|
|
834 |
.................... float48 log(float48 x) |
|
|
835 |
.................... { |
|
|
836 |
.................... float48 y, res, r, y2; |
|
|
837 |
.................... unsigned int8 data1,data2; |
|
|
838 |
.................... signed int8 n; |
|
|
839 |
.................... #ifdef _ERRNO |
|
|
840 |
.................... if(x <0) |
|
|
841 |
.................... { |
|
|
842 |
.................... errno=EDOM; |
|
|
843 |
.................... } |
|
|
844 |
.................... if(x ==0) |
|
|
845 |
.................... { |
|
|
846 |
.................... errno=ERANGE; |
|
|
847 |
.................... return(0); |
|
|
848 |
.................... } |
|
|
849 |
.................... #endif |
|
|
850 |
.................... y = x; |
|
|
851 |
.................... |
|
|
852 |
.................... if (y != 1.0) |
|
|
853 |
.................... { |
|
|
854 |
.................... |
|
|
855 |
.................... #if !defined(__PCD__) |
|
|
856 |
.................... *((unsigned int8 *)(&y)) = 0x7E; |
|
|
857 |
.................... #endif |
|
|
858 |
.................... data2 = *(((unsigned int8 *)(&y))+5); |
|
|
859 |
.................... *(((unsigned int8 *)(&y))+5) = 0x3F; |
|
|
860 |
.................... data1 = *(((unsigned int8 *)(&y))+4); |
|
|
861 |
.................... bit_clear(data1,7); |
|
|
862 |
.................... *(((unsigned int8 *)(&y))+4) = data1; |
|
|
863 |
.................... |
|
|
864 |
.................... if(bit_test(data2,7)) |
|
|
865 |
.................... bit_set(*(((unsigned int8 *)(&y))+4),7); |
|
|
866 |
.................... y = (y - 1.0)/(y + 1.0); |
|
|
867 |
.................... |
|
|
868 |
.................... y2=y*y; |
|
|
869 |
.................... |
|
|
870 |
.................... res = pl[0]*y2 + pl[1]; |
|
|
871 |
.................... res = res*y2 + pl[2]; |
|
|
872 |
.................... res = res*y2 + pl[3]; |
|
|
873 |
.................... |
|
|
874 |
.................... r = ql[0]*y2 + ql[1]; |
|
|
875 |
.................... r = r*y2 + ql[2]; |
|
|
876 |
.................... r = r*y2 + ql[3]; |
|
|
877 |
.................... |
|
|
878 |
.................... res = y*res/r; |
|
|
879 |
.................... |
|
|
880 |
.................... data1 = *(((unsigned int8 *)(&x)+5)); |
|
|
881 |
.................... rotate_left(&data1,1); |
|
|
882 |
.................... data2 = *(((unsigned int8 *)(&x)+4)); |
|
|
883 |
.................... if(bit_test (data2,7)) |
|
|
884 |
.................... bit_set(data1,0); |
|
|
885 |
.................... |
|
|
886 |
.................... n = data1 - 0x7E; |
|
|
887 |
.................... |
|
|
888 |
.................... if (n<0) |
|
|
889 |
.................... r = -(float48)-n; |
|
|
890 |
.................... else |
|
|
891 |
.................... r = (float48)n; |
|
|
892 |
.................... |
|
|
893 |
.................... res += r*LN2; |
|
|
894 |
.................... } |
|
|
895 |
.................... |
|
|
896 |
.................... else |
|
|
897 |
.................... res = 0.0; |
|
|
898 |
.................... |
|
|
899 |
.................... return(res); |
|
|
900 |
.................... } |
|
|
901 |
.................... |
|
|
902 |
.................... // Overloaded function log() for data type - Float48 |
|
|
903 |
.................... #if defined(__PCD__) |
|
|
904 |
.................... float32 const pl_64[4] = {0.45145214, -9.0558803, 26.940971, -19.860189}; |
|
|
905 |
.................... float32 const ql_64[4] = {1.0000000, -8.1354259, 16.780517, -9.9300943}; |
|
|
906 |
.................... #endif |
|
|
907 |
.................... float64 log(float64 x) |
|
|
908 |
.................... { |
|
|
909 |
.................... float64 y, res, r, y2; |
|
|
910 |
.................... unsigned int16 data1,data2; |
|
|
911 |
.................... unsigned int16 *p; |
|
|
912 |
.................... signed int16 n; |
|
|
913 |
.................... #ifdef _ERRNO |
|
|
914 |
.................... if(x <0) |
|
|
915 |
.................... { |
|
|
916 |
.................... errno=EDOM; |
|
|
917 |
.................... } |
|
|
918 |
.................... if(x ==0) |
|
|
919 |
.................... { |
|
|
920 |
.................... errno=ERANGE; |
|
|
921 |
.................... return(0); |
|
|
922 |
.................... } |
|
|
923 |
.................... #endif |
|
|
924 |
.................... y = x; |
|
|
925 |
.................... |
|
|
926 |
.................... if (y != 1.0) |
|
|
927 |
.................... { |
|
|
928 |
.................... #if !defined(__PCD__) |
|
|
929 |
.................... *((unsigned int8 *)(&y)) = 0x7E; |
|
|
930 |
.................... #endif |
|
|
931 |
.................... p= (((unsigned int16 *)(&y))+3); |
|
|
932 |
.................... data1 = *p; |
|
|
933 |
.................... data2 = *p; |
|
|
934 |
.................... data1 = 0x3FE; |
|
|
935 |
.................... data1 = data1 <<4; |
|
|
936 |
.................... if(bit_test (data2,15)) |
|
|
937 |
.................... bit_set(data1,15); |
|
|
938 |
.................... data2 = data2 & 0x000F; |
|
|
939 |
.................... data1 ^=data2; |
|
|
940 |
.................... |
|
|
941 |
.................... *p = data1; |
|
|
942 |
.................... |
|
|
943 |
.................... y = (y - 1.0)/(y + 1.0); |
|
|
944 |
.................... |
|
|
945 |
.................... y2=y*y; |
|
|
946 |
.................... |
|
|
947 |
.................... res = pl_64[0]*y2 + pl_64[1]; |
|
|
948 |
.................... res = res*y2 + pl_64[2]; |
|
|
949 |
.................... res = res*y2 + pl_64[3]; |
|
|
950 |
.................... |
|
|
951 |
.................... r = ql_64[0]*y2 + ql_64[1]; |
|
|
952 |
.................... r = r*y2 + ql_64[2]; |
|
|
953 |
.................... r = r*y2 + ql_64[3]; |
|
|
954 |
.................... |
|
|
955 |
.................... res = y*res/r; |
|
|
956 |
.................... |
|
|
957 |
.................... p= (((unsigned int16 *)(&x))+3); |
|
|
958 |
.................... data1 = *p; |
|
|
959 |
.................... bit_clear(data1,15); |
|
|
960 |
.................... data1 = data1 >>4; |
|
|
961 |
.................... n = data1 - 0x3FE; |
|
|
962 |
.................... |
|
|
963 |
.................... |
|
|
964 |
.................... if (n<0) |
|
|
965 |
.................... r = -(float64)-n; |
|
|
966 |
.................... else |
|
|
967 |
.................... r = (float64)n; |
|
|
968 |
.................... |
|
|
969 |
.................... res += r*LN2; |
|
|
970 |
.................... } |
|
|
971 |
.................... |
|
|
972 |
.................... else |
|
|
973 |
.................... res = 0.0; |
|
|
974 |
.................... |
|
|
975 |
.................... return(res); |
|
|
976 |
.................... } |
|
|
977 |
.................... #endif |
|
|
978 |
.................... |
|
|
979 |
.................... |
|
|
980 |
.................... #define LN10 2.3025850929940456 |
|
|
981 |
.................... |
|
|
982 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
983 |
.................... // float log10(float x) |
|
|
984 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
985 |
.................... // Description : returns the the log base 10 of x |
|
|
986 |
.................... // Date : N/A |
|
|
987 |
.................... // |
|
|
988 |
.................... float32 log10(float32 x) |
|
|
989 |
.................... { |
|
|
990 |
.................... float32 r; |
|
|
991 |
.................... |
|
|
992 |
.................... r = log(x); |
|
|
993 |
.................... r = r/LN10; |
|
|
994 |
.................... return(r); |
|
|
995 |
.................... } |
|
|
996 |
.................... |
|
|
997 |
.................... //Overloaded functions for log10() for PCD |
|
|
998 |
.................... // Overloaded function log10() for data type - Float48 |
|
|
999 |
.................... #if defined(__PCD__) |
|
|
1000 |
.................... float48 log10(float48 x) |
|
|
1001 |
.................... { |
|
|
1002 |
.................... float48 r; |
|
|
1003 |
.................... |
|
|
1004 |
.................... r = log(x); |
|
|
1005 |
.................... r = r/LN10; |
|
|
1006 |
.................... return(r); |
|
|
1007 |
.................... } |
|
|
1008 |
.................... |
|
|
1009 |
.................... // Overloaded function log10() for data type - Float64 |
|
|
1010 |
.................... float64 log10(float64 x) |
|
|
1011 |
.................... { |
|
|
1012 |
.................... float64 r; |
|
|
1013 |
.................... |
|
|
1014 |
.................... r = log(x); |
|
|
1015 |
.................... r = r/LN10; |
|
|
1016 |
.................... return(r); |
|
|
1017 |
.................... } |
|
|
1018 |
.................... #endif |
|
|
1019 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1020 |
.................... // float modf(float x) |
|
|
1021 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1022 |
.................... // Description :breaks the argument value int integral and fractional parts, |
|
|
1023 |
.................... // ach of which have the same sign as the argument. It stores the integral part |
|
|
1024 |
.................... // as a float in the object pointed to by the iptr |
|
|
1025 |
.................... // Returns : returns the signed fractional part of value. |
|
|
1026 |
.................... // Date : N/A |
|
|
1027 |
.................... // |
|
|
1028 |
.................... |
|
|
1029 |
.................... float32 modf(float32 value,float32 *iptr) |
|
|
1030 |
.................... { |
|
|
1031 |
.................... *iptr=(value < 0.0)? ceil(value): floor(value); |
|
|
1032 |
.................... return(value - *iptr); |
|
|
1033 |
.................... } |
|
|
1034 |
.................... //Overloaded functions for modf() for PCD |
|
|
1035 |
.................... // Overloaded function modf() for data type - Float48 |
|
|
1036 |
.................... #if defined(__PCD__) |
|
|
1037 |
.................... float48 modf(float48 value,float48 *iptr) |
|
|
1038 |
.................... { |
|
|
1039 |
.................... *iptr=(value < 0.0)? ceil(value): floor(value); |
|
|
1040 |
.................... return(value - *iptr); |
|
|
1041 |
.................... } |
|
|
1042 |
.................... // Overloaded function modf() for data type - Float64 |
|
|
1043 |
.................... float64 modf(float64 value,float64 *iptr) |
|
|
1044 |
.................... { |
|
|
1045 |
.................... *iptr=(value < 0.0)? ceil(value): floor(value); |
|
|
1046 |
.................... return(value - *iptr); |
|
|
1047 |
.................... } |
|
|
1048 |
.................... #endif |
|
|
1049 |
.................... |
|
|
1050 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1051 |
.................... // float pwr(float x,float y) |
|
|
1052 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1053 |
.................... // Description : returns the value (x^y) |
|
|
1054 |
.................... // Date : N/A |
|
|
1055 |
.................... // Note : 0 is returned when the function will generate an imaginary number |
|
|
1056 |
.................... // |
|
|
1057 |
.................... float32 pwr(float32 x,float32 y) |
|
|
1058 |
.................... { |
|
|
1059 |
.................... if(0 > x && fmod(y, 1) == 0) { |
|
|
1060 |
.................... if(fmod(y, 2) == 0) { |
|
|
1061 |
.................... return (exp(log(-x) * y)); |
|
|
1062 |
.................... } else { |
|
|
1063 |
.................... return (-exp(log(-x) * y)); |
|
|
1064 |
.................... } |
|
|
1065 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
|
|
1066 |
.................... return 0; |
|
|
1067 |
.................... } else { |
|
|
1068 |
.................... if(x != 0 || 0 >= y) { |
|
|
1069 |
.................... return (exp(log(x) * y)); |
|
|
1070 |
.................... } |
|
|
1071 |
.................... } |
|
|
1072 |
.................... } |
|
|
1073 |
.................... //Overloaded functions for pwr() for PCD |
|
|
1074 |
.................... // Overloaded function pwr() for data type - Float48 |
|
|
1075 |
.................... #if defined(__PCD__) |
|
|
1076 |
.................... float48 pwr(float48 x,float48 y) |
|
|
1077 |
.................... { |
|
|
1078 |
.................... if(0 > x && fmod(y, 1) == 0) { |
|
|
1079 |
.................... if(fmod(y, 2) == 0) { |
|
|
1080 |
.................... return (exp(log(-x) * y)); |
|
|
1081 |
.................... } else { |
|
|
1082 |
.................... return (-exp(log(-x) * y)); |
|
|
1083 |
.................... } |
|
|
1084 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
|
|
1085 |
.................... return 0; |
|
|
1086 |
.................... } else { |
|
|
1087 |
.................... if(x != 0 || 0 >= y) { |
|
|
1088 |
.................... return (exp(log(x) * y)); |
|
|
1089 |
.................... } |
|
|
1090 |
.................... } |
|
|
1091 |
.................... } |
|
|
1092 |
.................... // Overloaded function pwr() for data type - Float64 |
|
|
1093 |
.................... float64 pwr(float64 x,float64 y) |
|
|
1094 |
.................... { |
|
|
1095 |
.................... if(0 > x && fmod(y, 1) == 0) { |
|
|
1096 |
.................... if(fmod(y, 2) == 0) { |
|
|
1097 |
.................... return (exp(log(-x) * y)); |
|
|
1098 |
.................... } else { |
|
|
1099 |
.................... return (-exp(log(-x) * y)); |
|
|
1100 |
.................... } |
|
|
1101 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
|
|
1102 |
.................... return 0; |
|
|
1103 |
.................... } else { |
|
|
1104 |
.................... if(x != 0 || 0 >= y) { |
|
|
1105 |
.................... return (exp(log(x) * y)); |
|
|
1106 |
.................... } |
|
|
1107 |
.................... } |
|
|
1108 |
.................... } |
|
|
1109 |
.................... #endif |
|
|
1110 |
.................... |
|
|
1111 |
.................... //////////////////// Power functions //////////////////// |
|
|
1112 |
.................... |
|
|
1113 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1114 |
.................... // float pow(float x,float y) |
|
|
1115 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1116 |
.................... // Description : returns the value (x^y) |
|
|
1117 |
.................... // Date : N/A |
|
|
1118 |
.................... // Note : 0 is returned when the function will generate an imaginary number |
|
|
1119 |
.................... // |
|
|
1120 |
.................... float32 pow(float32 x,float32 y) |
|
|
1121 |
.................... { |
|
|
1122 |
.................... if(0 > x && fmod(y, 1) == 0) { |
|
|
1123 |
.................... if(fmod(y, 2) == 0) { |
|
|
1124 |
.................... return (exp(log(-x) * y)); |
|
|
1125 |
.................... } else { |
|
|
1126 |
.................... return (-exp(log(-x) * y)); |
|
|
1127 |
.................... } |
|
|
1128 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
|
|
1129 |
.................... return 0; |
|
|
1130 |
.................... } else { |
|
|
1131 |
.................... if(x != 0 || 0 >= y) { |
|
|
1132 |
.................... return (exp(log(x) * y)); |
|
|
1133 |
.................... } |
|
|
1134 |
.................... } |
|
|
1135 |
.................... } |
|
|
1136 |
.................... //Overloaded functions for pow() for PCD |
|
|
1137 |
.................... // Overloaded function for pow() data type - Float48 |
|
|
1138 |
.................... #if defined(__PCD__) |
|
|
1139 |
.................... float48 pow(float48 x,float48 y) |
|
|
1140 |
.................... { |
|
|
1141 |
.................... if(0 > x && fmod(y, 1) == 0) { |
|
|
1142 |
.................... if(fmod(y, 2) == 0) { |
|
|
1143 |
.................... return (exp(log(-x) * y)); |
|
|
1144 |
.................... } else { |
|
|
1145 |
.................... return (-exp(log(-x) * y)); |
|
|
1146 |
.................... } |
|
|
1147 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
|
|
1148 |
.................... return 0; |
|
|
1149 |
.................... } else { |
|
|
1150 |
.................... if(x != 0 || 0 >= y) { |
|
|
1151 |
.................... return (exp(log(x) * y)); |
|
|
1152 |
.................... } |
|
|
1153 |
.................... } |
|
|
1154 |
.................... } |
|
|
1155 |
.................... |
|
|
1156 |
.................... // Overloaded function pow() for data type - Float64 |
|
|
1157 |
.................... float64 pow(float64 x,float64 y) |
|
|
1158 |
.................... { |
|
|
1159 |
.................... if(0 > x && fmod(y, 1) == 0) { |
|
|
1160 |
.................... if(fmod(y, 2) == 0) { |
|
|
1161 |
.................... return (exp(log(-x) * y)); |
|
|
1162 |
.................... } else { |
|
|
1163 |
.................... return (-exp(log(-x) * y)); |
|
|
1164 |
.................... } |
|
|
1165 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
|
|
1166 |
.................... return 0; |
|
|
1167 |
.................... } else { |
|
|
1168 |
.................... if(x != 0 || 0 >= y) { |
|
|
1169 |
.................... return (exp(log(x) * y)); |
|
|
1170 |
.................... } |
|
|
1171 |
.................... } |
|
|
1172 |
.................... } |
|
|
1173 |
.................... #endif |
|
|
1174 |
.................... |
|
|
1175 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1176 |
.................... // float sqrt(float x) |
|
|
1177 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1178 |
.................... // Description : returns the square root of x |
|
|
1179 |
.................... // Date : N/A |
|
|
1180 |
.................... // |
|
|
1181 |
.................... float32 sqrt(float32 x) |
|
|
1182 |
.................... { |
|
|
1183 |
.................... float32 y, res; |
|
|
1184 |
.................... #if defined(__PCD__) |
|
|
1185 |
.................... unsigned int16 data1,data2; |
|
|
1186 |
.................... #endif |
|
|
1187 |
.................... BYTE *p; |
|
|
1188 |
.................... |
|
|
1189 |
.................... #ifdef _ERRNO |
|
|
1190 |
.................... if(x < 0) |
|
|
1191 |
.................... { |
|
|
1192 |
.................... errno=EDOM; |
|
|
1193 |
.................... } |
|
|
1194 |
.................... #endif |
|
|
1195 |
.................... |
|
|
1196 |
.................... if( x<=0.0) |
|
|
1197 |
.................... return(0.0); |
|
|
1198 |
.................... |
|
|
1199 |
.................... y=x; |
|
|
1200 |
.................... |
|
|
1201 |
.................... #if !defined(__PCD__) |
|
|
1202 |
.................... p=&y; |
|
|
1203 |
.................... (*p)=(BYTE)((((unsigned int16)(*p)) + 127) >> 1); |
|
|
1204 |
.................... #endif |
|
|
1205 |
.................... |
|
|
1206 |
.................... #if defined(__PCD__) |
|
|
1207 |
.................... p = (((unsigned int8 *)(&y))+3); |
|
|
1208 |
.................... data1 = *(((unsigned int8 *)(&y))+3); |
|
|
1209 |
.................... data2 = *(((unsigned int8 *)(&y))+2); |
|
|
1210 |
.................... rotate_left(&data1,1); |
|
|
1211 |
.................... if(bit_test(data2,7)) |
|
|
1212 |
.................... bit_set(data1,0); |
|
|
1213 |
.................... data1 = ((data1+127) >>1); |
|
|
1214 |
.................... bit_clear(data2,7); |
|
|
1215 |
.................... if(bit_test(data1,0)) |
|
|
1216 |
.................... bit_set(data2,7); |
|
|
1217 |
.................... data1 = data1 >>1; |
|
|
1218 |
.................... *(((unsigned int8 *)(&y))+3) = data1; |
|
|
1219 |
.................... *(((unsigned int8 *)(&y))+2) = data2; |
|
|
1220 |
.................... |
|
|
1221 |
.................... #endif |
|
|
1222 |
.................... |
|
|
1223 |
.................... do { |
|
|
1224 |
.................... res=y; |
|
|
1225 |
.................... y+=(x/y); |
|
|
1226 |
.................... |
|
|
1227 |
.................... #if !defined(__PCD__) |
|
|
1228 |
.................... (*p)--; |
|
|
1229 |
.................... #endif |
|
|
1230 |
.................... |
|
|
1231 |
.................... #if defined(__PCD__) |
|
|
1232 |
.................... data1 = *(((unsigned int8 *)(&y))+3); |
|
|
1233 |
.................... data2 = *(((unsigned int8 *)(&y))+2); |
|
|
1234 |
.................... rotate_left(&data1,1); |
|
|
1235 |
.................... if(bit_test(data2,7)) |
|
|
1236 |
.................... bit_set(data1,0); |
|
|
1237 |
.................... data1--; |
|
|
1238 |
.................... bit_clear(data2,7); |
|
|
1239 |
.................... if(bit_test(data1,0)) |
|
|
1240 |
.................... bit_set(data2,7); |
|
|
1241 |
.................... data1 = data1 >>1; |
|
|
1242 |
.................... *(((unsigned int8 *)(&y))+3) = data1; |
|
|
1243 |
.................... *(((unsigned int8 *)(&y))+2) = data2; |
|
|
1244 |
.................... |
|
|
1245 |
.................... #endif |
|
|
1246 |
.................... } while(res != y); |
|
|
1247 |
.................... |
|
|
1248 |
.................... return(res); |
|
|
1249 |
.................... } |
|
|
1250 |
.................... //Overloaded functions for sqrt() for PCD |
|
|
1251 |
.................... // Overloaded function sqrt() for data type - Float48 |
|
|
1252 |
.................... #if defined(__PCD__) |
|
|
1253 |
.................... float48 sqrt(float48 x) |
|
|
1254 |
.................... { |
|
|
1255 |
.................... float48 y, res; |
|
|
1256 |
.................... unsigned int16 data1,data2; |
|
|
1257 |
.................... BYTE *p; |
|
|
1258 |
.................... |
|
|
1259 |
.................... #ifdef _ERRNO |
|
|
1260 |
.................... if(x < 0) |
|
|
1261 |
.................... { |
|
|
1262 |
.................... errno=EDOM; |
|
|
1263 |
.................... } |
|
|
1264 |
.................... #endif |
|
|
1265 |
.................... |
|
|
1266 |
.................... if( x<=0.0) |
|
|
1267 |
.................... return(0.0); |
|
|
1268 |
.................... |
|
|
1269 |
.................... y=x; |
|
|
1270 |
.................... |
|
|
1271 |
.................... #if !defined(__PCD__) |
|
|
1272 |
.................... p=&y; |
|
|
1273 |
.................... (*p)=(BYTE)((((unsigned int16)(*p)) + 127) >> 1); |
|
|
1274 |
.................... #endif |
|
|
1275 |
.................... |
|
|
1276 |
.................... #if defined(__PCD__) |
|
|
1277 |
.................... p = (((unsigned int8 *)(&y))+5); |
|
|
1278 |
.................... data1 = *(((unsigned int8 *)(&y))+5); |
|
|
1279 |
.................... data2 = *(((unsigned int8 *)(&y))+4); |
|
|
1280 |
.................... rotate_left(&data1,1); |
|
|
1281 |
.................... if(bit_test(data2,7)) |
|
|
1282 |
.................... bit_set(data1,0); |
|
|
1283 |
.................... data1 = ((data1+127) >>1); |
|
|
1284 |
.................... bit_clear(data2,7); |
|
|
1285 |
.................... if(bit_test(data1,0)) |
|
|
1286 |
.................... bit_set(data2,7); |
|
|
1287 |
.................... data1 = data1 >>1; |
|
|
1288 |
.................... *(((unsigned int8 *)(&y))+5) = data1; |
|
|
1289 |
.................... *(((unsigned int8 *)(&y))+4) = data2; |
|
|
1290 |
.................... |
|
|
1291 |
.................... #endif |
|
|
1292 |
.................... |
|
|
1293 |
.................... do { |
|
|
1294 |
.................... res=y; |
|
|
1295 |
.................... y+=(x/y); |
|
|
1296 |
.................... |
|
|
1297 |
.................... #if !defined(__PCD__) |
|
|
1298 |
.................... (*p)--; |
|
|
1299 |
.................... #endif |
|
|
1300 |
.................... |
|
|
1301 |
.................... data1 = *(((unsigned int8 *)(&y))+5); |
|
|
1302 |
.................... data2 = *(((unsigned int8 *)(&y))+4); |
|
|
1303 |
.................... rotate_left(&data1,1); |
|
|
1304 |
.................... if(bit_test(data2,7)) |
|
|
1305 |
.................... bit_set(data1,0); |
|
|
1306 |
.................... data1--; |
|
|
1307 |
.................... bit_clear(data2,7); |
|
|
1308 |
.................... if(bit_test(data1,0)) |
|
|
1309 |
.................... bit_set(data2,7); |
|
|
1310 |
.................... data1 = data1 >>1; |
|
|
1311 |
.................... *(((unsigned int8 *)(&y))+5) = data1; |
|
|
1312 |
.................... *(((unsigned int8 *)(&y))+4) = data2; |
|
|
1313 |
.................... |
|
|
1314 |
.................... } while(res != y); |
|
|
1315 |
.................... |
|
|
1316 |
.................... return(res); |
|
|
1317 |
.................... } |
|
|
1318 |
.................... |
|
|
1319 |
.................... // Overloaded function sqrt() for data type - Float64 |
|
|
1320 |
.................... float64 sqrt(float64 x) |
|
|
1321 |
.................... { |
|
|
1322 |
.................... float64 y, res; |
|
|
1323 |
.................... unsigned int16 *p; |
|
|
1324 |
.................... unsigned int16 temp1,temp2; |
|
|
1325 |
.................... |
|
|
1326 |
.................... #ifdef _ERRNO |
|
|
1327 |
.................... if(x < 0) |
|
|
1328 |
.................... { |
|
|
1329 |
.................... errno=EDOM; |
|
|
1330 |
.................... } |
|
|
1331 |
.................... #endif |
|
|
1332 |
.................... |
|
|
1333 |
.................... if( x<=0.0) |
|
|
1334 |
.................... return(0.0); |
|
|
1335 |
.................... |
|
|
1336 |
.................... y=x; |
|
|
1337 |
.................... p= (((unsigned int16 *)(&y))+3); |
|
|
1338 |
.................... temp1 = *p; |
|
|
1339 |
.................... temp2 = *p; |
|
|
1340 |
.................... bit_clear(temp1,15); |
|
|
1341 |
.................... temp1 = (temp1>>4)+1023; |
|
|
1342 |
.................... temp1 = temp1 >> 1; |
|
|
1343 |
.................... temp1 = (temp1<<4) & 0xFFF0; |
|
|
1344 |
.................... if(bit_test(temp2,15)) |
|
|
1345 |
.................... bit_set(temp1,15); |
|
|
1346 |
.................... temp2 = temp2 & 0x000F; |
|
|
1347 |
.................... temp1 ^= temp2; |
|
|
1348 |
.................... |
|
|
1349 |
.................... (*p) = temp1; |
|
|
1350 |
.................... |
|
|
1351 |
.................... do { |
|
|
1352 |
.................... res=y; |
|
|
1353 |
.................... y+=(x/y); |
|
|
1354 |
.................... temp1 = *p; |
|
|
1355 |
.................... temp2 = *p; |
|
|
1356 |
.................... bit_clear(temp1,15); |
|
|
1357 |
.................... temp1 = (temp1>>4); |
|
|
1358 |
.................... temp1--; |
|
|
1359 |
.................... temp1 = (temp1<<4) & 0xFFF0; |
|
|
1360 |
.................... if(bit_test(temp2,15)) |
|
|
1361 |
.................... bit_set(temp1,15); |
|
|
1362 |
.................... temp2 = temp2 & 0x000F; |
|
|
1363 |
.................... temp1 ^= temp2; |
|
|
1364 |
.................... (*p) = temp1; |
|
|
1365 |
.................... |
|
|
1366 |
.................... } while(res != y); |
|
|
1367 |
.................... |
|
|
1368 |
.................... return(res); |
|
|
1369 |
.................... } |
|
|
1370 |
.................... #endif |
|
|
1371 |
.................... |
|
|
1372 |
.................... ////////////////////////////// Trig Functions ////////////////////////////// |
|
|
1373 |
.................... #ifdef PI_DIV_BY_TWO |
|
|
1374 |
.................... #undef PI_DIV_BY_TWO |
|
|
1375 |
.................... #endif |
|
|
1376 |
.................... #define PI_DIV_BY_TWO 1.5707963267948966 |
|
|
1377 |
.................... #ifdef TWOBYPI |
|
|
1378 |
.................... #undef TWOBYPI |
|
|
1379 |
.................... #define TWOBYPI 0.6366197723675813 |
|
|
1380 |
.................... #endif |
|
|
1381 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1382 |
.................... // float cos(float x) |
|
|
1383 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1384 |
.................... // Description : returns the cosine value of the angle x, which is in radian |
|
|
1385 |
.................... // Date : 9/20/2001 |
|
|
1386 |
.................... // |
|
|
1387 |
.................... float32 cos(float32 x) |
|
|
1388 |
.................... { |
|
|
1389 |
.................... float32 y, t, t2 = 1.0; |
|
|
1390 |
.................... unsigned int8 quad, i; |
|
|
1391 |
.................... float32 frac; |
|
|
1392 |
.................... float32 p[6] = { //by the series definition for cosine |
|
|
1393 |
.................... -0.5, // sum ( ( (-1)^n * x^2n )/(2n)! ) |
|
|
1394 |
.................... 0.04166666666667, |
|
|
1395 |
.................... -0.00138888888889, |
|
|
1396 |
.................... 0.00002480158730, |
|
|
1397 |
.................... -0.00000027557319, |
|
|
1398 |
.................... 0.00000000208767, |
|
|
1399 |
.................... //-0.00000000001147, |
|
|
1400 |
.................... // 0.00000000000005 |
|
|
1401 |
.................... }; |
|
|
1402 |
.................... |
|
|
1403 |
.................... if (x < 0) x = -x; // absolute value of input |
|
|
1404 |
.................... |
|
|
1405 |
.................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant |
|
|
1406 |
.................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input |
|
|
1407 |
.................... quad = quad % 4; // quadrant (0 to 3) |
|
|
1408 |
.................... |
|
|
1409 |
.................... if (quad == 0 || quad == 2) |
|
|
1410 |
.................... t = frac * PI_DIV_BY_TWO; |
|
|
1411 |
.................... else if (quad == 1) |
|
|
1412 |
.................... t = (1-frac) * PI_DIV_BY_TWO; |
|
|
1413 |
.................... else // should be 3 |
|
|
1414 |
.................... t = (frac-1) * PI_DIV_BY_TWO; |
|
|
1415 |
.................... |
|
|
1416 |
.................... y = 1.0; |
|
|
1417 |
.................... t = t * t; |
|
|
1418 |
.................... for (i = 0; i <= 5; i++) |
|
|
1419 |
.................... { |
|
|
1420 |
.................... t2 = t2 * t; |
|
|
1421 |
.................... y = y + p[i] * t2; |
|
|
1422 |
.................... } |
|
|
1423 |
.................... |
|
|
1424 |
.................... if (quad == 2 || quad == 1) |
|
|
1425 |
.................... y = -y; // correct sign |
|
|
1426 |
.................... |
|
|
1427 |
.................... return (y); |
|
|
1428 |
.................... } |
|
|
1429 |
.................... |
|
|
1430 |
.................... |
|
|
1431 |
.................... //Overloaded functions for cos() for PCD |
|
|
1432 |
.................... // Overloaded function cos() for data type - Float48 |
|
|
1433 |
.................... #if defined(__PCD__) |
|
|
1434 |
.................... float48 cos(float48 x) |
|
|
1435 |
.................... { |
|
|
1436 |
.................... float48 y, t, t2 = 1.0; |
|
|
1437 |
.................... unsigned int8 quad, i; |
|
|
1438 |
.................... float48 frac; |
|
|
1439 |
.................... float48 p[6] = { //by the series definition for cosine |
|
|
1440 |
.................... -0.5, // sum ( ( (-1)^n * x^2n )/(2n)! ) |
|
|
1441 |
.................... 0.04166666666667, |
|
|
1442 |
.................... -0.00138888888889, |
|
|
1443 |
.................... 0.00002480158730, |
|
|
1444 |
.................... -0.00000027557319, |
|
|
1445 |
.................... 0.00000000208767, |
|
|
1446 |
.................... //-0.00000000001147, |
|
|
1447 |
.................... // 0.00000000000005 |
|
|
1448 |
.................... }; |
|
|
1449 |
.................... |
|
|
1450 |
.................... if (x < 0) x = -x; // absolute value of input |
|
|
1451 |
.................... |
|
|
1452 |
.................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant |
|
|
1453 |
.................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input |
|
|
1454 |
.................... quad = quad % 4; // quadrant (0 to 3) |
|
|
1455 |
.................... |
|
|
1456 |
.................... if (quad == 0 || quad == 2) |
|
|
1457 |
.................... t = frac * PI_DIV_BY_TWO; |
|
|
1458 |
.................... else if (quad == 1) |
|
|
1459 |
.................... t = (1-frac) * PI_DIV_BY_TWO; |
|
|
1460 |
.................... else // should be 3 |
|
|
1461 |
.................... t = (frac-1) * PI_DIV_BY_TWO; |
|
|
1462 |
.................... |
|
|
1463 |
.................... y = 0.999999999781; |
|
|
1464 |
.................... t = t * t; |
|
|
1465 |
.................... for (i = 0; i <= 5; i++) |
|
|
1466 |
.................... { |
|
|
1467 |
.................... t2 = t2 * t; |
|
|
1468 |
.................... y = y + p[i] * t2; |
|
|
1469 |
.................... } |
|
|
1470 |
.................... |
|
|
1471 |
.................... if (quad == 2 || quad == 1) |
|
|
1472 |
.................... y = -y; // correct sign |
|
|
1473 |
.................... |
|
|
1474 |
.................... return (y); |
|
|
1475 |
.................... } |
|
|
1476 |
.................... |
|
|
1477 |
.................... // Overloaded function cos() for data type - Float48 |
|
|
1478 |
.................... float64 cos(float64 x) |
|
|
1479 |
.................... { |
|
|
1480 |
.................... float64 y, t, t2 = 1.0; |
|
|
1481 |
.................... unsigned int8 quad, i; |
|
|
1482 |
.................... float64 frac; |
|
|
1483 |
.................... float64 p[6] = { //by the series definition for cosine |
|
|
1484 |
.................... -0.5, // sum ( ( (-1)^n * x^2n )/(2n)! ) |
|
|
1485 |
.................... 0.04166666666667, |
|
|
1486 |
.................... -0.00138888888889, |
|
|
1487 |
.................... 0.00002480158730, |
|
|
1488 |
.................... -0.00000027557319, |
|
|
1489 |
.................... 0.00000000208767, |
|
|
1490 |
.................... //-0.00000000001147, |
|
|
1491 |
.................... // 0.00000000000005 |
|
|
1492 |
.................... }; |
|
|
1493 |
.................... |
|
|
1494 |
.................... if (x < 0) x = -x; // absolute value of input |
|
|
1495 |
.................... |
|
|
1496 |
.................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant |
|
|
1497 |
.................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input |
|
|
1498 |
.................... quad = quad % 4; // quadrant (0 to 3) |
|
|
1499 |
.................... |
|
|
1500 |
.................... if (quad == 0 || quad == 2) |
|
|
1501 |
.................... t = frac * PI_DIV_BY_TWO; |
|
|
1502 |
.................... else if (quad == 1) |
|
|
1503 |
.................... t = (1-frac) * PI_DIV_BY_TWO; |
|
|
1504 |
.................... else // should be 3 |
|
|
1505 |
.................... t = (frac-1) * PI_DIV_BY_TWO; |
|
|
1506 |
.................... |
|
|
1507 |
.................... y = 0.999999999781; |
|
|
1508 |
.................... t = t * t; |
|
|
1509 |
.................... for (i = 0; i <= 5; i++) |
|
|
1510 |
.................... { |
|
|
1511 |
.................... t2 = t2 * t; |
|
|
1512 |
.................... y = y + p[i] * t2; |
|
|
1513 |
.................... } |
|
|
1514 |
.................... |
|
|
1515 |
.................... if (quad == 2 || quad == 1) |
|
|
1516 |
.................... y = -y; // correct sign |
|
|
1517 |
.................... |
|
|
1518 |
.................... return (y); |
|
|
1519 |
.................... } |
|
|
1520 |
.................... |
|
|
1521 |
.................... #endif |
|
|
1522 |
.................... |
|
|
1523 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1524 |
.................... // float sin(float x) |
|
|
1525 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1526 |
.................... // Description : returns the sine value of the angle x, which is in radian |
|
|
1527 |
.................... // Date : 9/20/2001 |
|
|
1528 |
.................... // |
|
|
1529 |
.................... float32 sin(float32 x) |
|
|
1530 |
.................... { |
|
|
1531 |
.................... return cos(x - PI_DIV_BY_TWO); |
|
|
1532 |
.................... } |
|
|
1533 |
.................... |
|
|
1534 |
.................... //Overloaded functions for sin() for PCD |
|
|
1535 |
.................... // Overloaded function sin() for data type - Float48 |
|
|
1536 |
.................... #if defined(__PCD__) |
|
|
1537 |
.................... float48 sin(float48 x) |
|
|
1538 |
.................... { |
|
|
1539 |
.................... return cos(x - PI_DIV_BY_TWO); |
|
|
1540 |
.................... } |
|
|
1541 |
.................... |
|
|
1542 |
.................... // Overloaded function sin() for data type - Float48 |
|
|
1543 |
.................... float64 sin(float64 x) |
|
|
1544 |
.................... { |
|
|
1545 |
.................... return cos(x - PI_DIV_BY_TWO); |
|
|
1546 |
.................... } |
|
|
1547 |
.................... #endif |
|
|
1548 |
.................... |
|
|
1549 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1550 |
.................... // float tan(float x) |
|
|
1551 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1552 |
.................... // Description : returns the tangent value of the angle x, which is in radian |
|
|
1553 |
.................... // Date : 9/20/2001 |
|
|
1554 |
.................... // |
|
|
1555 |
.................... float32 tan(float32 x) |
|
|
1556 |
.................... { |
|
|
1557 |
.................... float32 c, s; |
|
|
1558 |
.................... |
|
|
1559 |
.................... c = cos(x); |
|
|
1560 |
.................... if (c == 0.0) |
|
|
1561 |
.................... return (1.0e+36); |
|
|
1562 |
.................... |
|
|
1563 |
.................... s = sin(x); |
|
|
1564 |
.................... return(s/c); |
|
|
1565 |
.................... } |
|
|
1566 |
.................... //Overloaded functions for tan() for PCD |
|
|
1567 |
.................... // Overloaded function tan() for data type - Float48 |
|
|
1568 |
.................... #if defined(__PCD__) |
|
|
1569 |
.................... float48 tan(float48 x) |
|
|
1570 |
.................... { |
|
|
1571 |
.................... float48 c, s; |
|
|
1572 |
.................... |
|
|
1573 |
.................... c = cos(x); |
|
|
1574 |
.................... if (c == 0.0) |
|
|
1575 |
.................... return (1.0e+36); |
|
|
1576 |
.................... |
|
|
1577 |
.................... s = sin(x); |
|
|
1578 |
.................... return(s/c); |
|
|
1579 |
.................... } |
|
|
1580 |
.................... |
|
|
1581 |
.................... // Overloaded function tan() for data type - Float48 |
|
|
1582 |
.................... float64 tan(float64 x) |
|
|
1583 |
.................... { |
|
|
1584 |
.................... float64 c, s; |
|
|
1585 |
.................... |
|
|
1586 |
.................... c = cos(x); |
|
|
1587 |
.................... if (c == 0.0) |
|
|
1588 |
.................... return (1.0e+36); |
|
|
1589 |
.................... |
|
|
1590 |
.................... s = sin(x); |
|
|
1591 |
.................... return(s/c); |
|
|
1592 |
.................... } |
|
|
1593 |
.................... #endif |
|
|
1594 |
.................... |
|
|
1595 |
.................... float32 const pas[3] = {0.49559947, -4.6145309, 5.6036290}; |
|
|
1596 |
.................... float32 const qas[3] = {1.0000000, -5.5484666, 5.6036290}; |
|
|
1597 |
.................... |
|
|
1598 |
.................... float32 ASIN_COS(float32 x, unsigned int8 n) |
|
|
1599 |
.................... { |
|
|
1600 |
.................... float32 y, res, r, y2; |
|
|
1601 |
.................... int1 s; |
|
|
1602 |
.................... #ifdef _ERRNO |
|
|
1603 |
.................... if(x <-1 || x > 1) |
|
|
1604 |
.................... { |
|
|
1605 |
.................... errno=EDOM; |
|
|
1606 |
.................... } |
|
|
1607 |
.................... #endif |
|
|
1608 |
.................... s = 0; |
|
|
1609 |
.................... y = x; |
|
|
1610 |
.................... |
|
|
1611 |
.................... if (x < 0) |
|
|
1612 |
.................... { |
|
|
1613 |
.................... s = 1; |
|
|
1614 |
.................... y = -y; |
|
|
1615 |
.................... } |
|
|
1616 |
.................... |
|
|
1617 |
.................... if (y > 0.5) |
|
|
1618 |
.................... { |
|
|
1619 |
.................... y = sqrt((1.0 - y)/2.0); |
|
|
1620 |
.................... n += 2; |
|
|
1621 |
.................... } |
|
|
1622 |
.................... |
|
|
1623 |
.................... y2=y*y; |
|
|
1624 |
.................... |
|
|
1625 |
.................... res = pas[0]*y2 + pas[1]; |
|
|
1626 |
.................... res = res*y2 + pas[2]; |
|
|
1627 |
.................... |
|
|
1628 |
.................... r = qas[0]*y2 + qas[1]; |
|
|
1629 |
.................... r = r*y2 + qas[2]; |
|
|
1630 |
.................... |
|
|
1631 |
.................... res = y*res/r; |
|
|
1632 |
.................... |
|
|
1633 |
.................... if (n & 2) // |x| > 0.5 |
|
|
1634 |
.................... res = PI_DIV_BY_TWO - 2.0*res; |
|
|
1635 |
.................... if (s) |
|
|
1636 |
.................... res = -res; |
|
|
1637 |
.................... if (n & 1) // take arccos |
|
|
1638 |
.................... res = PI_DIV_BY_TWO - res; |
|
|
1639 |
.................... |
|
|
1640 |
.................... return(res); |
|
|
1641 |
.................... } |
|
|
1642 |
.................... |
|
|
1643 |
.................... //Overloaded functions for ASIN_COS() for PCD |
|
|
1644 |
.................... // Overloaded function ASIN_COS() for data type - Float48 |
|
|
1645 |
.................... #if defined(__PCD__) |
|
|
1646 |
.................... float48 ASIN_COS(float48 x, unsigned int8 n) |
|
|
1647 |
.................... { |
|
|
1648 |
.................... float48 y, res, r, y2; |
|
|
1649 |
.................... int1 s; |
|
|
1650 |
.................... #ifdef _ERRNO |
|
|
1651 |
.................... if(x <-1 || x > 1) |
|
|
1652 |
.................... { |
|
|
1653 |
.................... errno=EDOM; |
|
|
1654 |
.................... } |
|
|
1655 |
.................... #endif |
|
|
1656 |
.................... s = 0; |
|
|
1657 |
.................... y = x; |
|
|
1658 |
.................... |
|
|
1659 |
.................... if (x < 0) |
|
|
1660 |
.................... { |
|
|
1661 |
.................... s = 1; |
|
|
1662 |
.................... y = -y; |
|
|
1663 |
.................... } |
|
|
1664 |
.................... |
|
|
1665 |
.................... if (y > 0.5) |
|
|
1666 |
.................... { |
|
|
1667 |
.................... y = sqrt((1.0 - y)/2.0); |
|
|
1668 |
.................... n += 2; |
|
|
1669 |
.................... } |
|
|
1670 |
.................... |
|
|
1671 |
.................... y2=y*y; |
|
|
1672 |
.................... |
|
|
1673 |
.................... res = pas[0]*y2 + pas[1]; |
|
|
1674 |
.................... res = res*y2 + pas[2]; |
|
|
1675 |
.................... |
|
|
1676 |
.................... r = qas[0]*y2 + qas[1]; |
|
|
1677 |
.................... r = r*y2 + qas[2]; |
|
|
1678 |
.................... |
|
|
1679 |
.................... res = y*res/r; |
|
|
1680 |
.................... |
|
|
1681 |
.................... if (n & 2) // |x| > 0.5 |
|
|
1682 |
.................... res = PI_DIV_BY_TWO - 2.0*res; |
|
|
1683 |
.................... if (s) |
|
|
1684 |
.................... res = -res; |
|
|
1685 |
.................... if (n & 1) // take arccos |
|
|
1686 |
.................... res = PI_DIV_BY_TWO - res; |
|
|
1687 |
.................... |
|
|
1688 |
.................... return(res); |
|
|
1689 |
.................... } |
|
|
1690 |
.................... |
|
|
1691 |
.................... // Overloaded function ASIN_COS() for data type - Float64 |
|
|
1692 |
.................... float64 ASIN_COS(float64 x, unsigned int8 n) |
|
|
1693 |
.................... { |
|
|
1694 |
.................... float64 y, res, r, y2; |
|
|
1695 |
.................... int1 s; |
|
|
1696 |
.................... #ifdef _ERRNO |
|
|
1697 |
.................... if(x <-1 || x > 1) |
|
|
1698 |
.................... { |
|
|
1699 |
.................... errno=EDOM; |
|
|
1700 |
.................... } |
|
|
1701 |
.................... #endif |
|
|
1702 |
.................... s = 0; |
|
|
1703 |
.................... y = x; |
|
|
1704 |
.................... |
|
|
1705 |
.................... if (x < 0) |
|
|
1706 |
.................... { |
|
|
1707 |
.................... s = 1; |
|
|
1708 |
.................... y = -y; |
|
|
1709 |
.................... } |
|
|
1710 |
.................... |
|
|
1711 |
.................... if (y > 0.5) |
|
|
1712 |
.................... { |
|
|
1713 |
.................... y = sqrt((1.0 - y)/2.0); |
|
|
1714 |
.................... n += 2; |
|
|
1715 |
.................... } |
|
|
1716 |
.................... |
|
|
1717 |
.................... y2=y*y; |
|
|
1718 |
.................... |
|
|
1719 |
.................... res = pas[0]*y2 + pas[1]; |
|
|
1720 |
.................... res = res*y2 + pas[2]; |
|
|
1721 |
.................... |
|
|
1722 |
.................... r = qas[0]*y2 + qas[1]; |
|
|
1723 |
.................... r = r*y2 + qas[2]; |
|
|
1724 |
.................... |
|
|
1725 |
.................... res = y*res/r; |
|
|
1726 |
.................... |
|
|
1727 |
.................... if (n & 2) // |x| > 0.5 |
|
|
1728 |
.................... res = PI_DIV_BY_TWO - 2.0*res; |
|
|
1729 |
.................... if (s) |
|
|
1730 |
.................... res = -res; |
|
|
1731 |
.................... if (n & 1) // take arccos |
|
|
1732 |
.................... res = PI_DIV_BY_TWO - res; |
|
|
1733 |
.................... |
|
|
1734 |
.................... return(res); |
|
|
1735 |
.................... } |
|
|
1736 |
.................... #endif |
|
|
1737 |
.................... |
|
|
1738 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1739 |
.................... // float asin(float x) |
|
|
1740 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1741 |
.................... // Description : returns the arcsine value of the value x. |
|
|
1742 |
.................... // Date : N/A |
|
|
1743 |
.................... // |
|
|
1744 |
.................... float32 asin(float32 x) |
|
|
1745 |
.................... { |
|
|
1746 |
.................... float32 r; |
|
|
1747 |
.................... |
|
|
1748 |
.................... r = ASIN_COS(x, 0); |
|
|
1749 |
.................... return(r); |
|
|
1750 |
.................... } |
|
|
1751 |
.................... //Overloaded functions for asin() for PCD |
|
|
1752 |
.................... // Overloaded function asin() for data type - Float48 |
|
|
1753 |
.................... #if defined(__PCD__) |
|
|
1754 |
.................... float48 asin(float48 x) |
|
|
1755 |
.................... { |
|
|
1756 |
.................... float48 r; |
|
|
1757 |
.................... |
|
|
1758 |
.................... r = ASIN_COS(x, 0); |
|
|
1759 |
.................... return(r); |
|
|
1760 |
.................... } |
|
|
1761 |
.................... |
|
|
1762 |
.................... // Overloaded function asin() for data type - Float64 |
|
|
1763 |
.................... float64 asin(float64 x) |
|
|
1764 |
.................... { |
|
|
1765 |
.................... float64 r; |
|
|
1766 |
.................... |
|
|
1767 |
.................... r = ASIN_COS(x, 0); |
|
|
1768 |
.................... return(r); |
|
|
1769 |
.................... } |
|
|
1770 |
.................... #endif |
|
|
1771 |
.................... |
|
|
1772 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1773 |
.................... // float acos(float x) |
|
|
1774 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1775 |
.................... // Description : returns the arccosine value of the value x. |
|
|
1776 |
.................... // Date : N/A |
|
|
1777 |
.................... // |
|
|
1778 |
.................... float32 acos(float32 x) |
|
|
1779 |
.................... { |
|
|
1780 |
.................... float32 r; |
|
|
1781 |
.................... |
|
|
1782 |
.................... r = ASIN_COS(x, 1); |
|
|
1783 |
.................... return(r); |
|
|
1784 |
.................... } |
|
|
1785 |
.................... //Overloaded functions for acos() for PCD |
|
|
1786 |
.................... // Overloaded function acos() for data type - Float48 |
|
|
1787 |
.................... #if defined(__PCD__) |
|
|
1788 |
.................... float48 acos(float48 x) |
|
|
1789 |
.................... { |
|
|
1790 |
.................... float48 r; |
|
|
1791 |
.................... |
|
|
1792 |
.................... r = ASIN_COS(x, 1); |
|
|
1793 |
.................... return(r); |
|
|
1794 |
.................... } |
|
|
1795 |
.................... |
|
|
1796 |
.................... // Overloaded function acos() for data type - Float64 |
|
|
1797 |
.................... float64 acos(float64 x) |
|
|
1798 |
.................... { |
|
|
1799 |
.................... float64 r; |
|
|
1800 |
.................... |
|
|
1801 |
.................... r = ASIN_COS(x, 1); |
|
|
1802 |
.................... return(r); |
|
|
1803 |
.................... } |
|
|
1804 |
.................... #endif |
|
|
1805 |
.................... |
|
|
1806 |
.................... float32 const pat[4] = {0.17630401, 5.6710795, 22.376096, 19.818457}; |
|
|
1807 |
.................... float32 const qat[4] = {1.0000000, 11.368190, 28.982246, 19.818457}; |
|
|
1808 |
.................... |
|
|
1809 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1810 |
.................... // float atan(float x) |
|
|
1811 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1812 |
.................... // Description : returns the arctangent value of the value x. |
|
|
1813 |
.................... // Date : N/A |
|
|
1814 |
.................... // |
|
|
1815 |
.................... float32 atan(float32 x) |
|
|
1816 |
.................... { |
|
|
1817 |
.................... float32 y, res, r; |
|
|
1818 |
.................... int1 s, flag; |
|
|
1819 |
.................... |
|
|
1820 |
.................... s = 0; |
|
|
1821 |
* |
|
|
1822 |
0800: BCF 58.0 |
|
|
1823 |
.................... flag = 0; |
|
|
1824 |
0801: BCF 58.1 |
|
|
1825 |
.................... y = x; |
|
|
1826 |
0802: MOVF 4B,W |
|
|
1827 |
0803: MOVWF 4F |
|
|
1828 |
0804: MOVF 4A,W |
|
|
1829 |
0805: MOVWF 4E |
|
|
1830 |
0806: MOVF 49,W |
|
|
1831 |
0807: MOVWF 4D |
|
|
1832 |
0808: MOVF 48,W |
|
|
1833 |
0809: MOVWF 4C |
|
|
1834 |
.................... |
|
|
1835 |
.................... if (x < 0) |
|
|
1836 |
080A: MOVF 4B,W |
|
|
1837 |
080B: MOVWF 5C |
|
|
1838 |
080C: MOVF 4A,W |
|
|
1839 |
080D: MOVWF 5B |
|
|
1840 |
080E: MOVF 49,W |
|
|
1841 |
080F: MOVWF 5A |
|
|
1842 |
0810: MOVF 48,W |
|
|
1843 |
0811: MOVWF 59 |
|
|
1844 |
0812: CLRF 60 |
|
|
1845 |
0813: CLRF 5F |
|
|
1846 |
0814: CLRF 5E |
|
|
1847 |
0815: CLRF 5D |
|
|
1848 |
0816: BCF 0A.3 |
|
|
1849 |
0817: CALL 4CE |
|
|
1850 |
0818: BSF 0A.3 |
|
|
1851 |
0819: BTFSS 03.0 |
|
|
1852 |
081A: GOTO 01F |
|
|
1853 |
.................... { |
|
|
1854 |
.................... s = 1; |
|
|
1855 |
081B: BSF 58.0 |
|
|
1856 |
.................... y = -y; |
|
|
1857 |
081C: MOVF 4D,W |
|
|
1858 |
081D: XORLW 80 |
|
|
1859 |
081E: MOVWF 4D |
|
|
1860 |
.................... } |
|
|
1861 |
.................... |
|
|
1862 |
.................... if (y > 1.0) |
|
|
1863 |
081F: CLRF 5C |
|
|
1864 |
0820: CLRF 5B |
|
|
1865 |
0821: CLRF 5A |
|
|
1866 |
0822: MOVLW 7F |
|
|
1867 |
0823: MOVWF 59 |
|
|
1868 |
0824: MOVF 4F,W |
|
|
1869 |
0825: MOVWF 60 |
|
|
1870 |
0826: MOVF 4E,W |
|
|
1871 |
0827: MOVWF 5F |
|
|
1872 |
0828: MOVF 4D,W |
|
|
1873 |
0829: MOVWF 5E |
|
|
1874 |
082A: MOVF 4C,W |
|
|
1875 |
082B: MOVWF 5D |
|
|
1876 |
082C: BCF 0A.3 |
|
|
1877 |
082D: CALL 4CE |
|
|
1878 |
082E: BSF 0A.3 |
|
|
1879 |
082F: BTFSS 03.0 |
|
|
1880 |
0830: GOTO 04A |
|
|
1881 |
.................... { |
|
|
1882 |
.................... y = 1.0/y; |
|
|
1883 |
0831: CLRF 60 |
|
|
1884 |
0832: CLRF 5F |
|
|
1885 |
0833: CLRF 5E |
|
|
1886 |
0834: MOVLW 7F |
|
|
1887 |
0835: MOVWF 5D |
|
|
1888 |
0836: MOVF 4F,W |
|
|
1889 |
0837: MOVWF 64 |
|
|
1890 |
0838: MOVF 4E,W |
|
|
1891 |
0839: MOVWF 63 |
|
|
1892 |
083A: MOVF 4D,W |
|
|
1893 |
083B: MOVWF 62 |
|
|
1894 |
083C: MOVF 4C,W |
|
|
1895 |
083D: MOVWF 61 |
|
|
1896 |
083E: BCF 0A.3 |
|
|
1897 |
083F: CALL 404 |
|
|
1898 |
0840: BSF 0A.3 |
|
|
1899 |
0841: MOVF 7A,W |
|
|
1900 |
0842: MOVWF 4F |
|
|
1901 |
0843: MOVF 79,W |
|
|
1902 |
0844: MOVWF 4E |
|
|
1903 |
0845: MOVF 78,W |
|
|
1904 |
0846: MOVWF 4D |
|
|
1905 |
0847: MOVF 77,W |
|
|
1906 |
0848: MOVWF 4C |
|
|
1907 |
.................... flag = 1; |
|
|
1908 |
0849: BSF 58.1 |
|
|
1909 |
.................... } |
|
|
1910 |
.................... |
|
|
1911 |
.................... res = pat[0]*y*y + pat[1]; |
|
|
1912 |
084A: MOVLW 0A |
|
|
1913 |
084B: MOVWF 60 |
|
|
1914 |
084C: MOVLW 89 |
|
|
1915 |
084D: MOVWF 5F |
|
|
1916 |
084E: MOVLW 34 |
|
|
1917 |
084F: MOVWF 5E |
|
|
1918 |
0850: MOVLW 7C |
|
|
1919 |
0851: MOVWF 5D |
|
|
1920 |
0852: MOVF 4F,W |
|
|
1921 |
0853: MOVWF 64 |
|
|
1922 |
0854: MOVF 4E,W |
|
|
1923 |
0855: MOVWF 63 |
|
|
1924 |
0856: MOVF 4D,W |
|
|
1925 |
0857: MOVWF 62 |
|
|
1926 |
0858: MOVF 4C,W |
|
|
1927 |
0859: MOVWF 61 |
|
|
1928 |
085A: BCF 0A.3 |
|
|
1929 |
085B: CALL 50D |
|
|
1930 |
085C: BSF 0A.3 |
|
|
1931 |
085D: MOVF 77,W |
|
|
1932 |
085E: MOVWF 59 |
|
|
1933 |
085F: MOVF 78,W |
|
|
1934 |
0860: MOVWF 5A |
|
|
1935 |
0861: MOVF 79,W |
|
|
1936 |
0862: MOVWF 5B |
|
|
1937 |
0863: MOVF 7A,W |
|
|
1938 |
0864: MOVWF 5C |
|
|
1939 |
0865: MOVWF 60 |
|
|
1940 |
0866: MOVF 5B,W |
|
|
1941 |
0867: MOVWF 5F |
|
|
1942 |
0868: MOVF 5A,W |
|
|
1943 |
0869: MOVWF 5E |
|
|
1944 |
086A: MOVF 59,W |
|
|
1945 |
086B: MOVWF 5D |
|
|
1946 |
086C: MOVF 4F,W |
|
|
1947 |
086D: MOVWF 64 |
|
|
1948 |
086E: MOVF 4E,W |
|
|
1949 |
086F: MOVWF 63 |
|
|
1950 |
0870: MOVF 4D,W |
|
|
1951 |
0871: MOVWF 62 |
|
|
1952 |
0872: MOVF 4C,W |
|
|
1953 |
0873: MOVWF 61 |
|
|
1954 |
0874: BCF 0A.3 |
|
|
1955 |
0875: CALL 50D |
|
|
1956 |
0876: BSF 0A.3 |
|
|
1957 |
0877: MOVF 77,W |
|
|
1958 |
0878: MOVWF 59 |
|
|
1959 |
0879: MOVF 78,W |
|
|
1960 |
087A: MOVWF 5A |
|
|
1961 |
087B: MOVF 79,W |
|
|
1962 |
087C: MOVWF 5B |
|
|
1963 |
087D: MOVF 7A,W |
|
|
1964 |
087E: MOVWF 5C |
|
|
1965 |
087F: BCF 03.1 |
|
|
1966 |
0880: MOVF 5C,W |
|
|
1967 |
0881: MOVWF 60 |
|
|
1968 |
0882: MOVF 5B,W |
|
|
1969 |
0883: MOVWF 5F |
|
|
1970 |
0884: MOVF 5A,W |
|
|
1971 |
0885: MOVWF 5E |
|
|
1972 |
0886: MOVF 59,W |
|
|
1973 |
0887: MOVWF 5D |
|
|
1974 |
0888: MOVLW 7C |
|
|
1975 |
0889: MOVWF 64 |
|
|
1976 |
088A: MOVLW 79 |
|
|
1977 |
088B: MOVWF 63 |
|
|
1978 |
088C: MOVLW 35 |
|
|
1979 |
088D: MOVWF 62 |
|
|
1980 |
088E: MOVLW 81 |
|
|
1981 |
088F: MOVWF 61 |
|
|
1982 |
0890: BCF 0A.3 |
|
|
1983 |
0891: CALL 582 |
|
|
1984 |
0892: BSF 0A.3 |
|
|
1985 |
0893: MOVF 7A,W |
|
|
1986 |
0894: MOVWF 53 |
|
|
1987 |
0895: MOVF 79,W |
|
|
1988 |
0896: MOVWF 52 |
|
|
1989 |
0897: MOVF 78,W |
|
|
1990 |
0898: MOVWF 51 |
|
|
1991 |
0899: MOVF 77,W |
|
|
1992 |
089A: MOVWF 50 |
|
|
1993 |
.................... res = res*y*y + pat[2]; |
|
|
1994 |
089B: MOVF 53,W |
|
|
1995 |
089C: MOVWF 60 |
|
|
1996 |
089D: MOVF 52,W |
|
|
1997 |
089E: MOVWF 5F |
|
|
1998 |
089F: MOVF 51,W |
|
|
1999 |
08A0: MOVWF 5E |
|
|
2000 |
08A1: MOVF 50,W |
|
|
2001 |
08A2: MOVWF 5D |
|
|
2002 |
08A3: MOVF 4F,W |
|
|
2003 |
08A4: MOVWF 64 |
|
|
2004 |
08A5: MOVF 4E,W |
|
|
2005 |
08A6: MOVWF 63 |
|
|
2006 |
08A7: MOVF 4D,W |
|
|
2007 |
08A8: MOVWF 62 |
|
|
2008 |
08A9: MOVF 4C,W |
|
|
2009 |
08AA: MOVWF 61 |
|
|
2010 |
08AB: BCF 0A.3 |
|
|
2011 |
08AC: CALL 50D |
|
|
2012 |
08AD: BSF 0A.3 |
|
|
2013 |
08AE: MOVF 77,W |
|
|
2014 |
08AF: MOVWF 59 |
|
|
2015 |
08B0: MOVF 78,W |
|
|
2016 |
08B1: MOVWF 5A |
|
|
2017 |
08B2: MOVF 79,W |
|
|
2018 |
08B3: MOVWF 5B |
|
|
2019 |
08B4: MOVF 7A,W |
|
|
2020 |
08B5: MOVWF 5C |
|
|
2021 |
08B6: MOVWF 60 |
|
|
2022 |
08B7: MOVF 5B,W |
|
|
2023 |
08B8: MOVWF 5F |
|
|
2024 |
08B9: MOVF 5A,W |
|
|
2025 |
08BA: MOVWF 5E |
|
|
2026 |
08BB: MOVF 59,W |
|
|
2027 |
08BC: MOVWF 5D |
|
|
2028 |
08BD: MOVF 4F,W |
|
|
2029 |
08BE: MOVWF 64 |
|
|
2030 |
08BF: MOVF 4E,W |
|
|
2031 |
08C0: MOVWF 63 |
|
|
2032 |
08C1: MOVF 4D,W |
|
|
2033 |
08C2: MOVWF 62 |
|
|
2034 |
08C3: MOVF 4C,W |
|
|
2035 |
08C4: MOVWF 61 |
|
|
2036 |
08C5: BCF 0A.3 |
|
|
2037 |
08C6: CALL 50D |
|
|
2038 |
08C7: BSF 0A.3 |
|
|
2039 |
08C8: MOVF 77,W |
|
|
2040 |
08C9: MOVWF 59 |
|
|
2041 |
08CA: MOVF 78,W |
|
|
2042 |
08CB: MOVWF 5A |
|
|
2043 |
08CC: MOVF 79,W |
|
|
2044 |
08CD: MOVWF 5B |
|
|
2045 |
08CE: MOVF 7A,W |
|
|
2046 |
08CF: MOVWF 5C |
|
|
2047 |
08D0: BCF 03.1 |
|
|
2048 |
08D1: MOVF 5C,W |
|
|
2049 |
08D2: MOVWF 60 |
|
|
2050 |
08D3: MOVF 5B,W |
|
|
2051 |
08D4: MOVWF 5F |
|
|
2052 |
08D5: MOVF 5A,W |
|
|
2053 |
08D6: MOVWF 5E |
|
|
2054 |
08D7: MOVF 59,W |
|
|
2055 |
08D8: MOVWF 5D |
|
|
2056 |
08D9: MOVLW 3F |
|
|
2057 |
08DA: MOVWF 64 |
|
|
2058 |
08DB: MOVLW 02 |
|
|
2059 |
08DC: MOVWF 63 |
|
|
2060 |
08DD: MOVLW 33 |
|
|
2061 |
08DE: MOVWF 62 |
|
|
2062 |
08DF: MOVLW 83 |
|
|
2063 |
08E0: MOVWF 61 |
|
|
2064 |
08E1: BCF 0A.3 |
|
|
2065 |
08E2: CALL 582 |
|
|
2066 |
08E3: BSF 0A.3 |
|
|
2067 |
08E4: MOVF 7A,W |
|
|
2068 |
08E5: MOVWF 53 |
|
|
2069 |
08E6: MOVF 79,W |
|
|
2070 |
08E7: MOVWF 52 |
|
|
2071 |
08E8: MOVF 78,W |
|
|
2072 |
08E9: MOVWF 51 |
|
|
2073 |
08EA: MOVF 77,W |
|
|
2074 |
08EB: MOVWF 50 |
|
|
2075 |
.................... res = res*y*y + pat[3]; |
|
|
2076 |
08EC: MOVF 53,W |
|
|
2077 |
08ED: MOVWF 60 |
|
|
2078 |
08EE: MOVF 52,W |
|
|
2079 |
08EF: MOVWF 5F |
|
|
2080 |
08F0: MOVF 51,W |
|
|
2081 |
08F1: MOVWF 5E |
|
|
2082 |
08F2: MOVF 50,W |
|
|
2083 |
08F3: MOVWF 5D |
|
|
2084 |
08F4: MOVF 4F,W |
|
|
2085 |
08F5: MOVWF 64 |
|
|
2086 |
08F6: MOVF 4E,W |
|
|
2087 |
08F7: MOVWF 63 |
|
|
2088 |
08F8: MOVF 4D,W |
|
|
2089 |
08F9: MOVWF 62 |
|
|
2090 |
08FA: MOVF 4C,W |
|
|
2091 |
08FB: MOVWF 61 |
|
|
2092 |
08FC: BCF 0A.3 |
|
|
2093 |
08FD: CALL 50D |
|
|
2094 |
08FE: BSF 0A.3 |
|
|
2095 |
08FF: MOVF 77,W |
|
|
2096 |
0900: MOVWF 59 |
|
|
2097 |
0901: MOVF 78,W |
|
|
2098 |
0902: MOVWF 5A |
|
|
2099 |
0903: MOVF 79,W |
|
|
2100 |
0904: MOVWF 5B |
|
|
2101 |
0905: MOVF 7A,W |
|
|
2102 |
0906: MOVWF 5C |
|
|
2103 |
0907: MOVWF 60 |
|
|
2104 |
0908: MOVF 5B,W |
|
|
2105 |
0909: MOVWF 5F |
|
|
2106 |
090A: MOVF 5A,W |
|
|
2107 |
090B: MOVWF 5E |
|
|
2108 |
090C: MOVF 59,W |
|
|
2109 |
090D: MOVWF 5D |
|
|
2110 |
090E: MOVF 4F,W |
|
|
2111 |
090F: MOVWF 64 |
|
|
2112 |
0910: MOVF 4E,W |
|
|
2113 |
0911: MOVWF 63 |
|
|
2114 |
0912: MOVF 4D,W |
|
|
2115 |
0913: MOVWF 62 |
|
|
2116 |
0914: MOVF 4C,W |
|
|
2117 |
0915: MOVWF 61 |
|
|
2118 |
0916: BCF 0A.3 |
|
|
2119 |
0917: CALL 50D |
|
|
2120 |
0918: BSF 0A.3 |
|
|
2121 |
0919: MOVF 77,W |
|
|
2122 |
091A: MOVWF 59 |
|
|
2123 |
091B: MOVF 78,W |
|
|
2124 |
091C: MOVWF 5A |
|
|
2125 |
091D: MOVF 79,W |
|
|
2126 |
091E: MOVWF 5B |
|
|
2127 |
091F: MOVF 7A,W |
|
|
2128 |
0920: MOVWF 5C |
|
|
2129 |
0921: BCF 03.1 |
|
|
2130 |
0922: MOVF 5C,W |
|
|
2131 |
0923: MOVWF 60 |
|
|
2132 |
0924: MOVF 5B,W |
|
|
2133 |
0925: MOVWF 5F |
|
|
2134 |
0926: MOVF 5A,W |
|
|
2135 |
0927: MOVWF 5E |
|
|
2136 |
0928: MOVF 59,W |
|
|
2137 |
0929: MOVWF 5D |
|
|
2138 |
092A: MOVLW 33 |
|
|
2139 |
092B: MOVWF 64 |
|
|
2140 |
092C: MOVLW 8C |
|
|
2141 |
092D: MOVWF 63 |
|
|
2142 |
092E: MOVLW 1E |
|
|
2143 |
092F: MOVWF 62 |
|
|
2144 |
0930: MOVLW 83 |
|
|
2145 |
0931: MOVWF 61 |
|
|
2146 |
0932: BCF 0A.3 |
|
|
2147 |
0933: CALL 582 |
|
|
2148 |
0934: BSF 0A.3 |
|
|
2149 |
0935: MOVF 7A,W |
|
|
2150 |
0936: MOVWF 53 |
|
|
2151 |
0937: MOVF 79,W |
|
|
2152 |
0938: MOVWF 52 |
|
|
2153 |
0939: MOVF 78,W |
|
|
2154 |
093A: MOVWF 51 |
|
|
2155 |
093B: MOVF 77,W |
|
|
2156 |
093C: MOVWF 50 |
|
|
2157 |
.................... |
|
|
2158 |
.................... r = qat[0]*y*y + qat[1]; |
|
|
2159 |
093D: CLRF 60 |
|
|
2160 |
093E: CLRF 5F |
|
|
2161 |
093F: CLRF 5E |
|
|
2162 |
0940: MOVLW 7F |
|
|
2163 |
0941: MOVWF 5D |
|
|
2164 |
0942: MOVF 4F,W |
|
|
2165 |
0943: MOVWF 64 |
|
|
2166 |
0944: MOVF 4E,W |
|
|
2167 |
0945: MOVWF 63 |
|
|
2168 |
0946: MOVF 4D,W |
|
|
2169 |
0947: MOVWF 62 |
|
|
2170 |
0948: MOVF 4C,W |
|
|
2171 |
0949: MOVWF 61 |
|
|
2172 |
094A: BCF 0A.3 |
|
|
2173 |
094B: CALL 50D |
|
|
2174 |
094C: BSF 0A.3 |
|
|
2175 |
094D: MOVF 77,W |
|
|
2176 |
094E: MOVWF 59 |
|
|
2177 |
094F: MOVF 78,W |
|
|
2178 |
0950: MOVWF 5A |
|
|
2179 |
0951: MOVF 79,W |
|
|
2180 |
0952: MOVWF 5B |
|
|
2181 |
0953: MOVF 7A,W |
|
|
2182 |
0954: MOVWF 5C |
|
|
2183 |
0955: MOVWF 60 |
|
|
2184 |
0956: MOVF 5B,W |
|
|
2185 |
0957: MOVWF 5F |
|
|
2186 |
0958: MOVF 5A,W |
|
|
2187 |
0959: MOVWF 5E |
|
|
2188 |
095A: MOVF 59,W |
|
|
2189 |
095B: MOVWF 5D |
|
|
2190 |
095C: MOVF 4F,W |
|
|
2191 |
095D: MOVWF 64 |
|
|
2192 |
095E: MOVF 4E,W |
|
|
2193 |
095F: MOVWF 63 |
|
|
2194 |
0960: MOVF 4D,W |
|
|
2195 |
0961: MOVWF 62 |
|
|
2196 |
0962: MOVF 4C,W |
|
|
2197 |
0963: MOVWF 61 |
|
|
2198 |
0964: BCF 0A.3 |
|
|
2199 |
0965: CALL 50D |
|
|
2200 |
0966: BSF 0A.3 |
|
|
2201 |
0967: MOVF 77,W |
|
|
2202 |
0968: MOVWF 59 |
|
|
2203 |
0969: MOVF 78,W |
|
|
2204 |
096A: MOVWF 5A |
|
|
2205 |
096B: MOVF 79,W |
|
|
2206 |
096C: MOVWF 5B |
|
|
2207 |
096D: MOVF 7A,W |
|
|
2208 |
096E: MOVWF 5C |
|
|
2209 |
096F: BCF 03.1 |
|
|
2210 |
0970: MOVF 5C,W |
|
|
2211 |
0971: MOVWF 60 |
|
|
2212 |
0972: MOVF 5B,W |
|
|
2213 |
0973: MOVWF 5F |
|
|
2214 |
0974: MOVF 5A,W |
|
|
2215 |
0975: MOVWF 5E |
|
|
2216 |
0976: MOVF 59,W |
|
|
2217 |
0977: MOVWF 5D |
|
|
2218 |
0978: MOVLW 1B |
|
|
2219 |
0979: MOVWF 64 |
|
|
2220 |
097A: MOVLW E4 |
|
|
2221 |
097B: MOVWF 63 |
|
|
2222 |
097C: MOVLW 35 |
|
|
2223 |
097D: MOVWF 62 |
|
|
2224 |
097E: MOVLW 82 |
|
|
2225 |
097F: MOVWF 61 |
|
|
2226 |
0980: BCF 0A.3 |
|
|
2227 |
0981: CALL 582 |
|
|
2228 |
0982: BSF 0A.3 |
|
|
2229 |
0983: MOVF 7A,W |
|
|
2230 |
0984: MOVWF 57 |
|
|
2231 |
0985: MOVF 79,W |
|
|
2232 |
0986: MOVWF 56 |
|
|
2233 |
0987: MOVF 78,W |
|
|
2234 |
0988: MOVWF 55 |
|
|
2235 |
0989: MOVF 77,W |
|
|
2236 |
098A: MOVWF 54 |
|
|
2237 |
.................... r = r*y*y + qat[2]; |
|
|
2238 |
098B: MOVF 57,W |
|
|
2239 |
098C: MOVWF 60 |
|
|
2240 |
098D: MOVF 56,W |
|
|
2241 |
098E: MOVWF 5F |
|
|
2242 |
098F: MOVF 55,W |
|
|
2243 |
0990: MOVWF 5E |
|
|
2244 |
0991: MOVF 54,W |
|
|
2245 |
0992: MOVWF 5D |
|
|
2246 |
0993: MOVF 4F,W |
|
|
2247 |
0994: MOVWF 64 |
|
|
2248 |
0995: MOVF 4E,W |
|
|
2249 |
0996: MOVWF 63 |
|
|
2250 |
0997: MOVF 4D,W |
|
|
2251 |
0998: MOVWF 62 |
|
|
2252 |
0999: MOVF 4C,W |
|
|
2253 |
099A: MOVWF 61 |
|
|
2254 |
099B: BCF 0A.3 |
|
|
2255 |
099C: CALL 50D |
|
|
2256 |
099D: BSF 0A.3 |
|
|
2257 |
099E: MOVF 77,W |
|
|
2258 |
099F: MOVWF 59 |
|
|
2259 |
09A0: MOVF 78,W |
|
|
2260 |
09A1: MOVWF 5A |
|
|
2261 |
09A2: MOVF 79,W |
|
|
2262 |
09A3: MOVWF 5B |
|
|
2263 |
09A4: MOVF 7A,W |
|
|
2264 |
09A5: MOVWF 5C |
|
|
2265 |
09A6: MOVWF 60 |
|
|
2266 |
09A7: MOVF 5B,W |
|
|
2267 |
09A8: MOVWF 5F |
|
|
2268 |
09A9: MOVF 5A,W |
|
|
2269 |
09AA: MOVWF 5E |
|
|
2270 |
09AB: MOVF 59,W |
|
|
2271 |
09AC: MOVWF 5D |
|
|
2272 |
09AD: MOVF 4F,W |
|
|
2273 |
09AE: MOVWF 64 |
|
|
2274 |
09AF: MOVF 4E,W |
|
|
2275 |
09B0: MOVWF 63 |
|
|
2276 |
09B1: MOVF 4D,W |
|
|
2277 |
09B2: MOVWF 62 |
|
|
2278 |
09B3: MOVF 4C,W |
|
|
2279 |
09B4: MOVWF 61 |
|
|
2280 |
09B5: BCF 0A.3 |
|
|
2281 |
09B6: CALL 50D |
|
|
2282 |
09B7: BSF 0A.3 |
|
|
2283 |
09B8: MOVF 77,W |
|
|
2284 |
09B9: MOVWF 59 |
|
|
2285 |
09BA: MOVF 78,W |
|
|
2286 |
09BB: MOVWF 5A |
|
|
2287 |
09BC: MOVF 79,W |
|
|
2288 |
09BD: MOVWF 5B |
|
|
2289 |
09BE: MOVF 7A,W |
|
|
2290 |
09BF: MOVWF 5C |
|
|
2291 |
09C0: BCF 03.1 |
|
|
2292 |
09C1: MOVF 5C,W |
|
|
2293 |
09C2: MOVWF 60 |
|
|
2294 |
09C3: MOVF 5B,W |
|
|
2295 |
09C4: MOVWF 5F |
|
|
2296 |
09C5: MOVF 5A,W |
|
|
2297 |
09C6: MOVWF 5E |
|
|
2298 |
09C7: MOVF 59,W |
|
|
2299 |
09C8: MOVWF 5D |
|
|
2300 |
09C9: MOVLW A4 |
|
|
2301 |
09CA: MOVWF 64 |
|
|
2302 |
09CB: MOVLW DB |
|
|
2303 |
09CC: MOVWF 63 |
|
|
2304 |
09CD: MOVLW 67 |
|
|
2305 |
09CE: MOVWF 62 |
|
|
2306 |
09CF: MOVLW 83 |
|
|
2307 |
09D0: MOVWF 61 |
|
|
2308 |
09D1: BCF 0A.3 |
|
|
2309 |
09D2: CALL 582 |
|
|
2310 |
09D3: BSF 0A.3 |
|
|
2311 |
09D4: MOVF 7A,W |
|
|
2312 |
09D5: MOVWF 57 |
|
|
2313 |
09D6: MOVF 79,W |
|
|
2314 |
09D7: MOVWF 56 |
|
|
2315 |
09D8: MOVF 78,W |
|
|
2316 |
09D9: MOVWF 55 |
|
|
2317 |
09DA: MOVF 77,W |
|
|
2318 |
09DB: MOVWF 54 |
|
|
2319 |
.................... r = r*y*y + qat[3]; |
|
|
2320 |
09DC: MOVF 57,W |
|
|
2321 |
09DD: MOVWF 60 |
|
|
2322 |
09DE: MOVF 56,W |
|
|
2323 |
09DF: MOVWF 5F |
|
|
2324 |
09E0: MOVF 55,W |
|
|
2325 |
09E1: MOVWF 5E |
|
|
2326 |
09E2: MOVF 54,W |
|
|
2327 |
09E3: MOVWF 5D |
|
|
2328 |
09E4: MOVF 4F,W |
|
|
2329 |
09E5: MOVWF 64 |
|
|
2330 |
09E6: MOVF 4E,W |
|
|
2331 |
09E7: MOVWF 63 |
|
|
2332 |
09E8: MOVF 4D,W |
|
|
2333 |
09E9: MOVWF 62 |
|
|
2334 |
09EA: MOVF 4C,W |
|
|
2335 |
09EB: MOVWF 61 |
|
|
2336 |
09EC: BCF 0A.3 |
|
|
2337 |
09ED: CALL 50D |
|
|
2338 |
09EE: BSF 0A.3 |
|
|
2339 |
09EF: MOVF 77,W |
|
|
2340 |
09F0: MOVWF 59 |
|
|
2341 |
09F1: MOVF 78,W |
|
|
2342 |
09F2: MOVWF 5A |
|
|
2343 |
09F3: MOVF 79,W |
|
|
2344 |
09F4: MOVWF 5B |
|
|
2345 |
09F5: MOVF 7A,W |
|
|
2346 |
09F6: MOVWF 5C |
|
|
2347 |
09F7: MOVWF 60 |
|
|
2348 |
09F8: MOVF 5B,W |
|
|
2349 |
09F9: MOVWF 5F |
|
|
2350 |
09FA: MOVF 5A,W |
|
|
2351 |
09FB: MOVWF 5E |
|
|
2352 |
09FC: MOVF 59,W |
|
|
2353 |
09FD: MOVWF 5D |
|
|
2354 |
09FE: MOVF 4F,W |
|
|
2355 |
09FF: MOVWF 64 |
|
|
2356 |
0A00: MOVF 4E,W |
|
|
2357 |
0A01: MOVWF 63 |
|
|
2358 |
0A02: MOVF 4D,W |
|
|
2359 |
0A03: MOVWF 62 |
|
|
2360 |
0A04: MOVF 4C,W |
|
|
2361 |
0A05: MOVWF 61 |
|
|
2362 |
0A06: BCF 0A.3 |
|
|
2363 |
0A07: CALL 50D |
|
|
2364 |
0A08: BSF 0A.3 |
|
|
2365 |
0A09: MOVF 77,W |
|
|
2366 |
0A0A: MOVWF 59 |
|
|
2367 |
0A0B: MOVF 78,W |
|
|
2368 |
0A0C: MOVWF 5A |
|
|
2369 |
0A0D: MOVF 79,W |
|
|
2370 |
0A0E: MOVWF 5B |
|
|
2371 |
0A0F: MOVF 7A,W |
|
|
2372 |
0A10: MOVWF 5C |
|
|
2373 |
0A11: BCF 03.1 |
|
|
2374 |
0A12: MOVF 5C,W |
|
|
2375 |
0A13: MOVWF 60 |
|
|
2376 |
0A14: MOVF 5B,W |
|
|
2377 |
0A15: MOVWF 5F |
|
|
2378 |
0A16: MOVF 5A,W |
|
|
2379 |
0A17: MOVWF 5E |
|
|
2380 |
0A18: MOVF 59,W |
|
|
2381 |
0A19: MOVWF 5D |
|
|
2382 |
0A1A: MOVLW 33 |
|
|
2383 |
0A1B: MOVWF 64 |
|
|
2384 |
0A1C: MOVLW 8C |
|
|
2385 |
0A1D: MOVWF 63 |
|
|
2386 |
0A1E: MOVLW 1E |
|
|
2387 |
0A1F: MOVWF 62 |
|
|
2388 |
0A20: MOVLW 83 |
|
|
2389 |
0A21: MOVWF 61 |
|
|
2390 |
0A22: BCF 0A.3 |
|
|
2391 |
0A23: CALL 582 |
|
|
2392 |
0A24: BSF 0A.3 |
|
|
2393 |
0A25: MOVF 7A,W |
|
|
2394 |
0A26: MOVWF 57 |
|
|
2395 |
0A27: MOVF 79,W |
|
|
2396 |
0A28: MOVWF 56 |
|
|
2397 |
0A29: MOVF 78,W |
|
|
2398 |
0A2A: MOVWF 55 |
|
|
2399 |
0A2B: MOVF 77,W |
|
|
2400 |
0A2C: MOVWF 54 |
|
|
2401 |
.................... |
|
|
2402 |
.................... res = y*res/r; |
|
|
2403 |
0A2D: MOVF 4F,W |
|
|
2404 |
0A2E: MOVWF 60 |
|
|
2405 |
0A2F: MOVF 4E,W |
|
|
2406 |
0A30: MOVWF 5F |
|
|
2407 |
0A31: MOVF 4D,W |
|
|
2408 |
0A32: MOVWF 5E |
|
|
2409 |
0A33: MOVF 4C,W |
|
|
2410 |
0A34: MOVWF 5D |
|
|
2411 |
0A35: MOVF 53,W |
|
|
2412 |
0A36: MOVWF 64 |
|
|
2413 |
0A37: MOVF 52,W |
|
|
2414 |
0A38: MOVWF 63 |
|
|
2415 |
0A39: MOVF 51,W |
|
|
2416 |
0A3A: MOVWF 62 |
|
|
2417 |
0A3B: MOVF 50,W |
|
|
2418 |
0A3C: MOVWF 61 |
|
|
2419 |
0A3D: BCF 0A.3 |
|
|
2420 |
0A3E: CALL 50D |
|
|
2421 |
0A3F: BSF 0A.3 |
|
|
2422 |
0A40: MOVF 77,W |
|
|
2423 |
0A41: MOVWF 59 |
|
|
2424 |
0A42: MOVF 78,W |
|
|
2425 |
0A43: MOVWF 5A |
|
|
2426 |
0A44: MOVF 79,W |
|
|
2427 |
0A45: MOVWF 5B |
|
|
2428 |
0A46: MOVF 7A,W |
|
|
2429 |
0A47: MOVWF 5C |
|
|
2430 |
0A48: MOVWF 60 |
|
|
2431 |
0A49: MOVF 5B,W |
|
|
2432 |
0A4A: MOVWF 5F |
|
|
2433 |
0A4B: MOVF 5A,W |
|
|
2434 |
0A4C: MOVWF 5E |
|
|
2435 |
0A4D: MOVF 59,W |
|
|
2436 |
0A4E: MOVWF 5D |
|
|
2437 |
0A4F: MOVF 57,W |
|
|
2438 |
0A50: MOVWF 64 |
|
|
2439 |
0A51: MOVF 56,W |
|
|
2440 |
0A52: MOVWF 63 |
|
|
2441 |
0A53: MOVF 55,W |
|
|
2442 |
0A54: MOVWF 62 |
|
|
2443 |
0A55: MOVF 54,W |
|
|
2444 |
0A56: MOVWF 61 |
|
|
2445 |
0A57: BCF 0A.3 |
|
|
2446 |
0A58: CALL 404 |
|
|
2447 |
0A59: BSF 0A.3 |
|
|
2448 |
0A5A: MOVF 7A,W |
|
|
2449 |
0A5B: MOVWF 53 |
|
|
2450 |
0A5C: MOVF 79,W |
|
|
2451 |
0A5D: MOVWF 52 |
|
|
2452 |
0A5E: MOVF 78,W |
|
|
2453 |
0A5F: MOVWF 51 |
|
|
2454 |
0A60: MOVF 77,W |
|
|
2455 |
0A61: MOVWF 50 |
|
|
2456 |
.................... |
|
|
2457 |
.................... |
|
|
2458 |
.................... if (flag) // for |x| > 1 |
|
|
2459 |
0A62: BTFSS 58.1 |
|
|
2460 |
0A63: GOTO 280 |
|
|
2461 |
.................... res = PI_DIV_BY_TWO - res; |
|
|
2462 |
0A64: BSF 03.1 |
|
|
2463 |
0A65: MOVLW DB |
|
|
2464 |
0A66: MOVWF 60 |
|
|
2465 |
0A67: MOVLW 0F |
|
|
2466 |
0A68: MOVWF 5F |
|
|
2467 |
0A69: MOVLW 49 |
|
|
2468 |
0A6A: MOVWF 5E |
|
|
2469 |
0A6B: MOVLW 7F |
|
|
2470 |
0A6C: MOVWF 5D |
|
|
2471 |
0A6D: MOVF 53,W |
|
|
2472 |
0A6E: MOVWF 64 |
|
|
2473 |
0A6F: MOVF 52,W |
|
|
2474 |
0A70: MOVWF 63 |
|
|
2475 |
0A71: MOVF 51,W |
|
|
2476 |
0A72: MOVWF 62 |
|
|
2477 |
0A73: MOVF 50,W |
|
|
2478 |
0A74: MOVWF 61 |
|
|
2479 |
0A75: BCF 0A.3 |
|
|
2480 |
0A76: CALL 582 |
|
|
2481 |
0A77: BSF 0A.3 |
|
|
2482 |
0A78: MOVF 7A,W |
|
|
2483 |
0A79: MOVWF 53 |
|
|
2484 |
0A7A: MOVF 79,W |
|
|
2485 |
0A7B: MOVWF 52 |
|
|
2486 |
0A7C: MOVF 78,W |
|
|
2487 |
0A7D: MOVWF 51 |
|
|
2488 |
0A7E: MOVF 77,W |
|
|
2489 |
0A7F: MOVWF 50 |
|
|
2490 |
.................... if (s) |
|
|
2491 |
0A80: BTFSS 58.0 |
|
|
2492 |
0A81: GOTO 285 |
|
|
2493 |
.................... res = -res; |
|
|
2494 |
0A82: MOVF 51,W |
|
|
2495 |
0A83: XORLW 80 |
|
|
2496 |
0A84: MOVWF 51 |
|
|
2497 |
.................... |
|
|
2498 |
.................... return(res); |
|
|
2499 |
0A85: MOVF 50,W |
|
|
2500 |
0A86: MOVWF 77 |
|
|
2501 |
0A87: MOVF 51,W |
|
|
2502 |
0A88: MOVWF 78 |
|
|
2503 |
0A89: MOVF 52,W |
|
|
2504 |
0A8A: MOVWF 79 |
|
|
2505 |
0A8B: MOVF 53,W |
|
|
2506 |
0A8C: MOVWF 7A |
|
|
2507 |
.................... } |
|
|
2508 |
0A8D: RETURN |
|
|
2509 |
.................... //Overloaded functions for atan() for PCD |
|
|
2510 |
.................... // Overloaded function atan() for data type - Float48 |
|
|
2511 |
.................... #if defined(__PCD__) |
|
|
2512 |
.................... float48 atan(float48 x) |
|
|
2513 |
.................... { |
|
|
2514 |
.................... float48 y, res, r; |
|
|
2515 |
.................... int1 s, flag; |
|
|
2516 |
.................... |
|
|
2517 |
.................... s = 0; |
|
|
2518 |
.................... flag = 0; |
|
|
2519 |
.................... y = x; |
|
|
2520 |
.................... |
|
|
2521 |
.................... if (x < 0) |
|
|
2522 |
.................... { |
|
|
2523 |
.................... s = 1; |
|
|
2524 |
.................... y = -y; |
|
|
2525 |
.................... } |
|
|
2526 |
.................... |
|
|
2527 |
.................... if (y > 1.0) |
|
|
2528 |
.................... { |
|
|
2529 |
.................... y = 1.0/y; |
|
|
2530 |
.................... flag = 1; |
|
|
2531 |
.................... } |
|
|
2532 |
.................... |
|
|
2533 |
.................... res = pat[0]*y*y + pat[1]; |
|
|
2534 |
.................... res = res*y*y + pat[2]; |
|
|
2535 |
.................... res = res*y*y + pat[3]; |
|
|
2536 |
.................... |
|
|
2537 |
.................... r = qat[0]*y*y + qat[1]; |
|
|
2538 |
.................... r = r*y*y + qat[2]; |
|
|
2539 |
.................... r = r*y*y + qat[3]; |
|
|
2540 |
.................... |
|
|
2541 |
.................... res = y*res/r; |
|
|
2542 |
.................... |
|
|
2543 |
.................... |
|
|
2544 |
.................... if (flag) // for |x| > 1 |
|
|
2545 |
.................... res = PI_DIV_BY_TWO - res; |
|
|
2546 |
.................... if (s) |
|
|
2547 |
.................... res = -res; |
|
|
2548 |
.................... |
|
|
2549 |
.................... return(res); |
|
|
2550 |
.................... } |
|
|
2551 |
.................... |
|
|
2552 |
.................... // Overloaded function atan() for data type - Float64 |
|
|
2553 |
.................... float64 atan(float64 x) |
|
|
2554 |
.................... { |
|
|
2555 |
.................... float64 y, res, r; |
|
|
2556 |
.................... int1 s, flag; |
|
|
2557 |
.................... |
|
|
2558 |
.................... s = 0; |
|
|
2559 |
.................... flag = 0; |
|
|
2560 |
.................... y = x; |
|
|
2561 |
.................... |
|
|
2562 |
.................... if (x < 0) |
|
|
2563 |
.................... { |
|
|
2564 |
.................... s = 1; |
|
|
2565 |
.................... y = -y; |
|
|
2566 |
.................... } |
|
|
2567 |
.................... |
|
|
2568 |
.................... if (y > 1.0) |
|
|
2569 |
.................... { |
|
|
2570 |
.................... y = 1.0/y; |
|
|
2571 |
.................... flag = 1; |
|
|
2572 |
.................... } |
|
|
2573 |
.................... |
|
|
2574 |
.................... res = pat[0]*y*y + pat[1]; |
|
|
2575 |
.................... res = res*y*y + pat[2]; |
|
|
2576 |
.................... res = res*y*y + pat[3]; |
|
|
2577 |
.................... |
|
|
2578 |
.................... r = qat[0]*y*y + qat[1]; |
|
|
2579 |
.................... r = r*y*y + qat[2]; |
|
|
2580 |
.................... r = r*y*y + qat[3]; |
|
|
2581 |
.................... |
|
|
2582 |
.................... res = y*res/r; |
|
|
2583 |
.................... |
|
|
2584 |
.................... |
|
|
2585 |
.................... if (flag) // for |x| > 1 |
|
|
2586 |
.................... res = PI_DIV_BY_TWO - res; |
|
|
2587 |
.................... if (s) |
|
|
2588 |
.................... res = -res; |
|
|
2589 |
.................... |
|
|
2590 |
.................... return(res); |
|
|
2591 |
.................... } |
|
|
2592 |
.................... #endif |
|
|
2593 |
.................... |
|
|
2594 |
.................... ///////////////////////////////////////////////////////////////////////////// |
|
|
2595 |
.................... // float atan2(float y, float x) |
|
|
2596 |
.................... ///////////////////////////////////////////////////////////////////////////// |
|
|
2597 |
.................... // Description :computes the principal value of arc tangent of y/x, using the |
|
|
2598 |
.................... // signs of both the arguments to determine the quadrant of the return value |
|
|
2599 |
.................... // Returns : returns the arc tangent of y/x. |
|
|
2600 |
.................... // Date : N/A |
|
|
2601 |
.................... // |
|
|
2602 |
.................... |
|
|
2603 |
.................... float32 atan2(float32 y,float32 x) |
|
|
2604 |
.................... { |
|
|
2605 |
.................... float32 z; |
|
|
2606 |
.................... int1 sign; |
|
|
2607 |
.................... unsigned int8 quad; |
|
|
2608 |
.................... sign=0; |
|
|
2609 |
.................... quad=0; //quadrant |
|
|
2610 |
.................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1)); |
|
|
2611 |
.................... if(y<0.0) |
|
|
2612 |
.................... { |
|
|
2613 |
.................... sign=1; |
|
|
2614 |
.................... y=-y; |
|
|
2615 |
.................... } |
|
|
2616 |
.................... if(x<0.0) |
|
|
2617 |
.................... { |
|
|
2618 |
.................... x=-x; |
|
|
2619 |
.................... } |
|
|
2620 |
.................... if (x==0.0) |
|
|
2621 |
.................... { |
|
|
2622 |
.................... if(y==0.0) |
|
|
2623 |
.................... { |
|
|
2624 |
.................... #ifdef _ERRNO |
|
|
2625 |
.................... { |
|
|
2626 |
.................... errno=EDOM; |
|
|
2627 |
.................... } |
|
|
2628 |
.................... #endif |
|
|
2629 |
.................... } |
|
|
2630 |
.................... else |
|
|
2631 |
.................... { |
|
|
2632 |
.................... if(sign) |
|
|
2633 |
.................... { |
|
|
2634 |
.................... return (-(PI_DIV_BY_TWO)); |
|
|
2635 |
.................... } |
|
|
2636 |
.................... else |
|
|
2637 |
.................... { |
|
|
2638 |
.................... return (PI_DIV_BY_TWO); |
|
|
2639 |
.................... } |
|
|
2640 |
.................... } |
|
|
2641 |
.................... } |
|
|
2642 |
.................... else |
|
|
2643 |
.................... { |
|
|
2644 |
.................... z=y/x; |
|
|
2645 |
.................... switch(quad) |
|
|
2646 |
.................... { |
|
|
2647 |
.................... case 1: |
|
|
2648 |
.................... { |
|
|
2649 |
.................... return atan(z); |
|
|
2650 |
.................... break; |
|
|
2651 |
.................... } |
|
|
2652 |
.................... case 2: |
|
|
2653 |
.................... { |
|
|
2654 |
.................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122 |
|
|
2655 |
.................... return (PI-atan(z)); |
|
|
2656 |
.................... break; |
|
|
2657 |
.................... } |
|
|
2658 |
.................... case 3: |
|
|
2659 |
.................... { |
|
|
2660 |
.................... return (atan(z)-PI); |
|
|
2661 |
.................... break; |
|
|
2662 |
.................... } |
|
|
2663 |
.................... case 4: |
|
|
2664 |
.................... { |
|
|
2665 |
.................... return (-atan(z)); |
|
|
2666 |
.................... break; |
|
|
2667 |
.................... } |
|
|
2668 |
.................... } |
|
|
2669 |
.................... } |
|
|
2670 |
.................... } |
|
|
2671 |
.................... |
|
|
2672 |
.................... //Overloaded functions for atan2() for PCD |
|
|
2673 |
.................... // Overloaded function atan2() for data type - Float48 |
|
|
2674 |
.................... #if defined(__PCD__) |
|
|
2675 |
.................... float48 atan2(float48 y,float48 x) |
|
|
2676 |
.................... { |
|
|
2677 |
.................... float48 z; |
|
|
2678 |
.................... int1 sign; |
|
|
2679 |
.................... unsigned int8 quad; |
|
|
2680 |
.................... sign=0; |
|
|
2681 |
.................... quad=0; //quadrant |
|
|
2682 |
.................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1)); |
|
|
2683 |
.................... if(y<0.0) |
|
|
2684 |
.................... { |
|
|
2685 |
.................... sign=1; |
|
|
2686 |
.................... y=-y; |
|
|
2687 |
.................... } |
|
|
2688 |
.................... if(x<0.0) |
|
|
2689 |
.................... { |
|
|
2690 |
.................... x=-x; |
|
|
2691 |
.................... } |
|
|
2692 |
.................... if (x==0.0) |
|
|
2693 |
.................... { |
|
|
2694 |
.................... if(y==0.0) |
|
|
2695 |
.................... { |
|
|
2696 |
.................... #ifdef _ERRNO |
|
|
2697 |
.................... { |
|
|
2698 |
.................... errno=EDOM; |
|
|
2699 |
.................... } |
|
|
2700 |
.................... #endif |
|
|
2701 |
.................... } |
|
|
2702 |
.................... else |
|
|
2703 |
.................... { |
|
|
2704 |
.................... if(sign) |
|
|
2705 |
.................... { |
|
|
2706 |
.................... return (-(PI_DIV_BY_TWO)); |
|
|
2707 |
.................... } |
|
|
2708 |
.................... else |
|
|
2709 |
.................... { |
|
|
2710 |
.................... return (PI_DIV_BY_TWO); |
|
|
2711 |
.................... } |
|
|
2712 |
.................... } |
|
|
2713 |
.................... } |
|
|
2714 |
.................... else |
|
|
2715 |
.................... { |
|
|
2716 |
.................... z=y/x; |
|
|
2717 |
.................... switch(quad) |
|
|
2718 |
.................... { |
|
|
2719 |
.................... case 1: |
|
|
2720 |
.................... { |
|
|
2721 |
.................... return atan(z); |
|
|
2722 |
.................... break; |
|
|
2723 |
.................... } |
|
|
2724 |
.................... case 2: |
|
|
2725 |
.................... { |
|
|
2726 |
.................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122 |
|
|
2727 |
.................... return (PI-atan(z)); |
|
|
2728 |
.................... break; |
|
|
2729 |
.................... } |
|
|
2730 |
.................... case 3: |
|
|
2731 |
.................... { |
|
|
2732 |
.................... return (atan(z)-PI); |
|
|
2733 |
.................... break; |
|
|
2734 |
.................... } |
|
|
2735 |
.................... case 4: |
|
|
2736 |
.................... { |
|
|
2737 |
.................... return (-atan(z)); |
|
|
2738 |
.................... break; |
|
|
2739 |
.................... } |
|
|
2740 |
.................... } |
|
|
2741 |
.................... } |
|
|
2742 |
.................... } |
|
|
2743 |
.................... |
|
|
2744 |
.................... // Overloaded function atan2() for data type - Float64 |
|
|
2745 |
.................... float64 atan2(float64 y,float64 x) |
|
|
2746 |
.................... { |
|
|
2747 |
.................... float64 z; |
|
|
2748 |
.................... int1 sign; |
|
|
2749 |
.................... unsigned int8 quad; |
|
|
2750 |
.................... sign=0; |
|
|
2751 |
.................... quad=0; //quadrant |
|
|
2752 |
.................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1)); |
|
|
2753 |
.................... if(y<0.0) |
|
|
2754 |
.................... { |
|
|
2755 |
.................... sign=1; |
|
|
2756 |
.................... y=-y; |
|
|
2757 |
.................... } |
|
|
2758 |
.................... if(x<0.0) |
|
|
2759 |
.................... { |
|
|
2760 |
.................... x=-x; |
|
|
2761 |
.................... } |
|
|
2762 |
.................... if (x==0.0) |
|
|
2763 |
.................... { |
|
|
2764 |
.................... if(y==0.0) |
|
|
2765 |
.................... { |
|
|
2766 |
.................... #ifdef _ERRNO |
|
|
2767 |
.................... { |
|
|
2768 |
.................... errno=EDOM; |
|
|
2769 |
.................... } |
|
|
2770 |
.................... #endif |
|
|
2771 |
.................... } |
|
|
2772 |
.................... else |
|
|
2773 |
.................... { |
|
|
2774 |
.................... if(sign) |
|
|
2775 |
.................... { |
|
|
2776 |
.................... return (-(PI_DIV_BY_TWO)); |
|
|
2777 |
.................... } |
|
|
2778 |
.................... else |
|
|
2779 |
.................... { |
|
|
2780 |
.................... return (PI_DIV_BY_TWO); |
|
|
2781 |
.................... } |
|
|
2782 |
.................... } |
|
|
2783 |
.................... } |
|
|
2784 |
.................... else |
|
|
2785 |
.................... { |
|
|
2786 |
.................... z=y/x; |
|
|
2787 |
.................... switch(quad) |
|
|
2788 |
.................... { |
|
|
2789 |
.................... case 1: |
|
|
2790 |
.................... { |
|
|
2791 |
.................... return atan(z); |
|
|
2792 |
.................... break; |
|
|
2793 |
.................... } |
|
|
2794 |
.................... case 2: |
|
|
2795 |
.................... { |
|
|
2796 |
.................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122 |
|
|
2797 |
.................... return (PI-atan(z)); |
|
|
2798 |
.................... break; |
|
|
2799 |
.................... } |
|
|
2800 |
.................... case 3: |
|
|
2801 |
.................... { |
|
|
2802 |
.................... return (atan(z)-PI); |
|
|
2803 |
.................... break; |
|
|
2804 |
.................... } |
|
|
2805 |
.................... case 4: |
|
|
2806 |
.................... { |
|
|
2807 |
.................... return (-atan(z)); |
|
|
2808 |
.................... break; |
|
|
2809 |
.................... } |
|
|
2810 |
.................... } |
|
|
2811 |
.................... } |
|
|
2812 |
.................... } |
|
|
2813 |
.................... #endif |
|
|
2814 |
.................... |
|
|
2815 |
.................... //////////////////// Hyperbolic functions //////////////////// |
|
|
2816 |
.................... |
|
|
2817 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2818 |
.................... // float cosh(float x) |
|
|
2819 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2820 |
.................... // Description : Computes the hyperbolic cosine value of x |
|
|
2821 |
.................... // Returns : returns the hyperbolic cosine value of x |
|
|
2822 |
.................... // Date : N/A |
|
|
2823 |
.................... // |
|
|
2824 |
.................... |
|
|
2825 |
.................... float32 cosh(float32 x) |
|
|
2826 |
.................... { |
|
|
2827 |
.................... return ((exp(x)+exp(-x))/2); |
|
|
2828 |
.................... } |
|
|
2829 |
.................... //Overloaded functions for cosh() for PCD |
|
|
2830 |
.................... // Overloaded function cosh() for data type - Float48 |
|
|
2831 |
.................... #if defined(__PCD__) |
|
|
2832 |
.................... float48 cosh(float48 x) |
|
|
2833 |
.................... { |
|
|
2834 |
.................... return ((exp(x)+exp(-x))/2); |
|
|
2835 |
.................... } |
|
|
2836 |
.................... |
|
|
2837 |
.................... // Overloaded function cosh() for data type - Float64 |
|
|
2838 |
.................... float64 cosh(float64 x) |
|
|
2839 |
.................... { |
|
|
2840 |
.................... return ((exp(x)+exp(-x))/2); |
|
|
2841 |
.................... } |
|
|
2842 |
.................... #endif |
|
|
2843 |
.................... |
|
|
2844 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2845 |
.................... // float sinh(float x) |
|
|
2846 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2847 |
.................... // Description : Computes the hyperbolic sine value of x |
|
|
2848 |
.................... // Returns : returns the hyperbolic sine value of x |
|
|
2849 |
.................... // Date : N/A |
|
|
2850 |
.................... // |
|
|
2851 |
.................... |
|
|
2852 |
.................... float32 sinh(float32 x) |
|
|
2853 |
.................... { |
|
|
2854 |
.................... |
|
|
2855 |
.................... return ((exp(x) - exp(-x))/2); |
|
|
2856 |
.................... } |
|
|
2857 |
.................... //Overloaded functions for sinh() for PCD |
|
|
2858 |
.................... // Overloaded function sinh() for data type - Float48 |
|
|
2859 |
.................... #if defined(__PCD__) |
|
|
2860 |
.................... float48 sinh(float48 x) |
|
|
2861 |
.................... { |
|
|
2862 |
.................... |
|
|
2863 |
.................... return ((exp(x) - exp(-x))/2); |
|
|
2864 |
.................... } |
|
|
2865 |
.................... |
|
|
2866 |
.................... // Overloaded function sinh() for data type - Float48 |
|
|
2867 |
.................... float64 sinh(float64 x) |
|
|
2868 |
.................... { |
|
|
2869 |
.................... |
|
|
2870 |
.................... return ((exp(x) - exp(-x))/2); |
|
|
2871 |
.................... } |
|
|
2872 |
.................... #endif |
|
|
2873 |
.................... |
|
|
2874 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2875 |
.................... // float tanh(float x) |
|
|
2876 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2877 |
.................... // Description : Computes the hyperbolic tangent value of x |
|
|
2878 |
.................... // Returns : returns the hyperbolic tangent value of x |
|
|
2879 |
.................... // Date : N/A |
|
|
2880 |
.................... // |
|
|
2881 |
.................... |
|
|
2882 |
.................... float32 tanh(float32 x) |
|
|
2883 |
.................... { |
|
|
2884 |
.................... return(sinh(x)/cosh(x)); |
|
|
2885 |
.................... } |
|
|
2886 |
.................... //Overloaded functions for tanh() for PCD |
|
|
2887 |
.................... // Overloaded function tanh() for data type - Float48 |
|
|
2888 |
.................... #if defined(__PCD__) |
|
|
2889 |
.................... float48 tanh(float48 x) |
|
|
2890 |
.................... { |
|
|
2891 |
.................... return(sinh(x)/cosh(x)); |
|
|
2892 |
.................... } |
|
|
2893 |
.................... |
|
|
2894 |
.................... // Overloaded function tanh() for data type - Float64 |
|
|
2895 |
.................... float64 tanh(float64 x) |
|
|
2896 |
.................... { |
|
|
2897 |
.................... return(sinh(x)/cosh(x)); |
|
|
2898 |
.................... } |
|
|
2899 |
.................... #endif |
|
|
2900 |
.................... |
|
|
2901 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2902 |
.................... // float frexp(float x, signed int *exp) |
|
|
2903 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2904 |
.................... // Description : breaks a floating point number into a normalized fraction and an integral |
|
|
2905 |
.................... // power of 2. It stores the integer in the signed int object pointed to by exp. |
|
|
2906 |
.................... // Returns : returns the value x, such that x is a double with magnitude in the interval |
|
|
2907 |
.................... // [1/2,1) or zero, and value equals x times 2 raised to the power *exp.If value is zero, |
|
|
2908 |
.................... // both parts of the result are zero. |
|
|
2909 |
.................... // Date : N/A |
|
|
2910 |
.................... // |
|
|
2911 |
.................... |
|
|
2912 |
.................... #define LOG2 .30102999566398119521 |
|
|
2913 |
.................... float32 frexp(float32 x, signed int8 *exp) |
|
|
2914 |
.................... { |
|
|
2915 |
.................... float32 res; |
|
|
2916 |
.................... int1 sign = 0; |
|
|
2917 |
.................... if(x == 0.0) |
|
|
2918 |
.................... { |
|
|
2919 |
.................... *exp=0; |
|
|
2920 |
.................... return (0.0); |
|
|
2921 |
.................... } |
|
|
2922 |
.................... if(x < 0.0) |
|
|
2923 |
.................... { |
|
|
2924 |
.................... x=-x; |
|
|
2925 |
.................... sign=1; |
|
|
2926 |
.................... } |
|
|
2927 |
.................... if (x > 1.0) |
|
|
2928 |
.................... { |
|
|
2929 |
.................... *exp=(ceil(log10(x)/LOG2)); |
|
|
2930 |
.................... res=x/(pow(2, *exp)); |
|
|
2931 |
.................... if (res == 1) |
|
|
2932 |
.................... { |
|
|
2933 |
.................... *exp=*exp+1; |
|
|
2934 |
.................... res=.5; |
|
|
2935 |
.................... } |
|
|
2936 |
.................... } |
|
|
2937 |
.................... else |
|
|
2938 |
.................... { |
|
|
2939 |
.................... if(x < 0.5) |
|
|
2940 |
.................... { |
|
|
2941 |
.................... *exp=-1; |
|
|
2942 |
.................... res=x*2; |
|
|
2943 |
.................... } |
|
|
2944 |
.................... else |
|
|
2945 |
.................... { |
|
|
2946 |
.................... *exp=0; |
|
|
2947 |
.................... res=x; |
|
|
2948 |
.................... } |
|
|
2949 |
.................... } |
|
|
2950 |
.................... if(sign) |
|
|
2951 |
.................... { |
|
|
2952 |
.................... res=-res; |
|
|
2953 |
.................... } |
|
|
2954 |
.................... return res; |
|
|
2955 |
.................... } |
|
|
2956 |
.................... |
|
|
2957 |
.................... //Overloaded functions for frexp() for PCD |
|
|
2958 |
.................... // Overloaded function frexp() for data type - Float48 |
|
|
2959 |
.................... #if defined(__PCD__) |
|
|
2960 |
.................... float48 frexp(float48 x, signed int8 *exp) |
|
|
2961 |
.................... { |
|
|
2962 |
.................... float48 res; |
|
|
2963 |
.................... int1 sign = 0; |
|
|
2964 |
.................... if(x == 0.0) |
|
|
2965 |
.................... { |
|
|
2966 |
.................... *exp=0; |
|
|
2967 |
.................... return (0.0); |
|
|
2968 |
.................... } |
|
|
2969 |
.................... if(x < 0.0) |
|
|
2970 |
.................... { |
|
|
2971 |
.................... x=-x; |
|
|
2972 |
.................... sign=1; |
|
|
2973 |
.................... } |
|
|
2974 |
.................... if (x > 1.0) |
|
|
2975 |
.................... { |
|
|
2976 |
.................... *exp=(ceil(log10(x)/LOG2)); |
|
|
2977 |
.................... res=x/(pow(2, *exp)); |
|
|
2978 |
.................... if (res == 1) |
|
|
2979 |
.................... { |
|
|
2980 |
.................... *exp=*exp+1; |
|
|
2981 |
.................... res=.5; |
|
|
2982 |
.................... } |
|
|
2983 |
.................... } |
|
|
2984 |
.................... else |
|
|
2985 |
.................... { |
|
|
2986 |
.................... if(x < 0.5) |
|
|
2987 |
.................... { |
|
|
2988 |
.................... *exp=-1; |
|
|
2989 |
.................... res=x*2; |
|
|
2990 |
.................... } |
|
|
2991 |
.................... else |
|
|
2992 |
.................... { |
|
|
2993 |
.................... *exp=0; |
|
|
2994 |
.................... res=x; |
|
|
2995 |
.................... } |
|
|
2996 |
.................... } |
|
|
2997 |
.................... if(sign) |
|
|
2998 |
.................... { |
|
|
2999 |
.................... res=-res; |
|
|
3000 |
.................... } |
|
|
3001 |
.................... return res; |
|
|
3002 |
.................... } |
|
|
3003 |
.................... |
|
|
3004 |
.................... // Overloaded function frexp() for data type - Float64 |
|
|
3005 |
.................... float64 frexp(float64 x, signed int8 *exp) |
|
|
3006 |
.................... { |
|
|
3007 |
.................... float64 res; |
|
|
3008 |
.................... int1 sign = 0; |
|
|
3009 |
.................... if(x == 0.0) |
|
|
3010 |
.................... { |
|
|
3011 |
.................... *exp=0; |
|
|
3012 |
.................... return (0.0); |
|
|
3013 |
.................... } |
|
|
3014 |
.................... if(x < 0.0) |
|
|
3015 |
.................... { |
|
|
3016 |
.................... x=-x; |
|
|
3017 |
.................... sign=1; |
|
|
3018 |
.................... } |
|
|
3019 |
.................... if (x > 1.0) |
|
|
3020 |
.................... { |
|
|
3021 |
.................... *exp=(ceil(log10(x)/LOG2)); |
|
|
3022 |
.................... res=x/(pow(2, *exp)); |
|
|
3023 |
.................... if (res == 1) |
|
|
3024 |
.................... { |
|
|
3025 |
.................... *exp=*exp+1; |
|
|
3026 |
.................... res=.5; |
|
|
3027 |
.................... } |
|
|
3028 |
.................... } |
|
|
3029 |
.................... else |
|
|
3030 |
.................... { |
|
|
3031 |
.................... if(x < 0.5) |
|
|
3032 |
.................... { |
|
|
3033 |
.................... *exp=-1; |
|
|
3034 |
.................... res=x*2; |
|
|
3035 |
.................... } |
|
|
3036 |
.................... else |
|
|
3037 |
.................... { |
|
|
3038 |
.................... *exp=0; |
|
|
3039 |
.................... res=x; |
|
|
3040 |
.................... } |
|
|
3041 |
.................... } |
|
|
3042 |
.................... if(sign) |
|
|
3043 |
.................... { |
|
|
3044 |
.................... res=-res; |
|
|
3045 |
.................... } |
|
|
3046 |
.................... return res; |
|
|
3047 |
.................... } |
|
|
3048 |
.................... #endif |
|
|
3049 |
.................... |
|
|
3050 |
.................... ////////////////////////////////////////////////////////////////////////////// |
|
|
3051 |
.................... // float ldexp(float x, signed int *exp) |
|
|
3052 |
.................... ////////////////////////////////////////////////////////////////////////////// |
|
|
3053 |
.................... // Description : multiplies a floating point number by an integral power of 2. |
|
|
3054 |
.................... // Returns : returns the value of x times 2 raised to the power exp. |
|
|
3055 |
.................... // Date : N/A |
|
|
3056 |
.................... // |
|
|
3057 |
.................... |
|
|
3058 |
.................... float32 ldexp(float32 value, signed int8 exp) |
|
|
3059 |
.................... { |
|
|
3060 |
.................... return (value * pow(2,exp)); |
|
|
3061 |
.................... } |
|
|
3062 |
.................... //Overloaded functions for ldexp() for PCD |
|
|
3063 |
.................... // Overloaded function ldexp() for data type - Float48 |
|
|
3064 |
.................... |
|
|
3065 |
.................... #if defined(__PCD__) |
|
|
3066 |
.................... float48 ldexp(float48 value, signed int8 exp) |
|
|
3067 |
.................... { |
|
|
3068 |
.................... return (value * pow(2,exp)); |
|
|
3069 |
.................... } |
|
|
3070 |
.................... // Overloaded function ldexp() for data type - Float64 |
|
|
3071 |
.................... float64 ldexp(float64 value, signed int8 exp) |
|
|
3072 |
.................... { |
|
|
3073 |
.................... return (value * pow(2,exp)); |
|
|
3074 |
.................... } |
|
|
3075 |
.................... #endif |
|
|
3076 |
.................... |
|
|
3077 |
.................... #endif |
|
|
3078 |
.................... |
|
|
3079 |
.................... |
|
|
3080 |
.................... //Akcelerometr |
|
|
3081 |
.................... #define AK_W 0x38 //adresa akcelerometru zápis |
|
|
3082 |
.................... #define AK_R 0x39 //adresa akcelerometru ètení |
|
|
3083 |
.................... #define AK_XH 0x01 //osa X LSB |
|
|
3084 |
.................... #define AK_XL 0x02 //osa X MSB |
|
|
3085 |
.................... #define AK_YH 0x03 //osa Y LSB |
|
|
3086 |
.................... #define AK_YL 0x04 //osa Y MSB |
|
|
3087 |
.................... #define AK_ZH 0x05 //osa Z LSB |
|
|
3088 |
.................... #define AK_ZL 0x06 //osa Z MSB |
|
|
3089 |
.................... |
|
|
3090 |
.................... //Magnetometr |
|
|
3091 |
.................... #define MAG_W 0x3C //adresa akcelerometru zápis |
|
|
3092 |
.................... #define MAG_R 0x3D //adresa akcelerometru ètení |
|
|
3093 |
.................... #define MAG_XH 0x03 //osa X LSB |
|
|
3094 |
.................... #define MAG_XL 0x04 //osa X MSB |
|
|
3095 |
.................... #define MAG_ZH 0x05 //osa Y LSB |
|
|
3096 |
.................... #define MAG_ZL 0x06 //osa Y MSB |
|
|
3097 |
.................... #define MAG_YH 0x07 //osa Z LSB |
|
|
3098 |
.................... #define MAG_YL 0x08 //osa Z MSB |
|
|
3099 |
.................... |
|
|
3100 |
.................... |
|
|
3101 |
.................... |
|
|
3102 |
.................... |
|
|
3103 |
.................... |
|
|
3104 |
.................... //pøipojení motorù |
|
|
3105 |
.................... //AIN1 - pro vysku slunce |
|
|
3106 |
.................... #define AIN1 PIN_D0 |
|
|
3107 |
.................... #define AIN2 PIN_D1 |
|
|
3108 |
.................... //motor A -cerveny vodic na AOUT1 |
|
|
3109 |
.................... //motor A -modry vodic na Aout2 |
|
|
3110 |
.................... |
|
|
3111 |
.................... //AIN2 - pro azimut |
|
|
3112 |
.................... #define BIN1 PIN_D2 |
|
|
3113 |
.................... #define BIN2 PIN_D3 |
|
|
3114 |
.................... //motor B - èerveny vodic na BOUT2 |
|
|
3115 |
.................... //motor B - modrý vodic na BOUT1 |
|
|
3116 |
.................... |
|
|
3117 |
.................... signed int16 X, Y, Z,AX, AY, AZ; |
|
|
3118 |
.................... |
|
|
3119 |
.................... void setAK (void) //nastaveni akcelerometru |
|
|
3120 |
.................... { |
|
|
3121 |
.................... i2c_start(); |
|
|
3122 |
* |
|
|
3123 |
018D: BSF 20.4 |
|
|
3124 |
018E: MOVF 20,W |
|
|
3125 |
018F: BSF 03.5 |
|
|
3126 |
0190: MOVWF 07 |
|
|
3127 |
0191: NOP |
|
|
3128 |
0192: BCF 03.5 |
|
|
3129 |
0193: BSF 20.3 |
|
|
3130 |
0194: MOVF 20,W |
|
|
3131 |
0195: BSF 03.5 |
|
|
3132 |
0196: MOVWF 07 |
|
|
3133 |
0197: NOP |
|
|
3134 |
0198: BCF 03.5 |
|
|
3135 |
0199: BCF 07.4 |
|
|
3136 |
019A: BCF 20.4 |
|
|
3137 |
019B: MOVF 20,W |
|
|
3138 |
019C: BSF 03.5 |
|
|
3139 |
019D: MOVWF 07 |
|
|
3140 |
019E: NOP |
|
|
3141 |
019F: BCF 03.5 |
|
|
3142 |
01A0: BCF 07.3 |
|
|
3143 |
01A1: BCF 20.3 |
|
|
3144 |
01A2: MOVF 20,W |
|
|
3145 |
01A3: BSF 03.5 |
|
|
3146 |
01A4: MOVWF 07 |
|
|
3147 |
.................... I2C_Write(AK_W); |
|
|
3148 |
01A5: MOVLW 38 |
|
|
3149 |
01A6: BCF 03.5 |
|
|
3150 |
01A7: MOVWF 4E |
|
|
3151 |
01A8: CALL 143 |
|
|
3152 |
.................... I2C_write(0x2A); |
|
|
3153 |
01A9: MOVLW 2A |
|
|
3154 |
01AA: MOVWF 4E |
|
|
3155 |
01AB: CALL 143 |
|
|
3156 |
.................... I2C_write(0x01); //nastaví aktivní stav |
|
|
3157 |
01AC: MOVLW 01 |
|
|
3158 |
01AD: MOVWF 4E |
|
|
3159 |
01AE: CALL 143 |
|
|
3160 |
.................... |
|
|
3161 |
.................... i2c_stop(); |
|
|
3162 |
01AF: BCF 20.4 |
|
|
3163 |
01B0: MOVF 20,W |
|
|
3164 |
01B1: BSF 03.5 |
|
|
3165 |
01B2: MOVWF 07 |
|
|
3166 |
01B3: NOP |
|
|
3167 |
01B4: BCF 03.5 |
|
|
3168 |
01B5: BSF 20.3 |
|
|
3169 |
01B6: MOVF 20,W |
|
|
3170 |
01B7: BSF 03.5 |
|
|
3171 |
01B8: MOVWF 07 |
|
|
3172 |
01B9: BCF 03.5 |
|
|
3173 |
01BA: BTFSS 07.3 |
|
|
3174 |
01BB: GOTO 1BA |
|
|
3175 |
01BC: NOP |
|
|
3176 |
01BD: GOTO 1BE |
|
|
3177 |
01BE: NOP |
|
|
3178 |
01BF: BSF 20.4 |
|
|
3179 |
01C0: MOVF 20,W |
|
|
3180 |
01C1: BSF 03.5 |
|
|
3181 |
01C2: MOVWF 07 |
|
|
3182 |
01C3: NOP |
|
|
3183 |
.................... } |
|
|
3184 |
01C4: BCF 03.5 |
|
|
3185 |
01C5: BCF 0A.3 |
|
|
3186 |
01C6: BSF 0A.4 |
|
|
3187 |
01C7: GOTO 266 (RETURN) |
|
|
3188 |
.................... |
|
|
3189 |
.................... void setmag (void) |
|
|
3190 |
.................... { |
|
|
3191 |
.................... i2c_start(); |
|
|
3192 |
* |
|
|
3193 |
01DC: BSF 20.4 |
|
|
3194 |
01DD: MOVF 20,W |
|
|
3195 |
01DE: BSF 03.5 |
|
|
3196 |
01DF: MOVWF 07 |
|
|
3197 |
01E0: NOP |
|
|
3198 |
01E1: BCF 03.5 |
|
|
3199 |
01E2: BSF 20.3 |
|
|
3200 |
01E3: MOVF 20,W |
|
|
3201 |
01E4: BSF 03.5 |
|
|
3202 |
01E5: MOVWF 07 |
|
|
3203 |
01E6: NOP |
|
|
3204 |
01E7: BCF 03.5 |
|
|
3205 |
01E8: BCF 07.4 |
|
|
3206 |
01E9: BCF 20.4 |
|
|
3207 |
01EA: MOVF 20,W |
|
|
3208 |
01EB: BSF 03.5 |
|
|
3209 |
01EC: MOVWF 07 |
|
|
3210 |
01ED: NOP |
|
|
3211 |
01EE: BCF 03.5 |
|
|
3212 |
01EF: BCF 07.3 |
|
|
3213 |
01F0: BCF 20.3 |
|
|
3214 |
01F1: MOVF 20,W |
|
|
3215 |
01F2: BSF 03.5 |
|
|
3216 |
01F3: MOVWF 07 |
|
|
3217 |
.................... I2C_Write(MAG_W); // W |
|
|
3218 |
01F4: MOVLW 3C |
|
|
3219 |
01F5: BCF 03.5 |
|
|
3220 |
01F6: MOVWF 4E |
|
|
3221 |
01F7: CALL 143 |
|
|
3222 |
.................... I2C_Write(0x00); |
|
|
3223 |
01F8: CLRF 4E |
|
|
3224 |
01F9: CALL 143 |
|
|
3225 |
.................... I2C_Write(0x78); |
|
|
3226 |
01FA: MOVLW 78 |
|
|
3227 |
01FB: MOVWF 4E |
|
|
3228 |
01FC: CALL 143 |
|
|
3229 |
.................... i2c_stop(); |
|
|
3230 |
01FD: BCF 20.4 |
|
|
3231 |
01FE: MOVF 20,W |
|
|
3232 |
01FF: BSF 03.5 |
|
|
3233 |
0200: MOVWF 07 |
|
|
3234 |
0201: NOP |
|
|
3235 |
0202: BCF 03.5 |
|
|
3236 |
0203: BSF 20.3 |
|
|
3237 |
0204: MOVF 20,W |
|
|
3238 |
0205: BSF 03.5 |
|
|
3239 |
0206: MOVWF 07 |
|
|
3240 |
0207: BCF 03.5 |
|
|
3241 |
0208: BTFSS 07.3 |
|
|
3242 |
0209: GOTO 208 |
|
|
3243 |
020A: NOP |
|
|
3244 |
020B: GOTO 20C |
|
|
3245 |
020C: NOP |
|
|
3246 |
020D: BSF 20.4 |
|
|
3247 |
020E: MOVF 20,W |
|
|
3248 |
020F: BSF 03.5 |
|
|
3249 |
0210: MOVWF 07 |
|
|
3250 |
0211: NOP |
|
|
3251 |
.................... Delay_ms(6); |
|
|
3252 |
0212: MOVLW 06 |
|
|
3253 |
0213: BCF 03.5 |
|
|
3254 |
0214: MOVWF 40 |
|
|
3255 |
0215: CALL 1C8 |
|
|
3256 |
.................... |
|
|
3257 |
.................... i2c_start(); |
|
|
3258 |
0216: BSF 20.4 |
|
|
3259 |
0217: MOVF 20,W |
|
|
3260 |
0218: BSF 03.5 |
|
|
3261 |
0219: MOVWF 07 |
|
|
3262 |
021A: NOP |
|
|
3263 |
021B: BCF 03.5 |
|
|
3264 |
021C: BSF 20.3 |
|
|
3265 |
021D: MOVF 20,W |
|
|
3266 |
021E: BSF 03.5 |
|
|
3267 |
021F: MOVWF 07 |
|
|
3268 |
0220: NOP |
|
|
3269 |
0221: BCF 03.5 |
|
|
3270 |
0222: BCF 07.4 |
|
|
3271 |
0223: BCF 20.4 |
|
|
3272 |
0224: MOVF 20,W |
|
|
3273 |
0225: BSF 03.5 |
|
|
3274 |
0226: MOVWF 07 |
|
|
3275 |
0227: NOP |
|
|
3276 |
0228: BCF 03.5 |
|
|
3277 |
0229: BCF 07.3 |
|
|
3278 |
022A: BCF 20.3 |
|
|
3279 |
022B: MOVF 20,W |
|
|
3280 |
022C: BSF 03.5 |
|
|
3281 |
022D: MOVWF 07 |
|
|
3282 |
.................... I2C_Write(MAG_W); // W |
|
|
3283 |
022E: MOVLW 3C |
|
|
3284 |
022F: BCF 03.5 |
|
|
3285 |
0230: MOVWF 4E |
|
|
3286 |
0231: CALL 143 |
|
|
3287 |
.................... I2C_Write(0x01); |
|
|
3288 |
0232: MOVLW 01 |
|
|
3289 |
0233: MOVWF 4E |
|
|
3290 |
0234: CALL 143 |
|
|
3291 |
.................... I2C_Write(0x00); |
|
|
3292 |
0235: CLRF 4E |
|
|
3293 |
0236: CALL 143 |
|
|
3294 |
.................... i2c_stop(); |
|
|
3295 |
0237: BCF 20.4 |
|
|
3296 |
0238: MOVF 20,W |
|
|
3297 |
0239: BSF 03.5 |
|
|
3298 |
023A: MOVWF 07 |
|
|
3299 |
023B: NOP |
|
|
3300 |
023C: BCF 03.5 |
|
|
3301 |
023D: BSF 20.3 |
|
|
3302 |
023E: MOVF 20,W |
|
|
3303 |
023F: BSF 03.5 |
|
|
3304 |
0240: MOVWF 07 |
|
|
3305 |
0241: BCF 03.5 |
|
|
3306 |
0242: BTFSS 07.3 |
|
|
3307 |
0243: GOTO 242 |
|
|
3308 |
0244: NOP |
|
|
3309 |
0245: GOTO 246 |
|
|
3310 |
0246: NOP |
|
|
3311 |
0247: BSF 20.4 |
|
|
3312 |
0248: MOVF 20,W |
|
|
3313 |
0249: BSF 03.5 |
|
|
3314 |
024A: MOVWF 07 |
|
|
3315 |
024B: NOP |
|
|
3316 |
.................... |
|
|
3317 |
.................... Delay_ms(6); |
|
|
3318 |
024C: MOVLW 06 |
|
|
3319 |
024D: BCF 03.5 |
|
|
3320 |
024E: MOVWF 40 |
|
|
3321 |
024F: CALL 1C8 |
|
|
3322 |
.................... |
|
|
3323 |
.................... i2c_start(); |
|
|
3324 |
0250: BSF 20.4 |
|
|
3325 |
0251: MOVF 20,W |
|
|
3326 |
0252: BSF 03.5 |
|
|
3327 |
0253: MOVWF 07 |
|
|
3328 |
0254: NOP |
|
|
3329 |
0255: BCF 03.5 |
|
|
3330 |
0256: BSF 20.3 |
|
|
3331 |
0257: MOVF 20,W |
|
|
3332 |
0258: BSF 03.5 |
|
|
3333 |
0259: MOVWF 07 |
|
|
3334 |
025A: NOP |
|
|
3335 |
025B: BCF 03.5 |
|
|
3336 |
025C: BCF 07.4 |
|
|
3337 |
025D: BCF 20.4 |
|
|
3338 |
025E: MOVF 20,W |
|
|
3339 |
025F: BSF 03.5 |
|
|
3340 |
0260: MOVWF 07 |
|
|
3341 |
0261: NOP |
|
|
3342 |
0262: BCF 03.5 |
|
|
3343 |
0263: BCF 07.3 |
|
|
3344 |
0264: BCF 20.3 |
|
|
3345 |
0265: MOVF 20,W |
|
|
3346 |
0266: BSF 03.5 |
|
|
3347 |
0267: MOVWF 07 |
|
|
3348 |
.................... I2C_Write(MAG_W); // W |
|
|
3349 |
0268: MOVLW 3C |
|
|
3350 |
0269: BCF 03.5 |
|
|
3351 |
026A: MOVWF 4E |
|
|
3352 |
026B: CALL 143 |
|
|
3353 |
.................... I2C_Write(0x02); |
|
|
3354 |
026C: MOVLW 02 |
|
|
3355 |
026D: MOVWF 4E |
|
|
3356 |
026E: CALL 143 |
|
|
3357 |
.................... I2C_Write(0x00); |
|
|
3358 |
026F: CLRF 4E |
|
|
3359 |
0270: CALL 143 |
|
|
3360 |
.................... i2c_stop(); |
|
|
3361 |
0271: BCF 20.4 |
|
|
3362 |
0272: MOVF 20,W |
|
|
3363 |
0273: BSF 03.5 |
|
|
3364 |
0274: MOVWF 07 |
|
|
3365 |
0275: NOP |
|
|
3366 |
0276: BCF 03.5 |
|
|
3367 |
0277: BSF 20.3 |
|
|
3368 |
0278: MOVF 20,W |
|
|
3369 |
0279: BSF 03.5 |
|
|
3370 |
027A: MOVWF 07 |
|
|
3371 |
027B: BCF 03.5 |
|
|
3372 |
027C: BTFSS 07.3 |
|
|
3373 |
027D: GOTO 27C |
|
|
3374 |
027E: NOP |
|
|
3375 |
027F: GOTO 280 |
|
|
3376 |
0280: NOP |
|
|
3377 |
0281: BSF 20.4 |
|
|
3378 |
0282: MOVF 20,W |
|
|
3379 |
0283: BSF 03.5 |
|
|
3380 |
0284: MOVWF 07 |
|
|
3381 |
0285: NOP |
|
|
3382 |
.................... Delay_ms(6); |
|
|
3383 |
0286: MOVLW 06 |
|
|
3384 |
0287: BCF 03.5 |
|
|
3385 |
0288: MOVWF 40 |
|
|
3386 |
0289: CALL 1C8 |
|
|
3387 |
.................... } |
|
|
3388 |
028A: BCF 0A.3 |
|
|
3389 |
028B: BSF 0A.4 |
|
|
3390 |
028C: GOTO 269 (RETURN) |
|
|
3391 |
.................... |
|
|
3392 |
.................... int16 akR (int8 H, int8 L) //vycitani hodnot z akcelerometru |
|
|
3393 |
.................... { |
|
|
3394 |
* |
|
|
3395 |
02D2: CLRF 4A |
|
|
3396 |
02D3: CLRF 4B |
|
|
3397 |
.................... unsigned int8 XL=0,XH=0; |
|
|
3398 |
.................... signed int16 x; |
|
|
3399 |
.................... |
|
|
3400 |
.................... i2c_start(); |
|
|
3401 |
02D4: BSF 20.4 |
|
|
3402 |
02D5: MOVF 20,W |
|
|
3403 |
02D6: BSF 03.5 |
|
|
3404 |
02D7: MOVWF 07 |
|
|
3405 |
02D8: NOP |
|
|
3406 |
02D9: BCF 03.5 |
|
|
3407 |
02DA: BSF 20.3 |
|
|
3408 |
02DB: MOVF 20,W |
|
|
3409 |
02DC: BSF 03.5 |
|
|
3410 |
02DD: MOVWF 07 |
|
|
3411 |
02DE: NOP |
|
|
3412 |
02DF: BCF 03.5 |
|
|
3413 |
02E0: BCF 07.4 |
|
|
3414 |
02E1: BCF 20.4 |
|
|
3415 |
02E2: MOVF 20,W |
|
|
3416 |
02E3: BSF 03.5 |
|
|
3417 |
02E4: MOVWF 07 |
|
|
3418 |
02E5: NOP |
|
|
3419 |
02E6: BCF 03.5 |
|
|
3420 |
02E7: BCF 07.3 |
|
|
3421 |
02E8: BCF 20.3 |
|
|
3422 |
02E9: MOVF 20,W |
|
|
3423 |
02EA: BSF 03.5 |
|
|
3424 |
02EB: MOVWF 07 |
|
|
3425 |
.................... I2C_Write(AK_W); |
|
|
3426 |
02EC: MOVLW 38 |
|
|
3427 |
02ED: BCF 03.5 |
|
|
3428 |
02EE: MOVWF 4E |
|
|
3429 |
02EF: CALL 143 |
|
|
3430 |
.................... I2C_write(H); |
|
|
3431 |
02F0: MOVF 48,W |
|
|
3432 |
02F1: MOVWF 4E |
|
|
3433 |
02F2: CALL 143 |
|
|
3434 |
.................... i2c_start(); |
|
|
3435 |
02F3: BSF 20.4 |
|
|
3436 |
02F4: MOVF 20,W |
|
|
3437 |
02F5: BSF 03.5 |
|
|
3438 |
02F6: MOVWF 07 |
|
|
3439 |
02F7: NOP |
|
|
3440 |
02F8: BCF 03.5 |
|
|
3441 |
02F9: BSF 20.3 |
|
|
3442 |
02FA: MOVF 20,W |
|
|
3443 |
02FB: BSF 03.5 |
|
|
3444 |
02FC: MOVWF 07 |
|
|
3445 |
02FD: NOP |
|
|
3446 |
02FE: BCF 03.5 |
|
|
3447 |
02FF: BTFSS 07.3 |
|
|
3448 |
0300: GOTO 2FF |
|
|
3449 |
0301: BCF 07.4 |
|
|
3450 |
0302: BCF 20.4 |
|
|
3451 |
0303: MOVF 20,W |
|
|
3452 |
0304: BSF 03.5 |
|
|
3453 |
0305: MOVWF 07 |
|
|
3454 |
0306: NOP |
|
|
3455 |
0307: BCF 03.5 |
|
|
3456 |
0308: BCF 07.3 |
|
|
3457 |
0309: BCF 20.3 |
|
|
3458 |
030A: MOVF 20,W |
|
|
3459 |
030B: BSF 03.5 |
|
|
3460 |
030C: MOVWF 07 |
|
|
3461 |
.................... I2C_Write(AK_R); |
|
|
3462 |
030D: MOVLW 39 |
|
|
3463 |
030E: BCF 03.5 |
|
|
3464 |
030F: MOVWF 4E |
|
|
3465 |
0310: CALL 143 |
|
|
3466 |
.................... XH=i2c_read(0); |
|
|
3467 |
0311: CLRF 77 |
|
|
3468 |
0312: CALL 28D |
|
|
3469 |
0313: MOVF 78,W |
|
|
3470 |
0314: MOVWF 4B |
|
|
3471 |
.................... i2c_stop(); |
|
|
3472 |
0315: BCF 20.4 |
|
|
3473 |
0316: MOVF 20,W |
|
|
3474 |
0317: BSF 03.5 |
|
|
3475 |
0318: MOVWF 07 |
|
|
3476 |
0319: NOP |
|
|
3477 |
031A: BCF 03.5 |
|
|
3478 |
031B: BSF 20.3 |
|
|
3479 |
031C: MOVF 20,W |
|
|
3480 |
031D: BSF 03.5 |
|
|
3481 |
031E: MOVWF 07 |
|
|
3482 |
031F: BCF 03.5 |
|
|
3483 |
0320: BTFSS 07.3 |
|
|
3484 |
0321: GOTO 320 |
|
|
3485 |
0322: NOP |
|
|
3486 |
0323: GOTO 324 |
|
|
3487 |
0324: NOP |
|
|
3488 |
0325: BSF 20.4 |
|
|
3489 |
0326: MOVF 20,W |
|
|
3490 |
0327: BSF 03.5 |
|
|
3491 |
0328: MOVWF 07 |
|
|
3492 |
0329: NOP |
|
|
3493 |
.................... |
|
|
3494 |
.................... i2c_start(); |
|
|
3495 |
032A: BCF 03.5 |
|
|
3496 |
032B: BSF 20.4 |
|
|
3497 |
032C: MOVF 20,W |
|
|
3498 |
032D: BSF 03.5 |
|
|
3499 |
032E: MOVWF 07 |
|
|
3500 |
032F: NOP |
|
|
3501 |
0330: BCF 03.5 |
|
|
3502 |
0331: BSF 20.3 |
|
|
3503 |
0332: MOVF 20,W |
|
|
3504 |
0333: BSF 03.5 |
|
|
3505 |
0334: MOVWF 07 |
|
|
3506 |
0335: NOP |
|
|
3507 |
0336: BCF 03.5 |
|
|
3508 |
0337: BCF 07.4 |
|
|
3509 |
0338: BCF 20.4 |
|
|
3510 |
0339: MOVF 20,W |
|
|
3511 |
033A: BSF 03.5 |
|
|
3512 |
033B: MOVWF 07 |
|
|
3513 |
033C: NOP |
|
|
3514 |
033D: BCF 03.5 |
|
|
3515 |
033E: BCF 07.3 |
|
|
3516 |
033F: BCF 20.3 |
|
|
3517 |
0340: MOVF 20,W |
|
|
3518 |
0341: BSF 03.5 |
|
|
3519 |
0342: MOVWF 07 |
|
|
3520 |
.................... I2C_Write(AK_W); |
|
|
3521 |
0343: MOVLW 38 |
|
|
3522 |
0344: BCF 03.5 |
|
|
3523 |
0345: MOVWF 4E |
|
|
3524 |
0346: CALL 143 |
|
|
3525 |
.................... I2C_write(L); |
|
|
3526 |
0347: MOVF 49,W |
|
|
3527 |
0348: MOVWF 4E |
|
|
3528 |
0349: CALL 143 |
|
|
3529 |
.................... i2c_start(); |
|
|
3530 |
034A: BSF 20.4 |
|
|
3531 |
034B: MOVF 20,W |
|
|
3532 |
034C: BSF 03.5 |
|
|
3533 |
034D: MOVWF 07 |
|
|
3534 |
034E: NOP |
|
|
3535 |
034F: BCF 03.5 |
|
|
3536 |
0350: BSF 20.3 |
|
|
3537 |
0351: MOVF 20,W |
|
|
3538 |
0352: BSF 03.5 |
|
|
3539 |
0353: MOVWF 07 |
|
|
3540 |
0354: NOP |
|
|
3541 |
0355: BCF 03.5 |
|
|
3542 |
0356: BTFSS 07.3 |
|
|
3543 |
0357: GOTO 356 |
|
|
3544 |
0358: BCF 07.4 |
|
|
3545 |
0359: BCF 20.4 |
|
|
3546 |
035A: MOVF 20,W |
|
|
3547 |
035B: BSF 03.5 |
|
|
3548 |
035C: MOVWF 07 |
|
|
3549 |
035D: NOP |
|
|
3550 |
035E: BCF 03.5 |
|
|
3551 |
035F: BCF 07.3 |
|
|
3552 |
0360: BCF 20.3 |
|
|
3553 |
0361: MOVF 20,W |
|
|
3554 |
0362: BSF 03.5 |
|
|
3555 |
0363: MOVWF 07 |
|
|
3556 |
.................... I2C_Write(AK_R); |
|
|
3557 |
0364: MOVLW 39 |
|
|
3558 |
0365: BCF 03.5 |
|
|
3559 |
0366: MOVWF 4E |
|
|
3560 |
0367: CALL 143 |
|
|
3561 |
.................... XL=i2c_read(0); |
|
|
3562 |
0368: CLRF 77 |
|
|
3563 |
0369: CALL 28D |
|
|
3564 |
036A: MOVF 78,W |
|
|
3565 |
036B: MOVWF 4A |
|
|
3566 |
.................... i2c_stop(); |
|
|
3567 |
036C: BCF 20.4 |
|
|
3568 |
036D: MOVF 20,W |
|
|
3569 |
036E: BSF 03.5 |
|
|
3570 |
036F: MOVWF 07 |
|
|
3571 |
0370: NOP |
|
|
3572 |
0371: BCF 03.5 |
|
|
3573 |
0372: BSF 20.3 |
|
|
3574 |
0373: MOVF 20,W |
|
|
3575 |
0374: BSF 03.5 |
|
|
3576 |
0375: MOVWF 07 |
|
|
3577 |
0376: BCF 03.5 |
|
|
3578 |
0377: BTFSS 07.3 |
|
|
3579 |
0378: GOTO 377 |
|
|
3580 |
0379: NOP |
|
|
3581 |
037A: GOTO 37B |
|
|
3582 |
037B: NOP |
|
|
3583 |
037C: BSF 20.4 |
|
|
3584 |
037D: MOVF 20,W |
|
|
3585 |
037E: BSF 03.5 |
|
|
3586 |
037F: MOVWF 07 |
|
|
3587 |
0380: NOP |
|
|
3588 |
.................... |
|
|
3589 |
.................... x = (((unsigned int16) XH << 8) + XL ); //prevod na 16bit hodnotu |
|
|
3590 |
0381: BCF 03.5 |
|
|
3591 |
0382: CLRF 4F |
|
|
3592 |
0383: MOVF 4B,W |
|
|
3593 |
0384: MOVWF 4E |
|
|
3594 |
0385: MOVWF 4F |
|
|
3595 |
0386: CLRF 4E |
|
|
3596 |
0387: MOVF 4A,W |
|
|
3597 |
0388: ADDWF 4E,W |
|
|
3598 |
0389: MOVWF 78 |
|
|
3599 |
038A: MOVF 4F,W |
|
|
3600 |
038B: MOVWF 7A |
|
|
3601 |
038C: BTFSC 03.0 |
|
|
3602 |
038D: INCF 7A,F |
|
|
3603 |
038E: MOVF 78,W |
|
|
3604 |
038F: MOVWF 4C |
|
|
3605 |
0390: MOVF 7A,W |
|
|
3606 |
0391: MOVWF 4D |
|
|
3607 |
.................... x=x/4; |
|
|
3608 |
0392: MOVF 4D,W |
|
|
3609 |
0393: MOVWF 4F |
|
|
3610 |
0394: MOVF 4C,W |
|
|
3611 |
0395: MOVWF 4E |
|
|
3612 |
0396: CLRF 51 |
|
|
3613 |
0397: MOVLW 04 |
|
|
3614 |
0398: MOVWF 50 |
|
|
3615 |
* |
|
|
3616 |
03D6: MOVF 79,W |
|
|
3617 |
03D7: MOVWF 4D |
|
|
3618 |
03D8: MOVF 78,W |
|
|
3619 |
03D9: MOVWF 4C |
|
|
3620 |
.................... |
|
|
3621 |
.................... return x; |
|
|
3622 |
03DA: MOVF 4C,W |
|
|
3623 |
03DB: MOVWF 78 |
|
|
3624 |
03DC: MOVF 4D,W |
|
|
3625 |
03DD: MOVWF 79 |
|
|
3626 |
.................... } |
|
|
3627 |
03DE: RETURN |
|
|
3628 |
.................... |
|
|
3629 |
.................... int16 magR (int8 H, int8 L) //vycitani hodnot z akcelerometru |
|
|
3630 |
.................... { |
|
|
3631 |
* |
|
|
3632 |
0E44: CLRF 4A |
|
|
3633 |
0E45: CLRF 4B |
|
|
3634 |
.................... unsigned int8 XL=0,XH=0; |
|
|
3635 |
.................... signed int16 x; |
|
|
3636 |
.................... |
|
|
3637 |
.................... i2c_start(); |
|
|
3638 |
0E46: BSF 20.4 |
|
|
3639 |
0E47: MOVF 20,W |
|
|
3640 |
0E48: BSF 03.5 |
|
|
3641 |
0E49: MOVWF 07 |
|
|
3642 |
0E4A: NOP |
|
|
3643 |
0E4B: BCF 03.5 |
|
|
3644 |
0E4C: BSF 20.3 |
|
|
3645 |
0E4D: MOVF 20,W |
|
|
3646 |
0E4E: BSF 03.5 |
|
|
3647 |
0E4F: MOVWF 07 |
|
|
3648 |
0E50: NOP |
|
|
3649 |
0E51: BCF 03.5 |
|
|
3650 |
0E52: BCF 07.4 |
|
|
3651 |
0E53: BCF 20.4 |
|
|
3652 |
0E54: MOVF 20,W |
|
|
3653 |
0E55: BSF 03.5 |
|
|
3654 |
0E56: MOVWF 07 |
|
|
3655 |
0E57: NOP |
|
|
3656 |
0E58: BCF 03.5 |
|
|
3657 |
0E59: BCF 07.3 |
|
|
3658 |
0E5A: BCF 20.3 |
|
|
3659 |
0E5B: MOVF 20,W |
|
|
3660 |
0E5C: BSF 03.5 |
|
|
3661 |
0E5D: MOVWF 07 |
|
|
3662 |
.................... I2C_Write(MAG_W); |
|
|
3663 |
0E5E: MOVLW 3C |
|
|
3664 |
0E5F: BCF 03.5 |
|
|
3665 |
0E60: MOVWF 4E |
|
|
3666 |
0E61: BCF 0A.3 |
|
|
3667 |
0E62: CALL 143 |
|
|
3668 |
0E63: BSF 0A.3 |
|
|
3669 |
.................... I2C_write(H); |
|
|
3670 |
0E64: MOVF 48,W |
|
|
3671 |
0E65: MOVWF 4E |
|
|
3672 |
0E66: BCF 0A.3 |
|
|
3673 |
0E67: CALL 143 |
|
|
3674 |
0E68: BSF 0A.3 |
|
|
3675 |
.................... i2c_start(); |
|
|
3676 |
0E69: BSF 20.4 |
|
|
3677 |
0E6A: MOVF 20,W |
|
|
3678 |
0E6B: BSF 03.5 |
|
|
3679 |
0E6C: MOVWF 07 |
|
|
3680 |
0E6D: NOP |
|
|
3681 |
0E6E: BCF 03.5 |
|
|
3682 |
0E6F: BSF 20.3 |
|
|
3683 |
0E70: MOVF 20,W |
|
|
3684 |
0E71: BSF 03.5 |
|
|
3685 |
0E72: MOVWF 07 |
|
|
3686 |
0E73: NOP |
|
|
3687 |
0E74: BCF 03.5 |
|
|
3688 |
0E75: BTFSS 07.3 |
|
|
3689 |
0E76: GOTO 675 |
|
|
3690 |
0E77: BCF 07.4 |
|
|
3691 |
0E78: BCF 20.4 |
|
|
3692 |
0E79: MOVF 20,W |
|
|
3693 |
0E7A: BSF 03.5 |
|
|
3694 |
0E7B: MOVWF 07 |
|
|
3695 |
0E7C: NOP |
|
|
3696 |
0E7D: BCF 03.5 |
|
|
3697 |
0E7E: BCF 07.3 |
|
|
3698 |
0E7F: BCF 20.3 |
|
|
3699 |
0E80: MOVF 20,W |
|
|
3700 |
0E81: BSF 03.5 |
|
|
3701 |
0E82: MOVWF 07 |
|
|
3702 |
.................... I2C_Write(MAG_R); |
|
|
3703 |
0E83: MOVLW 3D |
|
|
3704 |
0E84: BCF 03.5 |
|
|
3705 |
0E85: MOVWF 4E |
|
|
3706 |
0E86: BCF 0A.3 |
|
|
3707 |
0E87: CALL 143 |
|
|
3708 |
0E88: BSF 0A.3 |
|
|
3709 |
.................... XH=i2c_read(0); |
|
|
3710 |
0E89: CLRF 77 |
|
|
3711 |
0E8A: BCF 0A.3 |
|
|
3712 |
0E8B: CALL 28D |
|
|
3713 |
0E8C: BSF 0A.3 |
|
|
3714 |
0E8D: MOVF 78,W |
|
|
3715 |
0E8E: MOVWF 4B |
|
|
3716 |
.................... i2c_stop(); |
|
|
3717 |
0E8F: BCF 20.4 |
|
|
3718 |
0E90: MOVF 20,W |
|
|
3719 |
0E91: BSF 03.5 |
|
|
3720 |
0E92: MOVWF 07 |
|
|
3721 |
0E93: NOP |
|
|
3722 |
0E94: BCF 03.5 |
|
|
3723 |
0E95: BSF 20.3 |
|
|
3724 |
0E96: MOVF 20,W |
|
|
3725 |
0E97: BSF 03.5 |
|
|
3726 |
0E98: MOVWF 07 |
|
|
3727 |
0E99: BCF 03.5 |
|
|
3728 |
0E9A: BTFSS 07.3 |
|
|
3729 |
0E9B: GOTO 69A |
|
|
3730 |
0E9C: NOP |
|
|
3731 |
0E9D: GOTO 69E |
|
|
3732 |
0E9E: NOP |
|
|
3733 |
0E9F: BSF 20.4 |
|
|
3734 |
0EA0: MOVF 20,W |
|
|
3735 |
0EA1: BSF 03.5 |
|
|
3736 |
0EA2: MOVWF 07 |
|
|
3737 |
0EA3: NOP |
|
|
3738 |
.................... |
|
|
3739 |
.................... i2c_start(); |
|
|
3740 |
0EA4: BCF 03.5 |
|
|
3741 |
0EA5: BSF 20.4 |
|
|
3742 |
0EA6: MOVF 20,W |
|
|
3743 |
0EA7: BSF 03.5 |
|
|
3744 |
0EA8: MOVWF 07 |
|
|
3745 |
0EA9: NOP |
|
|
3746 |
0EAA: BCF 03.5 |
|
|
3747 |
0EAB: BSF 20.3 |
|
|
3748 |
0EAC: MOVF 20,W |
|
|
3749 |
0EAD: BSF 03.5 |
|
|
3750 |
0EAE: MOVWF 07 |
|
|
3751 |
0EAF: NOP |
|
|
3752 |
0EB0: BCF 03.5 |
|
|
3753 |
0EB1: BCF 07.4 |
|
|
3754 |
0EB2: BCF 20.4 |
|
|
3755 |
0EB3: MOVF 20,W |
|
|
3756 |
0EB4: BSF 03.5 |
|
|
3757 |
0EB5: MOVWF 07 |
|
|
3758 |
0EB6: NOP |
|
|
3759 |
0EB7: BCF 03.5 |
|
|
3760 |
0EB8: BCF 07.3 |
|
|
3761 |
0EB9: BCF 20.3 |
|
|
3762 |
0EBA: MOVF 20,W |
|
|
3763 |
0EBB: BSF 03.5 |
|
|
3764 |
0EBC: MOVWF 07 |
|
|
3765 |
.................... I2C_Write(MAG_W); |
|
|
3766 |
0EBD: MOVLW 3C |
|
|
3767 |
0EBE: BCF 03.5 |
|
|
3768 |
0EBF: MOVWF 4E |
|
|
3769 |
0EC0: BCF 0A.3 |
|
|
3770 |
0EC1: CALL 143 |
|
|
3771 |
0EC2: BSF 0A.3 |
|
|
3772 |
.................... I2C_write(L); |
|
|
3773 |
0EC3: MOVF 49,W |
|
|
3774 |
0EC4: MOVWF 4E |
|
|
3775 |
0EC5: BCF 0A.3 |
|
|
3776 |
0EC6: CALL 143 |
|
|
3777 |
0EC7: BSF 0A.3 |
|
|
3778 |
.................... i2c_start(); |
|
|
3779 |
0EC8: BSF 20.4 |
|
|
3780 |
0EC9: MOVF 20,W |
|
|
3781 |
0ECA: BSF 03.5 |
|
|
3782 |
0ECB: MOVWF 07 |
|
|
3783 |
0ECC: NOP |
|
|
3784 |
0ECD: BCF 03.5 |
|
|
3785 |
0ECE: BSF 20.3 |
|
|
3786 |
0ECF: MOVF 20,W |
|
|
3787 |
0ED0: BSF 03.5 |
|
|
3788 |
0ED1: MOVWF 07 |
|
|
3789 |
0ED2: NOP |
|
|
3790 |
0ED3: BCF 03.5 |
|
|
3791 |
0ED4: BTFSS 07.3 |
|
|
3792 |
0ED5: GOTO 6D4 |
|
|
3793 |
0ED6: BCF 07.4 |
|
|
3794 |
0ED7: BCF 20.4 |
|
|
3795 |
0ED8: MOVF 20,W |
|
|
3796 |
0ED9: BSF 03.5 |
|
|
3797 |
0EDA: MOVWF 07 |
|
|
3798 |
0EDB: NOP |
|
|
3799 |
0EDC: BCF 03.5 |
|
|
3800 |
0EDD: BCF 07.3 |
|
|
3801 |
0EDE: BCF 20.3 |
|
|
3802 |
0EDF: MOVF 20,W |
|
|
3803 |
0EE0: BSF 03.5 |
|
|
3804 |
0EE1: MOVWF 07 |
|
|
3805 |
.................... I2C_Write(MAG_R); |
|
|
3806 |
0EE2: MOVLW 3D |
|
|
3807 |
0EE3: BCF 03.5 |
|
|
3808 |
0EE4: MOVWF 4E |
|
|
3809 |
0EE5: BCF 0A.3 |
|
|
3810 |
0EE6: CALL 143 |
|
|
3811 |
0EE7: BSF 0A.3 |
|
|
3812 |
.................... XL=i2c_read(0); |
|
|
3813 |
0EE8: CLRF 77 |
|
|
3814 |
0EE9: BCF 0A.3 |
|
|
3815 |
0EEA: CALL 28D |
|
|
3816 |
0EEB: BSF 0A.3 |
|
|
3817 |
0EEC: MOVF 78,W |
|
|
3818 |
0EED: MOVWF 4A |
|
|
3819 |
.................... i2c_stop(); |
|
|
3820 |
0EEE: BCF 20.4 |
|
|
3821 |
0EEF: MOVF 20,W |
|
|
3822 |
0EF0: BSF 03.5 |
|
|
3823 |
0EF1: MOVWF 07 |
|
|
3824 |
0EF2: NOP |
|
|
3825 |
0EF3: BCF 03.5 |
|
|
3826 |
0EF4: BSF 20.3 |
|
|
3827 |
0EF5: MOVF 20,W |
|
|
3828 |
0EF6: BSF 03.5 |
|
|
3829 |
0EF7: MOVWF 07 |
|
|
3830 |
0EF8: BCF 03.5 |
|
|
3831 |
0EF9: BTFSS 07.3 |
|
|
3832 |
0EFA: GOTO 6F9 |
|
|
3833 |
0EFB: NOP |
|
|
3834 |
0EFC: GOTO 6FD |
|
|
3835 |
0EFD: NOP |
|
|
3836 |
0EFE: BSF 20.4 |
|
|
3837 |
0EFF: MOVF 20,W |
|
|
3838 |
0F00: BSF 03.5 |
|
|
3839 |
0F01: MOVWF 07 |
|
|
3840 |
0F02: NOP |
|
|
3841 |
.................... |
|
|
3842 |
.................... x = (((unsigned int16) XH << 8) + XL ); |
|
|
3843 |
0F03: BCF 03.5 |
|
|
3844 |
0F04: CLRF 4F |
|
|
3845 |
0F05: MOVF 4B,W |
|
|
3846 |
0F06: MOVWF 4E |
|
|
3847 |
0F07: MOVWF 4F |
|
|
3848 |
0F08: CLRF 4E |
|
|
3849 |
0F09: MOVF 4A,W |
|
|
3850 |
0F0A: ADDWF 4E,W |
|
|
3851 |
0F0B: MOVWF 78 |
|
|
3852 |
0F0C: MOVF 4F,W |
|
|
3853 |
0F0D: MOVWF 7A |
|
|
3854 |
0F0E: BTFSC 03.0 |
|
|
3855 |
0F0F: INCF 7A,F |
|
|
3856 |
0F10: MOVF 78,W |
|
|
3857 |
0F11: MOVWF 4C |
|
|
3858 |
0F12: MOVF 7A,W |
|
|
3859 |
0F13: MOVWF 4D |
|
|
3860 |
.................... |
|
|
3861 |
.................... |
|
|
3862 |
.................... return x; |
|
|
3863 |
0F14: MOVF 4C,W |
|
|
3864 |
0F15: MOVWF 78 |
|
|
3865 |
0F16: MOVF 4D,W |
|
|
3866 |
0F17: MOVWF 79 |
|
|
3867 |
.................... } |
|
|
3868 |
0F18: RETURN |
|
|
3869 |
.................... |
|
|
3870 |
.................... float vyska (void) //vypocet aktualni vysky panelu |
|
|
3871 |
.................... { |
|
|
3872 |
.................... printf("Akcelerometr5: \r\n",); |
|
|
3873 |
* |
|
|
3874 |
0B85: MOVLW 04 |
|
|
3875 |
0B86: BSF 03.6 |
|
|
3876 |
0B87: MOVWF 0D |
|
|
3877 |
0B88: MOVLW 00 |
|
|
3878 |
0B89: MOVWF 0F |
|
|
3879 |
0B8A: BCF 0A.3 |
|
|
3880 |
0B8B: BCF 03.6 |
|
|
3881 |
0B8C: CALL 0DA |
|
|
3882 |
0B8D: BSF 0A.3 |
|
|
3883 |
.................... |
|
|
3884 |
.................... X= akR (AK_XH, AK_XL); |
|
|
3885 |
0B8E: MOVLW 01 |
|
|
3886 |
0B8F: MOVWF 48 |
|
|
3887 |
0B90: MOVLW 02 |
|
|
3888 |
0B91: MOVWF 49 |
|
|
3889 |
0B92: BCF 0A.3 |
|
|
3890 |
0B93: CALL 2D2 |
|
|
3891 |
0B94: BSF 0A.3 |
|
|
3892 |
0B95: MOVF 79,W |
|
|
3893 |
0B96: MOVWF 22 |
|
|
3894 |
0B97: MOVF 78,W |
|
|
3895 |
0B98: MOVWF 21 |
|
|
3896 |
.................... Y= akR (AK_YH, AK_YL); |
|
|
3897 |
0B99: MOVLW 03 |
|
|
3898 |
0B9A: MOVWF 48 |
|
|
3899 |
0B9B: MOVLW 04 |
|
|
3900 |
0B9C: MOVWF 49 |
|
|
3901 |
0B9D: BCF 0A.3 |
|
|
3902 |
0B9E: CALL 2D2 |
|
|
3903 |
0B9F: BSF 0A.3 |
|
|
3904 |
0BA0: MOVF 79,W |
|
|
3905 |
0BA1: MOVWF 24 |
|
|
3906 |
0BA2: MOVF 78,W |
|
|
3907 |
0BA3: MOVWF 23 |
|
|
3908 |
.................... Z= akR (AK_ZH, AK_ZL); |
|
|
3909 |
0BA4: MOVLW 05 |
|
|
3910 |
0BA5: MOVWF 48 |
|
|
3911 |
0BA6: MOVLW 06 |
|
|
3912 |
0BA7: MOVWF 49 |
|
|
3913 |
0BA8: BCF 0A.3 |
|
|
3914 |
0BA9: CALL 2D2 |
|
|
3915 |
0BAA: BSF 0A.3 |
|
|
3916 |
0BAB: MOVF 79,W |
|
|
3917 |
0BAC: MOVWF 26 |
|
|
3918 |
0BAD: MOVF 78,W |
|
|
3919 |
0BAE: MOVWF 25 |
|
|
3920 |
.................... |
|
|
3921 |
.................... AX=abs(X); |
|
|
3922 |
0BAF: MOVF 22,W |
|
|
3923 |
0BB0: MOVWF 7A |
|
|
3924 |
0BB1: MOVF 21,W |
|
|
3925 |
0BB2: BTFSS 22.7 |
|
|
3926 |
0BB3: GOTO 3BD |
|
|
3927 |
0BB4: MOVF 21,W |
|
|
3928 |
0BB5: SUBLW 00 |
|
|
3929 |
0BB6: MOVWF 77 |
|
|
3930 |
0BB7: CLRF 7A |
|
|
3931 |
0BB8: MOVF 22,W |
|
|
3932 |
0BB9: BTFSS 03.0 |
|
|
3933 |
0BBA: INCFSZ 22,W |
|
|
3934 |
0BBB: SUBWF 7A,F |
|
|
3935 |
0BBC: MOVF 77,W |
|
|
3936 |
0BBD: MOVWF 27 |
|
|
3937 |
0BBE: MOVF 7A,W |
|
|
3938 |
0BBF: MOVWF 28 |
|
|
3939 |
.................... AY=abs(Y)+250; |
|
|
3940 |
0BC0: MOVF 24,W |
|
|
3941 |
0BC1: MOVWF 7A |
|
|
3942 |
0BC2: MOVF 23,W |
|
|
3943 |
0BC3: BTFSS 24.7 |
|
|
3944 |
0BC4: GOTO 3CE |
|
|
3945 |
0BC5: MOVF 23,W |
|
|
3946 |
0BC6: SUBLW 00 |
|
|
3947 |
0BC7: MOVWF 77 |
|
|
3948 |
0BC8: CLRF 7A |
|
|
3949 |
0BC9: MOVF 24,W |
|
|
3950 |
0BCA: BTFSS 03.0 |
|
|
3951 |
0BCB: INCFSZ 24,W |
|
|
3952 |
0BCC: SUBWF 7A,F |
|
|
3953 |
0BCD: MOVF 77,W |
|
|
3954 |
0BCE: MOVWF 48 |
|
|
3955 |
0BCF: MOVLW FA |
|
|
3956 |
0BD0: ADDWF 48,W |
|
|
3957 |
0BD1: MOVWF 29 |
|
|
3958 |
0BD2: MOVF 7A,W |
|
|
3959 |
0BD3: MOVWF 2A |
|
|
3960 |
0BD4: BTFSC 03.0 |
|
|
3961 |
0BD5: INCF 2A,F |
|
|
3962 |
.................... AZ=abs(Z)+250; |
|
|
3963 |
0BD6: MOVF 26,W |
|
|
3964 |
0BD7: MOVWF 7A |
|
|
3965 |
0BD8: MOVF 25,W |
|
|
3966 |
0BD9: BTFSS 26.7 |
|
|
3967 |
0BDA: GOTO 3E4 |
|
|
3968 |
0BDB: MOVF 25,W |
|
|
3969 |
0BDC: SUBLW 00 |
|
|
3970 |
0BDD: MOVWF 77 |
|
|
3971 |
0BDE: CLRF 7A |
|
|
3972 |
0BDF: MOVF 26,W |
|
|
3973 |
0BE0: BTFSS 03.0 |
|
|
3974 |
0BE1: INCFSZ 26,W |
|
|
3975 |
0BE2: SUBWF 7A,F |
|
|
3976 |
0BE3: MOVF 77,W |
|
|
3977 |
0BE4: MOVWF 48 |
|
|
3978 |
0BE5: MOVLW FA |
|
|
3979 |
0BE6: ADDWF 48,W |
|
|
3980 |
0BE7: MOVWF 2B |
|
|
3981 |
0BE8: MOVF 7A,W |
|
|
3982 |
0BE9: MOVWF 2C |
|
|
3983 |
0BEA: BTFSC 03.0 |
|
|
3984 |
0BEB: INCF 2C,F |
|
|
3985 |
.................... |
|
|
3986 |
.................... float a, b; |
|
|
3987 |
.................... a=(float)Y/Z; |
|
|
3988 |
0BEC: MOVF 24,W |
|
|
3989 |
0BED: MOVWF 4D |
|
|
3990 |
0BEE: MOVF 23,W |
|
|
3991 |
0BEF: MOVWF 4C |
|
|
3992 |
0BF0: BCF 0A.3 |
|
|
3993 |
0BF1: CALL 3DF |
|
|
3994 |
0BF2: BSF 0A.3 |
|
|
3995 |
0BF3: MOVF 77,W |
|
|
3996 |
0BF4: MOVWF 48 |
|
|
3997 |
0BF5: MOVF 78,W |
|
|
3998 |
0BF6: MOVWF 49 |
|
|
3999 |
0BF7: MOVF 79,W |
|
|
4000 |
0BF8: MOVWF 4A |
|
|
4001 |
0BF9: MOVF 7A,W |
|
|
4002 |
0BFA: MOVWF 4B |
|
|
4003 |
0BFB: MOVF 26,W |
|
|
4004 |
0BFC: MOVWF 4D |
|
|
4005 |
0BFD: MOVF 25,W |
|
|
4006 |
0BFE: MOVWF 4C |
|
|
4007 |
0BFF: BCF 0A.3 |
|
|
4008 |
0C00: CALL 3DF |
|
|
4009 |
0C01: BSF 0A.3 |
|
|
4010 |
0C02: MOVF 4B,W |
|
|
4011 |
0C03: MOVWF 60 |
|
|
4012 |
0C04: MOVF 4A,W |
|
|
4013 |
0C05: MOVWF 5F |
|
|
4014 |
0C06: MOVF 49,W |
|
|
4015 |
0C07: MOVWF 5E |
|
|
4016 |
0C08: MOVF 48,W |
|
|
4017 |
0C09: MOVWF 5D |
|
|
4018 |
0C0A: MOVF 7A,W |
|
|
4019 |
0C0B: MOVWF 64 |
|
|
4020 |
0C0C: MOVF 79,W |
|
|
4021 |
0C0D: MOVWF 63 |
|
|
4022 |
0C0E: MOVF 78,W |
|
|
4023 |
0C0F: MOVWF 62 |
|
|
4024 |
0C10: MOVF 77,W |
|
|
4025 |
0C11: MOVWF 61 |
|
|
4026 |
0C12: BCF 0A.3 |
|
|
4027 |
0C13: CALL 404 |
|
|
4028 |
0C14: BSF 0A.3 |
|
|
4029 |
0C15: MOVF 7A,W |
|
|
4030 |
0C16: MOVWF 43 |
|
|
4031 |
0C17: MOVF 79,W |
|
|
4032 |
0C18: MOVWF 42 |
|
|
4033 |
0C19: MOVF 78,W |
|
|
4034 |
0C1A: MOVWF 41 |
|
|
4035 |
0C1B: MOVF 77,W |
|
|
4036 |
0C1C: MOVWF 40 |
|
|
4037 |
.................... b=atan(a); |
|
|
4038 |
0C1D: MOVF 43,W |
|
|
4039 |
0C1E: MOVWF 4B |
|
|
4040 |
0C1F: MOVF 42,W |
|
|
4041 |
0C20: MOVWF 4A |
|
|
4042 |
0C21: MOVF 41,W |
|
|
4043 |
0C22: MOVWF 49 |
|
|
4044 |
0C23: MOVF 40,W |
|
|
4045 |
0C24: MOVWF 48 |
|
|
4046 |
0C25: CALL 000 |
|
|
4047 |
0C26: MOVF 7A,W |
|
|
4048 |
0C27: MOVWF 47 |
|
|
4049 |
0C28: MOVF 79,W |
|
|
4050 |
0C29: MOVWF 46 |
|
|
4051 |
0C2A: MOVF 78,W |
|
|
4052 |
0C2B: MOVWF 45 |
|
|
4053 |
0C2C: MOVF 77,W |
|
|
4054 |
0C2D: MOVWF 44 |
|
|
4055 |
.................... b = (b/3.14)*180; |
|
|
4056 |
0C2E: MOVF 47,W |
|
|
4057 |
0C2F: MOVWF 60 |
|
|
4058 |
0C30: MOVF 46,W |
|
|
4059 |
0C31: MOVWF 5F |
|
|
4060 |
0C32: MOVF 45,W |
|
|
4061 |
0C33: MOVWF 5E |
|
|
4062 |
0C34: MOVF 44,W |
|
|
4063 |
0C35: MOVWF 5D |
|
|
4064 |
0C36: MOVLW C3 |
|
|
4065 |
0C37: MOVWF 64 |
|
|
4066 |
0C38: MOVLW F5 |
|
|
4067 |
0C39: MOVWF 63 |
|
|
4068 |
0C3A: MOVLW 48 |
|
|
4069 |
0C3B: MOVWF 62 |
|
|
4070 |
0C3C: MOVLW 80 |
|
|
4071 |
0C3D: MOVWF 61 |
|
|
4072 |
0C3E: BCF 0A.3 |
|
|
4073 |
0C3F: CALL 404 |
|
|
4074 |
0C40: BSF 0A.3 |
|
|
4075 |
0C41: MOVF 77,W |
|
|
4076 |
0C42: MOVWF 48 |
|
|
4077 |
0C43: MOVF 78,W |
|
|
4078 |
0C44: MOVWF 49 |
|
|
4079 |
0C45: MOVF 79,W |
|
|
4080 |
0C46: MOVWF 4A |
|
|
4081 |
0C47: MOVF 7A,W |
|
|
4082 |
0C48: MOVWF 4B |
|
|
4083 |
0C49: MOVWF 60 |
|
|
4084 |
0C4A: MOVF 79,W |
|
|
4085 |
0C4B: MOVWF 5F |
|
|
4086 |
0C4C: MOVF 78,W |
|
|
4087 |
0C4D: MOVWF 5E |
|
|
4088 |
0C4E: MOVF 77,W |
|
|
4089 |
0C4F: MOVWF 5D |
|
|
4090 |
0C50: CLRF 64 |
|
|
4091 |
0C51: CLRF 63 |
|
|
4092 |
0C52: MOVLW 34 |
|
|
4093 |
0C53: MOVWF 62 |
|
|
4094 |
0C54: MOVLW 86 |
|
|
4095 |
0C55: MOVWF 61 |
|
|
4096 |
0C56: BCF 0A.3 |
|
|
4097 |
0C57: CALL 50D |
|
|
4098 |
0C58: BSF 0A.3 |
|
|
4099 |
0C59: MOVF 7A,W |
|
|
4100 |
0C5A: MOVWF 47 |
|
|
4101 |
0C5B: MOVF 79,W |
|
|
4102 |
0C5C: MOVWF 46 |
|
|
4103 |
0C5D: MOVF 78,W |
|
|
4104 |
0C5E: MOVWF 45 |
|
|
4105 |
0C5F: MOVF 77,W |
|
|
4106 |
0C60: MOVWF 44 |
|
|
4107 |
.................... b=abs(b); |
|
|
4108 |
0C61: MOVF 44,W |
|
|
4109 |
0C62: MOVWF 77 |
|
|
4110 |
0C63: MOVF 45,W |
|
|
4111 |
0C64: MOVWF 78 |
|
|
4112 |
0C65: MOVF 46,W |
|
|
4113 |
0C66: MOVWF 79 |
|
|
4114 |
0C67: MOVF 47,W |
|
|
4115 |
0C68: MOVWF 7A |
|
|
4116 |
0C69: BCF 78.7 |
|
|
4117 |
0C6A: MOVF 47,W |
|
|
4118 |
0C6B: MOVWF 47 |
|
|
4119 |
0C6C: MOVF 46,W |
|
|
4120 |
0C6D: MOVWF 46 |
|
|
4121 |
0C6E: MOVF 78,W |
|
|
4122 |
0C6F: MOVWF 45 |
|
|
4123 |
0C70: MOVF 44,W |
|
|
4124 |
0C71: MOVWF 44 |
|
|
4125 |
.................... |
|
|
4126 |
.................... if(((AX>AY) || (AX>AZ))) //indikace prevraceni panelu |
|
|
4127 |
0C72: BTFSS 2A.7 |
|
|
4128 |
0C73: GOTO 477 |
|
|
4129 |
0C74: BTFSS 28.7 |
|
|
4130 |
0C75: GOTO 494 |
|
|
4131 |
0C76: GOTO 479 |
|
|
4132 |
0C77: BTFSC 28.7 |
|
|
4133 |
0C78: GOTO 483 |
|
|
4134 |
0C79: MOVF 2A,W |
|
|
4135 |
0C7A: SUBWF 28,W |
|
|
4136 |
0C7B: BTFSS 03.0 |
|
|
4137 |
0C7C: GOTO 483 |
|
|
4138 |
0C7D: BTFSS 03.2 |
|
|
4139 |
0C7E: GOTO 494 |
|
|
4140 |
0C7F: MOVF 27,W |
|
|
4141 |
0C80: SUBWF 29,W |
|
|
4142 |
0C81: BTFSS 03.0 |
|
|
4143 |
0C82: GOTO 494 |
|
|
4144 |
0C83: BTFSS 2C.7 |
|
|
4145 |
0C84: GOTO 488 |
|
|
4146 |
0C85: BTFSS 28.7 |
|
|
4147 |
0C86: GOTO 494 |
|
|
4148 |
0C87: GOTO 48A |
|
|
4149 |
0C88: BTFSC 28.7 |
|
|
4150 |
0C89: GOTO 4BD |
|
|
4151 |
0C8A: MOVF 2C,W |
|
|
4152 |
0C8B: SUBWF 28,W |
|
|
4153 |
0C8C: BTFSS 03.0 |
|
|
4154 |
0C8D: GOTO 4BD |
|
|
4155 |
0C8E: BTFSS 03.2 |
|
|
4156 |
0C8F: GOTO 494 |
|
|
4157 |
0C90: MOVF 27,W |
|
|
4158 |
0C91: SUBWF 2B,W |
|
|
4159 |
0C92: BTFSC 03.0 |
|
|
4160 |
0C93: GOTO 4BD |
|
|
4161 |
.................... { |
|
|
4162 |
.................... printf("Prevracený panel)\r\n", ); |
|
|
4163 |
0C94: MOVLW 0E |
|
|
4164 |
0C95: BSF 03.6 |
|
|
4165 |
0C96: MOVWF 0D |
|
|
4166 |
0C97: MOVLW 00 |
|
|
4167 |
0C98: MOVWF 0F |
|
|
4168 |
.................... } |
|
|
4169 |
.................... else |
|
|
4170 |
* |
|
|
4171 |
0CBB: GOTO 551 |
|
|
4172 |
0CBC: BCF 03.6 |
|
|
4173 |
.................... { |
|
|
4174 |
.................... if(Z==0) //osetreni proti deleni 0 |
|
|
4175 |
0CBD: MOVF 25,F |
|
|
4176 |
0CBE: BTFSS 03.2 |
|
|
4177 |
0CBF: GOTO 4D8 |
|
|
4178 |
0CC0: MOVF 26,F |
|
|
4179 |
0CC1: BTFSS 03.2 |
|
|
4180 |
0CC2: GOTO 4D8 |
|
|
4181 |
.................... { |
|
|
4182 |
.................... if(Y>0) |
|
|
4183 |
0CC3: BTFSC 24.7 |
|
|
4184 |
0CC4: GOTO 4D3 |
|
|
4185 |
0CC5: MOVF 24,F |
|
|
4186 |
0CC6: BTFSS 03.2 |
|
|
4187 |
0CC7: GOTO 4CC |
|
|
4188 |
0CC8: MOVF 23,W |
|
|
4189 |
0CC9: SUBLW 00 |
|
|
4190 |
0CCA: BTFSC 03.0 |
|
|
4191 |
0CCB: GOTO 4D3 |
|
|
4192 |
.................... { |
|
|
4193 |
.................... b=180; |
|
|
4194 |
0CCC: CLRF 47 |
|
|
4195 |
0CCD: CLRF 46 |
|
|
4196 |
0CCE: MOVLW 34 |
|
|
4197 |
0CCF: MOVWF 45 |
|
|
4198 |
0CD0: MOVLW 86 |
|
|
4199 |
0CD1: MOVWF 44 |
|
|
4200 |
.................... } |
|
|
4201 |
.................... else |
|
|
4202 |
0CD2: GOTO 4D7 |
|
|
4203 |
.................... { |
|
|
4204 |
.................... b=0; |
|
|
4205 |
0CD3: CLRF 47 |
|
|
4206 |
0CD4: CLRF 46 |
|
|
4207 |
0CD5: CLRF 45 |
|
|
4208 |
0CD6: CLRF 44 |
|
|
4209 |
.................... } |
|
|
4210 |
.................... } |
|
|
4211 |
.................... else |
|
|
4212 |
0CD7: GOTO 550 |
|
|
4213 |
.................... { |
|
|
4214 |
.................... if(Z>0) |
|
|
4215 |
0CD8: BTFSC 26.7 |
|
|
4216 |
0CD9: GOTO 519 |
|
|
4217 |
0CDA: MOVF 26,F |
|
|
4218 |
0CDB: BTFSS 03.2 |
|
|
4219 |
0CDC: GOTO 4E1 |
|
|
4220 |
0CDD: MOVF 25,W |
|
|
4221 |
0CDE: SUBLW 00 |
|
|
4222 |
0CDF: BTFSC 03.0 |
|
|
4223 |
0CE0: GOTO 519 |
|
|
4224 |
.................... { |
|
|
4225 |
.................... if(Y>=0) |
|
|
4226 |
0CE1: BTFSC 24.7 |
|
|
4227 |
0CE2: GOTO 4FE |
|
|
4228 |
.................... { |
|
|
4229 |
.................... b=90+b; |
|
|
4230 |
0CE3: BCF 03.1 |
|
|
4231 |
0CE4: CLRF 60 |
|
|
4232 |
0CE5: CLRF 5F |
|
|
4233 |
0CE6: MOVLW 34 |
|
|
4234 |
0CE7: MOVWF 5E |
|
|
4235 |
0CE8: MOVLW 85 |
|
|
4236 |
0CE9: MOVWF 5D |
|
|
4237 |
0CEA: MOVF 47,W |
|
|
4238 |
0CEB: MOVWF 64 |
|
|
4239 |
0CEC: MOVF 46,W |
|
|
4240 |
0CED: MOVWF 63 |
|
|
4241 |
0CEE: MOVF 45,W |
|
|
4242 |
0CEF: MOVWF 62 |
|
|
4243 |
0CF0: MOVF 44,W |
|
|
4244 |
0CF1: MOVWF 61 |
|
|
4245 |
0CF2: BCF 0A.3 |
|
|
4246 |
0CF3: CALL 582 |
|
|
4247 |
0CF4: BSF 0A.3 |
|
|
4248 |
0CF5: MOVF 7A,W |
|
|
4249 |
0CF6: MOVWF 47 |
|
|
4250 |
0CF7: MOVF 79,W |
|
|
4251 |
0CF8: MOVWF 46 |
|
|
4252 |
0CF9: MOVF 78,W |
|
|
4253 |
0CFA: MOVWF 45 |
|
|
4254 |
0CFB: MOVF 77,W |
|
|
4255 |
0CFC: MOVWF 44 |
|
|
4256 |
.................... } |
|
|
4257 |
.................... else |
|
|
4258 |
0CFD: GOTO 518 |
|
|
4259 |
.................... { |
|
|
4260 |
.................... b=90-b; |
|
|
4261 |
0CFE: BSF 03.1 |
|
|
4262 |
0CFF: CLRF 60 |
|
|
4263 |
0D00: CLRF 5F |
|
|
4264 |
0D01: MOVLW 34 |
|
|
4265 |
0D02: MOVWF 5E |
|
|
4266 |
0D03: MOVLW 85 |
|
|
4267 |
0D04: MOVWF 5D |
|
|
4268 |
0D05: MOVF 47,W |
|
|
4269 |
0D06: MOVWF 64 |
|
|
4270 |
0D07: MOVF 46,W |
|
|
4271 |
0D08: MOVWF 63 |
|
|
4272 |
0D09: MOVF 45,W |
|
|
4273 |
0D0A: MOVWF 62 |
|
|
4274 |
0D0B: MOVF 44,W |
|
|
4275 |
0D0C: MOVWF 61 |
|
|
4276 |
0D0D: BCF 0A.3 |
|
|
4277 |
0D0E: CALL 582 |
|
|
4278 |
0D0F: BSF 0A.3 |
|
|
4279 |
0D10: MOVF 7A,W |
|
|
4280 |
0D11: MOVWF 47 |
|
|
4281 |
0D12: MOVF 79,W |
|
|
4282 |
0D13: MOVWF 46 |
|
|
4283 |
0D14: MOVF 78,W |
|
|
4284 |
0D15: MOVWF 45 |
|
|
4285 |
0D16: MOVF 77,W |
|
|
4286 |
0D17: MOVWF 44 |
|
|
4287 |
.................... } |
|
|
4288 |
.................... } |
|
|
4289 |
.................... else |
|
|
4290 |
0D18: GOTO 550 |
|
|
4291 |
.................... { |
|
|
4292 |
.................... if(Y>=0) |
|
|
4293 |
0D19: BTFSC 24.7 |
|
|
4294 |
0D1A: GOTO 536 |
|
|
4295 |
.................... { |
|
|
4296 |
.................... b=180-b; |
|
|
4297 |
0D1B: BSF 03.1 |
|
|
4298 |
0D1C: CLRF 60 |
|
|
4299 |
0D1D: CLRF 5F |
|
|
4300 |
0D1E: MOVLW 34 |
|
|
4301 |
0D1F: MOVWF 5E |
|
|
4302 |
0D20: MOVLW 86 |
|
|
4303 |
0D21: MOVWF 5D |
|
|
4304 |
0D22: MOVF 47,W |
|
|
4305 |
0D23: MOVWF 64 |
|
|
4306 |
0D24: MOVF 46,W |
|
|
4307 |
0D25: MOVWF 63 |
|
|
4308 |
0D26: MOVF 45,W |
|
|
4309 |
0D27: MOVWF 62 |
|
|
4310 |
0D28: MOVF 44,W |
|
|
4311 |
0D29: MOVWF 61 |
|
|
4312 |
0D2A: BCF 0A.3 |
|
|
4313 |
0D2B: CALL 582 |
|
|
4314 |
0D2C: BSF 0A.3 |
|
|
4315 |
0D2D: MOVF 7A,W |
|
|
4316 |
0D2E: MOVWF 47 |
|
|
4317 |
0D2F: MOVF 79,W |
|
|
4318 |
0D30: MOVWF 46 |
|
|
4319 |
0D31: MOVF 78,W |
|
|
4320 |
0D32: MOVWF 45 |
|
|
4321 |
0D33: MOVF 77,W |
|
|
4322 |
0D34: MOVWF 44 |
|
|
4323 |
.................... } |
|
|
4324 |
.................... else |
|
|
4325 |
0D35: GOTO 550 |
|
|
4326 |
.................... { |
|
|
4327 |
.................... b=270+b; |
|
|
4328 |
0D36: BCF 03.1 |
|
|
4329 |
0D37: CLRF 60 |
|
|
4330 |
0D38: CLRF 5F |
|
|
4331 |
0D39: MOVLW 07 |
|
|
4332 |
0D3A: MOVWF 5E |
|
|
4333 |
0D3B: MOVLW 87 |
|
|
4334 |
0D3C: MOVWF 5D |
|
|
4335 |
0D3D: MOVF 47,W |
|
|
4336 |
0D3E: MOVWF 64 |
|
|
4337 |
0D3F: MOVF 46,W |
|
|
4338 |
0D40: MOVWF 63 |
|
|
4339 |
0D41: MOVF 45,W |
|
|
4340 |
0D42: MOVWF 62 |
|
|
4341 |
0D43: MOVF 44,W |
|
|
4342 |
0D44: MOVWF 61 |
|
|
4343 |
0D45: BCF 0A.3 |
|
|
4344 |
0D46: CALL 582 |
|
|
4345 |
0D47: BSF 0A.3 |
|
|
4346 |
0D48: MOVF 7A,W |
|
|
4347 |
0D49: MOVWF 47 |
|
|
4348 |
0D4A: MOVF 79,W |
|
|
4349 |
0D4B: MOVWF 46 |
|
|
4350 |
0D4C: MOVF 78,W |
|
|
4351 |
0D4D: MOVWF 45 |
|
|
4352 |
0D4E: MOVF 77,W |
|
|
4353 |
0D4F: MOVWF 44 |
|
|
4354 |
0D50: BSF 03.6 |
|
|
4355 |
.................... } |
|
|
4356 |
.................... } |
|
|
4357 |
.................... |
|
|
4358 |
.................... } |
|
|
4359 |
.................... |
|
|
4360 |
.................... |
|
|
4361 |
.................... |
|
|
4362 |
.................... } |
|
|
4363 |
.................... printf("uhel namìreny %10.2f \r\n", b); |
|
|
4364 |
0D51: MOVLW 22 |
|
|
4365 |
0D52: MOVWF 0D |
|
|
4366 |
0D53: MOVLW 00 |
|
|
4367 |
0D54: MOVWF 0F |
|
|
4368 |
0D55: MOVLW 0E |
|
|
4369 |
0D56: BCF 03.6 |
|
|
4370 |
0D57: MOVWF 48 |
|
|
4371 |
0D58: BCF 0A.3 |
|
|
4372 |
0D59: CALL 6C3 |
|
|
4373 |
0D5A: BSF 0A.3 |
|
|
4374 |
0D5B: MOVLW 09 |
|
|
4375 |
0D5C: MOVWF 04 |
|
|
4376 |
0D5D: MOVF 47,W |
|
|
4377 |
0D5E: MOVWF 4B |
|
|
4378 |
0D5F: MOVF 46,W |
|
|
4379 |
0D60: MOVWF 4A |
|
|
4380 |
0D61: MOVF 45,W |
|
|
4381 |
0D62: MOVWF 49 |
|
|
4382 |
0D63: MOVF 44,W |
|
|
4383 |
0D64: MOVWF 48 |
|
|
4384 |
0D65: MOVLW 02 |
|
|
4385 |
0D66: MOVWF 4C |
|
|
4386 |
0D67: GOTO 28E |
|
|
4387 |
0D68: MOVLW 20 |
|
|
4388 |
0D69: MOVWF 55 |
|
|
4389 |
0D6A: BCF 0A.3 |
|
|
4390 |
0D6B: CALL 0B6 |
|
|
4391 |
0D6C: BSF 0A.3 |
|
|
4392 |
0D6D: MOVLW 0D |
|
|
4393 |
0D6E: MOVWF 55 |
|
|
4394 |
0D6F: BCF 0A.3 |
|
|
4395 |
0D70: CALL 0B6 |
|
|
4396 |
0D71: BSF 0A.3 |
|
|
4397 |
0D72: MOVLW 0A |
|
|
4398 |
0D73: MOVWF 55 |
|
|
4399 |
0D74: BCF 0A.3 |
|
|
4400 |
0D75: CALL 0B6 |
|
|
4401 |
0D76: BSF 0A.3 |
|
|
4402 |
.................... return b; |
|
|
4403 |
0D77: MOVF 44,W |
|
|
4404 |
0D78: MOVWF 77 |
|
|
4405 |
0D79: MOVF 45,W |
|
|
4406 |
0D7A: MOVWF 78 |
|
|
4407 |
0D7B: MOVF 46,W |
|
|
4408 |
0D7C: MOVWF 79 |
|
|
4409 |
0D7D: MOVF 47,W |
|
|
4410 |
0D7E: MOVWF 7A |
|
|
4411 |
.................... |
|
|
4412 |
.................... } |
|
|
4413 |
0D7F: RETURN |
|
|
4414 |
.................... |
|
|
4415 |
.................... float azimut (void) //vypocet aktualni vysky panelu |
|
|
4416 |
.................... { |
|
|
4417 |
.................... X= magR (MAG_XH, MAG_XL); |
|
|
4418 |
* |
|
|
4419 |
1000: MOVLW 03 |
|
|
4420 |
1001: MOVWF 48 |
|
|
4421 |
1002: MOVLW 04 |
|
|
4422 |
1003: MOVWF 49 |
|
|
4423 |
1004: BCF 0A.4 |
|
|
4424 |
1005: BSF 0A.3 |
|
|
4425 |
1006: CALL 644 |
|
|
4426 |
1007: BSF 0A.4 |
|
|
4427 |
1008: BCF 0A.3 |
|
|
4428 |
1009: MOVF 79,W |
|
|
4429 |
100A: MOVWF 22 |
|
|
4430 |
100B: MOVF 78,W |
|
|
4431 |
100C: MOVWF 21 |
|
|
4432 |
.................... Y= magR (MAG_YH, MAG_YL); |
|
|
4433 |
100D: MOVLW 07 |
|
|
4434 |
100E: MOVWF 48 |
|
|
4435 |
100F: MOVLW 08 |
|
|
4436 |
1010: MOVWF 49 |
|
|
4437 |
1011: BCF 0A.4 |
|
|
4438 |
1012: BSF 0A.3 |
|
|
4439 |
1013: CALL 644 |
|
|
4440 |
1014: BSF 0A.4 |
|
|
4441 |
1015: BCF 0A.3 |
|
|
4442 |
1016: MOVF 79,W |
|
|
4443 |
1017: MOVWF 24 |
|
|
4444 |
1018: MOVF 78,W |
|
|
4445 |
1019: MOVWF 23 |
|
|
4446 |
.................... Z= magR (MAG_ZH, MAG_ZL); |
|
|
4447 |
101A: MOVLW 05 |
|
|
4448 |
101B: MOVWF 48 |
|
|
4449 |
101C: MOVLW 06 |
|
|
4450 |
101D: MOVWF 49 |
|
|
4451 |
101E: BCF 0A.4 |
|
|
4452 |
101F: BSF 0A.3 |
|
|
4453 |
1020: CALL 644 |
|
|
4454 |
1021: BSF 0A.4 |
|
|
4455 |
1022: BCF 0A.3 |
|
|
4456 |
1023: MOVF 79,W |
|
|
4457 |
1024: MOVWF 26 |
|
|
4458 |
1025: MOVF 78,W |
|
|
4459 |
1026: MOVWF 25 |
|
|
4460 |
.................... |
|
|
4461 |
.................... |
|
|
4462 |
.................... |
|
|
4463 |
.................... |
|
|
4464 |
.................... AX=abs(X); |
|
|
4465 |
1027: MOVF 22,W |
|
|
4466 |
1028: MOVWF 7A |
|
|
4467 |
1029: MOVF 21,W |
|
|
4468 |
102A: BTFSS 22.7 |
|
|
4469 |
102B: GOTO 035 |
|
|
4470 |
102C: MOVF 21,W |
|
|
4471 |
102D: SUBLW 00 |
|
|
4472 |
102E: MOVWF 77 |
|
|
4473 |
102F: CLRF 7A |
|
|
4474 |
1030: MOVF 22,W |
|
|
4475 |
1031: BTFSS 03.0 |
|
|
4476 |
1032: INCFSZ 22,W |
|
|
4477 |
1033: SUBWF 7A,F |
|
|
4478 |
1034: MOVF 77,W |
|
|
4479 |
1035: MOVWF 27 |
|
|
4480 |
1036: MOVF 7A,W |
|
|
4481 |
1037: MOVWF 28 |
|
|
4482 |
.................... AY=abs(Y); |
|
|
4483 |
1038: MOVF 24,W |
|
|
4484 |
1039: MOVWF 7A |
|
|
4485 |
103A: MOVF 23,W |
|
|
4486 |
103B: BTFSS 24.7 |
|
|
4487 |
103C: GOTO 046 |
|
|
4488 |
103D: MOVF 23,W |
|
|
4489 |
103E: SUBLW 00 |
|
|
4490 |
103F: MOVWF 77 |
|
|
4491 |
1040: CLRF 7A |
|
|
4492 |
1041: MOVF 24,W |
|
|
4493 |
1042: BTFSS 03.0 |
|
|
4494 |
1043: INCFSZ 24,W |
|
|
4495 |
1044: SUBWF 7A,F |
|
|
4496 |
1045: MOVF 77,W |
|
|
4497 |
1046: MOVWF 29 |
|
|
4498 |
1047: MOVF 7A,W |
|
|
4499 |
1048: MOVWF 2A |
|
|
4500 |
.................... AZ=abs(Z); |
|
|
4501 |
1049: MOVF 26,W |
|
|
4502 |
104A: MOVWF 7A |
|
|
4503 |
104B: MOVF 25,W |
|
|
4504 |
104C: BTFSS 26.7 |
|
|
4505 |
104D: GOTO 057 |
|
|
4506 |
104E: MOVF 25,W |
|
|
4507 |
104F: SUBLW 00 |
|
|
4508 |
1050: MOVWF 77 |
|
|
4509 |
1051: CLRF 7A |
|
|
4510 |
1052: MOVF 26,W |
|
|
4511 |
1053: BTFSS 03.0 |
|
|
4512 |
1054: INCFSZ 26,W |
|
|
4513 |
1055: SUBWF 7A,F |
|
|
4514 |
1056: MOVF 77,W |
|
|
4515 |
1057: MOVWF 2B |
|
|
4516 |
1058: MOVF 7A,W |
|
|
4517 |
1059: MOVWF 2C |
|
|
4518 |
.................... |
|
|
4519 |
.................... float a, b; |
|
|
4520 |
.................... a=(float)Y/X; |
|
|
4521 |
105A: MOVF 24,W |
|
|
4522 |
105B: MOVWF 4D |
|
|
4523 |
105C: MOVF 23,W |
|
|
4524 |
105D: MOVWF 4C |
|
|
4525 |
105E: BCF 0A.4 |
|
|
4526 |
105F: CALL 3DF |
|
|
4527 |
1060: BSF 0A.4 |
|
|
4528 |
1061: MOVF 77,W |
|
|
4529 |
1062: MOVWF 48 |
|
|
4530 |
1063: MOVF 78,W |
|
|
4531 |
1064: MOVWF 49 |
|
|
4532 |
1065: MOVF 79,W |
|
|
4533 |
1066: MOVWF 4A |
|
|
4534 |
1067: MOVF 7A,W |
|
|
4535 |
1068: MOVWF 4B |
|
|
4536 |
1069: MOVF 22,W |
|
|
4537 |
106A: MOVWF 4D |
|
|
4538 |
106B: MOVF 21,W |
|
|
4539 |
106C: MOVWF 4C |
|
|
4540 |
106D: BCF 0A.4 |
|
|
4541 |
106E: CALL 3DF |
|
|
4542 |
106F: BSF 0A.4 |
|
|
4543 |
1070: MOVF 4B,W |
|
|
4544 |
1071: MOVWF 60 |
|
|
4545 |
1072: MOVF 4A,W |
|
|
4546 |
1073: MOVWF 5F |
|
|
4547 |
1074: MOVF 49,W |
|
|
4548 |
1075: MOVWF 5E |
|
|
4549 |
1076: MOVF 48,W |
|
|
4550 |
1077: MOVWF 5D |
|
|
4551 |
1078: MOVF 7A,W |
|
|
4552 |
1079: MOVWF 64 |
|
|
4553 |
107A: MOVF 79,W |
|
|
4554 |
107B: MOVWF 63 |
|
|
4555 |
107C: MOVF 78,W |
|
|
4556 |
107D: MOVWF 62 |
|
|
4557 |
107E: MOVF 77,W |
|
|
4558 |
107F: MOVWF 61 |
|
|
4559 |
1080: BCF 0A.4 |
|
|
4560 |
1081: CALL 404 |
|
|
4561 |
1082: BSF 0A.4 |
|
|
4562 |
1083: MOVF 7A,W |
|
|
4563 |
1084: MOVWF 43 |
|
|
4564 |
1085: MOVF 79,W |
|
|
4565 |
1086: MOVWF 42 |
|
|
4566 |
1087: MOVF 78,W |
|
|
4567 |
1088: MOVWF 41 |
|
|
4568 |
1089: MOVF 77,W |
|
|
4569 |
108A: MOVWF 40 |
|
|
4570 |
.................... b=atan(a); |
|
|
4571 |
108B: MOVF 43,W |
|
|
4572 |
108C: MOVWF 4B |
|
|
4573 |
108D: MOVF 42,W |
|
|
4574 |
108E: MOVWF 4A |
|
|
4575 |
108F: MOVF 41,W |
|
|
4576 |
1090: MOVWF 49 |
|
|
4577 |
1091: MOVF 40,W |
|
|
4578 |
1092: MOVWF 48 |
|
|
4579 |
1093: BCF 0A.4 |
|
|
4580 |
1094: BSF 0A.3 |
|
|
4581 |
1095: CALL 000 |
|
|
4582 |
1096: BSF 0A.4 |
|
|
4583 |
1097: BCF 0A.3 |
|
|
4584 |
1098: MOVF 7A,W |
|
|
4585 |
1099: MOVWF 47 |
|
|
4586 |
109A: MOVF 79,W |
|
|
4587 |
109B: MOVWF 46 |
|
|
4588 |
109C: MOVF 78,W |
|
|
4589 |
109D: MOVWF 45 |
|
|
4590 |
109E: MOVF 77,W |
|
|
4591 |
109F: MOVWF 44 |
|
|
4592 |
.................... b = (b/3.14)*180; |
|
|
4593 |
10A0: MOVF 47,W |
|
|
4594 |
10A1: MOVWF 60 |
|
|
4595 |
10A2: MOVF 46,W |
|
|
4596 |
10A3: MOVWF 5F |
|
|
4597 |
10A4: MOVF 45,W |
|
|
4598 |
10A5: MOVWF 5E |
|
|
4599 |
10A6: MOVF 44,W |
|
|
4600 |
10A7: MOVWF 5D |
|
|
4601 |
10A8: MOVLW C3 |
|
|
4602 |
10A9: MOVWF 64 |
|
|
4603 |
10AA: MOVLW F5 |
|
|
4604 |
10AB: MOVWF 63 |
|
|
4605 |
10AC: MOVLW 48 |
|
|
4606 |
10AD: MOVWF 62 |
|
|
4607 |
10AE: MOVLW 80 |
|
|
4608 |
10AF: MOVWF 61 |
|
|
4609 |
10B0: BCF 0A.4 |
|
|
4610 |
10B1: CALL 404 |
|
|
4611 |
10B2: BSF 0A.4 |
|
|
4612 |
10B3: MOVF 77,W |
|
|
4613 |
10B4: MOVWF 48 |
|
|
4614 |
10B5: MOVF 78,W |
|
|
4615 |
10B6: MOVWF 49 |
|
|
4616 |
10B7: MOVF 79,W |
|
|
4617 |
10B8: MOVWF 4A |
|
|
4618 |
10B9: MOVF 7A,W |
|
|
4619 |
10BA: MOVWF 4B |
|
|
4620 |
10BB: MOVWF 60 |
|
|
4621 |
10BC: MOVF 4A,W |
|
|
4622 |
10BD: MOVWF 5F |
|
|
4623 |
10BE: MOVF 49,W |
|
|
4624 |
10BF: MOVWF 5E |
|
|
4625 |
10C0: MOVF 48,W |
|
|
4626 |
10C1: MOVWF 5D |
|
|
4627 |
10C2: CLRF 64 |
|
|
4628 |
10C3: CLRF 63 |
|
|
4629 |
10C4: MOVLW 34 |
|
|
4630 |
10C5: MOVWF 62 |
|
|
4631 |
10C6: MOVLW 86 |
|
|
4632 |
10C7: MOVWF 61 |
|
|
4633 |
10C8: BCF 0A.4 |
|
|
4634 |
10C9: CALL 50D |
|
|
4635 |
10CA: BSF 0A.4 |
|
|
4636 |
10CB: MOVF 7A,W |
|
|
4637 |
10CC: MOVWF 47 |
|
|
4638 |
10CD: MOVF 79,W |
|
|
4639 |
10CE: MOVWF 46 |
|
|
4640 |
10CF: MOVF 78,W |
|
|
4641 |
10D0: MOVWF 45 |
|
|
4642 |
10D1: MOVF 77,W |
|
|
4643 |
10D2: MOVWF 44 |
|
|
4644 |
.................... b=abs(b); |
|
|
4645 |
10D3: MOVF 44,W |
|
|
4646 |
10D4: MOVWF 77 |
|
|
4647 |
10D5: MOVF 45,W |
|
|
4648 |
10D6: MOVWF 78 |
|
|
4649 |
10D7: MOVF 46,W |
|
|
4650 |
10D8: MOVWF 79 |
|
|
4651 |
10D9: MOVF 47,W |
|
|
4652 |
10DA: MOVWF 7A |
|
|
4653 |
10DB: BCF 78.7 |
|
|
4654 |
10DC: MOVF 47,W |
|
|
4655 |
10DD: MOVWF 47 |
|
|
4656 |
10DE: MOVF 46,W |
|
|
4657 |
10DF: MOVWF 46 |
|
|
4658 |
10E0: MOVF 78,W |
|
|
4659 |
10E1: MOVWF 45 |
|
|
4660 |
10E2: MOVF 44,W |
|
|
4661 |
10E3: MOVWF 44 |
|
|
4662 |
.................... |
|
|
4663 |
.................... |
|
|
4664 |
.................... |
|
|
4665 |
.................... |
|
|
4666 |
.................... if(X==0) //osetreni proti deleni 0 |
|
|
4667 |
10E4: MOVF 21,F |
|
|
4668 |
10E5: BTFSS 03.2 |
|
|
4669 |
10E6: GOTO 101 |
|
|
4670 |
10E7: MOVF 22,F |
|
|
4671 |
10E8: BTFSS 03.2 |
|
|
4672 |
10E9: GOTO 101 |
|
|
4673 |
.................... { |
|
|
4674 |
.................... if(Y>0) |
|
|
4675 |
10EA: BTFSC 24.7 |
|
|
4676 |
10EB: GOTO 0FA |
|
|
4677 |
10EC: MOVF 24,F |
|
|
4678 |
10ED: BTFSS 03.2 |
|
|
4679 |
10EE: GOTO 0F3 |
|
|
4680 |
10EF: MOVF 23,W |
|
|
4681 |
10F0: SUBLW 00 |
|
|
4682 |
10F1: BTFSC 03.0 |
|
|
4683 |
10F2: GOTO 0FA |
|
|
4684 |
.................... { |
|
|
4685 |
.................... b=90; |
|
|
4686 |
10F3: CLRF 47 |
|
|
4687 |
10F4: CLRF 46 |
|
|
4688 |
10F5: MOVLW 34 |
|
|
4689 |
10F6: MOVWF 45 |
|
|
4690 |
10F7: MOVLW 85 |
|
|
4691 |
10F8: MOVWF 44 |
|
|
4692 |
.................... } |
|
|
4693 |
.................... else |
|
|
4694 |
10F9: GOTO 100 |
|
|
4695 |
.................... { |
|
|
4696 |
.................... b=270; |
|
|
4697 |
10FA: CLRF 47 |
|
|
4698 |
10FB: CLRF 46 |
|
|
4699 |
10FC: MOVLW 07 |
|
|
4700 |
10FD: MOVWF 45 |
|
|
4701 |
10FE: MOVLW 87 |
|
|
4702 |
10FF: MOVWF 44 |
|
|
4703 |
.................... } |
|
|
4704 |
.................... } |
|
|
4705 |
.................... else |
|
|
4706 |
1100: GOTO 15E |
|
|
4707 |
.................... { |
|
|
4708 |
.................... if(X>0) |
|
|
4709 |
1101: BTFSC 22.7 |
|
|
4710 |
1102: GOTO 127 |
|
|
4711 |
1103: MOVF 22,F |
|
|
4712 |
1104: BTFSS 03.2 |
|
|
4713 |
1105: GOTO 10A |
|
|
4714 |
1106: MOVF 21,W |
|
|
4715 |
1107: SUBLW 00 |
|
|
4716 |
1108: BTFSC 03.0 |
|
|
4717 |
1109: GOTO 127 |
|
|
4718 |
.................... { |
|
|
4719 |
.................... if(Y>=0) |
|
|
4720 |
110A: BTFSS 24.7 |
|
|
4721 |
.................... { |
|
|
4722 |
.................... b=b; |
|
|
4723 |
.................... } |
|
|
4724 |
.................... else |
|
|
4725 |
110B: GOTO 126 |
|
|
4726 |
.................... { |
|
|
4727 |
.................... b=360-b; |
|
|
4728 |
110C: BSF 03.1 |
|
|
4729 |
110D: CLRF 60 |
|
|
4730 |
110E: CLRF 5F |
|
|
4731 |
110F: MOVLW 34 |
|
|
4732 |
1110: MOVWF 5E |
|
|
4733 |
1111: MOVLW 87 |
|
|
4734 |
1112: MOVWF 5D |
|
|
4735 |
1113: MOVF 47,W |
|
|
4736 |
1114: MOVWF 64 |
|
|
4737 |
1115: MOVF 46,W |
|
|
4738 |
1116: MOVWF 63 |
|
|
4739 |
1117: MOVF 45,W |
|
|
4740 |
1118: MOVWF 62 |
|
|
4741 |
1119: MOVF 44,W |
|
|
4742 |
111A: MOVWF 61 |
|
|
4743 |
111B: BCF 0A.4 |
|
|
4744 |
111C: CALL 582 |
|
|
4745 |
111D: BSF 0A.4 |
|
|
4746 |
111E: MOVF 7A,W |
|
|
4747 |
111F: MOVWF 47 |
|
|
4748 |
1120: MOVF 79,W |
|
|
4749 |
1121: MOVWF 46 |
|
|
4750 |
1122: MOVF 78,W |
|
|
4751 |
1123: MOVWF 45 |
|
|
4752 |
1124: MOVF 77,W |
|
|
4753 |
1125: MOVWF 44 |
|
|
4754 |
.................... } |
|
|
4755 |
.................... } |
|
|
4756 |
.................... else |
|
|
4757 |
1126: GOTO 15E |
|
|
4758 |
.................... { |
|
|
4759 |
.................... if(Y>=0) |
|
|
4760 |
1127: BTFSC 24.7 |
|
|
4761 |
1128: GOTO 144 |
|
|
4762 |
.................... { |
|
|
4763 |
.................... b=180-b; |
|
|
4764 |
1129: BSF 03.1 |
|
|
4765 |
112A: CLRF 60 |
|
|
4766 |
112B: CLRF 5F |
|
|
4767 |
112C: MOVLW 34 |
|
|
4768 |
112D: MOVWF 5E |
|
|
4769 |
112E: MOVLW 86 |
|
|
4770 |
112F: MOVWF 5D |
|
|
4771 |
1130: MOVF 47,W |
|
|
4772 |
1131: MOVWF 64 |
|
|
4773 |
1132: MOVF 46,W |
|
|
4774 |
1133: MOVWF 63 |
|
|
4775 |
1134: MOVF 45,W |
|
|
4776 |
1135: MOVWF 62 |
|
|
4777 |
1136: MOVF 44,W |
|
|
4778 |
1137: MOVWF 61 |
|
|
4779 |
1138: BCF 0A.4 |
|
|
4780 |
1139: CALL 582 |
|
|
4781 |
113A: BSF 0A.4 |
|
|
4782 |
113B: MOVF 7A,W |
|
|
4783 |
113C: MOVWF 47 |
|
|
4784 |
113D: MOVF 79,W |
|
|
4785 |
113E: MOVWF 46 |
|
|
4786 |
113F: MOVF 78,W |
|
|
4787 |
1140: MOVWF 45 |
|
|
4788 |
1141: MOVF 77,W |
|
|
4789 |
1142: MOVWF 44 |
|
|
4790 |
.................... } |
|
|
4791 |
.................... else |
|
|
4792 |
1143: GOTO 15E |
|
|
4793 |
.................... { |
|
|
4794 |
.................... b=180+b; |
|
|
4795 |
1144: BCF 03.1 |
|
|
4796 |
1145: CLRF 60 |
|
|
4797 |
1146: CLRF 5F |
|
|
4798 |
1147: MOVLW 34 |
|
|
4799 |
1148: MOVWF 5E |
|
|
4800 |
1149: MOVLW 86 |
|
|
4801 |
114A: MOVWF 5D |
|
|
4802 |
114B: MOVF 47,W |
|
|
4803 |
114C: MOVWF 64 |
|
|
4804 |
114D: MOVF 46,W |
|
|
4805 |
114E: MOVWF 63 |
|
|
4806 |
114F: MOVF 45,W |
|
|
4807 |
1150: MOVWF 62 |
|
|
4808 |
1151: MOVF 44,W |
|
|
4809 |
1152: MOVWF 61 |
|
|
4810 |
1153: BCF 0A.4 |
|
|
4811 |
1154: CALL 582 |
|
|
4812 |
1155: BSF 0A.4 |
|
|
4813 |
1156: MOVF 7A,W |
|
|
4814 |
1157: MOVWF 47 |
|
|
4815 |
1158: MOVF 79,W |
|
|
4816 |
1159: MOVWF 46 |
|
|
4817 |
115A: MOVF 78,W |
|
|
4818 |
115B: MOVWF 45 |
|
|
4819 |
115C: MOVF 77,W |
|
|
4820 |
115D: MOVWF 44 |
|
|
4821 |
.................... } |
|
|
4822 |
.................... } |
|
|
4823 |
.................... |
|
|
4824 |
.................... } |
|
|
4825 |
.................... |
|
|
4826 |
.................... return b; |
|
|
4827 |
115E: MOVF 44,W |
|
|
4828 |
115F: MOVWF 77 |
|
|
4829 |
1160: MOVF 45,W |
|
|
4830 |
1161: MOVWF 78 |
|
|
4831 |
1162: MOVF 46,W |
|
|
4832 |
1163: MOVWF 79 |
|
|
4833 |
1164: MOVF 47,W |
|
|
4834 |
1165: MOVWF 7A |
|
|
4835 |
.................... |
|
|
4836 |
.................... } |
|
|
4837 |
1166: RETURN |
|
|
4838 |
.................... |
|
|
4839 |
.................... void motorA (int8 H) //pro ovladani prvniho motoru nastaveni vysky |
|
|
4840 |
.................... { |
|
|
4841 |
.................... switch(H){ |
|
|
4842 |
* |
|
|
4843 |
0120: MOVF 40,W |
|
|
4844 |
0121: XORLW 01 |
|
|
4845 |
0122: BTFSC 03.2 |
|
|
4846 |
0123: GOTO 128 |
|
|
4847 |
0124: XORLW 03 |
|
|
4848 |
0125: BTFSC 03.2 |
|
|
4849 |
0126: GOTO 131 |
|
|
4850 |
0127: GOTO 13A |
|
|
4851 |
.................... case 1: //reverzní chod |
|
|
4852 |
.................... output_low (AIN2); |
|
|
4853 |
0128: BSF 03.5 |
|
|
4854 |
0129: BCF 08.1 |
|
|
4855 |
012A: BCF 03.5 |
|
|
4856 |
012B: BCF 08.1 |
|
|
4857 |
.................... output_high (AIN1); |
|
|
4858 |
012C: BSF 03.5 |
|
|
4859 |
012D: BCF 08.0 |
|
|
4860 |
012E: BCF 03.5 |
|
|
4861 |
012F: BSF 08.0 |
|
|
4862 |
.................... break; |
|
|
4863 |
0130: GOTO 142 |
|
|
4864 |
.................... |
|
|
4865 |
.................... case 2: //dopøedu |
|
|
4866 |
.................... output_low (AIN1); |
|
|
4867 |
0131: BSF 03.5 |
|
|
4868 |
0132: BCF 08.0 |
|
|
4869 |
0133: BCF 03.5 |
|
|
4870 |
0134: BCF 08.0 |
|
|
4871 |
.................... output_high (AIN2); |
|
|
4872 |
0135: BSF 03.5 |
|
|
4873 |
0136: BCF 08.1 |
|
|
4874 |
0137: BCF 03.5 |
|
|
4875 |
0138: BSF 08.1 |
|
|
4876 |
.................... break; |
|
|
4877 |
0139: GOTO 142 |
|
|
4878 |
.................... |
|
|
4879 |
.................... default: |
|
|
4880 |
.................... output_low (AIN2); |
|
|
4881 |
013A: BSF 03.5 |
|
|
4882 |
013B: BCF 08.1 |
|
|
4883 |
013C: BCF 03.5 |
|
|
4884 |
013D: BCF 08.1 |
|
|
4885 |
.................... output_low (AIN1); |
|
|
4886 |
013E: BSF 03.5 |
|
|
4887 |
013F: BCF 08.0 |
|
|
4888 |
0140: BCF 03.5 |
|
|
4889 |
0141: BCF 08.0 |
|
|
4890 |
.................... } |
|
|
4891 |
.................... } |
|
|
4892 |
0142: RETURN |
|
|
4893 |
.................... |
|
|
4894 |
.................... void motorB (int8 H) //pro ovladani prvniho motoru nastaveni vysky |
|
|
4895 |
.................... { |
|
|
4896 |
.................... switch(H){ |
|
|
4897 |
* |
|
|
4898 |
07C5: MOVF 40,W |
|
|
4899 |
07C6: XORLW 01 |
|
|
4900 |
07C7: BTFSC 03.2 |
|
|
4901 |
07C8: GOTO 7CD |
|
|
4902 |
07C9: XORLW 03 |
|
|
4903 |
07CA: BTFSC 03.2 |
|
|
4904 |
07CB: GOTO 7D6 |
|
|
4905 |
07CC: GOTO 7DF |
|
|
4906 |
.................... case 1: //reverzní chod |
|
|
4907 |
.................... output_low (BIN2); |
|
|
4908 |
07CD: BSF 03.5 |
|
|
4909 |
07CE: BCF 08.3 |
|
|
4910 |
07CF: BCF 03.5 |
|
|
4911 |
07D0: BCF 08.3 |
|
|
4912 |
.................... output_high (BIN1); |
|
|
4913 |
07D1: BSF 03.5 |
|
|
4914 |
07D2: BCF 08.2 |
|
|
4915 |
07D3: BCF 03.5 |
|
|
4916 |
07D4: BSF 08.2 |
|
|
4917 |
.................... break; |
|
|
4918 |
07D5: GOTO 7E7 |
|
|
4919 |
.................... |
|
|
4920 |
.................... case 2: //dopøedu |
|
|
4921 |
.................... output_low (BIN1); |
|
|
4922 |
07D6: BSF 03.5 |
|
|
4923 |
07D7: BCF 08.2 |
|
|
4924 |
07D8: BCF 03.5 |
|
|
4925 |
07D9: BCF 08.2 |
|
|
4926 |
.................... output_high (BIN2); |
|
|
4927 |
07DA: BSF 03.5 |
|
|
4928 |
07DB: BCF 08.3 |
|
|
4929 |
07DC: BCF 03.5 |
|
|
4930 |
07DD: BSF 08.3 |
|
|
4931 |
.................... break; |
|
|
4932 |
07DE: GOTO 7E7 |
|
|
4933 |
.................... |
|
|
4934 |
.................... default: |
|
|
4935 |
.................... output_low (BIN2); |
|
|
4936 |
07DF: BSF 03.5 |
|
|
4937 |
07E0: BCF 08.3 |
|
|
4938 |
07E1: BCF 03.5 |
|
|
4939 |
07E2: BCF 08.3 |
|
|
4940 |
.................... output_low (BIN1); |
|
|
4941 |
07E3: BSF 03.5 |
|
|
4942 |
07E4: BCF 08.2 |
|
|
4943 |
07E5: BCF 03.5 |
|
|
4944 |
07E6: BCF 08.2 |
|
|
4945 |
.................... } |
|
|
4946 |
.................... } |
|
|
4947 |
07E7: RETURN |
|
|
4948 |
.................... |
|
|
4949 |
.................... void vyska_set (int8 H) //slouzi pro nastaveni nove vysky panelu |
|
|
4950 |
.................... { |
|
|
4951 |
.................... printf("Akcelerometr4: \r\n",); |
|
|
4952 |
* |
|
|
4953 |
0D80: MOVLW 3A |
|
|
4954 |
0D81: BSF 03.6 |
|
|
4955 |
0D82: MOVWF 0D |
|
|
4956 |
0D83: MOVLW 00 |
|
|
4957 |
0D84: MOVWF 0F |
|
|
4958 |
0D85: BCF 0A.3 |
|
|
4959 |
0D86: BCF 03.6 |
|
|
4960 |
0D87: CALL 0DA |
|
|
4961 |
0D88: BSF 0A.3 |
|
|
4962 |
.................... float a; |
|
|
4963 |
.................... int16 b,c; |
|
|
4964 |
.................... |
|
|
4965 |
.................... a=vyska(); |
|
|
4966 |
0D89: CALL 385 |
|
|
4967 |
0D8A: MOVF 7A,W |
|
|
4968 |
0D8B: MOVWF 3B |
|
|
4969 |
0D8C: MOVF 79,W |
|
|
4970 |
0D8D: MOVWF 3A |
|
|
4971 |
0D8E: MOVF 78,W |
|
|
4972 |
0D8F: MOVWF 39 |
|
|
4973 |
0D90: MOVF 77,W |
|
|
4974 |
0D91: MOVWF 38 |
|
|
4975 |
.................... b= (int16) a; |
|
|
4976 |
0D92: MOVF 3B,W |
|
|
4977 |
0D93: MOVWF 43 |
|
|
4978 |
0D94: MOVF 3A,W |
|
|
4979 |
0D95: MOVWF 42 |
|
|
4980 |
0D96: MOVF 39,W |
|
|
4981 |
0D97: MOVWF 41 |
|
|
4982 |
0D98: MOVF 38,W |
|
|
4983 |
0D99: MOVWF 40 |
|
|
4984 |
0D9A: BCF 0A.3 |
|
|
4985 |
0D9B: CALL 726 |
|
|
4986 |
0D9C: BSF 0A.3 |
|
|
4987 |
0D9D: MOVF 79,W |
|
|
4988 |
0D9E: MOVWF 3D |
|
|
4989 |
0D9F: MOVF 78,W |
|
|
4990 |
0DA0: MOVWF 3C |
|
|
4991 |
.................... |
|
|
4992 |
.................... if(b>350) |
|
|
4993 |
0DA1: MOVF 3D,W |
|
|
4994 |
0DA2: SUBLW 00 |
|
|
4995 |
0DA3: BTFSC 03.0 |
|
|
4996 |
0DA4: GOTO 5AF |
|
|
4997 |
0DA5: XORLW FF |
|
|
4998 |
0DA6: BTFSS 03.2 |
|
|
4999 |
0DA7: GOTO 5AC |
|
|
5000 |
0DA8: MOVF 3C,W |
|
|
5001 |
0DA9: SUBLW 5E |
|
|
5002 |
0DAA: BTFSC 03.0 |
|
|
5003 |
0DAB: GOTO 5AF |
|
|
5004 |
.................... { |
|
|
5005 |
.................... b=0; |
|
|
5006 |
0DAC: CLRF 3D |
|
|
5007 |
0DAD: CLRF 3C |
|
|
5008 |
.................... } |
|
|
5009 |
.................... else |
|
|
5010 |
0DAE: GOTO 5AF |
|
|
5011 |
.................... { |
|
|
5012 |
.................... |
|
|
5013 |
.................... } |
|
|
5014 |
.................... c=abs(H-b); |
|
|
5015 |
0DAF: MOVF 3C,W |
|
|
5016 |
0DB0: SUBWF 37,W |
|
|
5017 |
0DB1: MOVWF 40 |
|
|
5018 |
0DB2: CLRF 41 |
|
|
5019 |
0DB3: MOVF 3D,W |
|
|
5020 |
0DB4: BTFSS 03.0 |
|
|
5021 |
0DB5: INCFSZ 3D,W |
|
|
5022 |
0DB6: SUBWF 41,F |
|
|
5023 |
0DB7: MOVF 41,W |
|
|
5024 |
0DB8: MOVWF 3F |
|
|
5025 |
0DB9: MOVF 40,W |
|
|
5026 |
0DBA: MOVWF 3E |
|
|
5027 |
.................... |
|
|
5028 |
.................... while(c>2) //maximalni odchylka uhlu, aby nebylo potreba panelem hybat |
|
|
5029 |
.................... { |
|
|
5030 |
0DBB: MOVF 3F,F |
|
|
5031 |
0DBC: BTFSS 03.2 |
|
|
5032 |
0DBD: GOTO 5C2 |
|
|
5033 |
0DBE: MOVF 3E,W |
|
|
5034 |
0DBF: SUBLW 02 |
|
|
5035 |
0DC0: BTFSC 03.0 |
|
|
5036 |
0DC1: GOTO 61E |
|
|
5037 |
.................... while(H!=b) //probiha dokud se uhel panelu nerovna zadanemu na cele stupne |
|
|
5038 |
.................... { |
|
|
5039 |
0DC2: MOVF 3C,W |
|
|
5040 |
0DC3: SUBWF 37,W |
|
|
5041 |
0DC4: BTFSS 03.2 |
|
|
5042 |
0DC5: GOTO 5C9 |
|
|
5043 |
0DC6: MOVF 3D,F |
|
|
5044 |
0DC7: BTFSC 03.2 |
|
|
5045 |
0DC8: GOTO 61D |
|
|
5046 |
.................... |
|
|
5047 |
.................... if(H>b) |
|
|
5048 |
0DC9: MOVF 3D,F |
|
|
5049 |
0DCA: BTFSS 03.2 |
|
|
5050 |
0DCB: GOTO 5D6 |
|
|
5051 |
0DCC: MOVF 37,W |
|
|
5052 |
0DCD: SUBWF 3C,W |
|
|
5053 |
0DCE: BTFSC 03.0 |
|
|
5054 |
0DCF: GOTO 5D6 |
|
|
5055 |
.................... { |
|
|
5056 |
.................... motorA(2); |
|
|
5057 |
0DD0: MOVLW 02 |
|
|
5058 |
0DD1: MOVWF 40 |
|
|
5059 |
0DD2: BCF 0A.3 |
|
|
5060 |
0DD3: CALL 120 |
|
|
5061 |
0DD4: BSF 0A.3 |
|
|
5062 |
.................... |
|
|
5063 |
.................... } |
|
|
5064 |
.................... else |
|
|
5065 |
0DD5: GOTO 5DB |
|
|
5066 |
.................... { |
|
|
5067 |
.................... motorA(1); |
|
|
5068 |
0DD6: MOVLW 01 |
|
|
5069 |
0DD7: MOVWF 40 |
|
|
5070 |
0DD8: BCF 0A.3 |
|
|
5071 |
0DD9: CALL 120 |
|
|
5072 |
0DDA: BSF 0A.3 |
|
|
5073 |
.................... } |
|
|
5074 |
.................... |
|
|
5075 |
.................... delay_ms (50); //cas sepnuti motoru |
|
|
5076 |
0DDB: MOVLW 32 |
|
|
5077 |
0DDC: MOVWF 40 |
|
|
5078 |
0DDD: BCF 0A.3 |
|
|
5079 |
0DDE: CALL 1C8 |
|
|
5080 |
0DDF: BSF 0A.3 |
|
|
5081 |
.................... |
|
|
5082 |
.................... motorA(3); //vypne motor |
|
|
5083 |
0DE0: MOVLW 03 |
|
|
5084 |
0DE1: MOVWF 40 |
|
|
5085 |
0DE2: BCF 0A.3 |
|
|
5086 |
0DE3: CALL 120 |
|
|
5087 |
0DE4: BSF 0A.3 |
|
|
5088 |
.................... delay_ms (50); //doma na ustaleni panelu pred merenim |
|
|
5089 |
0DE5: MOVLW 32 |
|
|
5090 |
0DE6: MOVWF 40 |
|
|
5091 |
0DE7: BCF 0A.3 |
|
|
5092 |
0DE8: CALL 1C8 |
|
|
5093 |
0DE9: BSF 0A.3 |
|
|
5094 |
.................... a=vyska(); |
|
|
5095 |
0DEA: CALL 385 |
|
|
5096 |
0DEB: MOVF 7A,W |
|
|
5097 |
0DEC: MOVWF 3B |
|
|
5098 |
0DED: MOVF 79,W |
|
|
5099 |
0DEE: MOVWF 3A |
|
|
5100 |
0DEF: MOVF 78,W |
|
|
5101 |
0DF0: MOVWF 39 |
|
|
5102 |
0DF1: MOVF 77,W |
|
|
5103 |
0DF2: MOVWF 38 |
|
|
5104 |
.................... b= (int16) a; |
|
|
5105 |
0DF3: MOVF 3B,W |
|
|
5106 |
0DF4: MOVWF 43 |
|
|
5107 |
0DF5: MOVF 3A,W |
|
|
5108 |
0DF6: MOVWF 42 |
|
|
5109 |
0DF7: MOVF 39,W |
|
|
5110 |
0DF8: MOVWF 41 |
|
|
5111 |
0DF9: MOVF 38,W |
|
|
5112 |
0DFA: MOVWF 40 |
|
|
5113 |
0DFB: BCF 0A.3 |
|
|
5114 |
0DFC: CALL 726 |
|
|
5115 |
0DFD: BSF 0A.3 |
|
|
5116 |
0DFE: MOVF 79,W |
|
|
5117 |
0DFF: MOVWF 3D |
|
|
5118 |
0E00: MOVF 78,W |
|
|
5119 |
0E01: MOVWF 3C |
|
|
5120 |
.................... |
|
|
5121 |
.................... if(b>350) //osetreni pro uhel 0. Zabezpeci ze neprejde stav z 0 na 359 kdy by se solar zacal tocit na druhou stranu |
|
|
5122 |
0E02: MOVF 3D,W |
|
|
5123 |
0E03: SUBLW 00 |
|
|
5124 |
0E04: BTFSC 03.0 |
|
|
5125 |
0E05: GOTO 610 |
|
|
5126 |
0E06: XORLW FF |
|
|
5127 |
0E07: BTFSS 03.2 |
|
|
5128 |
0E08: GOTO 60D |
|
|
5129 |
0E09: MOVF 3C,W |
|
|
5130 |
0E0A: SUBLW 5E |
|
|
5131 |
0E0B: BTFSC 03.0 |
|
|
5132 |
0E0C: GOTO 610 |
|
|
5133 |
.................... { |
|
|
5134 |
.................... b=0; |
|
|
5135 |
0E0D: CLRF 3D |
|
|
5136 |
0E0E: CLRF 3C |
|
|
5137 |
.................... } |
|
|
5138 |
.................... else |
|
|
5139 |
0E0F: GOTO 610 |
|
|
5140 |
.................... { |
|
|
5141 |
.................... b=b; |
|
|
5142 |
.................... } |
|
|
5143 |
.................... c=abs(H-b); |
|
|
5144 |
0E10: MOVF 3C,W |
|
|
5145 |
0E11: SUBWF 37,W |
|
|
5146 |
0E12: MOVWF 40 |
|
|
5147 |
0E13: CLRF 41 |
|
|
5148 |
0E14: MOVF 3D,W |
|
|
5149 |
0E15: BTFSS 03.0 |
|
|
5150 |
0E16: INCFSZ 3D,W |
|
|
5151 |
0E17: SUBWF 41,F |
|
|
5152 |
0E18: MOVF 41,W |
|
|
5153 |
0E19: MOVWF 3F |
|
|
5154 |
0E1A: MOVF 40,W |
|
|
5155 |
0E1B: MOVWF 3E |
|
|
5156 |
.................... } |
|
|
5157 |
0E1C: GOTO 5C2 |
|
|
5158 |
.................... } |
|
|
5159 |
0E1D: GOTO 5BB |
|
|
5160 |
.................... motorA(3); //vypne motor |
|
|
5161 |
0E1E: MOVLW 03 |
|
|
5162 |
0E1F: MOVWF 40 |
|
|
5163 |
0E20: BCF 0A.3 |
|
|
5164 |
0E21: CALL 120 |
|
|
5165 |
0E22: BSF 0A.3 |
|
|
5166 |
.................... printf("Podaøené nastavení výka: %Ld\r\n", b); |
|
|
5167 |
0E23: MOVLW 44 |
|
|
5168 |
0E24: BSF 03.6 |
|
|
5169 |
0E25: MOVWF 0D |
|
|
5170 |
0E26: MOVLW 00 |
|
|
5171 |
0E27: MOVWF 0F |
|
|
5172 |
0E28: MOVLW 1A |
|
|
5173 |
0E29: BCF 03.6 |
|
|
5174 |
0E2A: MOVWF 48 |
|
|
5175 |
0E2B: BCF 0A.3 |
|
|
5176 |
0E2C: CALL 6C3 |
|
|
5177 |
0E2D: BSF 0A.3 |
|
|
5178 |
0E2E: MOVLW 10 |
|
|
5179 |
0E2F: MOVWF 04 |
|
|
5180 |
0E30: MOVF 3D,W |
|
|
5181 |
0E31: MOVWF 41 |
|
|
5182 |
0E32: MOVF 3C,W |
|
|
5183 |
0E33: MOVWF 40 |
|
|
5184 |
0E34: BCF 0A.3 |
|
|
5185 |
0E35: CALL 745 |
|
|
5186 |
0E36: BSF 0A.3 |
|
|
5187 |
0E37: MOVLW 0D |
|
|
5188 |
0E38: MOVWF 55 |
|
|
5189 |
0E39: BCF 0A.3 |
|
|
5190 |
0E3A: CALL 0B6 |
|
|
5191 |
0E3B: BSF 0A.3 |
|
|
5192 |
0E3C: MOVLW 0A |
|
|
5193 |
0E3D: MOVWF 55 |
|
|
5194 |
0E3E: BCF 0A.3 |
|
|
5195 |
0E3F: CALL 0B6 |
|
|
5196 |
0E40: BSF 0A.3 |
|
|
5197 |
.................... } |
|
|
5198 |
0E41: BCF 0A.3 |
|
|
5199 |
0E42: BSF 0A.4 |
|
|
5200 |
0E43: GOTO 281 (RETURN) |
|
|
5201 |
.................... |
|
|
5202 |
.................... void azimut_set (int8 H) //slouzi pro nastaveni nove vysky panelu |
|
|
5203 |
.................... { |
|
|
5204 |
.................... float a; |
|
|
5205 |
.................... int16 b,c; |
|
|
5206 |
.................... |
|
|
5207 |
.................... a=azimut(); |
|
|
5208 |
* |
|
|
5209 |
0F19: BSF 0A.4 |
|
|
5210 |
0F1A: BCF 0A.3 |
|
|
5211 |
0F1B: CALL 000 |
|
|
5212 |
0F1C: BCF 0A.4 |
|
|
5213 |
0F1D: BSF 0A.3 |
|
|
5214 |
0F1E: MOVF 7A,W |
|
|
5215 |
0F1F: MOVWF 3B |
|
|
5216 |
0F20: MOVF 79,W |
|
|
5217 |
0F21: MOVWF 3A |
|
|
5218 |
0F22: MOVF 78,W |
|
|
5219 |
0F23: MOVWF 39 |
|
|
5220 |
0F24: MOVF 77,W |
|
|
5221 |
0F25: MOVWF 38 |
|
|
5222 |
.................... b= (int16) a; |
|
|
5223 |
0F26: MOVF 3B,W |
|
|
5224 |
0F27: MOVWF 43 |
|
|
5225 |
0F28: MOVF 3A,W |
|
|
5226 |
0F29: MOVWF 42 |
|
|
5227 |
0F2A: MOVF 39,W |
|
|
5228 |
0F2B: MOVWF 41 |
|
|
5229 |
0F2C: MOVF 38,W |
|
|
5230 |
0F2D: MOVWF 40 |
|
|
5231 |
0F2E: BCF 0A.3 |
|
|
5232 |
0F2F: CALL 726 |
|
|
5233 |
0F30: BSF 0A.3 |
|
|
5234 |
0F31: MOVF 79,W |
|
|
5235 |
0F32: MOVWF 3D |
|
|
5236 |
0F33: MOVF 78,W |
|
|
5237 |
0F34: MOVWF 3C |
|
|
5238 |
.................... //printf("auhel pro mereni: %Ld(procenta)\r\n", b); |
|
|
5239 |
.................... if(b>350) |
|
|
5240 |
0F35: MOVF 3D,W |
|
|
5241 |
0F36: SUBLW 00 |
|
|
5242 |
0F37: BTFSC 03.0 |
|
|
5243 |
0F38: GOTO 743 |
|
|
5244 |
0F39: XORLW FF |
|
|
5245 |
0F3A: BTFSS 03.2 |
|
|
5246 |
0F3B: GOTO 740 |
|
|
5247 |
0F3C: MOVF 3C,W |
|
|
5248 |
0F3D: SUBLW 5E |
|
|
5249 |
0F3E: BTFSC 03.0 |
|
|
5250 |
0F3F: GOTO 743 |
|
|
5251 |
.................... { |
|
|
5252 |
.................... b=0; |
|
|
5253 |
0F40: CLRF 3D |
|
|
5254 |
0F41: CLRF 3C |
|
|
5255 |
.................... } |
|
|
5256 |
.................... else |
|
|
5257 |
0F42: GOTO 743 |
|
|
5258 |
.................... { |
|
|
5259 |
.................... |
|
|
5260 |
.................... } |
|
|
5261 |
.................... c=abs(H-b); |
|
|
5262 |
0F43: MOVF 3C,W |
|
|
5263 |
0F44: SUBWF 37,W |
|
|
5264 |
0F45: MOVWF 40 |
|
|
5265 |
0F46: CLRF 41 |
|
|
5266 |
0F47: MOVF 3D,W |
|
|
5267 |
0F48: BTFSS 03.0 |
|
|
5268 |
0F49: INCFSZ 3D,W |
|
|
5269 |
0F4A: SUBWF 41,F |
|
|
5270 |
0F4B: MOVF 41,W |
|
|
5271 |
0F4C: MOVWF 3F |
|
|
5272 |
0F4D: MOVF 40,W |
|
|
5273 |
0F4E: MOVWF 3E |
|
|
5274 |
.................... |
|
|
5275 |
.................... while(c>3) //maximalni odchylka uhlu, aby nebylo potreba panelem hybat |
|
|
5276 |
.................... { |
|
|
5277 |
0F4F: MOVF 3F,F |
|
|
5278 |
0F50: BTFSS 03.2 |
|
|
5279 |
0F51: GOTO 756 |
|
|
5280 |
0F52: MOVF 3E,W |
|
|
5281 |
0F53: SUBLW 03 |
|
|
5282 |
0F54: BTFSC 03.0 |
|
|
5283 |
0F55: GOTO 7B6 |
|
|
5284 |
.................... while(H!=b) //probiha dokud se uhel panelu nerovna zadanemu na cele stupne |
|
|
5285 |
.................... { |
|
|
5286 |
0F56: MOVF 3C,W |
|
|
5287 |
0F57: SUBWF 37,W |
|
|
5288 |
0F58: BTFSS 03.2 |
|
|
5289 |
0F59: GOTO 75D |
|
|
5290 |
0F5A: MOVF 3D,F |
|
|
5291 |
0F5B: BTFSC 03.2 |
|
|
5292 |
0F5C: GOTO 7B5 |
|
|
5293 |
.................... |
|
|
5294 |
.................... if(H>b) |
|
|
5295 |
0F5D: MOVF 3D,F |
|
|
5296 |
0F5E: BTFSS 03.2 |
|
|
5297 |
0F5F: GOTO 76A |
|
|
5298 |
0F60: MOVF 37,W |
|
|
5299 |
0F61: SUBWF 3C,W |
|
|
5300 |
0F62: BTFSC 03.0 |
|
|
5301 |
0F63: GOTO 76A |
|
|
5302 |
.................... { |
|
|
5303 |
.................... motorB(2); |
|
|
5304 |
0F64: MOVLW 02 |
|
|
5305 |
0F65: MOVWF 40 |
|
|
5306 |
0F66: BCF 0A.3 |
|
|
5307 |
0F67: CALL 7C5 |
|
|
5308 |
0F68: BSF 0A.3 |
|
|
5309 |
.................... |
|
|
5310 |
.................... } |
|
|
5311 |
.................... else |
|
|
5312 |
0F69: GOTO 76F |
|
|
5313 |
.................... { |
|
|
5314 |
.................... motorB(1); |
|
|
5315 |
0F6A: MOVLW 01 |
|
|
5316 |
0F6B: MOVWF 40 |
|
|
5317 |
0F6C: BCF 0A.3 |
|
|
5318 |
0F6D: CALL 7C5 |
|
|
5319 |
0F6E: BSF 0A.3 |
|
|
5320 |
.................... } |
|
|
5321 |
.................... |
|
|
5322 |
.................... delay_ms (50); //cas sepnuti motoru |
|
|
5323 |
0F6F: MOVLW 32 |
|
|
5324 |
0F70: MOVWF 40 |
|
|
5325 |
0F71: BCF 0A.3 |
|
|
5326 |
0F72: CALL 1C8 |
|
|
5327 |
0F73: BSF 0A.3 |
|
|
5328 |
.................... |
|
|
5329 |
.................... motorB(3); //vypne motor |
|
|
5330 |
0F74: MOVLW 03 |
|
|
5331 |
0F75: MOVWF 40 |
|
|
5332 |
0F76: BCF 0A.3 |
|
|
5333 |
0F77: CALL 7C5 |
|
|
5334 |
0F78: BSF 0A.3 |
|
|
5335 |
.................... delay_ms (50); //doma na ustaleni panelu pred merenim |
|
|
5336 |
0F79: MOVLW 32 |
|
|
5337 |
0F7A: MOVWF 40 |
|
|
5338 |
0F7B: BCF 0A.3 |
|
|
5339 |
0F7C: CALL 1C8 |
|
|
5340 |
0F7D: BSF 0A.3 |
|
|
5341 |
.................... a=azimut(); |
|
|
5342 |
0F7E: BSF 0A.4 |
|
|
5343 |
0F7F: BCF 0A.3 |
|
|
5344 |
0F80: CALL 000 |
|
|
5345 |
0F81: BCF 0A.4 |
|
|
5346 |
0F82: BSF 0A.3 |
|
|
5347 |
0F83: MOVF 7A,W |
|
|
5348 |
0F84: MOVWF 3B |
|
|
5349 |
0F85: MOVF 79,W |
|
|
5350 |
0F86: MOVWF 3A |
|
|
5351 |
0F87: MOVF 78,W |
|
|
5352 |
0F88: MOVWF 39 |
|
|
5353 |
0F89: MOVF 77,W |
|
|
5354 |
0F8A: MOVWF 38 |
|
|
5355 |
.................... b= (int16) a; |
|
|
5356 |
0F8B: MOVF 3B,W |
|
|
5357 |
0F8C: MOVWF 43 |
|
|
5358 |
0F8D: MOVF 3A,W |
|
|
5359 |
0F8E: MOVWF 42 |
|
|
5360 |
0F8F: MOVF 39,W |
|
|
5361 |
0F90: MOVWF 41 |
|
|
5362 |
0F91: MOVF 38,W |
|
|
5363 |
0F92: MOVWF 40 |
|
|
5364 |
0F93: BCF 0A.3 |
|
|
5365 |
0F94: CALL 726 |
|
|
5366 |
0F95: BSF 0A.3 |
|
|
5367 |
0F96: MOVF 79,W |
|
|
5368 |
0F97: MOVWF 3D |
|
|
5369 |
0F98: MOVF 78,W |
|
|
5370 |
0F99: MOVWF 3C |
|
|
5371 |
.................... |
|
|
5372 |
.................... if(b>350) //osetreni pro uhel 0. Zabezpeci ze neprejde stav z 0 na 359 kdy by se solar zacal tocit na druhou stranu |
|
|
5373 |
0F9A: MOVF 3D,W |
|
|
5374 |
0F9B: SUBLW 00 |
|
|
5375 |
0F9C: BTFSC 03.0 |
|
|
5376 |
0F9D: GOTO 7A8 |
|
|
5377 |
0F9E: XORLW FF |
|
|
5378 |
0F9F: BTFSS 03.2 |
|
|
5379 |
0FA0: GOTO 7A5 |
|
|
5380 |
0FA1: MOVF 3C,W |
|
|
5381 |
0FA2: SUBLW 5E |
|
|
5382 |
0FA3: BTFSC 03.0 |
|
|
5383 |
0FA4: GOTO 7A8 |
|
|
5384 |
.................... { |
|
|
5385 |
.................... b=0; |
|
|
5386 |
0FA5: CLRF 3D |
|
|
5387 |
0FA6: CLRF 3C |
|
|
5388 |
.................... } |
|
|
5389 |
.................... else |
|
|
5390 |
0FA7: GOTO 7A8 |
|
|
5391 |
.................... { |
|
|
5392 |
.................... b=b; |
|
|
5393 |
.................... } |
|
|
5394 |
.................... c=abs(H-b); |
|
|
5395 |
0FA8: MOVF 3C,W |
|
|
5396 |
0FA9: SUBWF 37,W |
|
|
5397 |
0FAA: MOVWF 40 |
|
|
5398 |
0FAB: CLRF 41 |
|
|
5399 |
0FAC: MOVF 3D,W |
|
|
5400 |
0FAD: BTFSS 03.0 |
|
|
5401 |
0FAE: INCFSZ 3D,W |
|
|
5402 |
0FAF: SUBWF 41,F |
|
|
5403 |
0FB0: MOVF 41,W |
|
|
5404 |
0FB1: MOVWF 3F |
|
|
5405 |
0FB2: MOVF 40,W |
|
|
5406 |
0FB3: MOVWF 3E |
|
|
5407 |
.................... } |
|
|
5408 |
0FB4: GOTO 756 |
|
|
5409 |
.................... } |
|
|
5410 |
0FB5: GOTO 74F |
|
|
5411 |
.................... motorA(3); //vypne motor |
|
|
5412 |
0FB6: MOVLW 03 |
|
|
5413 |
0FB7: MOVWF 40 |
|
|
5414 |
0FB8: BCF 0A.3 |
|
|
5415 |
0FB9: CALL 120 |
|
|
5416 |
0FBA: BSF 0A.3 |
|
|
5417 |
.................... printf("Podaøené nastavení azimut: %Ld\r\n", b); |
|
|
5418 |
0FBB: MOVLW 64 |
|
|
5419 |
0FBC: BSF 03.6 |
|
|
5420 |
0FBD: MOVWF 0D |
|
|
5421 |
0FBE: MOVLW 00 |
|
|
5422 |
0FBF: MOVWF 0F |
|
|
5423 |
0FC0: MOVLW 1B |
|
|
5424 |
0FC1: BCF 03.6 |
|
|
5425 |
0FC2: MOVWF 48 |
|
|
5426 |
0FC3: BCF 0A.3 |
|
|
5427 |
0FC4: CALL 6C3 |
|
|
5428 |
0FC5: BSF 0A.3 |
|
|
5429 |
0FC6: MOVLW 10 |
|
|
5430 |
0FC7: MOVWF 04 |
|
|
5431 |
0FC8: MOVF 3D,W |
|
|
5432 |
0FC9: MOVWF 41 |
|
|
5433 |
0FCA: MOVF 3C,W |
|
|
5434 |
0FCB: MOVWF 40 |
|
|
5435 |
0FCC: BCF 0A.3 |
|
|
5436 |
0FCD: CALL 745 |
|
|
5437 |
0FCE: BSF 0A.3 |
|
|
5438 |
0FCF: MOVLW 0D |
|
|
5439 |
0FD0: MOVWF 55 |
|
|
5440 |
0FD1: BCF 0A.3 |
|
|
5441 |
0FD2: CALL 0B6 |
|
|
5442 |
0FD3: BSF 0A.3 |
|
|
5443 |
0FD4: MOVLW 0A |
|
|
5444 |
0FD5: MOVWF 55 |
|
|
5445 |
0FD6: BCF 0A.3 |
|
|
5446 |
0FD7: CALL 0B6 |
|
|
5447 |
0FD8: BSF 0A.3 |
|
|
5448 |
.................... } |
|
|
5449 |
0FD9: BCF 0A.3 |
|
|
5450 |
0FDA: BSF 0A.4 |
|
|
5451 |
0FDB: GOTO 287 (RETURN) |
|
|
5452 |
.................... |
|
|
5453 |
.................... |
|
|
5454 |
.................... void main() |
|
|
5455 |
.................... { |
|
|
5456 |
* |
|
|
5457 |
11DA: CLRF 04 |
|
|
5458 |
11DB: BCF 03.7 |
|
|
5459 |
11DC: MOVLW 1F |
|
|
5460 |
11DD: ANDWF 03,F |
|
|
5461 |
11DE: MOVLW 71 |
|
|
5462 |
11DF: BSF 03.5 |
|
|
5463 |
11E0: MOVWF 0F |
|
|
5464 |
11E1: MOVF 0F,W |
|
|
5465 |
11E2: BCF 03.5 |
|
|
5466 |
11E3: BCF 20.7 |
|
|
5467 |
11E4: MOVF 20,W |
|
|
5468 |
11E5: BSF 03.5 |
|
|
5469 |
11E6: MOVWF 07 |
|
|
5470 |
11E7: BCF 03.5 |
|
|
5471 |
11E8: BSF 07.7 |
|
|
5472 |
11E9: BSF 03.5 |
|
|
5473 |
11EA: BSF 03.6 |
|
|
5474 |
11EB: MOVF 09,W |
|
|
5475 |
11EC: ANDLW C0 |
|
|
5476 |
11ED: MOVWF 09 |
|
|
5477 |
11EE: BCF 03.6 |
|
|
5478 |
11EF: BCF 1F.4 |
|
|
5479 |
11F0: BCF 1F.5 |
|
|
5480 |
11F1: MOVLW 00 |
|
|
5481 |
11F2: BSF 03.6 |
|
|
5482 |
11F3: MOVWF 08 |
|
|
5483 |
11F4: BCF 03.5 |
|
|
5484 |
11F5: CLRF 07 |
|
|
5485 |
11F6: CLRF 08 |
|
|
5486 |
11F7: CLRF 09 |
|
|
5487 |
.................... |
|
|
5488 |
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD); |
|
|
5489 |
* |
|
|
5490 |
11FB: BSF 03.5 |
|
|
5491 |
11FC: BSF 03.6 |
|
|
5492 |
11FD: MOVF 09,W |
|
|
5493 |
11FE: ANDLW C0 |
|
|
5494 |
11FF: MOVWF 09 |
|
|
5495 |
1200: BCF 03.6 |
|
|
5496 |
1201: BCF 1F.4 |
|
|
5497 |
1202: BCF 1F.5 |
|
|
5498 |
1203: MOVLW 00 |
|
|
5499 |
1204: BSF 03.6 |
|
|
5500 |
1205: MOVWF 08 |
|
|
5501 |
.................... setup_adc(ADC_CLOCK_DIV_2); |
|
|
5502 |
1206: BCF 03.5 |
|
|
5503 |
1207: BCF 03.6 |
|
|
5504 |
1208: BCF 1F.6 |
|
|
5505 |
1209: BCF 1F.7 |
|
|
5506 |
120A: BSF 03.5 |
|
|
5507 |
120B: BCF 1F.7 |
|
|
5508 |
120C: BCF 03.5 |
|
|
5509 |
120D: BSF 1F.0 |
|
|
5510 |
.................... setup_spi(SPI_SS_DISABLED); |
|
|
5511 |
120E: BCF 14.5 |
|
|
5512 |
120F: BCF 20.5 |
|
|
5513 |
1210: MOVF 20,W |
|
|
5514 |
1211: BSF 03.5 |
|
|
5515 |
1212: MOVWF 07 |
|
|
5516 |
1213: BCF 03.5 |
|
|
5517 |
1214: BSF 20.4 |
|
|
5518 |
1215: MOVF 20,W |
|
|
5519 |
1216: BSF 03.5 |
|
|
5520 |
1217: MOVWF 07 |
|
|
5521 |
1218: BCF 03.5 |
|
|
5522 |
1219: BCF 20.3 |
|
|
5523 |
121A: MOVF 20,W |
|
|
5524 |
121B: BSF 03.5 |
|
|
5525 |
121C: MOVWF 07 |
|
|
5526 |
121D: MOVLW 01 |
|
|
5527 |
121E: BCF 03.5 |
|
|
5528 |
121F: MOVWF 14 |
|
|
5529 |
1220: MOVLW 00 |
|
|
5530 |
1221: BSF 03.5 |
|
|
5531 |
1222: MOVWF 14 |
|
|
5532 |
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
|
|
5533 |
1223: MOVF 01,W |
|
|
5534 |
1224: ANDLW C7 |
|
|
5535 |
1225: IORLW 08 |
|
|
5536 |
1226: MOVWF 01 |
|
|
5537 |
.................... setup_timer_1(T1_DISABLED); |
|
|
5538 |
1227: BCF 03.5 |
|
|
5539 |
1228: CLRF 10 |
|
|
5540 |
.................... setup_timer_2(T2_DISABLED,0,1); |
|
|
5541 |
1229: MOVLW 00 |
|
|
5542 |
122A: MOVWF 78 |
|
|
5543 |
122B: MOVWF 12 |
|
|
5544 |
122C: MOVLW 00 |
|
|
5545 |
122D: BSF 03.5 |
|
|
5546 |
122E: MOVWF 12 |
|
|
5547 |
.................... setup_ccp1(CCP_OFF); |
|
|
5548 |
122F: BCF 03.5 |
|
|
5549 |
1230: BSF 20.2 |
|
|
5550 |
1231: MOVF 20,W |
|
|
5551 |
1232: BSF 03.5 |
|
|
5552 |
1233: MOVWF 07 |
|
|
5553 |
1234: BCF 03.5 |
|
|
5554 |
1235: CLRF 17 |
|
|
5555 |
1236: BSF 03.5 |
|
|
5556 |
1237: CLRF 1B |
|
|
5557 |
1238: CLRF 1C |
|
|
5558 |
1239: MOVLW 01 |
|
|
5559 |
123A: MOVWF 1D |
|
|
5560 |
.................... setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard |
|
|
5561 |
123B: BCF 03.5 |
|
|
5562 |
123C: BSF 03.6 |
|
|
5563 |
123D: CLRF 07 |
|
|
5564 |
123E: CLRF 08 |
|
|
5565 |
123F: CLRF 09 |
|
|
5566 |
.................... |
|
|
5567 |
.................... setup_adc_ports(PIN_A0); //piny pro A/D RA0 |
|
|
5568 |
1240: BSF 03.5 |
|
|
5569 |
1241: MOVF 09,W |
|
|
5570 |
1242: ANDLW C0 |
|
|
5571 |
1243: MOVWF 09 |
|
|
5572 |
1244: BCF 03.6 |
|
|
5573 |
1245: BCF 1F.4 |
|
|
5574 |
1246: BCF 1F.5 |
|
|
5575 |
1247: MOVLW 28 |
|
|
5576 |
1248: BSF 03.6 |
|
|
5577 |
1249: MOVWF 08 |
|
|
5578 |
.................... setup_adc_ports(PIN_A1); //piny pro A/D RA1 |
|
|
5579 |
124A: MOVF 09,W |
|
|
5580 |
124B: ANDLW C0 |
|
|
5581 |
124C: MOVWF 09 |
|
|
5582 |
124D: BCF 03.6 |
|
|
5583 |
124E: BCF 1F.4 |
|
|
5584 |
124F: BCF 1F.5 |
|
|
5585 |
1250: MOVLW 29 |
|
|
5586 |
1251: BSF 03.6 |
|
|
5587 |
1252: MOVWF 08 |
|
|
5588 |
.................... |
|
|
5589 |
.................... printf("Akcelerometr: \r\n",); |
|
|
5590 |
1253: MOVLW 85 |
|
|
5591 |
1254: BCF 03.5 |
|
|
5592 |
1255: MOVWF 0D |
|
|
5593 |
1256: MOVLW 00 |
|
|
5594 |
1257: MOVWF 0F |
|
|
5595 |
1258: BCF 0A.4 |
|
|
5596 |
1259: BCF 03.6 |
|
|
5597 |
125A: CALL 0DA |
|
|
5598 |
125B: BSF 0A.4 |
|
|
5599 |
.................... |
|
|
5600 |
.................... motorA(3); |
|
|
5601 |
125C: MOVLW 03 |
|
|
5602 |
125D: MOVWF 40 |
|
|
5603 |
125E: BCF 0A.4 |
|
|
5604 |
125F: CALL 120 |
|
|
5605 |
1260: BSF 0A.4 |
|
|
5606 |
.................... |
|
|
5607 |
.................... float a, b; |
|
|
5608 |
.................... unsigned int value1=10,value2=10; |
|
|
5609 |
1261: MOVLW 0A |
|
|
5610 |
1262: MOVWF 35 |
|
|
5611 |
1263: MOVWF 36 |
|
|
5612 |
.................... |
|
|
5613 |
.................... |
|
|
5614 |
.................... setAK(); //nastaveni akcelerometru |
|
|
5615 |
1264: BCF 0A.4 |
|
|
5616 |
1265: GOTO 18D |
|
|
5617 |
1266: BSF 0A.4 |
|
|
5618 |
.................... setmag(); |
|
|
5619 |
1267: BCF 0A.4 |
|
|
5620 |
1268: GOTO 1DC |
|
|
5621 |
1269: BSF 0A.4 |
|
|
5622 |
.................... printf("Akcelerometr1: \r\n",); |
|
|
5623 |
126A: MOVLW 8E |
|
|
5624 |
126B: BSF 03.6 |
|
|
5625 |
126C: MOVWF 0D |
|
|
5626 |
126D: MOVLW 00 |
|
|
5627 |
126E: MOVWF 0F |
|
|
5628 |
126F: BCF 0A.4 |
|
|
5629 |
1270: BCF 03.6 |
|
|
5630 |
1271: CALL 0DA |
|
|
5631 |
1272: BSF 0A.4 |
|
|
5632 |
.................... while(TRUE) |
|
|
5633 |
.................... { |
|
|
5634 |
.................... |
|
|
5635 |
.................... printf("Akcelerometr2: \r\n",); |
|
|
5636 |
1273: MOVLW 98 |
|
|
5637 |
1274: BSF 03.6 |
|
|
5638 |
1275: MOVWF 0D |
|
|
5639 |
1276: MOVLW 00 |
|
|
5640 |
1277: MOVWF 0F |
|
|
5641 |
1278: BCF 0A.4 |
|
|
5642 |
1279: BCF 03.6 |
|
|
5643 |
127A: CALL 0DA |
|
|
5644 |
127B: BSF 0A.4 |
|
|
5645 |
.................... |
|
|
5646 |
.................... |
|
|
5647 |
.................... |
|
|
5648 |
.................... |
|
|
5649 |
.................... |
|
|
5650 |
.................... /// set_adc_channel(0); //nastavi AD na kanál 0 (RA0) |
|
|
5651 |
.................... /// read_adc(ADC_START_ONLY); // Spustime A/D prevod |
|
|
5652 |
.................... // Delay_ms(1); |
|
|
5653 |
.................... // while(!adc_done()); // Cekame na dokonceni prevodu |
|
|
5654 |
.................... // value1=read_adc(); // Precteme hodnotu z prevodniku |
|
|
5655 |
.................... vyska_set (90); |
|
|
5656 |
127C: MOVLW 5A |
|
|
5657 |
127D: MOVWF 37 |
|
|
5658 |
127E: BCF 0A.4 |
|
|
5659 |
127F: BSF 0A.3 |
|
|
5660 |
1280: GOTO 580 |
|
|
5661 |
1281: BSF 0A.4 |
|
|
5662 |
1282: BCF 0A.3 |
|
|
5663 |
.................... azimut_set(0); |
|
|
5664 |
1283: CLRF 37 |
|
|
5665 |
1284: BCF 0A.4 |
|
|
5666 |
1285: BSF 0A.3 |
|
|
5667 |
1286: GOTO 719 |
|
|
5668 |
1287: BSF 0A.4 |
|
|
5669 |
1288: BCF 0A.3 |
|
|
5670 |
.................... printf("zadaný azimut %d \r\n", value1); |
|
|
5671 |
1289: MOVLW A2 |
|
|
5672 |
128A: BSF 03.6 |
|
|
5673 |
128B: MOVWF 0D |
|
|
5674 |
128C: MOVLW 00 |
|
|
5675 |
128D: MOVWF 0F |
|
|
5676 |
128E: MOVLW 0E |
|
|
5677 |
128F: BCF 03.6 |
|
|
5678 |
1290: MOVWF 48 |
|
|
5679 |
1291: BCF 0A.4 |
|
|
5680 |
1292: CALL 6C3 |
|
|
5681 |
1293: BSF 0A.4 |
|
|
5682 |
1294: MOVF 35,W |
|
|
5683 |
1295: MOVWF 37 |
|
|
5684 |
1296: MOVLW 1F |
|
|
5685 |
1297: MOVWF 38 |
|
|
5686 |
1298: GOTO 167 |
|
|
5687 |
1299: MOVLW 20 |
|
|
5688 |
129A: MOVWF 55 |
|
|
5689 |
129B: BCF 0A.4 |
|
|
5690 |
129C: CALL 0B6 |
|
|
5691 |
129D: BSF 0A.4 |
|
|
5692 |
129E: MOVLW 0D |
|
|
5693 |
129F: MOVWF 55 |
|
|
5694 |
12A0: BCF 0A.4 |
|
|
5695 |
12A1: CALL 0B6 |
|
|
5696 |
12A2: BSF 0A.4 |
|
|
5697 |
12A3: MOVLW 0A |
|
|
5698 |
12A4: MOVWF 55 |
|
|
5699 |
12A5: BCF 0A.4 |
|
|
5700 |
12A6: CALL 0B6 |
|
|
5701 |
12A7: BSF 0A.4 |
|
|
5702 |
.................... |
|
|
5703 |
.................... // set_adc_channel(1); //nastavi AD na kanál 1 (RA1) |
|
|
5704 |
.................... // read_adc(ADC_START_ONLY); // Spustime A/D prevod |
|
|
5705 |
.................... // Delay_ms(1); |
|
|
5706 |
.................... // while(!adc_done()); // Cekame na dokonceni prevodu |
|
|
5707 |
.................... // value2=read_adc(); |
|
|
5708 |
.................... //vyska_set (90); |
|
|
5709 |
.................... |
|
|
5710 |
.................... |
|
|
5711 |
.................... delay_ms (2000); |
|
|
5712 |
12A8: MOVLW 08 |
|
|
5713 |
12A9: MOVWF 37 |
|
|
5714 |
12AA: MOVLW FA |
|
|
5715 |
12AB: MOVWF 40 |
|
|
5716 |
12AC: BCF 0A.4 |
|
|
5717 |
12AD: CALL 1C8 |
|
|
5718 |
12AE: BSF 0A.4 |
|
|
5719 |
12AF: DECFSZ 37,F |
|
|
5720 |
12B0: GOTO 2AA |
|
|
5721 |
.................... |
|
|
5722 |
.................... |
|
|
5723 |
.................... } |
|
|
5724 |
12B1: GOTO 273 |
|
|
5725 |
.................... } |
|
|
5726 |
12B2: SLEEP |
|
|
5727 |
|
|
|
5728 |
Configuration Fuses: |
|
|
5729 |
Word 1: 2CF5 INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG |
|
|
5730 |
Word 2: 3FFF NOWRT BORV40 |