1045 |
jacho |
1 |
CCS PCM C Compiler, Version 4.106, 47914 16-4-13 01:14 |
|
|
2 |
|
|
|
3 |
Filename: c:\users\honza\documents\pic\meteo_stanice\main.lst |
|
|
4 |
|
|
|
5 |
ROM used: 3527 words (43%) |
|
|
6 |
Largest free fragment is 2048 |
|
|
7 |
RAM used: 36 (10%) at main() level |
|
|
8 |
89 (24%) worst case |
|
|
9 |
Stack: 3 locations |
|
|
10 |
|
|
|
11 |
* |
|
|
12 |
0000: MOVLW 0B |
|
|
13 |
0001: MOVWF 0A |
|
|
14 |
0002: GOTO 30B |
|
|
15 |
0003: NOP |
|
|
16 |
.................... //Meteorologicka cast |
|
|
17 |
.................... #define VERSION "0.1" |
|
|
18 |
.................... #define AUTOR "Jan Chroust" |
|
|
19 |
.................... #define DATE "15.4.2013" |
|
|
20 |
.................... |
|
|
21 |
.................... |
|
|
22 |
.................... |
|
|
23 |
.................... #include "C:\Users\Honza\Documents\pic\meteo_stanice\main.h" |
|
|
24 |
.................... #include <16F887.h> |
|
|
25 |
.................... //////// Standard Header file for the PIC16F887 device //////////////// |
|
|
26 |
.................... #device PIC16F887 |
|
|
27 |
.................... #list |
|
|
28 |
.................... |
|
|
29 |
.................... #device adc=8 |
|
|
30 |
.................... |
|
|
31 |
.................... #FUSES NOWDT //No Watch Dog Timer |
|
|
32 |
.................... #FUSES INTRC //Internal RC Osc |
|
|
33 |
.................... #FUSES NOPUT //No Power Up Timer |
|
|
34 |
.................... #FUSES MCLR //Master Clear pin enabled |
|
|
35 |
.................... #FUSES NOPROTECT //Code not protected from reading |
|
|
36 |
.................... #FUSES NOCPD //No EE protection |
|
|
37 |
.................... #FUSES NOBROWNOUT //No brownout reset |
|
|
38 |
.................... #FUSES IESO //Internal External Switch Over mode enabled |
|
|
39 |
.................... #FUSES FCMEN //Fail-safe clock monitor enabled |
|
|
40 |
.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O |
|
|
41 |
.................... #FUSES NODEBUG //No Debug mode for ICD |
|
|
42 |
.................... #FUSES NOWRT //Program memory not write protected |
|
|
43 |
.................... #FUSES BORV40 //Brownout reset at 4.0V |
|
|
44 |
.................... |
|
|
45 |
.................... #use delay(clock=8000000) |
|
|
46 |
* |
|
|
47 |
02A0: MOVLW 52 |
|
|
48 |
02A1: MOVWF 04 |
|
|
49 |
02A2: BCF 03.7 |
|
|
50 |
02A3: MOVF 00,W |
|
|
51 |
02A4: BTFSC 03.2 |
|
|
52 |
02A5: GOTO 2B3 |
|
|
53 |
02A6: MOVLW 02 |
|
|
54 |
02A7: MOVWF 78 |
|
|
55 |
02A8: CLRF 77 |
|
|
56 |
02A9: DECFSZ 77,F |
|
|
57 |
02AA: GOTO 2A9 |
|
|
58 |
02AB: DECFSZ 78,F |
|
|
59 |
02AC: GOTO 2A8 |
|
|
60 |
02AD: MOVLW 97 |
|
|
61 |
02AE: MOVWF 77 |
|
|
62 |
02AF: DECFSZ 77,F |
|
|
63 |
02B0: GOTO 2AF |
|
|
64 |
02B1: DECFSZ 00,F |
|
|
65 |
02B2: GOTO 2A6 |
|
|
66 |
02B3: RETURN |
|
|
67 |
.................... |
|
|
68 |
.................... |
|
|
69 |
.................... |
|
|
70 |
.................... #define PIN_SDA PIN_B0 |
|
|
71 |
.................... #define PIN_SCL PIN_B1 |
|
|
72 |
.................... #use i2c(master, sda=PIN_SDA, scl=PIN_SCL) |
|
|
73 |
* |
|
|
74 |
01FB: MOVLW 08 |
|
|
75 |
01FC: MOVWF 78 |
|
|
76 |
01FD: NOP |
|
|
77 |
01FE: BCF 06.1 |
|
|
78 |
01FF: BSF 03.5 |
|
|
79 |
0200: BCF 06.1 |
|
|
80 |
0201: NOP |
|
|
81 |
0202: BCF 03.5 |
|
|
82 |
0203: RLF 5F,F |
|
|
83 |
0204: BCF 06.0 |
|
|
84 |
0205: BTFSS 03.0 |
|
|
85 |
0206: GOTO 20A |
|
|
86 |
0207: BSF 03.5 |
|
|
87 |
0208: BSF 06.0 |
|
|
88 |
0209: BCF 03.5 |
|
|
89 |
020A: BTFSC 03.0 |
|
|
90 |
020B: GOTO 20F |
|
|
91 |
020C: BSF 03.5 |
|
|
92 |
020D: BCF 06.0 |
|
|
93 |
020E: BCF 03.5 |
|
|
94 |
020F: BSF 03.5 |
|
|
95 |
0210: BSF 06.1 |
|
|
96 |
0211: BCF 03.5 |
|
|
97 |
0212: BTFSS 06.1 |
|
|
98 |
0213: GOTO 212 |
|
|
99 |
0214: DECFSZ 78,F |
|
|
100 |
0215: GOTO 1FD |
|
|
101 |
0216: NOP |
|
|
102 |
0217: BCF 06.1 |
|
|
103 |
0218: BSF 03.5 |
|
|
104 |
0219: BCF 06.1 |
|
|
105 |
021A: NOP |
|
|
106 |
021B: BSF 06.0 |
|
|
107 |
021C: NOP |
|
|
108 |
021D: NOP |
|
|
109 |
021E: BSF 06.1 |
|
|
110 |
021F: BCF 03.5 |
|
|
111 |
0220: BTFSS 06.1 |
|
|
112 |
0221: GOTO 220 |
|
|
113 |
0222: CLRF 78 |
|
|
114 |
0223: NOP |
|
|
115 |
0224: BTFSC 06.0 |
|
|
116 |
0225: BSF 78.0 |
|
|
117 |
0226: BCF 06.1 |
|
|
118 |
0227: BSF 03.5 |
|
|
119 |
0228: BCF 06.1 |
|
|
120 |
0229: BCF 03.5 |
|
|
121 |
022A: BCF 06.0 |
|
|
122 |
022B: BSF 03.5 |
|
|
123 |
022C: BCF 06.0 |
|
|
124 |
022D: BCF 03.5 |
|
|
125 |
022E: RETURN |
|
|
126 |
* |
|
|
127 |
02B4: MOVLW 08 |
|
|
128 |
02B5: MOVWF 60 |
|
|
129 |
02B6: MOVF 77,W |
|
|
130 |
02B7: MOVWF 61 |
|
|
131 |
02B8: BSF 03.5 |
|
|
132 |
02B9: BSF 06.0 |
|
|
133 |
02BA: NOP |
|
|
134 |
02BB: BSF 06.1 |
|
|
135 |
02BC: BCF 03.5 |
|
|
136 |
02BD: BTFSS 06.1 |
|
|
137 |
02BE: GOTO 2BD |
|
|
138 |
02BF: BTFSC 06.0 |
|
|
139 |
02C0: BSF 03.0 |
|
|
140 |
02C1: BTFSS 06.0 |
|
|
141 |
02C2: BCF 03.0 |
|
|
142 |
02C3: RLF 78,F |
|
|
143 |
02C4: NOP |
|
|
144 |
02C5: BSF 03.5 |
|
|
145 |
02C6: BCF 06.1 |
|
|
146 |
02C7: BCF 03.5 |
|
|
147 |
02C8: BCF 06.1 |
|
|
148 |
02C9: DECFSZ 60,F |
|
|
149 |
02CA: GOTO 2B8 |
|
|
150 |
02CB: BSF 03.5 |
|
|
151 |
02CC: BSF 06.0 |
|
|
152 |
02CD: NOP |
|
|
153 |
02CE: BCF 03.5 |
|
|
154 |
02CF: BCF 06.0 |
|
|
155 |
02D0: MOVF 61,W |
|
|
156 |
02D1: BTFSC 03.2 |
|
|
157 |
02D2: GOTO 2D6 |
|
|
158 |
02D3: BSF 03.5 |
|
|
159 |
02D4: BCF 06.0 |
|
|
160 |
02D5: BCF 03.5 |
|
|
161 |
02D6: NOP |
|
|
162 |
02D7: BSF 03.5 |
|
|
163 |
02D8: BSF 06.1 |
|
|
164 |
02D9: BCF 03.5 |
|
|
165 |
02DA: BTFSS 06.1 |
|
|
166 |
02DB: GOTO 2DA |
|
|
167 |
02DC: NOP |
|
|
168 |
02DD: BCF 06.1 |
|
|
169 |
02DE: BSF 03.5 |
|
|
170 |
02DF: BCF 06.1 |
|
|
171 |
02E0: NOP |
|
|
172 |
02E1: BCF 03.5 |
|
|
173 |
02E2: BCF 06.0 |
|
|
174 |
02E3: BSF 03.5 |
|
|
175 |
02E4: BCF 06.0 |
|
|
176 |
02E5: BCF 03.5 |
|
|
177 |
02E6: RETURN |
|
|
178 |
.................... #use rs232(baud=9600,parity=N,xmit=PIN_B3,rcv=PIN_B2,bits=8) //rcv TXD xmit RXD |
|
|
179 |
* |
|
|
180 |
009A: BSF 03.5 |
|
|
181 |
009B: BCF 06.3 |
|
|
182 |
009C: BCF 03.5 |
|
|
183 |
009D: BCF 06.3 |
|
|
184 |
009E: MOVLW 08 |
|
|
185 |
009F: MOVWF 78 |
|
|
186 |
00A0: GOTO 0A1 |
|
|
187 |
00A1: NOP |
|
|
188 |
00A2: BSF 78.7 |
|
|
189 |
00A3: GOTO 0B2 |
|
|
190 |
00A4: BCF 78.7 |
|
|
191 |
00A5: RRF 51,F |
|
|
192 |
00A6: BTFSC 03.0 |
|
|
193 |
00A7: BSF 06.3 |
|
|
194 |
00A8: BTFSS 03.0 |
|
|
195 |
00A9: BCF 06.3 |
|
|
196 |
00AA: BSF 78.6 |
|
|
197 |
00AB: GOTO 0B2 |
|
|
198 |
00AC: BCF 78.6 |
|
|
199 |
00AD: DECFSZ 78,F |
|
|
200 |
00AE: GOTO 0A5 |
|
|
201 |
00AF: GOTO 0B0 |
|
|
202 |
00B0: NOP |
|
|
203 |
00B1: BSF 06.3 |
|
|
204 |
00B2: MOVLW 3F |
|
|
205 |
00B3: MOVWF 04 |
|
|
206 |
00B4: DECFSZ 04,F |
|
|
207 |
00B5: GOTO 0B4 |
|
|
208 |
00B6: NOP |
|
|
209 |
00B7: BTFSC 78.7 |
|
|
210 |
00B8: GOTO 0A4 |
|
|
211 |
00B9: BTFSC 78.6 |
|
|
212 |
00BA: GOTO 0AC |
|
|
213 |
00BB: RETURN |
|
|
214 |
.................... #include <math.h> |
|
|
215 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
216 |
.................... //// (C) Copyright 1996,2008 Custom Computer Services //// |
|
|
217 |
.................... //// This source code may only be used by licensed users of the CCS C //// |
|
|
218 |
.................... //// compiler. This source code may only be distributed to other //// |
|
|
219 |
.................... //// licensed users of the CCS C compiler. No other use, reproduction //// |
|
|
220 |
.................... //// or distribution is permitted without written permission. //// |
|
|
221 |
.................... //// Derivative programs created using this software in object code //// |
|
|
222 |
.................... //// form are not restricted in any way. //// |
|
|
223 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
224 |
.................... //// //// |
|
|
225 |
.................... //// History: //// |
|
|
226 |
.................... //// * 9/20/2001 : Improvments are made to sin/cos code. //// |
|
|
227 |
.................... //// The code now is small, much faster, //// |
|
|
228 |
.................... //// and more accurate. //// |
|
|
229 |
.................... //// * 2/21/2007 : Compiler handles & operator differently and does |
|
|
230 |
.................... //// not return generic (int8 *) so type cast is done //// |
|
|
231 |
.................... //// //// |
|
|
232 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
233 |
.................... |
|
|
234 |
.................... #ifndef MATH_H |
|
|
235 |
.................... #define MATH_H |
|
|
236 |
.................... |
|
|
237 |
.................... #ifdef PI |
|
|
238 |
.................... #undef PI |
|
|
239 |
.................... #endif |
|
|
240 |
.................... #define PI 3.1415926535897932 |
|
|
241 |
.................... |
|
|
242 |
.................... |
|
|
243 |
.................... #define SQRT2 1.4142135623730950 |
|
|
244 |
.................... |
|
|
245 |
.................... //float const ps[4] = {5.9304945, 21.125224, 8.9403076, 0.29730279}; |
|
|
246 |
.................... //float const qs[4] = {1.0000000, 15.035723, 17.764134, 2.4934718}; |
|
|
247 |
.................... |
|
|
248 |
.................... ///////////////////////////// Round Functions ////////////////////////////// |
|
|
249 |
.................... |
|
|
250 |
.................... float32 CEIL_FLOOR(float32 x, unsigned int8 n) |
|
|
251 |
.................... { |
|
|
252 |
.................... float32 y, res; |
|
|
253 |
.................... unsigned int16 l; |
|
|
254 |
.................... int1 s; |
|
|
255 |
.................... |
|
|
256 |
.................... s = 0; |
|
|
257 |
.................... y = x; |
|
|
258 |
.................... |
|
|
259 |
.................... if (x < 0) |
|
|
260 |
.................... { |
|
|
261 |
.................... s = 1; |
|
|
262 |
.................... y = -y; |
|
|
263 |
.................... } |
|
|
264 |
.................... |
|
|
265 |
.................... if (y <= 32768.0) |
|
|
266 |
.................... res = (float32)(unsigned int16)y; |
|
|
267 |
.................... |
|
|
268 |
.................... else if (y < 10000000.0) |
|
|
269 |
.................... { |
|
|
270 |
.................... l = (unsigned int16)(y/32768.0); |
|
|
271 |
.................... y = 32768.0*(y/32768.0 - (float32)l); |
|
|
272 |
.................... res = 32768.0*(float32)l; |
|
|
273 |
.................... res += (float32)(unsigned int16)y; |
|
|
274 |
.................... } |
|
|
275 |
.................... |
|
|
276 |
.................... else |
|
|
277 |
.................... res = y; |
|
|
278 |
.................... |
|
|
279 |
.................... y = y - (float32)(unsigned int16)y; |
|
|
280 |
.................... |
|
|
281 |
.................... if (s) |
|
|
282 |
.................... res = -res; |
|
|
283 |
.................... |
|
|
284 |
.................... if (y != 0) |
|
|
285 |
.................... { |
|
|
286 |
.................... if (s == 1 && n == 0) |
|
|
287 |
.................... res -= 1.0; |
|
|
288 |
.................... |
|
|
289 |
.................... if (s == 0 && n == 1) |
|
|
290 |
.................... res += 1.0; |
|
|
291 |
.................... } |
|
|
292 |
.................... if (x == 0) |
|
|
293 |
.................... res = 0; |
|
|
294 |
.................... |
|
|
295 |
.................... return (res); |
|
|
296 |
.................... } |
|
|
297 |
.................... |
|
|
298 |
.................... // Overloaded Functions to take care for new Data types in PCD |
|
|
299 |
.................... // Overloaded function CEIL_FLOOR() for data type - Float48 |
|
|
300 |
.................... #if defined(__PCD__) |
|
|
301 |
.................... float48 CEIL_FLOOR(float48 x, unsigned int8 n) |
|
|
302 |
.................... { |
|
|
303 |
.................... float48 y, res; |
|
|
304 |
.................... unsigned int16 l; |
|
|
305 |
.................... int1 s; |
|
|
306 |
.................... |
|
|
307 |
.................... s = 0; |
|
|
308 |
.................... y = x; |
|
|
309 |
.................... |
|
|
310 |
.................... if (x < 0) |
|
|
311 |
.................... { |
|
|
312 |
.................... s = 1; |
|
|
313 |
.................... y = -y; |
|
|
314 |
.................... } |
|
|
315 |
.................... |
|
|
316 |
.................... if (y <= 32768.0) |
|
|
317 |
.................... res = (float48)(unsigned int16)y; |
|
|
318 |
.................... |
|
|
319 |
.................... else if (y < 10000000.0) |
|
|
320 |
.................... { |
|
|
321 |
.................... l = (unsigned int16)(y/32768.0); |
|
|
322 |
.................... y = 32768.0*(y/32768.0 - (float48)l); |
|
|
323 |
.................... res = 32768.0*(float32)l; |
|
|
324 |
.................... res += (float48)(unsigned int16)y; |
|
|
325 |
.................... } |
|
|
326 |
.................... |
|
|
327 |
.................... else |
|
|
328 |
.................... res = y; |
|
|
329 |
.................... |
|
|
330 |
.................... y = y - (float48)(unsigned int16)y; |
|
|
331 |
.................... |
|
|
332 |
.................... if (s) |
|
|
333 |
.................... res = -res; |
|
|
334 |
.................... |
|
|
335 |
.................... if (y != 0) |
|
|
336 |
.................... { |
|
|
337 |
.................... if (s == 1 && n == 0) |
|
|
338 |
.................... res -= 1.0; |
|
|
339 |
.................... |
|
|
340 |
.................... if (s == 0 && n == 1) |
|
|
341 |
.................... res += 1.0; |
|
|
342 |
.................... } |
|
|
343 |
.................... if (x == 0) |
|
|
344 |
.................... res = 0; |
|
|
345 |
.................... |
|
|
346 |
.................... return (res); |
|
|
347 |
.................... } |
|
|
348 |
.................... |
|
|
349 |
.................... |
|
|
350 |
.................... // Overloaded function CEIL_FLOOR() for data type - Float64 |
|
|
351 |
.................... float64 CEIL_FLOOR(float64 x, unsigned int8 n) |
|
|
352 |
.................... { |
|
|
353 |
.................... float64 y, res; |
|
|
354 |
.................... unsigned int16 l; |
|
|
355 |
.................... int1 s; |
|
|
356 |
.................... |
|
|
357 |
.................... s = 0; |
|
|
358 |
.................... y = x; |
|
|
359 |
.................... |
|
|
360 |
.................... if (x < 0) |
|
|
361 |
.................... { |
|
|
362 |
.................... s = 1; |
|
|
363 |
.................... y = -y; |
|
|
364 |
.................... } |
|
|
365 |
.................... |
|
|
366 |
.................... if (y <= 32768.0) |
|
|
367 |
.................... res = (float64)(unsigned int16)y; |
|
|
368 |
.................... |
|
|
369 |
.................... else if (y < 10000000.0) |
|
|
370 |
.................... { |
|
|
371 |
.................... l = (unsigned int16)(y/32768.0); |
|
|
372 |
.................... y = 32768.0*(y/32768.0 - (float64)l); |
|
|
373 |
.................... res = 32768.0*(float64)l; |
|
|
374 |
.................... res += (float64)(unsigned int16)y; |
|
|
375 |
.................... } |
|
|
376 |
.................... |
|
|
377 |
.................... else |
|
|
378 |
.................... res = y; |
|
|
379 |
.................... |
|
|
380 |
.................... y = y - (float64)(unsigned int16)y; |
|
|
381 |
.................... |
|
|
382 |
.................... if (s) |
|
|
383 |
.................... res = -res; |
|
|
384 |
.................... |
|
|
385 |
.................... if (y != 0) |
|
|
386 |
.................... { |
|
|
387 |
.................... if (s == 1 && n == 0) |
|
|
388 |
.................... res -= 1.0; |
|
|
389 |
.................... |
|
|
390 |
.................... if (s == 0 && n == 1) |
|
|
391 |
.................... res += 1.0; |
|
|
392 |
.................... } |
|
|
393 |
.................... if (x == 0) |
|
|
394 |
.................... res = 0; |
|
|
395 |
.................... |
|
|
396 |
.................... return (res); |
|
|
397 |
.................... } |
|
|
398 |
.................... #endif |
|
|
399 |
.................... |
|
|
400 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
401 |
.................... // float floor(float x) |
|
|
402 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
403 |
.................... // Description : rounds down the number x. |
|
|
404 |
.................... // Date : N/A |
|
|
405 |
.................... // |
|
|
406 |
.................... float32 floor(float32 x) |
|
|
407 |
.................... { |
|
|
408 |
.................... return CEIL_FLOOR(x, 0); |
|
|
409 |
.................... } |
|
|
410 |
.................... // Following 2 functions are overloaded functions of floor() for PCD |
|
|
411 |
.................... // Overloaded function floor() for data type - Float48 |
|
|
412 |
.................... #if defined(__PCD__) |
|
|
413 |
.................... float48 floor(float48 x) |
|
|
414 |
.................... { |
|
|
415 |
.................... return CEIL_FLOOR(x, 0); |
|
|
416 |
.................... } |
|
|
417 |
.................... |
|
|
418 |
.................... // Overloaded function floor() for data type - Float64 |
|
|
419 |
.................... float64 floor(float64 x) |
|
|
420 |
.................... { |
|
|
421 |
.................... return CEIL_FLOOR(x, 0); |
|
|
422 |
.................... } |
|
|
423 |
.................... #endif |
|
|
424 |
.................... |
|
|
425 |
.................... |
|
|
426 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
427 |
.................... // float ceil(float x) |
|
|
428 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
429 |
.................... // Description : rounds up the number x. |
|
|
430 |
.................... // Date : N/A |
|
|
431 |
.................... // |
|
|
432 |
.................... float32 ceil(float32 x) |
|
|
433 |
.................... { |
|
|
434 |
.................... return CEIL_FLOOR(x, 1); |
|
|
435 |
.................... } |
|
|
436 |
.................... // Following 2 functions are overloaded functions of ceil() for PCD |
|
|
437 |
.................... // Overloaded function ceil() for data type - Float48 |
|
|
438 |
.................... #if defined(__PCD__) |
|
|
439 |
.................... float48 ceil(float48 x) |
|
|
440 |
.................... { |
|
|
441 |
.................... return CEIL_FLOOR(x, 1); |
|
|
442 |
.................... } |
|
|
443 |
.................... |
|
|
444 |
.................... // Overloaded function ceil() for data type - Float64 |
|
|
445 |
.................... float64 ceil(float64 x) |
|
|
446 |
.................... { |
|
|
447 |
.................... return CEIL_FLOOR(x, 1); |
|
|
448 |
.................... } |
|
|
449 |
.................... #endif |
|
|
450 |
.................... |
|
|
451 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
452 |
.................... // float fabs(float x) |
|
|
453 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
454 |
.................... // Description : Computes the absolute value of floating point number x |
|
|
455 |
.................... // Returns : returns the absolute value of x |
|
|
456 |
.................... // Date : N/A |
|
|
457 |
.................... // |
|
|
458 |
.................... #define fabs abs |
|
|
459 |
.................... |
|
|
460 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
461 |
.................... // float fmod(float x) |
|
|
462 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
463 |
.................... // Description : Computes the floating point remainder of x/y |
|
|
464 |
.................... // Returns : returns the value of x= i*y, for some integer i such that, if y |
|
|
465 |
.................... // is non zero, the result has the same isgn of x na dmagnitude less than the |
|
|
466 |
.................... // magnitude of y. If y is zero then a domain error occurs. |
|
|
467 |
.................... // Date : N/A |
|
|
468 |
.................... // |
|
|
469 |
.................... |
|
|
470 |
.................... float fmod(float32 x,float32 y) |
|
|
471 |
.................... { |
|
|
472 |
.................... float32 i; |
|
|
473 |
.................... if (y!=0.0) |
|
|
474 |
.................... { |
|
|
475 |
.................... i=(x/y < 0.0)? ceil(x/y): floor(x/y); |
|
|
476 |
.................... return(x-(i*y)); |
|
|
477 |
.................... } |
|
|
478 |
.................... else |
|
|
479 |
.................... { |
|
|
480 |
.................... #ifdef _ERRNO |
|
|
481 |
.................... { |
|
|
482 |
.................... errno=EDOM; |
|
|
483 |
.................... } |
|
|
484 |
.................... #endif |
|
|
485 |
.................... } |
|
|
486 |
.................... } |
|
|
487 |
.................... //Overloaded function for fmod() for PCD |
|
|
488 |
.................... // Overloaded function fmod() for data type - Float48 |
|
|
489 |
.................... #if defined(__PCD__) |
|
|
490 |
.................... float48 fmod(float48 x,float48 y) |
|
|
491 |
.................... { |
|
|
492 |
.................... float48 i; |
|
|
493 |
.................... if (y!=0.0) |
|
|
494 |
.................... { |
|
|
495 |
.................... i=(x/y < 0.0)? ceil(x/y): floor(x/y); |
|
|
496 |
.................... return(x-(i*y)); |
|
|
497 |
.................... } |
|
|
498 |
.................... else |
|
|
499 |
.................... { |
|
|
500 |
.................... #ifdef _ERRNO |
|
|
501 |
.................... { |
|
|
502 |
.................... errno=EDOM; |
|
|
503 |
.................... } |
|
|
504 |
.................... #endif |
|
|
505 |
.................... } |
|
|
506 |
.................... } |
|
|
507 |
.................... // Overloaded function fmod() for data type - Float64 |
|
|
508 |
.................... float64 fmod(float64 x,float64 y) |
|
|
509 |
.................... { |
|
|
510 |
.................... float64 i; |
|
|
511 |
.................... if (y!=0.0) |
|
|
512 |
.................... { |
|
|
513 |
.................... i=(x/y < 0.0)? ceil(x/y): floor(x/y); |
|
|
514 |
.................... return(x-(i*y)); |
|
|
515 |
.................... } |
|
|
516 |
.................... else |
|
|
517 |
.................... { |
|
|
518 |
.................... #ifdef _ERRNO |
|
|
519 |
.................... { |
|
|
520 |
.................... errno=EDOM; |
|
|
521 |
.................... } |
|
|
522 |
.................... #endif |
|
|
523 |
.................... } |
|
|
524 |
.................... } |
|
|
525 |
.................... #endif |
|
|
526 |
.................... //////////////////// Exponential and logarithmic functions //////////////////// |
|
|
527 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
528 |
.................... // float exp(float x) |
|
|
529 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
530 |
.................... // Description : returns the value (e^x) |
|
|
531 |
.................... // Date : N/A |
|
|
532 |
.................... // |
|
|
533 |
.................... #define LN2 0.6931471805599453 |
|
|
534 |
.................... |
|
|
535 |
.................... float const pe[6] = {0.000207455774, 0.00127100575, 0.00965065093, |
|
|
536 |
.................... 0.0554965651, 0.240227138, 0.693147172}; |
|
|
537 |
.................... |
|
|
538 |
.................... |
|
|
539 |
.................... float32 exp(float32 x) |
|
|
540 |
.................... { |
|
|
541 |
.................... float32 y, res, r; |
|
|
542 |
.................... #if defined(__PCD__) |
|
|
543 |
.................... int8 data1; |
|
|
544 |
.................... #endif |
|
|
545 |
.................... signed int8 n; |
|
|
546 |
.................... int1 s; |
|
|
547 |
.................... #ifdef _ERRNO |
|
|
548 |
.................... if(x > 88.722838) |
|
|
549 |
.................... { |
|
|
550 |
.................... errno=ERANGE; |
|
|
551 |
.................... return(0); |
|
|
552 |
.................... } |
|
|
553 |
.................... #endif |
|
|
554 |
.................... n = (signed int16)(x/LN2); |
|
|
555 |
.................... s = 0; |
|
|
556 |
.................... y = x; |
|
|
557 |
.................... |
|
|
558 |
.................... if (x < 0) |
|
|
559 |
.................... { |
|
|
560 |
.................... s = 1; |
|
|
561 |
.................... n = -n; |
|
|
562 |
.................... y = -y; |
|
|
563 |
.................... } |
|
|
564 |
.................... |
|
|
565 |
.................... res = 0.0; |
|
|
566 |
.................... #if !defined(__PCD__) |
|
|
567 |
.................... *((unsigned int8 *)(&res)) = n + 0x7F; |
|
|
568 |
.................... #endif |
|
|
569 |
.................... |
|
|
570 |
.................... #if defined(__PCD__) // Takes care of IEEE format for PCD |
|
|
571 |
.................... data1 = n+0x7F; |
|
|
572 |
.................... if(bit_test(data1,0)) |
|
|
573 |
.................... bit_set(*(((unsigned int8 *)(&res)+2)),7); |
|
|
574 |
.................... rotate_right(&data1,1); |
|
|
575 |
.................... bit_clear(data1,7); |
|
|
576 |
.................... *(((unsigned int8 *)(&res)+3)) = data1; |
|
|
577 |
.................... #endif |
|
|
578 |
.................... |
|
|
579 |
.................... y = y/LN2 - (float32)n; |
|
|
580 |
.................... |
|
|
581 |
.................... r = pe[0]*y + pe[1]; |
|
|
582 |
.................... r = r*y + pe[2]; |
|
|
583 |
.................... r = r*y + pe[3]; |
|
|
584 |
.................... r = r*y + pe[4]; |
|
|
585 |
.................... r = r*y + pe[5]; |
|
|
586 |
.................... |
|
|
587 |
.................... res = res*(1.0 + y*r); |
|
|
588 |
.................... |
|
|
589 |
.................... if (s) |
|
|
590 |
.................... res = 1.0/res; |
|
|
591 |
.................... return(res); |
|
|
592 |
.................... } |
|
|
593 |
.................... |
|
|
594 |
.................... |
|
|
595 |
.................... //Overloaded function for exp() for PCD |
|
|
596 |
.................... // Overloaded function exp() for data type - Float48 |
|
|
597 |
.................... #if defined(__PCD__) |
|
|
598 |
.................... float48 exp(float48 x) |
|
|
599 |
.................... { |
|
|
600 |
.................... float48 y, res, r; |
|
|
601 |
.................... int8 data1; |
|
|
602 |
.................... signed int8 n; |
|
|
603 |
.................... int1 s; |
|
|
604 |
.................... #ifdef _ERRNO |
|
|
605 |
.................... if(x > 88.722838) |
|
|
606 |
.................... { |
|
|
607 |
.................... errno=ERANGE; |
|
|
608 |
.................... return(0); |
|
|
609 |
.................... } |
|
|
610 |
.................... #endif |
|
|
611 |
.................... n = (signed int16)(x/LN2); |
|
|
612 |
.................... s = 0; |
|
|
613 |
.................... y = x; |
|
|
614 |
.................... |
|
|
615 |
.................... if (x < 0) |
|
|
616 |
.................... { |
|
|
617 |
.................... s = 1; |
|
|
618 |
.................... n = -n; |
|
|
619 |
.................... y = -y; |
|
|
620 |
.................... } |
|
|
621 |
.................... |
|
|
622 |
.................... res = 0.0; |
|
|
623 |
.................... |
|
|
624 |
.................... data1 = n+0x7F; |
|
|
625 |
.................... if(bit_test(data1,0)) |
|
|
626 |
.................... bit_set(*(((unsigned int8 *)(&res)+4)),7); |
|
|
627 |
.................... rotate_right(&data1,1); |
|
|
628 |
.................... bit_clear(data1,7); |
|
|
629 |
.................... *(((unsigned int8 *)(&res)+5)) = data1; |
|
|
630 |
.................... |
|
|
631 |
.................... y = y/LN2 - (float48)n; |
|
|
632 |
.................... |
|
|
633 |
.................... r = pe[0]*y + pe[1]; |
|
|
634 |
.................... r = r*y + pe[2]; |
|
|
635 |
.................... r = r*y + pe[3]; |
|
|
636 |
.................... r = r*y + pe[4]; |
|
|
637 |
.................... r = r*y + pe[5]; |
|
|
638 |
.................... |
|
|
639 |
.................... res = res*(1.0 + y*r); |
|
|
640 |
.................... |
|
|
641 |
.................... if (s) |
|
|
642 |
.................... res = 1.0/res; |
|
|
643 |
.................... return(res); |
|
|
644 |
.................... } |
|
|
645 |
.................... |
|
|
646 |
.................... // Overloaded function exp() for data type - Float64 |
|
|
647 |
.................... float64 exp(float64 x) |
|
|
648 |
.................... { |
|
|
649 |
.................... float64 y, res, r; |
|
|
650 |
.................... unsigned int16 data1, data2; |
|
|
651 |
.................... unsigned int16 *p; |
|
|
652 |
.................... signed int16 n; |
|
|
653 |
.................... int1 s; |
|
|
654 |
.................... #ifdef _ERRNO |
|
|
655 |
.................... if(x > 709.7827128) |
|
|
656 |
.................... { |
|
|
657 |
.................... errno=ERANGE; |
|
|
658 |
.................... return(0); |
|
|
659 |
.................... } |
|
|
660 |
.................... #endif |
|
|
661 |
.................... n = (signed int16)(x/LN2); |
|
|
662 |
.................... s = 0; |
|
|
663 |
.................... y = x; |
|
|
664 |
.................... |
|
|
665 |
.................... if (x < 0) |
|
|
666 |
.................... { |
|
|
667 |
.................... s = 1; |
|
|
668 |
.................... n = -n; |
|
|
669 |
.................... y = -y; |
|
|
670 |
.................... } |
|
|
671 |
.................... |
|
|
672 |
.................... res = 0.0; |
|
|
673 |
.................... |
|
|
674 |
.................... #if !defined(__PCD__) |
|
|
675 |
.................... *((unsigned int16 *)(&res)) = n + 0x7F; |
|
|
676 |
.................... #endif |
|
|
677 |
.................... p= (((unsigned int16 *)(&res))+3); |
|
|
678 |
.................... data1 = *p; |
|
|
679 |
.................... data2 = *p; |
|
|
680 |
.................... data1 = n + 0x3FF; |
|
|
681 |
.................... data1 = data1 <<4; |
|
|
682 |
.................... if(bit_test(data2,15)) |
|
|
683 |
.................... bit_set(data1,15); |
|
|
684 |
.................... data2 = data2 & 0x000F; |
|
|
685 |
.................... data1 ^= data2; |
|
|
686 |
.................... |
|
|
687 |
.................... *(((unsigned int16 *)(&res)+3)) = data1; |
|
|
688 |
.................... |
|
|
689 |
.................... |
|
|
690 |
.................... y = y/LN2 - (float64)n; |
|
|
691 |
.................... |
|
|
692 |
.................... r = pe[0]*y + pe[1]; |
|
|
693 |
.................... r = r*y + pe[2]; |
|
|
694 |
.................... r = r*y + pe[3]; |
|
|
695 |
.................... r = r*y + pe[4]; |
|
|
696 |
.................... r = r*y + pe[5]; |
|
|
697 |
.................... |
|
|
698 |
.................... res = res*(1.0 + y*r); |
|
|
699 |
.................... |
|
|
700 |
.................... if (s) |
|
|
701 |
.................... res = 1.0/res; |
|
|
702 |
.................... return(res); |
|
|
703 |
.................... } |
|
|
704 |
.................... |
|
|
705 |
.................... #ENDIF |
|
|
706 |
.................... |
|
|
707 |
.................... |
|
|
708 |
.................... /************************************************************/ |
|
|
709 |
.................... |
|
|
710 |
.................... float32 const pl[4] = {0.45145214, -9.0558803, 26.940971, -19.860189}; |
|
|
711 |
.................... float32 const ql[4] = {1.0000000, -8.1354259, 16.780517, -9.9300943}; |
|
|
712 |
.................... |
|
|
713 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
714 |
.................... // float log(float x) |
|
|
715 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
716 |
.................... // Description : returns the the natural log of x |
|
|
717 |
.................... // Date : N/A |
|
|
718 |
.................... // |
|
|
719 |
.................... float32 log(float32 x) |
|
|
720 |
.................... { |
|
|
721 |
.................... float32 y, res, r, y2; |
|
|
722 |
.................... #if defined(__PCD__) |
|
|
723 |
.................... unsigned int8 data1,data2; |
|
|
724 |
.................... #endif |
|
|
725 |
.................... signed int8 n; |
|
|
726 |
.................... #ifdef _ERRNO |
|
|
727 |
.................... if(x <0) |
|
|
728 |
.................... { |
|
|
729 |
.................... errno=EDOM; |
|
|
730 |
.................... } |
|
|
731 |
.................... if(x ==0) |
|
|
732 |
.................... { |
|
|
733 |
.................... errno=ERANGE; |
|
|
734 |
.................... return(0); |
|
|
735 |
.................... } |
|
|
736 |
.................... #endif |
|
|
737 |
.................... y = x; |
|
|
738 |
.................... |
|
|
739 |
.................... if (y != 1.0) |
|
|
740 |
.................... { |
|
|
741 |
.................... #if !defined(__PCD__) |
|
|
742 |
.................... *((unsigned int8 *)(&y)) = 0x7E; |
|
|
743 |
.................... #endif |
|
|
744 |
.................... |
|
|
745 |
.................... #if defined(__PCD__) // Takes care of IEEE format |
|
|
746 |
.................... data2 = *(((unsigned int8 *)(&y))+3); |
|
|
747 |
.................... *(((unsigned int8 *)(&y))+3) = 0x3F; |
|
|
748 |
.................... data1 = *(((unsigned int8 *)(&y))+2); |
|
|
749 |
.................... bit_clear(data1,7); |
|
|
750 |
.................... *(((unsigned int8 *)(&y))+2) = data1; |
|
|
751 |
.................... if(bit_test(data2,7)) |
|
|
752 |
.................... bit_set(*(((unsigned int8 *)(&y))+3),7); |
|
|
753 |
.................... #endif |
|
|
754 |
.................... |
|
|
755 |
.................... y = (y - 1.0)/(y + 1.0); |
|
|
756 |
.................... |
|
|
757 |
.................... y2=y*y; |
|
|
758 |
.................... |
|
|
759 |
.................... res = pl[0]*y2 + pl[1]; |
|
|
760 |
.................... res = res*y2 + pl[2]; |
|
|
761 |
.................... res = res*y2 + pl[3]; |
|
|
762 |
.................... |
|
|
763 |
.................... r = ql[0]*y2 + ql[1]; |
|
|
764 |
.................... r = r*y2 + ql[2]; |
|
|
765 |
.................... r = r*y2 + ql[3]; |
|
|
766 |
.................... |
|
|
767 |
.................... res = y*res/r; |
|
|
768 |
.................... #if !defined(__PCD__) |
|
|
769 |
.................... n = *((unsigned int8 *)(&x)) - 0x7E; |
|
|
770 |
.................... #endif |
|
|
771 |
.................... #if defined(__PCD__) |
|
|
772 |
.................... data1 = *(((unsigned int8 *)(&x)+3)); |
|
|
773 |
.................... rotate_left(&data1,1); |
|
|
774 |
.................... data2 = *(((unsigned int8 *)(&x)+2)); |
|
|
775 |
.................... if(bit_test (data2,7)) |
|
|
776 |
.................... bit_set(data1,0); |
|
|
777 |
.................... n = data1 - 0x7E; |
|
|
778 |
.................... #endif |
|
|
779 |
.................... |
|
|
780 |
.................... if (n<0) |
|
|
781 |
.................... r = -(float32)-n; |
|
|
782 |
.................... else |
|
|
783 |
.................... r = (float32)n; |
|
|
784 |
.................... |
|
|
785 |
.................... res += r*LN2; |
|
|
786 |
.................... } |
|
|
787 |
.................... |
|
|
788 |
.................... else |
|
|
789 |
.................... res = 0.0; |
|
|
790 |
.................... |
|
|
791 |
.................... return(res); |
|
|
792 |
.................... } |
|
|
793 |
.................... |
|
|
794 |
.................... //Overloaded function for log() for PCD |
|
|
795 |
.................... // Overloaded function log() for data type - Float48 |
|
|
796 |
.................... #if defined(__PCD__) |
|
|
797 |
.................... float48 log(float48 x) |
|
|
798 |
.................... { |
|
|
799 |
.................... float48 y, res, r, y2; |
|
|
800 |
.................... unsigned int8 data1,data2; |
|
|
801 |
.................... signed int8 n; |
|
|
802 |
.................... #ifdef _ERRNO |
|
|
803 |
.................... if(x <0) |
|
|
804 |
.................... { |
|
|
805 |
.................... errno=EDOM; |
|
|
806 |
.................... } |
|
|
807 |
.................... if(x ==0) |
|
|
808 |
.................... { |
|
|
809 |
.................... errno=ERANGE; |
|
|
810 |
.................... return(0); |
|
|
811 |
.................... } |
|
|
812 |
.................... #endif |
|
|
813 |
.................... y = x; |
|
|
814 |
.................... |
|
|
815 |
.................... if (y != 1.0) |
|
|
816 |
.................... { |
|
|
817 |
.................... |
|
|
818 |
.................... #if !defined(__PCD__) |
|
|
819 |
.................... *((unsigned int8 *)(&y)) = 0x7E; |
|
|
820 |
.................... #endif |
|
|
821 |
.................... data2 = *(((unsigned int8 *)(&y))+5); |
|
|
822 |
.................... *(((unsigned int8 *)(&y))+5) = 0x3F; |
|
|
823 |
.................... data1 = *(((unsigned int8 *)(&y))+4); |
|
|
824 |
.................... bit_clear(data1,7); |
|
|
825 |
.................... *(((unsigned int8 *)(&y))+4) = data1; |
|
|
826 |
.................... |
|
|
827 |
.................... if(bit_test(data2,7)) |
|
|
828 |
.................... bit_set(*(((unsigned int8 *)(&y))+4),7); |
|
|
829 |
.................... y = (y - 1.0)/(y + 1.0); |
|
|
830 |
.................... |
|
|
831 |
.................... y2=y*y; |
|
|
832 |
.................... |
|
|
833 |
.................... res = pl[0]*y2 + pl[1]; |
|
|
834 |
.................... res = res*y2 + pl[2]; |
|
|
835 |
.................... res = res*y2 + pl[3]; |
|
|
836 |
.................... |
|
|
837 |
.................... r = ql[0]*y2 + ql[1]; |
|
|
838 |
.................... r = r*y2 + ql[2]; |
|
|
839 |
.................... r = r*y2 + ql[3]; |
|
|
840 |
.................... |
|
|
841 |
.................... res = y*res/r; |
|
|
842 |
.................... |
|
|
843 |
.................... data1 = *(((unsigned int8 *)(&x)+5)); |
|
|
844 |
.................... rotate_left(&data1,1); |
|
|
845 |
.................... data2 = *(((unsigned int8 *)(&x)+4)); |
|
|
846 |
.................... if(bit_test (data2,7)) |
|
|
847 |
.................... bit_set(data1,0); |
|
|
848 |
.................... |
|
|
849 |
.................... n = data1 - 0x7E; |
|
|
850 |
.................... |
|
|
851 |
.................... if (n<0) |
|
|
852 |
.................... r = -(float48)-n; |
|
|
853 |
.................... else |
|
|
854 |
.................... r = (float48)n; |
|
|
855 |
.................... |
|
|
856 |
.................... res += r*LN2; |
|
|
857 |
.................... } |
|
|
858 |
.................... |
|
|
859 |
.................... else |
|
|
860 |
.................... res = 0.0; |
|
|
861 |
.................... |
|
|
862 |
.................... return(res); |
|
|
863 |
.................... } |
|
|
864 |
.................... |
|
|
865 |
.................... // Overloaded function log() for data type - Float48 |
|
|
866 |
.................... #if defined(__PCD__) |
|
|
867 |
.................... float32 const pl_64[4] = {0.45145214, -9.0558803, 26.940971, -19.860189}; |
|
|
868 |
.................... float32 const ql_64[4] = {1.0000000, -8.1354259, 16.780517, -9.9300943}; |
|
|
869 |
.................... #endif |
|
|
870 |
.................... float64 log(float64 x) |
|
|
871 |
.................... { |
|
|
872 |
.................... float64 y, res, r, y2; |
|
|
873 |
.................... unsigned int16 data1,data2; |
|
|
874 |
.................... unsigned int16 *p; |
|
|
875 |
.................... signed int16 n; |
|
|
876 |
.................... #ifdef _ERRNO |
|
|
877 |
.................... if(x <0) |
|
|
878 |
.................... { |
|
|
879 |
.................... errno=EDOM; |
|
|
880 |
.................... } |
|
|
881 |
.................... if(x ==0) |
|
|
882 |
.................... { |
|
|
883 |
.................... errno=ERANGE; |
|
|
884 |
.................... return(0); |
|
|
885 |
.................... } |
|
|
886 |
.................... #endif |
|
|
887 |
.................... y = x; |
|
|
888 |
.................... |
|
|
889 |
.................... if (y != 1.0) |
|
|
890 |
.................... { |
|
|
891 |
.................... #if !defined(__PCD__) |
|
|
892 |
.................... *((unsigned int8 *)(&y)) = 0x7E; |
|
|
893 |
.................... #endif |
|
|
894 |
.................... p= (((unsigned int16 *)(&y))+3); |
|
|
895 |
.................... data1 = *p; |
|
|
896 |
.................... data2 = *p; |
|
|
897 |
.................... data1 = 0x3FE; |
|
|
898 |
.................... data1 = data1 <<4; |
|
|
899 |
.................... if(bit_test (data2,15)) |
|
|
900 |
.................... bit_set(data1,15); |
|
|
901 |
.................... data2 = data2 & 0x000F; |
|
|
902 |
.................... data1 ^=data2; |
|
|
903 |
.................... |
|
|
904 |
.................... *p = data1; |
|
|
905 |
.................... |
|
|
906 |
.................... y = (y - 1.0)/(y + 1.0); |
|
|
907 |
.................... |
|
|
908 |
.................... y2=y*y; |
|
|
909 |
.................... |
|
|
910 |
.................... res = pl_64[0]*y2 + pl_64[1]; |
|
|
911 |
.................... res = res*y2 + pl_64[2]; |
|
|
912 |
.................... res = res*y2 + pl_64[3]; |
|
|
913 |
.................... |
|
|
914 |
.................... r = ql_64[0]*y2 + ql_64[1]; |
|
|
915 |
.................... r = r*y2 + ql_64[2]; |
|
|
916 |
.................... r = r*y2 + ql_64[3]; |
|
|
917 |
.................... |
|
|
918 |
.................... res = y*res/r; |
|
|
919 |
.................... |
|
|
920 |
.................... p= (((unsigned int16 *)(&x))+3); |
|
|
921 |
.................... data1 = *p; |
|
|
922 |
.................... bit_clear(data1,15); |
|
|
923 |
.................... data1 = data1 >>4; |
|
|
924 |
.................... n = data1 - 0x3FE; |
|
|
925 |
.................... |
|
|
926 |
.................... |
|
|
927 |
.................... if (n<0) |
|
|
928 |
.................... r = -(float64)-n; |
|
|
929 |
.................... else |
|
|
930 |
.................... r = (float64)n; |
|
|
931 |
.................... |
|
|
932 |
.................... res += r*LN2; |
|
|
933 |
.................... } |
|
|
934 |
.................... |
|
|
935 |
.................... else |
|
|
936 |
.................... res = 0.0; |
|
|
937 |
.................... |
|
|
938 |
.................... return(res); |
|
|
939 |
.................... } |
|
|
940 |
.................... #endif |
|
|
941 |
.................... |
|
|
942 |
.................... |
|
|
943 |
.................... #define LN10 2.3025850929940456 |
|
|
944 |
.................... |
|
|
945 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
946 |
.................... // float log10(float x) |
|
|
947 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
948 |
.................... // Description : returns the the log base 10 of x |
|
|
949 |
.................... // Date : N/A |
|
|
950 |
.................... // |
|
|
951 |
.................... float32 log10(float32 x) |
|
|
952 |
.................... { |
|
|
953 |
.................... float32 r; |
|
|
954 |
.................... |
|
|
955 |
.................... r = log(x); |
|
|
956 |
.................... r = r/LN10; |
|
|
957 |
.................... return(r); |
|
|
958 |
.................... } |
|
|
959 |
.................... |
|
|
960 |
.................... //Overloaded functions for log10() for PCD |
|
|
961 |
.................... // Overloaded function log10() for data type - Float48 |
|
|
962 |
.................... #if defined(__PCD__) |
|
|
963 |
.................... float48 log10(float48 x) |
|
|
964 |
.................... { |
|
|
965 |
.................... float48 r; |
|
|
966 |
.................... |
|
|
967 |
.................... r = log(x); |
|
|
968 |
.................... r = r/LN10; |
|
|
969 |
.................... return(r); |
|
|
970 |
.................... } |
|
|
971 |
.................... |
|
|
972 |
.................... // Overloaded function log10() for data type - Float64 |
|
|
973 |
.................... float64 log10(float64 x) |
|
|
974 |
.................... { |
|
|
975 |
.................... float64 r; |
|
|
976 |
.................... |
|
|
977 |
.................... r = log(x); |
|
|
978 |
.................... r = r/LN10; |
|
|
979 |
.................... return(r); |
|
|
980 |
.................... } |
|
|
981 |
.................... #endif |
|
|
982 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
983 |
.................... // float modf(float x) |
|
|
984 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
985 |
.................... // Description :breaks the argument value int integral and fractional parts, |
|
|
986 |
.................... // ach of which have the same sign as the argument. It stores the integral part |
|
|
987 |
.................... // as a float in the object pointed to by the iptr |
|
|
988 |
.................... // Returns : returns the signed fractional part of value. |
|
|
989 |
.................... // Date : N/A |
|
|
990 |
.................... // |
|
|
991 |
.................... |
|
|
992 |
.................... float32 modf(float32 value,float32 *iptr) |
|
|
993 |
.................... { |
|
|
994 |
.................... *iptr=(value < 0.0)? ceil(value): floor(value); |
|
|
995 |
.................... return(value - *iptr); |
|
|
996 |
.................... } |
|
|
997 |
.................... //Overloaded functions for modf() for PCD |
|
|
998 |
.................... // Overloaded function modf() for data type - Float48 |
|
|
999 |
.................... #if defined(__PCD__) |
|
|
1000 |
.................... float48 modf(float48 value,float48 *iptr) |
|
|
1001 |
.................... { |
|
|
1002 |
.................... *iptr=(value < 0.0)? ceil(value): floor(value); |
|
|
1003 |
.................... return(value - *iptr); |
|
|
1004 |
.................... } |
|
|
1005 |
.................... // Overloaded function modf() for data type - Float64 |
|
|
1006 |
.................... float64 modf(float64 value,float64 *iptr) |
|
|
1007 |
.................... { |
|
|
1008 |
.................... *iptr=(value < 0.0)? ceil(value): floor(value); |
|
|
1009 |
.................... return(value - *iptr); |
|
|
1010 |
.................... } |
|
|
1011 |
.................... #endif |
|
|
1012 |
.................... |
|
|
1013 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1014 |
.................... // float pwr(float x,float y) |
|
|
1015 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1016 |
.................... // Description : returns the value (x^y) |
|
|
1017 |
.................... // Date : N/A |
|
|
1018 |
.................... // Note : 0 is returned when the function will generate an imaginary number |
|
|
1019 |
.................... // |
|
|
1020 |
.................... float32 pwr(float32 x,float32 y) |
|
|
1021 |
.................... { |
|
|
1022 |
.................... if(0 > x && fmod(y, 1) == 0) { |
|
|
1023 |
.................... if(fmod(y, 2) == 0) { |
|
|
1024 |
.................... return (exp(log(-x) * y)); |
|
|
1025 |
.................... } else { |
|
|
1026 |
.................... return (-exp(log(-x) * y)); |
|
|
1027 |
.................... } |
|
|
1028 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
|
|
1029 |
.................... return 0; |
|
|
1030 |
.................... } else { |
|
|
1031 |
.................... if(x != 0 || 0 >= y) { |
|
|
1032 |
.................... return (exp(log(x) * y)); |
|
|
1033 |
.................... } |
|
|
1034 |
.................... } |
|
|
1035 |
.................... } |
|
|
1036 |
.................... //Overloaded functions for pwr() for PCD |
|
|
1037 |
.................... // Overloaded function pwr() for data type - Float48 |
|
|
1038 |
.................... #if defined(__PCD__) |
|
|
1039 |
.................... float48 pwr(float48 x,float48 y) |
|
|
1040 |
.................... { |
|
|
1041 |
.................... if(0 > x && fmod(y, 1) == 0) { |
|
|
1042 |
.................... if(fmod(y, 2) == 0) { |
|
|
1043 |
.................... return (exp(log(-x) * y)); |
|
|
1044 |
.................... } else { |
|
|
1045 |
.................... return (-exp(log(-x) * y)); |
|
|
1046 |
.................... } |
|
|
1047 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
|
|
1048 |
.................... return 0; |
|
|
1049 |
.................... } else { |
|
|
1050 |
.................... if(x != 0 || 0 >= y) { |
|
|
1051 |
.................... return (exp(log(x) * y)); |
|
|
1052 |
.................... } |
|
|
1053 |
.................... } |
|
|
1054 |
.................... } |
|
|
1055 |
.................... // Overloaded function pwr() for data type - Float64 |
|
|
1056 |
.................... float64 pwr(float64 x,float64 y) |
|
|
1057 |
.................... { |
|
|
1058 |
.................... if(0 > x && fmod(y, 1) == 0) { |
|
|
1059 |
.................... if(fmod(y, 2) == 0) { |
|
|
1060 |
.................... return (exp(log(-x) * y)); |
|
|
1061 |
.................... } else { |
|
|
1062 |
.................... return (-exp(log(-x) * y)); |
|
|
1063 |
.................... } |
|
|
1064 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
|
|
1065 |
.................... return 0; |
|
|
1066 |
.................... } else { |
|
|
1067 |
.................... if(x != 0 || 0 >= y) { |
|
|
1068 |
.................... return (exp(log(x) * y)); |
|
|
1069 |
.................... } |
|
|
1070 |
.................... } |
|
|
1071 |
.................... } |
|
|
1072 |
.................... #endif |
|
|
1073 |
.................... |
|
|
1074 |
.................... //////////////////// Power functions //////////////////// |
|
|
1075 |
.................... |
|
|
1076 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1077 |
.................... // float pow(float x,float y) |
|
|
1078 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1079 |
.................... // Description : returns the value (x^y) |
|
|
1080 |
.................... // Date : N/A |
|
|
1081 |
.................... // Note : 0 is returned when the function will generate an imaginary number |
|
|
1082 |
.................... // |
|
|
1083 |
.................... float32 pow(float32 x,float32 y) |
|
|
1084 |
.................... { |
|
|
1085 |
.................... if(0 > x && fmod(y, 1) == 0) { |
|
|
1086 |
.................... if(fmod(y, 2) == 0) { |
|
|
1087 |
.................... return (exp(log(-x) * y)); |
|
|
1088 |
.................... } else { |
|
|
1089 |
.................... return (-exp(log(-x) * y)); |
|
|
1090 |
.................... } |
|
|
1091 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
|
|
1092 |
.................... return 0; |
|
|
1093 |
.................... } else { |
|
|
1094 |
.................... if(x != 0 || 0 >= y) { |
|
|
1095 |
.................... return (exp(log(x) * y)); |
|
|
1096 |
.................... } |
|
|
1097 |
.................... } |
|
|
1098 |
.................... } |
|
|
1099 |
.................... //Overloaded functions for pow() for PCD |
|
|
1100 |
.................... // Overloaded function for pow() data type - Float48 |
|
|
1101 |
.................... #if defined(__PCD__) |
|
|
1102 |
.................... float48 pow(float48 x,float48 y) |
|
|
1103 |
.................... { |
|
|
1104 |
.................... if(0 > x && fmod(y, 1) == 0) { |
|
|
1105 |
.................... if(fmod(y, 2) == 0) { |
|
|
1106 |
.................... return (exp(log(-x) * y)); |
|
|
1107 |
.................... } else { |
|
|
1108 |
.................... return (-exp(log(-x) * y)); |
|
|
1109 |
.................... } |
|
|
1110 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
|
|
1111 |
.................... return 0; |
|
|
1112 |
.................... } else { |
|
|
1113 |
.................... if(x != 0 || 0 >= y) { |
|
|
1114 |
.................... return (exp(log(x) * y)); |
|
|
1115 |
.................... } |
|
|
1116 |
.................... } |
|
|
1117 |
.................... } |
|
|
1118 |
.................... |
|
|
1119 |
.................... // Overloaded function pow() for data type - Float64 |
|
|
1120 |
.................... float64 pow(float64 x,float64 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 |
.................... #endif |
|
|
1137 |
.................... |
|
|
1138 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1139 |
.................... // float sqrt(float x) |
|
|
1140 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1141 |
.................... // Description : returns the square root of x |
|
|
1142 |
.................... // Date : N/A |
|
|
1143 |
.................... // |
|
|
1144 |
.................... float32 sqrt(float32 x) |
|
|
1145 |
.................... { |
|
|
1146 |
.................... float32 y, res; |
|
|
1147 |
.................... #if defined(__PCD__) |
|
|
1148 |
.................... unsigned int16 data1,data2; |
|
|
1149 |
.................... #endif |
|
|
1150 |
.................... BYTE *p; |
|
|
1151 |
.................... |
|
|
1152 |
.................... #ifdef _ERRNO |
|
|
1153 |
.................... if(x < 0) |
|
|
1154 |
.................... { |
|
|
1155 |
.................... errno=EDOM; |
|
|
1156 |
.................... } |
|
|
1157 |
.................... #endif |
|
|
1158 |
.................... |
|
|
1159 |
.................... if( x<=0.0) |
|
|
1160 |
.................... return(0.0); |
|
|
1161 |
.................... |
|
|
1162 |
.................... y=x; |
|
|
1163 |
.................... |
|
|
1164 |
.................... #if !defined(__PCD__) |
|
|
1165 |
.................... p=&y; |
|
|
1166 |
.................... (*p)=(BYTE)((((unsigned int16)(*p)) + 127) >> 1); |
|
|
1167 |
.................... #endif |
|
|
1168 |
.................... |
|
|
1169 |
.................... #if defined(__PCD__) |
|
|
1170 |
.................... p = (((unsigned int8 *)(&y))+3); |
|
|
1171 |
.................... data1 = *(((unsigned int8 *)(&y))+3); |
|
|
1172 |
.................... data2 = *(((unsigned int8 *)(&y))+2); |
|
|
1173 |
.................... rotate_left(&data1,1); |
|
|
1174 |
.................... if(bit_test(data2,7)) |
|
|
1175 |
.................... bit_set(data1,0); |
|
|
1176 |
.................... data1 = ((data1+127) >>1); |
|
|
1177 |
.................... bit_clear(data2,7); |
|
|
1178 |
.................... if(bit_test(data1,0)) |
|
|
1179 |
.................... bit_set(data2,7); |
|
|
1180 |
.................... data1 = data1 >>1; |
|
|
1181 |
.................... *(((unsigned int8 *)(&y))+3) = data1; |
|
|
1182 |
.................... *(((unsigned int8 *)(&y))+2) = data2; |
|
|
1183 |
.................... |
|
|
1184 |
.................... #endif |
|
|
1185 |
.................... |
|
|
1186 |
.................... do { |
|
|
1187 |
.................... res=y; |
|
|
1188 |
.................... y+=(x/y); |
|
|
1189 |
.................... |
|
|
1190 |
.................... #if !defined(__PCD__) |
|
|
1191 |
.................... (*p)--; |
|
|
1192 |
.................... #endif |
|
|
1193 |
.................... |
|
|
1194 |
.................... #if defined(__PCD__) |
|
|
1195 |
.................... data1 = *(((unsigned int8 *)(&y))+3); |
|
|
1196 |
.................... data2 = *(((unsigned int8 *)(&y))+2); |
|
|
1197 |
.................... rotate_left(&data1,1); |
|
|
1198 |
.................... if(bit_test(data2,7)) |
|
|
1199 |
.................... bit_set(data1,0); |
|
|
1200 |
.................... data1--; |
|
|
1201 |
.................... bit_clear(data2,7); |
|
|
1202 |
.................... if(bit_test(data1,0)) |
|
|
1203 |
.................... bit_set(data2,7); |
|
|
1204 |
.................... data1 = data1 >>1; |
|
|
1205 |
.................... *(((unsigned int8 *)(&y))+3) = data1; |
|
|
1206 |
.................... *(((unsigned int8 *)(&y))+2) = data2; |
|
|
1207 |
.................... |
|
|
1208 |
.................... #endif |
|
|
1209 |
.................... } while(res != y); |
|
|
1210 |
.................... |
|
|
1211 |
.................... return(res); |
|
|
1212 |
.................... } |
|
|
1213 |
.................... //Overloaded functions for sqrt() for PCD |
|
|
1214 |
.................... // Overloaded function sqrt() for data type - Float48 |
|
|
1215 |
.................... #if defined(__PCD__) |
|
|
1216 |
.................... float48 sqrt(float48 x) |
|
|
1217 |
.................... { |
|
|
1218 |
.................... float48 y, res; |
|
|
1219 |
.................... unsigned int16 data1,data2; |
|
|
1220 |
.................... BYTE *p; |
|
|
1221 |
.................... |
|
|
1222 |
.................... #ifdef _ERRNO |
|
|
1223 |
.................... if(x < 0) |
|
|
1224 |
.................... { |
|
|
1225 |
.................... errno=EDOM; |
|
|
1226 |
.................... } |
|
|
1227 |
.................... #endif |
|
|
1228 |
.................... |
|
|
1229 |
.................... if( x<=0.0) |
|
|
1230 |
.................... return(0.0); |
|
|
1231 |
.................... |
|
|
1232 |
.................... y=x; |
|
|
1233 |
.................... |
|
|
1234 |
.................... #if !defined(__PCD__) |
|
|
1235 |
.................... p=&y; |
|
|
1236 |
.................... (*p)=(BYTE)((((unsigned int16)(*p)) + 127) >> 1); |
|
|
1237 |
.................... #endif |
|
|
1238 |
.................... |
|
|
1239 |
.................... #if defined(__PCD__) |
|
|
1240 |
.................... p = (((unsigned int8 *)(&y))+5); |
|
|
1241 |
.................... data1 = *(((unsigned int8 *)(&y))+5); |
|
|
1242 |
.................... data2 = *(((unsigned int8 *)(&y))+4); |
|
|
1243 |
.................... rotate_left(&data1,1); |
|
|
1244 |
.................... if(bit_test(data2,7)) |
|
|
1245 |
.................... bit_set(data1,0); |
|
|
1246 |
.................... data1 = ((data1+127) >>1); |
|
|
1247 |
.................... bit_clear(data2,7); |
|
|
1248 |
.................... if(bit_test(data1,0)) |
|
|
1249 |
.................... bit_set(data2,7); |
|
|
1250 |
.................... data1 = data1 >>1; |
|
|
1251 |
.................... *(((unsigned int8 *)(&y))+5) = data1; |
|
|
1252 |
.................... *(((unsigned int8 *)(&y))+4) = data2; |
|
|
1253 |
.................... |
|
|
1254 |
.................... #endif |
|
|
1255 |
.................... |
|
|
1256 |
.................... do { |
|
|
1257 |
.................... res=y; |
|
|
1258 |
.................... y+=(x/y); |
|
|
1259 |
.................... |
|
|
1260 |
.................... #if !defined(__PCD__) |
|
|
1261 |
.................... (*p)--; |
|
|
1262 |
.................... #endif |
|
|
1263 |
.................... |
|
|
1264 |
.................... data1 = *(((unsigned int8 *)(&y))+5); |
|
|
1265 |
.................... data2 = *(((unsigned int8 *)(&y))+4); |
|
|
1266 |
.................... rotate_left(&data1,1); |
|
|
1267 |
.................... if(bit_test(data2,7)) |
|
|
1268 |
.................... bit_set(data1,0); |
|
|
1269 |
.................... data1--; |
|
|
1270 |
.................... bit_clear(data2,7); |
|
|
1271 |
.................... if(bit_test(data1,0)) |
|
|
1272 |
.................... bit_set(data2,7); |
|
|
1273 |
.................... data1 = data1 >>1; |
|
|
1274 |
.................... *(((unsigned int8 *)(&y))+5) = data1; |
|
|
1275 |
.................... *(((unsigned int8 *)(&y))+4) = data2; |
|
|
1276 |
.................... |
|
|
1277 |
.................... } while(res != y); |
|
|
1278 |
.................... |
|
|
1279 |
.................... return(res); |
|
|
1280 |
.................... } |
|
|
1281 |
.................... |
|
|
1282 |
.................... // Overloaded function sqrt() for data type - Float64 |
|
|
1283 |
.................... float64 sqrt(float64 x) |
|
|
1284 |
.................... { |
|
|
1285 |
.................... float64 y, res; |
|
|
1286 |
.................... unsigned int16 *p; |
|
|
1287 |
.................... unsigned int16 temp1,temp2; |
|
|
1288 |
.................... |
|
|
1289 |
.................... #ifdef _ERRNO |
|
|
1290 |
.................... if(x < 0) |
|
|
1291 |
.................... { |
|
|
1292 |
.................... errno=EDOM; |
|
|
1293 |
.................... } |
|
|
1294 |
.................... #endif |
|
|
1295 |
.................... |
|
|
1296 |
.................... if( x<=0.0) |
|
|
1297 |
.................... return(0.0); |
|
|
1298 |
.................... |
|
|
1299 |
.................... y=x; |
|
|
1300 |
.................... p= (((unsigned int16 *)(&y))+3); |
|
|
1301 |
.................... temp1 = *p; |
|
|
1302 |
.................... temp2 = *p; |
|
|
1303 |
.................... bit_clear(temp1,15); |
|
|
1304 |
.................... temp1 = (temp1>>4)+1023; |
|
|
1305 |
.................... temp1 = temp1 >> 1; |
|
|
1306 |
.................... temp1 = (temp1<<4) & 0xFFF0; |
|
|
1307 |
.................... if(bit_test(temp2,15)) |
|
|
1308 |
.................... bit_set(temp1,15); |
|
|
1309 |
.................... temp2 = temp2 & 0x000F; |
|
|
1310 |
.................... temp1 ^= temp2; |
|
|
1311 |
.................... |
|
|
1312 |
.................... (*p) = temp1; |
|
|
1313 |
.................... |
|
|
1314 |
.................... do { |
|
|
1315 |
.................... res=y; |
|
|
1316 |
.................... y+=(x/y); |
|
|
1317 |
.................... temp1 = *p; |
|
|
1318 |
.................... temp2 = *p; |
|
|
1319 |
.................... bit_clear(temp1,15); |
|
|
1320 |
.................... temp1 = (temp1>>4); |
|
|
1321 |
.................... temp1--; |
|
|
1322 |
.................... temp1 = (temp1<<4) & 0xFFF0; |
|
|
1323 |
.................... if(bit_test(temp2,15)) |
|
|
1324 |
.................... bit_set(temp1,15); |
|
|
1325 |
.................... temp2 = temp2 & 0x000F; |
|
|
1326 |
.................... temp1 ^= temp2; |
|
|
1327 |
.................... (*p) = temp1; |
|
|
1328 |
.................... |
|
|
1329 |
.................... } while(res != y); |
|
|
1330 |
.................... |
|
|
1331 |
.................... return(res); |
|
|
1332 |
.................... } |
|
|
1333 |
.................... #endif |
|
|
1334 |
.................... |
|
|
1335 |
.................... ////////////////////////////// Trig Functions ////////////////////////////// |
|
|
1336 |
.................... #ifdef PI_DIV_BY_TWO |
|
|
1337 |
.................... #undef PI_DIV_BY_TWO |
|
|
1338 |
.................... #endif |
|
|
1339 |
.................... #define PI_DIV_BY_TWO 1.5707963267948966 |
|
|
1340 |
.................... #ifdef TWOBYPI |
|
|
1341 |
.................... #undef TWOBYPI |
|
|
1342 |
.................... #define TWOBYPI 0.6366197723675813 |
|
|
1343 |
.................... #endif |
|
|
1344 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1345 |
.................... // float cos(float x) |
|
|
1346 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1347 |
.................... // Description : returns the cosine value of the angle x, which is in radian |
|
|
1348 |
.................... // Date : 9/20/2001 |
|
|
1349 |
.................... // |
|
|
1350 |
.................... float32 cos(float32 x) |
|
|
1351 |
.................... { |
|
|
1352 |
.................... float32 y, t, t2 = 1.0; |
|
|
1353 |
.................... unsigned int8 quad, i; |
|
|
1354 |
.................... float32 frac; |
|
|
1355 |
.................... float32 p[6] = { //by the series definition for cosine |
|
|
1356 |
.................... -0.5, // sum ( ( (-1)^n * x^2n )/(2n)! ) |
|
|
1357 |
.................... 0.04166666666667, |
|
|
1358 |
.................... -0.00138888888889, |
|
|
1359 |
.................... 0.00002480158730, |
|
|
1360 |
.................... -0.00000027557319, |
|
|
1361 |
.................... 0.00000000208767, |
|
|
1362 |
.................... //-0.00000000001147, |
|
|
1363 |
.................... // 0.00000000000005 |
|
|
1364 |
.................... }; |
|
|
1365 |
.................... |
|
|
1366 |
.................... if (x < 0) x = -x; // absolute value of input |
|
|
1367 |
.................... |
|
|
1368 |
.................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant |
|
|
1369 |
.................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input |
|
|
1370 |
.................... quad = quad % 4; // quadrant (0 to 3) |
|
|
1371 |
.................... |
|
|
1372 |
.................... if (quad == 0 || quad == 2) |
|
|
1373 |
.................... t = frac * PI_DIV_BY_TWO; |
|
|
1374 |
.................... else if (quad == 1) |
|
|
1375 |
.................... t = (1-frac) * PI_DIV_BY_TWO; |
|
|
1376 |
.................... else // should be 3 |
|
|
1377 |
.................... t = (frac-1) * PI_DIV_BY_TWO; |
|
|
1378 |
.................... |
|
|
1379 |
.................... y = 1.0; |
|
|
1380 |
.................... t = t * t; |
|
|
1381 |
.................... for (i = 0; i <= 5; i++) |
|
|
1382 |
.................... { |
|
|
1383 |
.................... t2 = t2 * t; |
|
|
1384 |
.................... y = y + p[i] * t2; |
|
|
1385 |
.................... } |
|
|
1386 |
.................... |
|
|
1387 |
.................... if (quad == 2 || quad == 1) |
|
|
1388 |
.................... y = -y; // correct sign |
|
|
1389 |
.................... |
|
|
1390 |
.................... return (y); |
|
|
1391 |
.................... } |
|
|
1392 |
.................... |
|
|
1393 |
.................... |
|
|
1394 |
.................... //Overloaded functions for cos() for PCD |
|
|
1395 |
.................... // Overloaded function cos() for data type - Float48 |
|
|
1396 |
.................... #if defined(__PCD__) |
|
|
1397 |
.................... float48 cos(float48 x) |
|
|
1398 |
.................... { |
|
|
1399 |
.................... float48 y, t, t2 = 1.0; |
|
|
1400 |
.................... unsigned int8 quad, i; |
|
|
1401 |
.................... float48 frac; |
|
|
1402 |
.................... float48 p[6] = { //by the series definition for cosine |
|
|
1403 |
.................... -0.5, // sum ( ( (-1)^n * x^2n )/(2n)! ) |
|
|
1404 |
.................... 0.04166666666667, |
|
|
1405 |
.................... -0.00138888888889, |
|
|
1406 |
.................... 0.00002480158730, |
|
|
1407 |
.................... -0.00000027557319, |
|
|
1408 |
.................... 0.00000000208767, |
|
|
1409 |
.................... //-0.00000000001147, |
|
|
1410 |
.................... // 0.00000000000005 |
|
|
1411 |
.................... }; |
|
|
1412 |
.................... |
|
|
1413 |
.................... if (x < 0) x = -x; // absolute value of input |
|
|
1414 |
.................... |
|
|
1415 |
.................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant |
|
|
1416 |
.................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input |
|
|
1417 |
.................... quad = quad % 4; // quadrant (0 to 3) |
|
|
1418 |
.................... |
|
|
1419 |
.................... if (quad == 0 || quad == 2) |
|
|
1420 |
.................... t = frac * PI_DIV_BY_TWO; |
|
|
1421 |
.................... else if (quad == 1) |
|
|
1422 |
.................... t = (1-frac) * PI_DIV_BY_TWO; |
|
|
1423 |
.................... else // should be 3 |
|
|
1424 |
.................... t = (frac-1) * PI_DIV_BY_TWO; |
|
|
1425 |
.................... |
|
|
1426 |
.................... y = 0.999999999781; |
|
|
1427 |
.................... t = t * t; |
|
|
1428 |
.................... for (i = 0; i <= 5; i++) |
|
|
1429 |
.................... { |
|
|
1430 |
.................... t2 = t2 * t; |
|
|
1431 |
.................... y = y + p[i] * t2; |
|
|
1432 |
.................... } |
|
|
1433 |
.................... |
|
|
1434 |
.................... if (quad == 2 || quad == 1) |
|
|
1435 |
.................... y = -y; // correct sign |
|
|
1436 |
.................... |
|
|
1437 |
.................... return (y); |
|
|
1438 |
.................... } |
|
|
1439 |
.................... |
|
|
1440 |
.................... // Overloaded function cos() for data type - Float48 |
|
|
1441 |
.................... float64 cos(float64 x) |
|
|
1442 |
.................... { |
|
|
1443 |
.................... float64 y, t, t2 = 1.0; |
|
|
1444 |
.................... unsigned int8 quad, i; |
|
|
1445 |
.................... float64 frac; |
|
|
1446 |
.................... float64 p[6] = { //by the series definition for cosine |
|
|
1447 |
.................... -0.5, // sum ( ( (-1)^n * x^2n )/(2n)! ) |
|
|
1448 |
.................... 0.04166666666667, |
|
|
1449 |
.................... -0.00138888888889, |
|
|
1450 |
.................... 0.00002480158730, |
|
|
1451 |
.................... -0.00000027557319, |
|
|
1452 |
.................... 0.00000000208767, |
|
|
1453 |
.................... //-0.00000000001147, |
|
|
1454 |
.................... // 0.00000000000005 |
|
|
1455 |
.................... }; |
|
|
1456 |
.................... |
|
|
1457 |
.................... if (x < 0) x = -x; // absolute value of input |
|
|
1458 |
.................... |
|
|
1459 |
.................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant |
|
|
1460 |
.................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input |
|
|
1461 |
.................... quad = quad % 4; // quadrant (0 to 3) |
|
|
1462 |
.................... |
|
|
1463 |
.................... if (quad == 0 || quad == 2) |
|
|
1464 |
.................... t = frac * PI_DIV_BY_TWO; |
|
|
1465 |
.................... else if (quad == 1) |
|
|
1466 |
.................... t = (1-frac) * PI_DIV_BY_TWO; |
|
|
1467 |
.................... else // should be 3 |
|
|
1468 |
.................... t = (frac-1) * PI_DIV_BY_TWO; |
|
|
1469 |
.................... |
|
|
1470 |
.................... y = 0.999999999781; |
|
|
1471 |
.................... t = t * t; |
|
|
1472 |
.................... for (i = 0; i <= 5; i++) |
|
|
1473 |
.................... { |
|
|
1474 |
.................... t2 = t2 * t; |
|
|
1475 |
.................... y = y + p[i] * t2; |
|
|
1476 |
.................... } |
|
|
1477 |
.................... |
|
|
1478 |
.................... if (quad == 2 || quad == 1) |
|
|
1479 |
.................... y = -y; // correct sign |
|
|
1480 |
.................... |
|
|
1481 |
.................... return (y); |
|
|
1482 |
.................... } |
|
|
1483 |
.................... |
|
|
1484 |
.................... #endif |
|
|
1485 |
.................... |
|
|
1486 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1487 |
.................... // float sin(float x) |
|
|
1488 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1489 |
.................... // Description : returns the sine value of the angle x, which is in radian |
|
|
1490 |
.................... // Date : 9/20/2001 |
|
|
1491 |
.................... // |
|
|
1492 |
.................... float32 sin(float32 x) |
|
|
1493 |
.................... { |
|
|
1494 |
.................... return cos(x - PI_DIV_BY_TWO); |
|
|
1495 |
.................... } |
|
|
1496 |
.................... |
|
|
1497 |
.................... //Overloaded functions for sin() for PCD |
|
|
1498 |
.................... // Overloaded function sin() for data type - Float48 |
|
|
1499 |
.................... #if defined(__PCD__) |
|
|
1500 |
.................... float48 sin(float48 x) |
|
|
1501 |
.................... { |
|
|
1502 |
.................... return cos(x - PI_DIV_BY_TWO); |
|
|
1503 |
.................... } |
|
|
1504 |
.................... |
|
|
1505 |
.................... // Overloaded function sin() for data type - Float48 |
|
|
1506 |
.................... float64 sin(float64 x) |
|
|
1507 |
.................... { |
|
|
1508 |
.................... return cos(x - PI_DIV_BY_TWO); |
|
|
1509 |
.................... } |
|
|
1510 |
.................... #endif |
|
|
1511 |
.................... |
|
|
1512 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1513 |
.................... // float tan(float x) |
|
|
1514 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1515 |
.................... // Description : returns the tangent value of the angle x, which is in radian |
|
|
1516 |
.................... // Date : 9/20/2001 |
|
|
1517 |
.................... // |
|
|
1518 |
.................... float32 tan(float32 x) |
|
|
1519 |
.................... { |
|
|
1520 |
.................... float32 c, s; |
|
|
1521 |
.................... |
|
|
1522 |
.................... c = cos(x); |
|
|
1523 |
.................... if (c == 0.0) |
|
|
1524 |
.................... return (1.0e+36); |
|
|
1525 |
.................... |
|
|
1526 |
.................... s = sin(x); |
|
|
1527 |
.................... return(s/c); |
|
|
1528 |
.................... } |
|
|
1529 |
.................... //Overloaded functions for tan() for PCD |
|
|
1530 |
.................... // Overloaded function tan() for data type - Float48 |
|
|
1531 |
.................... #if defined(__PCD__) |
|
|
1532 |
.................... float48 tan(float48 x) |
|
|
1533 |
.................... { |
|
|
1534 |
.................... float48 c, s; |
|
|
1535 |
.................... |
|
|
1536 |
.................... c = cos(x); |
|
|
1537 |
.................... if (c == 0.0) |
|
|
1538 |
.................... return (1.0e+36); |
|
|
1539 |
.................... |
|
|
1540 |
.................... s = sin(x); |
|
|
1541 |
.................... return(s/c); |
|
|
1542 |
.................... } |
|
|
1543 |
.................... |
|
|
1544 |
.................... // Overloaded function tan() for data type - Float48 |
|
|
1545 |
.................... float64 tan(float64 x) |
|
|
1546 |
.................... { |
|
|
1547 |
.................... float64 c, s; |
|
|
1548 |
.................... |
|
|
1549 |
.................... c = cos(x); |
|
|
1550 |
.................... if (c == 0.0) |
|
|
1551 |
.................... return (1.0e+36); |
|
|
1552 |
.................... |
|
|
1553 |
.................... s = sin(x); |
|
|
1554 |
.................... return(s/c); |
|
|
1555 |
.................... } |
|
|
1556 |
.................... #endif |
|
|
1557 |
.................... |
|
|
1558 |
.................... float32 const pas[3] = {0.49559947, -4.6145309, 5.6036290}; |
|
|
1559 |
.................... float32 const qas[3] = {1.0000000, -5.5484666, 5.6036290}; |
|
|
1560 |
.................... |
|
|
1561 |
.................... float32 ASIN_COS(float32 x, unsigned int8 n) |
|
|
1562 |
.................... { |
|
|
1563 |
.................... float32 y, res, r, y2; |
|
|
1564 |
.................... int1 s; |
|
|
1565 |
.................... #ifdef _ERRNO |
|
|
1566 |
.................... if(x <-1 || x > 1) |
|
|
1567 |
.................... { |
|
|
1568 |
.................... errno=EDOM; |
|
|
1569 |
.................... } |
|
|
1570 |
.................... #endif |
|
|
1571 |
.................... s = 0; |
|
|
1572 |
.................... y = x; |
|
|
1573 |
.................... |
|
|
1574 |
.................... if (x < 0) |
|
|
1575 |
.................... { |
|
|
1576 |
.................... s = 1; |
|
|
1577 |
.................... y = -y; |
|
|
1578 |
.................... } |
|
|
1579 |
.................... |
|
|
1580 |
.................... if (y > 0.5) |
|
|
1581 |
.................... { |
|
|
1582 |
.................... y = sqrt((1.0 - y)/2.0); |
|
|
1583 |
.................... n += 2; |
|
|
1584 |
.................... } |
|
|
1585 |
.................... |
|
|
1586 |
.................... y2=y*y; |
|
|
1587 |
.................... |
|
|
1588 |
.................... res = pas[0]*y2 + pas[1]; |
|
|
1589 |
.................... res = res*y2 + pas[2]; |
|
|
1590 |
.................... |
|
|
1591 |
.................... r = qas[0]*y2 + qas[1]; |
|
|
1592 |
.................... r = r*y2 + qas[2]; |
|
|
1593 |
.................... |
|
|
1594 |
.................... res = y*res/r; |
|
|
1595 |
.................... |
|
|
1596 |
.................... if (n & 2) // |x| > 0.5 |
|
|
1597 |
.................... res = PI_DIV_BY_TWO - 2.0*res; |
|
|
1598 |
.................... if (s) |
|
|
1599 |
.................... res = -res; |
|
|
1600 |
.................... if (n & 1) // take arccos |
|
|
1601 |
.................... res = PI_DIV_BY_TWO - res; |
|
|
1602 |
.................... |
|
|
1603 |
.................... return(res); |
|
|
1604 |
.................... } |
|
|
1605 |
.................... |
|
|
1606 |
.................... //Overloaded functions for ASIN_COS() for PCD |
|
|
1607 |
.................... // Overloaded function ASIN_COS() for data type - Float48 |
|
|
1608 |
.................... #if defined(__PCD__) |
|
|
1609 |
.................... float48 ASIN_COS(float48 x, unsigned int8 n) |
|
|
1610 |
.................... { |
|
|
1611 |
.................... float48 y, res, r, y2; |
|
|
1612 |
.................... int1 s; |
|
|
1613 |
.................... #ifdef _ERRNO |
|
|
1614 |
.................... if(x <-1 || x > 1) |
|
|
1615 |
.................... { |
|
|
1616 |
.................... errno=EDOM; |
|
|
1617 |
.................... } |
|
|
1618 |
.................... #endif |
|
|
1619 |
.................... s = 0; |
|
|
1620 |
.................... y = x; |
|
|
1621 |
.................... |
|
|
1622 |
.................... if (x < 0) |
|
|
1623 |
.................... { |
|
|
1624 |
.................... s = 1; |
|
|
1625 |
.................... y = -y; |
|
|
1626 |
.................... } |
|
|
1627 |
.................... |
|
|
1628 |
.................... if (y > 0.5) |
|
|
1629 |
.................... { |
|
|
1630 |
.................... y = sqrt((1.0 - y)/2.0); |
|
|
1631 |
.................... n += 2; |
|
|
1632 |
.................... } |
|
|
1633 |
.................... |
|
|
1634 |
.................... y2=y*y; |
|
|
1635 |
.................... |
|
|
1636 |
.................... res = pas[0]*y2 + pas[1]; |
|
|
1637 |
.................... res = res*y2 + pas[2]; |
|
|
1638 |
.................... |
|
|
1639 |
.................... r = qas[0]*y2 + qas[1]; |
|
|
1640 |
.................... r = r*y2 + qas[2]; |
|
|
1641 |
.................... |
|
|
1642 |
.................... res = y*res/r; |
|
|
1643 |
.................... |
|
|
1644 |
.................... if (n & 2) // |x| > 0.5 |
|
|
1645 |
.................... res = PI_DIV_BY_TWO - 2.0*res; |
|
|
1646 |
.................... if (s) |
|
|
1647 |
.................... res = -res; |
|
|
1648 |
.................... if (n & 1) // take arccos |
|
|
1649 |
.................... res = PI_DIV_BY_TWO - res; |
|
|
1650 |
.................... |
|
|
1651 |
.................... return(res); |
|
|
1652 |
.................... } |
|
|
1653 |
.................... |
|
|
1654 |
.................... // Overloaded function ASIN_COS() for data type - Float64 |
|
|
1655 |
.................... float64 ASIN_COS(float64 x, unsigned int8 n) |
|
|
1656 |
.................... { |
|
|
1657 |
.................... float64 y, res, r, y2; |
|
|
1658 |
.................... int1 s; |
|
|
1659 |
.................... #ifdef _ERRNO |
|
|
1660 |
.................... if(x <-1 || x > 1) |
|
|
1661 |
.................... { |
|
|
1662 |
.................... errno=EDOM; |
|
|
1663 |
.................... } |
|
|
1664 |
.................... #endif |
|
|
1665 |
.................... s = 0; |
|
|
1666 |
.................... y = x; |
|
|
1667 |
.................... |
|
|
1668 |
.................... if (x < 0) |
|
|
1669 |
.................... { |
|
|
1670 |
.................... s = 1; |
|
|
1671 |
.................... y = -y; |
|
|
1672 |
.................... } |
|
|
1673 |
.................... |
|
|
1674 |
.................... if (y > 0.5) |
|
|
1675 |
.................... { |
|
|
1676 |
.................... y = sqrt((1.0 - y)/2.0); |
|
|
1677 |
.................... n += 2; |
|
|
1678 |
.................... } |
|
|
1679 |
.................... |
|
|
1680 |
.................... y2=y*y; |
|
|
1681 |
.................... |
|
|
1682 |
.................... res = pas[0]*y2 + pas[1]; |
|
|
1683 |
.................... res = res*y2 + pas[2]; |
|
|
1684 |
.................... |
|
|
1685 |
.................... r = qas[0]*y2 + qas[1]; |
|
|
1686 |
.................... r = r*y2 + qas[2]; |
|
|
1687 |
.................... |
|
|
1688 |
.................... res = y*res/r; |
|
|
1689 |
.................... |
|
|
1690 |
.................... if (n & 2) // |x| > 0.5 |
|
|
1691 |
.................... res = PI_DIV_BY_TWO - 2.0*res; |
|
|
1692 |
.................... if (s) |
|
|
1693 |
.................... res = -res; |
|
|
1694 |
.................... if (n & 1) // take arccos |
|
|
1695 |
.................... res = PI_DIV_BY_TWO - res; |
|
|
1696 |
.................... |
|
|
1697 |
.................... return(res); |
|
|
1698 |
.................... } |
|
|
1699 |
.................... #endif |
|
|
1700 |
.................... |
|
|
1701 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1702 |
.................... // float asin(float x) |
|
|
1703 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1704 |
.................... // Description : returns the arcsine value of the value x. |
|
|
1705 |
.................... // Date : N/A |
|
|
1706 |
.................... // |
|
|
1707 |
.................... float32 asin(float32 x) |
|
|
1708 |
.................... { |
|
|
1709 |
.................... float32 r; |
|
|
1710 |
.................... |
|
|
1711 |
.................... r = ASIN_COS(x, 0); |
|
|
1712 |
.................... return(r); |
|
|
1713 |
.................... } |
|
|
1714 |
.................... //Overloaded functions for asin() for PCD |
|
|
1715 |
.................... // Overloaded function asin() for data type - Float48 |
|
|
1716 |
.................... #if defined(__PCD__) |
|
|
1717 |
.................... float48 asin(float48 x) |
|
|
1718 |
.................... { |
|
|
1719 |
.................... float48 r; |
|
|
1720 |
.................... |
|
|
1721 |
.................... r = ASIN_COS(x, 0); |
|
|
1722 |
.................... return(r); |
|
|
1723 |
.................... } |
|
|
1724 |
.................... |
|
|
1725 |
.................... // Overloaded function asin() for data type - Float64 |
|
|
1726 |
.................... float64 asin(float64 x) |
|
|
1727 |
.................... { |
|
|
1728 |
.................... float64 r; |
|
|
1729 |
.................... |
|
|
1730 |
.................... r = ASIN_COS(x, 0); |
|
|
1731 |
.................... return(r); |
|
|
1732 |
.................... } |
|
|
1733 |
.................... #endif |
|
|
1734 |
.................... |
|
|
1735 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1736 |
.................... // float acos(float x) |
|
|
1737 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1738 |
.................... // Description : returns the arccosine value of the value x. |
|
|
1739 |
.................... // Date : N/A |
|
|
1740 |
.................... // |
|
|
1741 |
.................... float32 acos(float32 x) |
|
|
1742 |
.................... { |
|
|
1743 |
.................... float32 r; |
|
|
1744 |
.................... |
|
|
1745 |
.................... r = ASIN_COS(x, 1); |
|
|
1746 |
.................... return(r); |
|
|
1747 |
.................... } |
|
|
1748 |
.................... //Overloaded functions for acos() for PCD |
|
|
1749 |
.................... // Overloaded function acos() for data type - Float48 |
|
|
1750 |
.................... #if defined(__PCD__) |
|
|
1751 |
.................... float48 acos(float48 x) |
|
|
1752 |
.................... { |
|
|
1753 |
.................... float48 r; |
|
|
1754 |
.................... |
|
|
1755 |
.................... r = ASIN_COS(x, 1); |
|
|
1756 |
.................... return(r); |
|
|
1757 |
.................... } |
|
|
1758 |
.................... |
|
|
1759 |
.................... // Overloaded function acos() for data type - Float64 |
|
|
1760 |
.................... float64 acos(float64 x) |
|
|
1761 |
.................... { |
|
|
1762 |
.................... float64 r; |
|
|
1763 |
.................... |
|
|
1764 |
.................... r = ASIN_COS(x, 1); |
|
|
1765 |
.................... return(r); |
|
|
1766 |
.................... } |
|
|
1767 |
.................... #endif |
|
|
1768 |
.................... |
|
|
1769 |
.................... float32 const pat[4] = {0.17630401, 5.6710795, 22.376096, 19.818457}; |
|
|
1770 |
.................... float32 const qat[4] = {1.0000000, 11.368190, 28.982246, 19.818457}; |
|
|
1771 |
.................... |
|
|
1772 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1773 |
.................... // float atan(float x) |
|
|
1774 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
1775 |
.................... // Description : returns the arctangent value of the value x. |
|
|
1776 |
.................... // Date : N/A |
|
|
1777 |
.................... // |
|
|
1778 |
.................... float32 atan(float32 x) |
|
|
1779 |
.................... { |
|
|
1780 |
.................... float32 y, res, r; |
|
|
1781 |
.................... int1 s, flag; |
|
|
1782 |
.................... |
|
|
1783 |
.................... s = 0; |
|
|
1784 |
.................... flag = 0; |
|
|
1785 |
.................... y = x; |
|
|
1786 |
.................... |
|
|
1787 |
.................... if (x < 0) |
|
|
1788 |
.................... { |
|
|
1789 |
.................... s = 1; |
|
|
1790 |
.................... y = -y; |
|
|
1791 |
.................... } |
|
|
1792 |
.................... |
|
|
1793 |
.................... if (y > 1.0) |
|
|
1794 |
.................... { |
|
|
1795 |
.................... y = 1.0/y; |
|
|
1796 |
.................... flag = 1; |
|
|
1797 |
.................... } |
|
|
1798 |
.................... |
|
|
1799 |
.................... res = pat[0]*y*y + pat[1]; |
|
|
1800 |
.................... res = res*y*y + pat[2]; |
|
|
1801 |
.................... res = res*y*y + pat[3]; |
|
|
1802 |
.................... |
|
|
1803 |
.................... r = qat[0]*y*y + qat[1]; |
|
|
1804 |
.................... r = r*y*y + qat[2]; |
|
|
1805 |
.................... r = r*y*y + qat[3]; |
|
|
1806 |
.................... |
|
|
1807 |
.................... res = y*res/r; |
|
|
1808 |
.................... |
|
|
1809 |
.................... |
|
|
1810 |
.................... if (flag) // for |x| > 1 |
|
|
1811 |
.................... res = PI_DIV_BY_TWO - res; |
|
|
1812 |
.................... if (s) |
|
|
1813 |
.................... res = -res; |
|
|
1814 |
.................... |
|
|
1815 |
.................... return(res); |
|
|
1816 |
.................... } |
|
|
1817 |
.................... //Overloaded functions for atan() for PCD |
|
|
1818 |
.................... // Overloaded function atan() for data type - Float48 |
|
|
1819 |
.................... #if defined(__PCD__) |
|
|
1820 |
.................... float48 atan(float48 x) |
|
|
1821 |
.................... { |
|
|
1822 |
.................... float48 y, res, r; |
|
|
1823 |
.................... int1 s, flag; |
|
|
1824 |
.................... |
|
|
1825 |
.................... s = 0; |
|
|
1826 |
.................... flag = 0; |
|
|
1827 |
.................... y = x; |
|
|
1828 |
.................... |
|
|
1829 |
.................... if (x < 0) |
|
|
1830 |
.................... { |
|
|
1831 |
.................... s = 1; |
|
|
1832 |
.................... y = -y; |
|
|
1833 |
.................... } |
|
|
1834 |
.................... |
|
|
1835 |
.................... if (y > 1.0) |
|
|
1836 |
.................... { |
|
|
1837 |
.................... y = 1.0/y; |
|
|
1838 |
.................... flag = 1; |
|
|
1839 |
.................... } |
|
|
1840 |
.................... |
|
|
1841 |
.................... res = pat[0]*y*y + pat[1]; |
|
|
1842 |
.................... res = res*y*y + pat[2]; |
|
|
1843 |
.................... res = res*y*y + pat[3]; |
|
|
1844 |
.................... |
|
|
1845 |
.................... r = qat[0]*y*y + qat[1]; |
|
|
1846 |
.................... r = r*y*y + qat[2]; |
|
|
1847 |
.................... r = r*y*y + qat[3]; |
|
|
1848 |
.................... |
|
|
1849 |
.................... res = y*res/r; |
|
|
1850 |
.................... |
|
|
1851 |
.................... |
|
|
1852 |
.................... if (flag) // for |x| > 1 |
|
|
1853 |
.................... res = PI_DIV_BY_TWO - res; |
|
|
1854 |
.................... if (s) |
|
|
1855 |
.................... res = -res; |
|
|
1856 |
.................... |
|
|
1857 |
.................... return(res); |
|
|
1858 |
.................... } |
|
|
1859 |
.................... |
|
|
1860 |
.................... // Overloaded function atan() for data type - Float64 |
|
|
1861 |
.................... float64 atan(float64 x) |
|
|
1862 |
.................... { |
|
|
1863 |
.................... float64 y, res, r; |
|
|
1864 |
.................... int1 s, flag; |
|
|
1865 |
.................... |
|
|
1866 |
.................... s = 0; |
|
|
1867 |
.................... flag = 0; |
|
|
1868 |
.................... y = x; |
|
|
1869 |
.................... |
|
|
1870 |
.................... if (x < 0) |
|
|
1871 |
.................... { |
|
|
1872 |
.................... s = 1; |
|
|
1873 |
.................... y = -y; |
|
|
1874 |
.................... } |
|
|
1875 |
.................... |
|
|
1876 |
.................... if (y > 1.0) |
|
|
1877 |
.................... { |
|
|
1878 |
.................... y = 1.0/y; |
|
|
1879 |
.................... flag = 1; |
|
|
1880 |
.................... } |
|
|
1881 |
.................... |
|
|
1882 |
.................... res = pat[0]*y*y + pat[1]; |
|
|
1883 |
.................... res = res*y*y + pat[2]; |
|
|
1884 |
.................... res = res*y*y + pat[3]; |
|
|
1885 |
.................... |
|
|
1886 |
.................... r = qat[0]*y*y + qat[1]; |
|
|
1887 |
.................... r = r*y*y + qat[2]; |
|
|
1888 |
.................... r = r*y*y + qat[3]; |
|
|
1889 |
.................... |
|
|
1890 |
.................... res = y*res/r; |
|
|
1891 |
.................... |
|
|
1892 |
.................... |
|
|
1893 |
.................... if (flag) // for |x| > 1 |
|
|
1894 |
.................... res = PI_DIV_BY_TWO - res; |
|
|
1895 |
.................... if (s) |
|
|
1896 |
.................... res = -res; |
|
|
1897 |
.................... |
|
|
1898 |
.................... return(res); |
|
|
1899 |
.................... } |
|
|
1900 |
.................... #endif |
|
|
1901 |
.................... |
|
|
1902 |
.................... ///////////////////////////////////////////////////////////////////////////// |
|
|
1903 |
.................... // float atan2(float y, float x) |
|
|
1904 |
.................... ///////////////////////////////////////////////////////////////////////////// |
|
|
1905 |
.................... // Description :computes the principal value of arc tangent of y/x, using the |
|
|
1906 |
.................... // signs of both the arguments to determine the quadrant of the return value |
|
|
1907 |
.................... // Returns : returns the arc tangent of y/x. |
|
|
1908 |
.................... // Date : N/A |
|
|
1909 |
.................... // |
|
|
1910 |
.................... |
|
|
1911 |
.................... float32 atan2(float32 y,float32 x) |
|
|
1912 |
.................... { |
|
|
1913 |
.................... float32 z; |
|
|
1914 |
.................... int1 sign; |
|
|
1915 |
.................... unsigned int8 quad; |
|
|
1916 |
.................... sign=0; |
|
|
1917 |
.................... quad=0; //quadrant |
|
|
1918 |
.................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1)); |
|
|
1919 |
.................... if(y<0.0) |
|
|
1920 |
.................... { |
|
|
1921 |
.................... sign=1; |
|
|
1922 |
.................... y=-y; |
|
|
1923 |
.................... } |
|
|
1924 |
.................... if(x<0.0) |
|
|
1925 |
.................... { |
|
|
1926 |
.................... x=-x; |
|
|
1927 |
.................... } |
|
|
1928 |
.................... if (x==0.0) |
|
|
1929 |
.................... { |
|
|
1930 |
.................... if(y==0.0) |
|
|
1931 |
.................... { |
|
|
1932 |
.................... #ifdef _ERRNO |
|
|
1933 |
.................... { |
|
|
1934 |
.................... errno=EDOM; |
|
|
1935 |
.................... } |
|
|
1936 |
.................... #endif |
|
|
1937 |
.................... } |
|
|
1938 |
.................... else |
|
|
1939 |
.................... { |
|
|
1940 |
.................... if(sign) |
|
|
1941 |
.................... { |
|
|
1942 |
.................... return (-(PI_DIV_BY_TWO)); |
|
|
1943 |
.................... } |
|
|
1944 |
.................... else |
|
|
1945 |
.................... { |
|
|
1946 |
.................... return (PI_DIV_BY_TWO); |
|
|
1947 |
.................... } |
|
|
1948 |
.................... } |
|
|
1949 |
.................... } |
|
|
1950 |
.................... else |
|
|
1951 |
.................... { |
|
|
1952 |
.................... z=y/x; |
|
|
1953 |
.................... switch(quad) |
|
|
1954 |
.................... { |
|
|
1955 |
.................... case 1: |
|
|
1956 |
.................... { |
|
|
1957 |
.................... return atan(z); |
|
|
1958 |
.................... break; |
|
|
1959 |
.................... } |
|
|
1960 |
.................... case 2: |
|
|
1961 |
.................... { |
|
|
1962 |
.................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122 |
|
|
1963 |
.................... return (PI-atan(z)); |
|
|
1964 |
.................... break; |
|
|
1965 |
.................... } |
|
|
1966 |
.................... case 3: |
|
|
1967 |
.................... { |
|
|
1968 |
.................... return (atan(z)-PI); |
|
|
1969 |
.................... break; |
|
|
1970 |
.................... } |
|
|
1971 |
.................... case 4: |
|
|
1972 |
.................... { |
|
|
1973 |
.................... return (-atan(z)); |
|
|
1974 |
.................... break; |
|
|
1975 |
.................... } |
|
|
1976 |
.................... } |
|
|
1977 |
.................... } |
|
|
1978 |
.................... } |
|
|
1979 |
.................... |
|
|
1980 |
.................... //Overloaded functions for atan2() for PCD |
|
|
1981 |
.................... // Overloaded function atan2() for data type - Float48 |
|
|
1982 |
.................... #if defined(__PCD__) |
|
|
1983 |
.................... float48 atan2(float48 y,float48 x) |
|
|
1984 |
.................... { |
|
|
1985 |
.................... float48 z; |
|
|
1986 |
.................... int1 sign; |
|
|
1987 |
.................... unsigned int8 quad; |
|
|
1988 |
.................... sign=0; |
|
|
1989 |
.................... quad=0; //quadrant |
|
|
1990 |
.................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1)); |
|
|
1991 |
.................... if(y<0.0) |
|
|
1992 |
.................... { |
|
|
1993 |
.................... sign=1; |
|
|
1994 |
.................... y=-y; |
|
|
1995 |
.................... } |
|
|
1996 |
.................... if(x<0.0) |
|
|
1997 |
.................... { |
|
|
1998 |
.................... x=-x; |
|
|
1999 |
.................... } |
|
|
2000 |
.................... if (x==0.0) |
|
|
2001 |
.................... { |
|
|
2002 |
.................... if(y==0.0) |
|
|
2003 |
.................... { |
|
|
2004 |
.................... #ifdef _ERRNO |
|
|
2005 |
.................... { |
|
|
2006 |
.................... errno=EDOM; |
|
|
2007 |
.................... } |
|
|
2008 |
.................... #endif |
|
|
2009 |
.................... } |
|
|
2010 |
.................... else |
|
|
2011 |
.................... { |
|
|
2012 |
.................... if(sign) |
|
|
2013 |
.................... { |
|
|
2014 |
.................... return (-(PI_DIV_BY_TWO)); |
|
|
2015 |
.................... } |
|
|
2016 |
.................... else |
|
|
2017 |
.................... { |
|
|
2018 |
.................... return (PI_DIV_BY_TWO); |
|
|
2019 |
.................... } |
|
|
2020 |
.................... } |
|
|
2021 |
.................... } |
|
|
2022 |
.................... else |
|
|
2023 |
.................... { |
|
|
2024 |
.................... z=y/x; |
|
|
2025 |
.................... switch(quad) |
|
|
2026 |
.................... { |
|
|
2027 |
.................... case 1: |
|
|
2028 |
.................... { |
|
|
2029 |
.................... return atan(z); |
|
|
2030 |
.................... break; |
|
|
2031 |
.................... } |
|
|
2032 |
.................... case 2: |
|
|
2033 |
.................... { |
|
|
2034 |
.................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122 |
|
|
2035 |
.................... return (PI-atan(z)); |
|
|
2036 |
.................... break; |
|
|
2037 |
.................... } |
|
|
2038 |
.................... case 3: |
|
|
2039 |
.................... { |
|
|
2040 |
.................... return (atan(z)-PI); |
|
|
2041 |
.................... break; |
|
|
2042 |
.................... } |
|
|
2043 |
.................... case 4: |
|
|
2044 |
.................... { |
|
|
2045 |
.................... return (-atan(z)); |
|
|
2046 |
.................... break; |
|
|
2047 |
.................... } |
|
|
2048 |
.................... } |
|
|
2049 |
.................... } |
|
|
2050 |
.................... } |
|
|
2051 |
.................... |
|
|
2052 |
.................... // Overloaded function atan2() for data type - Float64 |
|
|
2053 |
.................... float64 atan2(float64 y,float64 x) |
|
|
2054 |
.................... { |
|
|
2055 |
.................... float64 z; |
|
|
2056 |
.................... int1 sign; |
|
|
2057 |
.................... unsigned int8 quad; |
|
|
2058 |
.................... sign=0; |
|
|
2059 |
.................... quad=0; //quadrant |
|
|
2060 |
.................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1)); |
|
|
2061 |
.................... if(y<0.0) |
|
|
2062 |
.................... { |
|
|
2063 |
.................... sign=1; |
|
|
2064 |
.................... y=-y; |
|
|
2065 |
.................... } |
|
|
2066 |
.................... if(x<0.0) |
|
|
2067 |
.................... { |
|
|
2068 |
.................... x=-x; |
|
|
2069 |
.................... } |
|
|
2070 |
.................... if (x==0.0) |
|
|
2071 |
.................... { |
|
|
2072 |
.................... if(y==0.0) |
|
|
2073 |
.................... { |
|
|
2074 |
.................... #ifdef _ERRNO |
|
|
2075 |
.................... { |
|
|
2076 |
.................... errno=EDOM; |
|
|
2077 |
.................... } |
|
|
2078 |
.................... #endif |
|
|
2079 |
.................... } |
|
|
2080 |
.................... else |
|
|
2081 |
.................... { |
|
|
2082 |
.................... if(sign) |
|
|
2083 |
.................... { |
|
|
2084 |
.................... return (-(PI_DIV_BY_TWO)); |
|
|
2085 |
.................... } |
|
|
2086 |
.................... else |
|
|
2087 |
.................... { |
|
|
2088 |
.................... return (PI_DIV_BY_TWO); |
|
|
2089 |
.................... } |
|
|
2090 |
.................... } |
|
|
2091 |
.................... } |
|
|
2092 |
.................... else |
|
|
2093 |
.................... { |
|
|
2094 |
.................... z=y/x; |
|
|
2095 |
.................... switch(quad) |
|
|
2096 |
.................... { |
|
|
2097 |
.................... case 1: |
|
|
2098 |
.................... { |
|
|
2099 |
.................... return atan(z); |
|
|
2100 |
.................... break; |
|
|
2101 |
.................... } |
|
|
2102 |
.................... case 2: |
|
|
2103 |
.................... { |
|
|
2104 |
.................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122 |
|
|
2105 |
.................... return (PI-atan(z)); |
|
|
2106 |
.................... break; |
|
|
2107 |
.................... } |
|
|
2108 |
.................... case 3: |
|
|
2109 |
.................... { |
|
|
2110 |
.................... return (atan(z)-PI); |
|
|
2111 |
.................... break; |
|
|
2112 |
.................... } |
|
|
2113 |
.................... case 4: |
|
|
2114 |
.................... { |
|
|
2115 |
.................... return (-atan(z)); |
|
|
2116 |
.................... break; |
|
|
2117 |
.................... } |
|
|
2118 |
.................... } |
|
|
2119 |
.................... } |
|
|
2120 |
.................... } |
|
|
2121 |
.................... #endif |
|
|
2122 |
.................... |
|
|
2123 |
.................... //////////////////// Hyperbolic functions //////////////////// |
|
|
2124 |
.................... |
|
|
2125 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2126 |
.................... // float cosh(float x) |
|
|
2127 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2128 |
.................... // Description : Computes the hyperbolic cosine value of x |
|
|
2129 |
.................... // Returns : returns the hyperbolic cosine value of x |
|
|
2130 |
.................... // Date : N/A |
|
|
2131 |
.................... // |
|
|
2132 |
.................... |
|
|
2133 |
.................... float32 cosh(float32 x) |
|
|
2134 |
.................... { |
|
|
2135 |
.................... return ((exp(x)+exp(-x))/2); |
|
|
2136 |
.................... } |
|
|
2137 |
.................... //Overloaded functions for cosh() for PCD |
|
|
2138 |
.................... // Overloaded function cosh() for data type - Float48 |
|
|
2139 |
.................... #if defined(__PCD__) |
|
|
2140 |
.................... float48 cosh(float48 x) |
|
|
2141 |
.................... { |
|
|
2142 |
.................... return ((exp(x)+exp(-x))/2); |
|
|
2143 |
.................... } |
|
|
2144 |
.................... |
|
|
2145 |
.................... // Overloaded function cosh() for data type - Float64 |
|
|
2146 |
.................... float64 cosh(float64 x) |
|
|
2147 |
.................... { |
|
|
2148 |
.................... return ((exp(x)+exp(-x))/2); |
|
|
2149 |
.................... } |
|
|
2150 |
.................... #endif |
|
|
2151 |
.................... |
|
|
2152 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2153 |
.................... // float sinh(float x) |
|
|
2154 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2155 |
.................... // Description : Computes the hyperbolic sine value of x |
|
|
2156 |
.................... // Returns : returns the hyperbolic sine value of x |
|
|
2157 |
.................... // Date : N/A |
|
|
2158 |
.................... // |
|
|
2159 |
.................... |
|
|
2160 |
.................... float32 sinh(float32 x) |
|
|
2161 |
.................... { |
|
|
2162 |
.................... |
|
|
2163 |
.................... return ((exp(x) - exp(-x))/2); |
|
|
2164 |
.................... } |
|
|
2165 |
.................... //Overloaded functions for sinh() for PCD |
|
|
2166 |
.................... // Overloaded function sinh() for data type - Float48 |
|
|
2167 |
.................... #if defined(__PCD__) |
|
|
2168 |
.................... float48 sinh(float48 x) |
|
|
2169 |
.................... { |
|
|
2170 |
.................... |
|
|
2171 |
.................... return ((exp(x) - exp(-x))/2); |
|
|
2172 |
.................... } |
|
|
2173 |
.................... |
|
|
2174 |
.................... // Overloaded function sinh() for data type - Float48 |
|
|
2175 |
.................... float64 sinh(float64 x) |
|
|
2176 |
.................... { |
|
|
2177 |
.................... |
|
|
2178 |
.................... return ((exp(x) - exp(-x))/2); |
|
|
2179 |
.................... } |
|
|
2180 |
.................... #endif |
|
|
2181 |
.................... |
|
|
2182 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2183 |
.................... // float tanh(float x) |
|
|
2184 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2185 |
.................... // Description : Computes the hyperbolic tangent value of x |
|
|
2186 |
.................... // Returns : returns the hyperbolic tangent value of x |
|
|
2187 |
.................... // Date : N/A |
|
|
2188 |
.................... // |
|
|
2189 |
.................... |
|
|
2190 |
.................... float32 tanh(float32 x) |
|
|
2191 |
.................... { |
|
|
2192 |
.................... return(sinh(x)/cosh(x)); |
|
|
2193 |
.................... } |
|
|
2194 |
.................... //Overloaded functions for tanh() for PCD |
|
|
2195 |
.................... // Overloaded function tanh() for data type - Float48 |
|
|
2196 |
.................... #if defined(__PCD__) |
|
|
2197 |
.................... float48 tanh(float48 x) |
|
|
2198 |
.................... { |
|
|
2199 |
.................... return(sinh(x)/cosh(x)); |
|
|
2200 |
.................... } |
|
|
2201 |
.................... |
|
|
2202 |
.................... // Overloaded function tanh() for data type - Float64 |
|
|
2203 |
.................... float64 tanh(float64 x) |
|
|
2204 |
.................... { |
|
|
2205 |
.................... return(sinh(x)/cosh(x)); |
|
|
2206 |
.................... } |
|
|
2207 |
.................... #endif |
|
|
2208 |
.................... |
|
|
2209 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2210 |
.................... // float frexp(float x, signed int *exp) |
|
|
2211 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2212 |
.................... // Description : breaks a floating point number into a normalized fraction and an integral |
|
|
2213 |
.................... // power of 2. It stores the integer in the signed int object pointed to by exp. |
|
|
2214 |
.................... // Returns : returns the value x, such that x is a double with magnitude in the interval |
|
|
2215 |
.................... // [1/2,1) or zero, and value equals x times 2 raised to the power *exp.If value is zero, |
|
|
2216 |
.................... // both parts of the result are zero. |
|
|
2217 |
.................... // Date : N/A |
|
|
2218 |
.................... // |
|
|
2219 |
.................... |
|
|
2220 |
.................... #define LOG2 .30102999566398119521 |
|
|
2221 |
.................... float32 frexp(float32 x, signed int8 *exp) |
|
|
2222 |
.................... { |
|
|
2223 |
.................... float32 res; |
|
|
2224 |
.................... int1 sign = 0; |
|
|
2225 |
.................... if(x == 0.0) |
|
|
2226 |
.................... { |
|
|
2227 |
.................... *exp=0; |
|
|
2228 |
.................... return (0.0); |
|
|
2229 |
.................... } |
|
|
2230 |
.................... if(x < 0.0) |
|
|
2231 |
.................... { |
|
|
2232 |
.................... x=-x; |
|
|
2233 |
.................... sign=1; |
|
|
2234 |
.................... } |
|
|
2235 |
.................... if (x > 1.0) |
|
|
2236 |
.................... { |
|
|
2237 |
.................... *exp=(ceil(log10(x)/LOG2)); |
|
|
2238 |
.................... res=x/(pow(2, *exp)); |
|
|
2239 |
.................... if (res == 1) |
|
|
2240 |
.................... { |
|
|
2241 |
.................... *exp=*exp+1; |
|
|
2242 |
.................... res=.5; |
|
|
2243 |
.................... } |
|
|
2244 |
.................... } |
|
|
2245 |
.................... else |
|
|
2246 |
.................... { |
|
|
2247 |
.................... if(x < 0.5) |
|
|
2248 |
.................... { |
|
|
2249 |
.................... *exp=-1; |
|
|
2250 |
.................... res=x*2; |
|
|
2251 |
.................... } |
|
|
2252 |
.................... else |
|
|
2253 |
.................... { |
|
|
2254 |
.................... *exp=0; |
|
|
2255 |
.................... res=x; |
|
|
2256 |
.................... } |
|
|
2257 |
.................... } |
|
|
2258 |
.................... if(sign) |
|
|
2259 |
.................... { |
|
|
2260 |
.................... res=-res; |
|
|
2261 |
.................... } |
|
|
2262 |
.................... return res; |
|
|
2263 |
.................... } |
|
|
2264 |
.................... |
|
|
2265 |
.................... //Overloaded functions for frexp() for PCD |
|
|
2266 |
.................... // Overloaded function frexp() for data type - Float48 |
|
|
2267 |
.................... #if defined(__PCD__) |
|
|
2268 |
.................... float48 frexp(float48 x, signed int8 *exp) |
|
|
2269 |
.................... { |
|
|
2270 |
.................... float48 res; |
|
|
2271 |
.................... int1 sign = 0; |
|
|
2272 |
.................... if(x == 0.0) |
|
|
2273 |
.................... { |
|
|
2274 |
.................... *exp=0; |
|
|
2275 |
.................... return (0.0); |
|
|
2276 |
.................... } |
|
|
2277 |
.................... if(x < 0.0) |
|
|
2278 |
.................... { |
|
|
2279 |
.................... x=-x; |
|
|
2280 |
.................... sign=1; |
|
|
2281 |
.................... } |
|
|
2282 |
.................... if (x > 1.0) |
|
|
2283 |
.................... { |
|
|
2284 |
.................... *exp=(ceil(log10(x)/LOG2)); |
|
|
2285 |
.................... res=x/(pow(2, *exp)); |
|
|
2286 |
.................... if (res == 1) |
|
|
2287 |
.................... { |
|
|
2288 |
.................... *exp=*exp+1; |
|
|
2289 |
.................... res=.5; |
|
|
2290 |
.................... } |
|
|
2291 |
.................... } |
|
|
2292 |
.................... else |
|
|
2293 |
.................... { |
|
|
2294 |
.................... if(x < 0.5) |
|
|
2295 |
.................... { |
|
|
2296 |
.................... *exp=-1; |
|
|
2297 |
.................... res=x*2; |
|
|
2298 |
.................... } |
|
|
2299 |
.................... else |
|
|
2300 |
.................... { |
|
|
2301 |
.................... *exp=0; |
|
|
2302 |
.................... res=x; |
|
|
2303 |
.................... } |
|
|
2304 |
.................... } |
|
|
2305 |
.................... if(sign) |
|
|
2306 |
.................... { |
|
|
2307 |
.................... res=-res; |
|
|
2308 |
.................... } |
|
|
2309 |
.................... return res; |
|
|
2310 |
.................... } |
|
|
2311 |
.................... |
|
|
2312 |
.................... // Overloaded function frexp() for data type - Float64 |
|
|
2313 |
.................... float64 frexp(float64 x, signed int8 *exp) |
|
|
2314 |
.................... { |
|
|
2315 |
.................... float64 res; |
|
|
2316 |
.................... int1 sign = 0; |
|
|
2317 |
.................... if(x == 0.0) |
|
|
2318 |
.................... { |
|
|
2319 |
.................... *exp=0; |
|
|
2320 |
.................... return (0.0); |
|
|
2321 |
.................... } |
|
|
2322 |
.................... if(x < 0.0) |
|
|
2323 |
.................... { |
|
|
2324 |
.................... x=-x; |
|
|
2325 |
.................... sign=1; |
|
|
2326 |
.................... } |
|
|
2327 |
.................... if (x > 1.0) |
|
|
2328 |
.................... { |
|
|
2329 |
.................... *exp=(ceil(log10(x)/LOG2)); |
|
|
2330 |
.................... res=x/(pow(2, *exp)); |
|
|
2331 |
.................... if (res == 1) |
|
|
2332 |
.................... { |
|
|
2333 |
.................... *exp=*exp+1; |
|
|
2334 |
.................... res=.5; |
|
|
2335 |
.................... } |
|
|
2336 |
.................... } |
|
|
2337 |
.................... else |
|
|
2338 |
.................... { |
|
|
2339 |
.................... if(x < 0.5) |
|
|
2340 |
.................... { |
|
|
2341 |
.................... *exp=-1; |
|
|
2342 |
.................... res=x*2; |
|
|
2343 |
.................... } |
|
|
2344 |
.................... else |
|
|
2345 |
.................... { |
|
|
2346 |
.................... *exp=0; |
|
|
2347 |
.................... res=x; |
|
|
2348 |
.................... } |
|
|
2349 |
.................... } |
|
|
2350 |
.................... if(sign) |
|
|
2351 |
.................... { |
|
|
2352 |
.................... res=-res; |
|
|
2353 |
.................... } |
|
|
2354 |
.................... return res; |
|
|
2355 |
.................... } |
|
|
2356 |
.................... #endif |
|
|
2357 |
.................... |
|
|
2358 |
.................... ////////////////////////////////////////////////////////////////////////////// |
|
|
2359 |
.................... // float ldexp(float x, signed int *exp) |
|
|
2360 |
.................... ////////////////////////////////////////////////////////////////////////////// |
|
|
2361 |
.................... // Description : multiplies a floating point number by an integral power of 2. |
|
|
2362 |
.................... // Returns : returns the value of x times 2 raised to the power exp. |
|
|
2363 |
.................... // Date : N/A |
|
|
2364 |
.................... // |
|
|
2365 |
.................... |
|
|
2366 |
.................... float32 ldexp(float32 value, signed int8 exp) |
|
|
2367 |
.................... { |
|
|
2368 |
.................... return (value * pow(2,exp)); |
|
|
2369 |
.................... } |
|
|
2370 |
.................... //Overloaded functions for ldexp() for PCD |
|
|
2371 |
.................... // Overloaded function ldexp() for data type - Float48 |
|
|
2372 |
.................... |
|
|
2373 |
.................... #if defined(__PCD__) |
|
|
2374 |
.................... float48 ldexp(float48 value, signed int8 exp) |
|
|
2375 |
.................... { |
|
|
2376 |
.................... return (value * pow(2,exp)); |
|
|
2377 |
.................... } |
|
|
2378 |
.................... // Overloaded function ldexp() for data type - Float64 |
|
|
2379 |
.................... float64 ldexp(float64 value, signed int8 exp) |
|
|
2380 |
.................... { |
|
|
2381 |
.................... return (value * pow(2,exp)); |
|
|
2382 |
.................... } |
|
|
2383 |
.................... #endif |
|
|
2384 |
.................... |
|
|
2385 |
.................... #endif |
|
|
2386 |
.................... |
|
|
2387 |
.................... #include <string.h> |
|
|
2388 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2389 |
.................... //// (C) Copyright 1996,2008 Custom Computer Services //// |
|
|
2390 |
.................... //// This source code may only be used by licensed users of the CCS C //// |
|
|
2391 |
.................... //// compiler. This source code may only be distributed to other //// |
|
|
2392 |
.................... //// licensed users of the CCS C compiler. No other use, reproduction //// |
|
|
2393 |
.................... //// or distribution is permitted without written permission. //// |
|
|
2394 |
.................... //// Derivative programs created using this software in object code //// |
|
|
2395 |
.................... //// form are not restricted in any way. //// |
|
|
2396 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2397 |
.................... |
|
|
2398 |
.................... #ifndef _STRING |
|
|
2399 |
.................... #define _STRING |
|
|
2400 |
.................... #include <stddef.h> |
|
|
2401 |
.................... /////////////////////////////////////////////////////////////////////////// |
|
|
2402 |
.................... //// (C) Copyright 1996,2003 Custom Computer Services //// |
|
|
2403 |
.................... //// This source code may only be used by licensed users of the CCS C //// |
|
|
2404 |
.................... //// compiler. This source code may only be distributed to other //// |
|
|
2405 |
.................... //// licensed users of the CCS C compiler. No other use, reproduction //// |
|
|
2406 |
.................... //// or distribution is permitted without written permission. //// |
|
|
2407 |
.................... //// Derivative programs created using this software in object code //// |
|
|
2408 |
.................... //// form are not restricted in any way. //// |
|
|
2409 |
.................... /////////////////////////////////////////////////////////////////////////// |
|
|
2410 |
.................... |
|
|
2411 |
.................... #ifndef _STDDEF |
|
|
2412 |
.................... |
|
|
2413 |
.................... #define _STDDEF |
|
|
2414 |
.................... |
|
|
2415 |
.................... #if sizeof(unsigned int8 *)==1 |
|
|
2416 |
.................... #define ptrdiff_t unsigned int8 |
|
|
2417 |
.................... #else |
|
|
2418 |
.................... #define ptrdiff_t unsigned int16 |
|
|
2419 |
.................... #endif |
|
|
2420 |
.................... |
|
|
2421 |
.................... #define size_t unsigned int8 |
|
|
2422 |
.................... #define wchar_t char |
|
|
2423 |
.................... #define NULL 0 |
|
|
2424 |
.................... |
|
|
2425 |
.................... #define offsetof(s,f) (offsetofbit(s,f)/8) |
|
|
2426 |
.................... |
|
|
2427 |
.................... #endif |
|
|
2428 |
.................... |
|
|
2429 |
.................... #include <ctype.h> |
|
|
2430 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2431 |
.................... //// (C) Copyright 1996,2003 Custom Computer Services //// |
|
|
2432 |
.................... //// This source code may only be used by licensed users of the CCS C //// |
|
|
2433 |
.................... //// compiler. This source code may only be distributed to other //// |
|
|
2434 |
.................... //// licensed users of the CCS C compiler. No other use, reproduction //// |
|
|
2435 |
.................... //// or distribution is permitted without written permission. //// |
|
|
2436 |
.................... //// Derivative programs created using this software in object code //// |
|
|
2437 |
.................... //// form are not restricted in any way. //// |
|
|
2438 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
2439 |
.................... |
|
|
2440 |
.................... #ifndef _CTYPE |
|
|
2441 |
.................... #define _CTYPE |
|
|
2442 |
.................... |
|
|
2443 |
.................... #define islower(x) isamong(x,"abcdefghijklmnopqrstuvwxyz") |
|
|
2444 |
.................... #define isupper(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZ") |
|
|
2445 |
.................... #define isalnum(x) isamong(x,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") |
|
|
2446 |
.................... #define isalpha(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") |
|
|
2447 |
.................... #define isdigit(x) isamong(x,"0123456789") |
|
|
2448 |
.................... #define isspace(x) ((x)==' ') |
|
|
2449 |
.................... #define isxdigit(x) isamong(x,"0123456789ABCDEFabcdef") |
|
|
2450 |
.................... #define iscntrl(x) ((x)<' ') |
|
|
2451 |
.................... #define isprint(x) ((x)>=' ') |
|
|
2452 |
.................... #define isgraph(x) ((x)>' ') |
|
|
2453 |
.................... #define ispunct(x) (((x)>' ')&&!isalnum(x)) |
|
|
2454 |
.................... |
|
|
2455 |
.................... #endif |
|
|
2456 |
.................... |
|
|
2457 |
.................... |
|
|
2458 |
.................... |
|
|
2459 |
.................... |
|
|
2460 |
.................... |
|
|
2461 |
.................... ////////////////////////////////////////////// |
|
|
2462 |
.................... //// Uncomment the following define to //// |
|
|
2463 |
.................... //// allow some functions to use a //// |
|
|
2464 |
.................... //// quicker algorithm, but use more ROM //// |
|
|
2465 |
.................... //// //// |
|
|
2466 |
.................... //// #define FASTER_BUT_MORE_ROM //// |
|
|
2467 |
.................... ////////////////////////////////////////////// |
|
|
2468 |
.................... |
|
|
2469 |
.................... |
|
|
2470 |
.................... |
|
|
2471 |
.................... /*Copying functions*/ |
|
|
2472 |
.................... /* standard template: |
|
|
2473 |
.................... void *memmove(void *s1, void *s2, size_t n). |
|
|
2474 |
.................... Copies max of n characters safely (not following ending '\0') |
|
|
2475 |
.................... from s2 in s1; if s2 has less than n characters, appends 0 */ |
|
|
2476 |
.................... |
|
|
2477 |
.................... char *memmove(void *s1,char *s2,size_t n) |
|
|
2478 |
.................... { |
|
|
2479 |
.................... char *sc1; |
|
|
2480 |
.................... char *sc2; |
|
|
2481 |
.................... sc1=s1; |
|
|
2482 |
.................... sc2=s2; |
|
|
2483 |
.................... if(sc2<sc1 && sc1 <sc2 +n) |
|
|
2484 |
.................... for(sc1+=n,sc2+=n;0<n;--n) |
|
|
2485 |
.................... *--sc1=*--sc2; |
|
|
2486 |
.................... else |
|
|
2487 |
.................... for(;0<n;--n) |
|
|
2488 |
.................... *sc1++=*sc2++; |
|
|
2489 |
.................... return s1; |
|
|
2490 |
.................... } |
|
|
2491 |
.................... |
|
|
2492 |
.................... /* Standard template: char *strcpy(char *s1, const char *s2) |
|
|
2493 |
.................... copies the string s2 including the null character to s1. |
|
|
2494 |
.................... This is a compiler built in to handle the different address |
|
|
2495 |
.................... spaces */ |
|
|
2496 |
.................... |
|
|
2497 |
.................... #define strcopy strcpy |
|
|
2498 |
.................... |
|
|
2499 |
.................... /* standard template: |
|
|
2500 |
.................... char *strncpy(char *s1, const char *s2, size_t n). |
|
|
2501 |
.................... Copies max of n characters (not following ending '\0') |
|
|
2502 |
.................... from s2 in s1; if s2 has less than n characters, appends 0 */ |
|
|
2503 |
.................... |
|
|
2504 |
.................... char *strncpy(char *s1, char *s2, size_t n) |
|
|
2505 |
.................... { |
|
|
2506 |
.................... char *s; |
|
|
2507 |
.................... |
|
|
2508 |
.................... for (s = s1; n > 0 && *s2 != '\0'; n--) |
|
|
2509 |
.................... *s++ = *s2++; |
|
|
2510 |
.................... for (; n > 0; n--) |
|
|
2511 |
.................... *s++ = '\0'; |
|
|
2512 |
.................... |
|
|
2513 |
.................... return(s1); |
|
|
2514 |
.................... } |
|
|
2515 |
.................... /***********************************************************/ |
|
|
2516 |
.................... |
|
|
2517 |
.................... /*concatenation functions*/ |
|
|
2518 |
.................... /* standard template: char *strcat(char *s1, const char *s2) |
|
|
2519 |
.................... appends s2 to s1*/ |
|
|
2520 |
.................... |
|
|
2521 |
.................... char *strcat(char *s1, char *s2) |
|
|
2522 |
.................... { |
|
|
2523 |
.................... char *s; |
|
|
2524 |
.................... |
|
|
2525 |
.................... for (s = s1; *s != '\0'; ++s); |
|
|
2526 |
.................... while(*s2 != '\0') |
|
|
2527 |
.................... { |
|
|
2528 |
.................... *s = *s2; |
|
|
2529 |
.................... ++s; |
|
|
2530 |
.................... ++s2; |
|
|
2531 |
.................... } |
|
|
2532 |
.................... |
|
|
2533 |
.................... *s = '\0'; |
|
|
2534 |
.................... return(s1); |
|
|
2535 |
.................... } |
|
|
2536 |
.................... /* standard template: char *strncat(char *s1, char *s2,size_t n) |
|
|
2537 |
.................... appends not more than n characters from s2 to s1*/ |
|
|
2538 |
.................... |
|
|
2539 |
.................... char *strncat(char *s1, char *s2, size_t n) |
|
|
2540 |
.................... { |
|
|
2541 |
.................... char *s; |
|
|
2542 |
.................... |
|
|
2543 |
.................... for (s = s1; *s != '\0'; ++s); |
|
|
2544 |
.................... while(*s2 != '\0' && 0<n) |
|
|
2545 |
.................... { |
|
|
2546 |
.................... *s = *s2; |
|
|
2547 |
.................... ++s; |
|
|
2548 |
.................... ++s2; |
|
|
2549 |
.................... --n; |
|
|
2550 |
.................... } |
|
|
2551 |
.................... |
|
|
2552 |
.................... *s = '\0'; |
|
|
2553 |
.................... return(s1); |
|
|
2554 |
.................... } |
|
|
2555 |
.................... |
|
|
2556 |
.................... /***********************************************************/ |
|
|
2557 |
.................... |
|
|
2558 |
.................... |
|
|
2559 |
.................... /*comparison functions*/ |
|
|
2560 |
.................... /* standard template: signed int memcmp(void *s1, void *s2). |
|
|
2561 |
.................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */ |
|
|
2562 |
.................... |
|
|
2563 |
.................... signed int8 memcmp(void * s1,char *s2,size_t n) |
|
|
2564 |
.................... { |
|
|
2565 |
.................... char *su1, *su2; |
|
|
2566 |
.................... for(su1=s1, su2=s2; 0<n; ++su1, ++su2, --n) |
|
|
2567 |
.................... { |
|
|
2568 |
.................... if(*su1!=*su2) |
|
|
2569 |
.................... return ((*su1<*su2)?-1:+1); |
|
|
2570 |
.................... } |
|
|
2571 |
.................... return 0; |
|
|
2572 |
.................... } |
|
|
2573 |
.................... |
|
|
2574 |
.................... /* standard template: int strcmp(const char *s1, const char *s2). |
|
|
2575 |
.................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */ |
|
|
2576 |
.................... |
|
|
2577 |
.................... signed int8 strcmp(char *s1, char *s2) |
|
|
2578 |
.................... { |
|
|
2579 |
.................... for (; *s1 == *s2; s1++, s2++) |
|
|
2580 |
.................... if (*s1 == '\0') |
|
|
2581 |
.................... return(0); |
|
|
2582 |
.................... return((*s1 < *s2) ? -1: 1); |
|
|
2583 |
.................... } |
|
|
2584 |
.................... /* standard template: int strcoll(const char *s1, const char *s2). |
|
|
2585 |
.................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */ |
|
|
2586 |
.................... |
|
|
2587 |
.................... signed int8 strcoll(char *s1, char *s2) |
|
|
2588 |
.................... { |
|
|
2589 |
.................... for (; *s1 == *s2; s1++, s2++) |
|
|
2590 |
.................... if (*s1 == '\0') |
|
|
2591 |
.................... return(0); |
|
|
2592 |
.................... return((*s1 < *s2) ? -1: 1); |
|
|
2593 |
.................... } |
|
|
2594 |
.................... |
|
|
2595 |
.................... /* standard template: |
|
|
2596 |
.................... int strncmp(const char *s1, const char *s2, size_t n). |
|
|
2597 |
.................... Compares max of n characters (not following 0) from s1 to s2; |
|
|
2598 |
.................... returns same as strcmp */ |
|
|
2599 |
.................... |
|
|
2600 |
.................... signed int8 strncmp(char *s1, char *s2, size_t n) |
|
|
2601 |
.................... { |
|
|
2602 |
.................... for (; n > 0; s1++, s2++, n--) |
|
|
2603 |
.................... if (*s1 != *s2) |
|
|
2604 |
.................... return((*s1 <*s2) ? -1: 1); |
|
|
2605 |
.................... else if (*s1 == '\0') |
|
|
2606 |
.................... return(0); |
|
|
2607 |
.................... return(0); |
|
|
2608 |
.................... } |
|
|
2609 |
.................... /* standard template: |
|
|
2610 |
.................... int strxfrm(const char *s1, const char *s2, size_t n). |
|
|
2611 |
.................... transforms maximum of n characters from s2 and places them into s1*/ |
|
|
2612 |
.................... size_t strxfrm(char *s1, char *s2, size_t n) |
|
|
2613 |
.................... { |
|
|
2614 |
.................... char *s; |
|
|
2615 |
.................... unsigned int8 n1; |
|
|
2616 |
.................... n1=n; |
|
|
2617 |
.................... for (s = s1; n > 0 && *s2 != '\0'; n--) |
|
|
2618 |
.................... *s++ = *s2++; |
|
|
2619 |
.................... for (; n > 0; n--) |
|
|
2620 |
.................... *s++ = '\0'; |
|
|
2621 |
.................... |
|
|
2622 |
.................... return(n1); |
|
|
2623 |
.................... } |
|
|
2624 |
.................... |
|
|
2625 |
.................... |
|
|
2626 |
.................... |
|
|
2627 |
.................... |
|
|
2628 |
.................... |
|
|
2629 |
.................... /***********************************************************/ |
|
|
2630 |
.................... /*Search functions*/ |
|
|
2631 |
.................... /* standard template: void *memchr(const char *s, int c). |
|
|
2632 |
.................... Finds first occurrence of c in n characters of s */ |
|
|
2633 |
.................... |
|
|
2634 |
.................... char *memchr(void *s,unsigned int8 c,size_t n) |
|
|
2635 |
.................... { |
|
|
2636 |
.................... char uc; |
|
|
2637 |
.................... char *su; |
|
|
2638 |
.................... uc=c; |
|
|
2639 |
.................... for(su=s;0<n;++su,--n) |
|
|
2640 |
.................... if(*su==uc) |
|
|
2641 |
.................... return su; |
|
|
2642 |
.................... return NULL; |
|
|
2643 |
.................... } |
|
|
2644 |
.................... |
|
|
2645 |
.................... /* standard template: char *strchr(const char *s, int c). |
|
|
2646 |
.................... Finds first occurrence of c in s */ |
|
|
2647 |
.................... |
|
|
2648 |
.................... char *strchr(char *s, unsigned int8 c) |
|
|
2649 |
.................... { |
|
|
2650 |
.................... for (; *s != c; s++) |
|
|
2651 |
.................... if (*s == '\0') |
|
|
2652 |
.................... return(0); |
|
|
2653 |
.................... return(s); |
|
|
2654 |
.................... } |
|
|
2655 |
.................... /* standard template: |
|
|
2656 |
.................... size_t strcspn(const char *s1, const char *s2). |
|
|
2657 |
.................... Computes length of max initial segment of s1 that |
|
|
2658 |
.................... consists entirely of characters NOT from s2*/ |
|
|
2659 |
.................... |
|
|
2660 |
.................... unsigned int8 strcspn(char *s1, char *s2) |
|
|
2661 |
.................... { |
|
|
2662 |
.................... char *sc1, *sc2; |
|
|
2663 |
.................... |
|
|
2664 |
.................... for (sc1 = s1; *sc1 != 0; sc1++) |
|
|
2665 |
.................... for (sc2 = s2; *sc2 != 0; sc2++) |
|
|
2666 |
.................... if (*sc1 == *sc2) |
|
|
2667 |
.................... return(sc1 - s1); |
|
|
2668 |
.................... return(sc1 - s1); |
|
|
2669 |
.................... } |
|
|
2670 |
.................... /* standard template: |
|
|
2671 |
.................... char *strpbrk(const char *s1, const char *s2). |
|
|
2672 |
.................... Locates first occurence of any character from s2 in s1; |
|
|
2673 |
.................... returns s1 if s2 is empty string */ |
|
|
2674 |
.................... |
|
|
2675 |
.................... char *strpbrk(char *s1, char *s2) |
|
|
2676 |
.................... { |
|
|
2677 |
.................... char *sc1, *sc2; |
|
|
2678 |
.................... |
|
|
2679 |
.................... for (sc1 = s1; *sc1 != 0; sc1++) |
|
|
2680 |
.................... for (sc2 = s2; *sc2 != 0; sc2++) |
|
|
2681 |
.................... if (*sc1 == *sc2) |
|
|
2682 |
.................... return(sc1); |
|
|
2683 |
.................... return(0); |
|
|
2684 |
.................... } |
|
|
2685 |
.................... |
|
|
2686 |
.................... |
|
|
2687 |
.................... /* standard template: char *strrchr(const char *s, int c). |
|
|
2688 |
.................... Finds last occurrence of c in s */ |
|
|
2689 |
.................... |
|
|
2690 |
.................... char *strrchr(char *s, unsigned int8 c) |
|
|
2691 |
.................... { |
|
|
2692 |
.................... char *p; |
|
|
2693 |
.................... |
|
|
2694 |
.................... for (p = 0; ; s++) |
|
|
2695 |
.................... { |
|
|
2696 |
.................... if (*s == c) |
|
|
2697 |
.................... p = s; |
|
|
2698 |
.................... if (*s == '\0') |
|
|
2699 |
.................... return(p); |
|
|
2700 |
.................... } |
|
|
2701 |
.................... } |
|
|
2702 |
.................... /* computes length of max initial segment of s1 consisting |
|
|
2703 |
.................... entirely of characters from s2 */ |
|
|
2704 |
.................... |
|
|
2705 |
.................... unsigned int8 strspn(char *s1, char *s2) |
|
|
2706 |
.................... { |
|
|
2707 |
.................... char *sc1, *sc2; |
|
|
2708 |
.................... |
|
|
2709 |
.................... for (sc1 = s1; *sc1 != 0; sc1++) |
|
|
2710 |
.................... for (sc2 = s2; ; sc2++) |
|
|
2711 |
.................... if (*sc2 == '\0') |
|
|
2712 |
.................... return(sc1 - s1); |
|
|
2713 |
.................... else if (*sc1 == *sc2) |
|
|
2714 |
.................... break; |
|
|
2715 |
.................... return(sc1 - s1); |
|
|
2716 |
.................... } |
|
|
2717 |
.................... /* standard template: |
|
|
2718 |
.................... char *strstr(const char *s1, const char *s2); |
|
|
2719 |
.................... Locates first occurence of character sequence s2 in s1; |
|
|
2720 |
.................... returns 0 if s2 is empty string |
|
|
2721 |
.................... |
|
|
2722 |
.................... Uncomment #define FASTER_BUT_MORE_ROM at the top of the |
|
|
2723 |
.................... file to use the faster algorithm */ |
|
|
2724 |
.................... char *strstr(char *s1, char *s2) |
|
|
2725 |
.................... { |
|
|
2726 |
.................... char *s, *t; |
|
|
2727 |
.................... |
|
|
2728 |
.................... #ifdef FASTER_BUT_MORE_ROM |
|
|
2729 |
.................... if (*s2 == '\0') |
|
|
2730 |
.................... return(s1); |
|
|
2731 |
.................... #endif |
|
|
2732 |
.................... |
|
|
2733 |
.................... while (*s1) |
|
|
2734 |
.................... { |
|
|
2735 |
.................... for(s = s1, t = s2; *t && (*s == *t); ++s, ++t); |
|
|
2736 |
.................... |
|
|
2737 |
.................... if (*t == '\0') |
|
|
2738 |
.................... return s1; |
|
|
2739 |
.................... ++s1; |
|
|
2740 |
.................... #ifdef FASTER_BUT_MORE_ROM |
|
|
2741 |
.................... while(*s1 != '\0' && *s1 != *s2) |
|
|
2742 |
.................... ++s1; |
|
|
2743 |
.................... #endif |
|
|
2744 |
.................... } |
|
|
2745 |
.................... return 0; |
|
|
2746 |
.................... } |
|
|
2747 |
.................... |
|
|
2748 |
.................... /* standard template: char *strtok(char *s1, const char *s2). |
|
|
2749 |
.................... |
|
|
2750 |
.................... Finds next token in s1 delimited by a character from separator |
|
|
2751 |
.................... string s2 (which can be different from call to call). First call |
|
|
2752 |
.................... starts at beginning of s1 searching for first character NOT |
|
|
2753 |
.................... contained in s2; returns 0 if none is found. |
|
|
2754 |
.................... If one is found, it is the start of first token (return value). |
|
|
2755 |
.................... Function then searches from there for a character contained in s2. |
|
|
2756 |
.................... If none is found, current token extends to end of s1, and subsequent |
|
|
2757 |
.................... searches for a token will return 0. If one is found, it is |
|
|
2758 |
.................... overwritten by '\0', which terminates current token. Function saves |
|
|
2759 |
.................... pointer to following character from which next search will start. |
|
|
2760 |
.................... Each subsequent call, with 0 as first argument, starts searching |
|
|
2761 |
.................... from saved pointer */ |
|
|
2762 |
.................... |
|
|
2763 |
.................... char *strtok(char *s1, char *s2) |
|
|
2764 |
.................... { |
|
|
2765 |
.................... char *beg, *end; |
|
|
2766 |
.................... static char *save; |
|
|
2767 |
* |
|
|
2768 |
0B25: BCF 03.6 |
|
|
2769 |
0B26: CLRF 20 |
|
|
2770 |
0B27: CLRF 21 |
|
|
2771 |
.................... |
|
|
2772 |
.................... beg = (s1)? s1: save; |
|
|
2773 |
.................... beg += strspn(beg, s2); |
|
|
2774 |
.................... if (*beg == '\0') |
|
|
2775 |
.................... { |
|
|
2776 |
.................... *save = ' '; |
|
|
2777 |
.................... return(0); |
|
|
2778 |
.................... } |
|
|
2779 |
.................... end = strpbrk(beg, s2); |
|
|
2780 |
.................... if (*end != '\0') |
|
|
2781 |
.................... { |
|
|
2782 |
.................... *end = '\0'; |
|
|
2783 |
.................... end++; |
|
|
2784 |
.................... } |
|
|
2785 |
.................... save = end; |
|
|
2786 |
.................... return(beg); |
|
|
2787 |
.................... } |
|
|
2788 |
.................... |
|
|
2789 |
.................... /*****************************************************************/ |
|
|
2790 |
.................... /*Miscellaneous functions*/ |
|
|
2791 |
.................... /* standard template |
|
|
2792 |
.................... maps error number in errnum to an error message string |
|
|
2793 |
.................... Returns: Pointer to string |
|
|
2794 |
.................... */ |
|
|
2795 |
.................... #ifdef _ERRNO |
|
|
2796 |
.................... char * strerror(unsigned int8 errnum) |
|
|
2797 |
.................... { |
|
|
2798 |
.................... char s[15]; |
|
|
2799 |
.................... switch( errnum) |
|
|
2800 |
.................... { |
|
|
2801 |
.................... case 0: |
|
|
2802 |
.................... strcpy(s,"no errors"); |
|
|
2803 |
.................... return s; |
|
|
2804 |
.................... case EDOM : |
|
|
2805 |
.................... strcpy(s,"domain error"); |
|
|
2806 |
.................... return s; |
|
|
2807 |
.................... case ERANGE: |
|
|
2808 |
.................... strcpy(s,"range error"); |
|
|
2809 |
.................... return s; |
|
|
2810 |
.................... } |
|
|
2811 |
.................... } |
|
|
2812 |
.................... #ENDIF |
|
|
2813 |
.................... /* standard template: size_t strlen(const char *s). |
|
|
2814 |
.................... Computes length of s1 (preceding terminating 0) */ |
|
|
2815 |
.................... |
|
|
2816 |
.................... unsigned int8 strlen(char *s) |
|
|
2817 |
.................... { |
|
|
2818 |
.................... char *sc; |
|
|
2819 |
.................... |
|
|
2820 |
.................... for (sc = s; *sc != 0; sc++); |
|
|
2821 |
.................... return(sc - s); |
|
|
2822 |
.................... } |
|
|
2823 |
.................... |
|
|
2824 |
.................... /* standard template: size_t stricmp(const char *s1, const char *s2). |
|
|
2825 |
.................... Compares s1 to s2 ignoring case (upper vs. lower) */ |
|
|
2826 |
.................... |
|
|
2827 |
.................... signed int8 stricmp(char *s1, char *s2) |
|
|
2828 |
.................... { |
|
|
2829 |
.................... for(; *s1==*s2||(isalpha(*s1)&&isalpha(*s2)&&(*s1==*s2+32||*s2==*s1+32)); |
|
|
2830 |
.................... s1++, s2++) |
|
|
2831 |
.................... if (*s1 == '\0') |
|
|
2832 |
.................... return(0); |
|
|
2833 |
.................... return((*s1 < *s2) ? -1: 1); |
|
|
2834 |
.................... } |
|
|
2835 |
.................... |
|
|
2836 |
.................... |
|
|
2837 |
.................... /* standard template: char *strlwr(char *s). |
|
|
2838 |
.................... Replaces uppercase letters by lowercase; |
|
|
2839 |
.................... returns pointer to new string s */ |
|
|
2840 |
.................... |
|
|
2841 |
.................... char *strlwr(char *s) |
|
|
2842 |
.................... { |
|
|
2843 |
.................... char *p; |
|
|
2844 |
.................... |
|
|
2845 |
.................... for (p = s; *p != '\0'; p++) |
|
|
2846 |
.................... if (*p >= 'A' && *p <='Z') |
|
|
2847 |
.................... *p += 'a' - 'A'; |
|
|
2848 |
.................... return(s); |
|
|
2849 |
.................... } |
|
|
2850 |
.................... |
|
|
2851 |
.................... |
|
|
2852 |
.................... /************************************************************/ |
|
|
2853 |
.................... |
|
|
2854 |
.................... |
|
|
2855 |
.................... #endif |
|
|
2856 |
.................... |
|
|
2857 |
.................... |
|
|
2858 |
.................... #include "SHT25.h" |
|
|
2859 |
.................... |
|
|
2860 |
.................... #define SHT25_HEATER_ON 0x04 |
|
|
2861 |
.................... #define SHT25_HEATER_OFF 0x00 |
|
|
2862 |
.................... #define SHT25_OTP_reload_off 0x02 |
|
|
2863 |
.................... #define SHT25_RH12_T14 0x00 |
|
|
2864 |
.................... #define SHT25_RH8_T12 0x01 |
|
|
2865 |
.................... #define SHT25_RH10_T13 0x80 |
|
|
2866 |
.................... #define SHT25_RH11_T11 0x81 |
|
|
2867 |
.................... |
|
|
2868 |
.................... #define SHT25_ADDR 0x80 |
|
|
2869 |
.................... |
|
|
2870 |
.................... #include "SHT25.c" |
|
|
2871 |
.................... void SHT25_soft_reset() |
|
|
2872 |
.................... { |
|
|
2873 |
.................... i2c_start(); // Start condition |
|
|
2874 |
.................... i2c_write(0x80); // Device address |
|
|
2875 |
.................... i2c_write(0xFE); // Device command |
|
|
2876 |
.................... i2c_stop(); // Stop condition |
|
|
2877 |
.................... } |
|
|
2878 |
.................... |
|
|
2879 |
.................... unsigned int8 SHT25_setup(unsigned int8 setup_reg ) // writes to status register and returns its value |
|
|
2880 |
.................... { |
|
|
2881 |
.................... unsigned int8 reg; |
|
|
2882 |
.................... |
|
|
2883 |
.................... i2c_start(); // Start condition |
|
|
2884 |
.................... i2c_write(SHT25_ADDR); // Device address |
|
|
2885 |
.................... i2c_write(0xE7); // Device command |
|
|
2886 |
.................... |
|
|
2887 |
.................... i2c_start(); // Start condition |
|
|
2888 |
.................... i2c_write(SHT25_ADDR+1); // Device address |
|
|
2889 |
.................... reg=i2c_read(0); // Read status actual status register |
|
|
2890 |
.................... |
|
|
2891 |
.................... reg = (reg & 0x3A) | setup_reg; |
|
|
2892 |
.................... |
|
|
2893 |
.................... i2c_start(); // Start condition |
|
|
2894 |
.................... i2c_write(SHT25_ADDR); // Device address |
|
|
2895 |
.................... i2c_write(0xE6); // Write to status register |
|
|
2896 |
.................... i2c_write(reg); // Device command |
|
|
2897 |
.................... i2c_stop(); // Stop condition |
|
|
2898 |
.................... |
|
|
2899 |
.................... delay_ms(10); |
|
|
2900 |
.................... |
|
|
2901 |
.................... i2c_start(); // Start condition |
|
|
2902 |
.................... i2c_write(SHT25_ADDR); // Device address |
|
|
2903 |
.................... i2c_write(0xE7); // Device command |
|
|
2904 |
.................... |
|
|
2905 |
.................... i2c_start(); // Start condition |
|
|
2906 |
.................... i2c_write(SHT25_ADDR+1); // Device address |
|
|
2907 |
.................... reg=i2c_read(0); // Read status actual status register |
|
|
2908 |
.................... |
|
|
2909 |
.................... return (reg); |
|
|
2910 |
.................... } |
|
|
2911 |
.................... |
|
|
2912 |
.................... |
|
|
2913 |
.................... float SHT25_get_temp() |
|
|
2914 |
.................... { |
|
|
2915 |
.................... unsigned int8 MSB, LSB, Check; |
|
|
2916 |
.................... unsigned int16 data; |
|
|
2917 |
.................... |
|
|
2918 |
.................... i2c_start(); |
|
|
2919 |
* |
|
|
2920 |
0800: BSF 03.5 |
|
|
2921 |
0801: BSF 06.0 |
|
|
2922 |
0802: NOP |
|
|
2923 |
0803: BSF 06.1 |
|
|
2924 |
0804: NOP |
|
|
2925 |
0805: BCF 03.5 |
|
|
2926 |
0806: BTFSS 06.1 |
|
|
2927 |
0807: GOTO 006 |
|
|
2928 |
0808: BCF 06.0 |
|
|
2929 |
0809: BSF 03.5 |
|
|
2930 |
080A: BCF 06.0 |
|
|
2931 |
080B: NOP |
|
|
2932 |
080C: BCF 03.5 |
|
|
2933 |
080D: BCF 06.1 |
|
|
2934 |
080E: BSF 03.5 |
|
|
2935 |
080F: BCF 06.1 |
|
|
2936 |
.................... I2C_Write(SHT25_ADDR); |
|
|
2937 |
0810: MOVLW 80 |
|
|
2938 |
0811: BCF 03.5 |
|
|
2939 |
0812: MOVWF 5F |
|
|
2940 |
0813: BCF 0A.3 |
|
|
2941 |
0814: CALL 1FB |
|
|
2942 |
0815: BSF 0A.3 |
|
|
2943 |
.................... I2C_write(0xE3); |
|
|
2944 |
0816: MOVLW E3 |
|
|
2945 |
0817: MOVWF 5F |
|
|
2946 |
0818: BCF 0A.3 |
|
|
2947 |
0819: CALL 1FB |
|
|
2948 |
081A: BSF 0A.3 |
|
|
2949 |
.................... i2c_stop(); |
|
|
2950 |
081B: BSF 03.5 |
|
|
2951 |
081C: BCF 06.0 |
|
|
2952 |
081D: NOP |
|
|
2953 |
081E: BSF 06.1 |
|
|
2954 |
081F: BCF 03.5 |
|
|
2955 |
0820: BTFSS 06.1 |
|
|
2956 |
0821: GOTO 020 |
|
|
2957 |
0822: NOP |
|
|
2958 |
0823: GOTO 024 |
|
|
2959 |
0824: NOP |
|
|
2960 |
0825: BSF 03.5 |
|
|
2961 |
0826: BSF 06.0 |
|
|
2962 |
0827: NOP |
|
|
2963 |
.................... |
|
|
2964 |
.................... delay_ms(100); |
|
|
2965 |
0828: MOVLW 64 |
|
|
2966 |
0829: BCF 03.5 |
|
|
2967 |
082A: MOVWF 52 |
|
|
2968 |
082B: BCF 0A.3 |
|
|
2969 |
082C: CALL 2A0 |
|
|
2970 |
082D: BSF 0A.3 |
|
|
2971 |
.................... |
|
|
2972 |
.................... i2c_start(); |
|
|
2973 |
082E: BSF 03.5 |
|
|
2974 |
082F: BSF 06.0 |
|
|
2975 |
0830: NOP |
|
|
2976 |
0831: BSF 06.1 |
|
|
2977 |
0832: NOP |
|
|
2978 |
0833: BCF 03.5 |
|
|
2979 |
0834: BCF 06.0 |
|
|
2980 |
0835: BSF 03.5 |
|
|
2981 |
0836: BCF 06.0 |
|
|
2982 |
0837: NOP |
|
|
2983 |
0838: BCF 03.5 |
|
|
2984 |
0839: BCF 06.1 |
|
|
2985 |
083A: BSF 03.5 |
|
|
2986 |
083B: BCF 06.1 |
|
|
2987 |
.................... I2C_Write(SHT25_ADDR+1); |
|
|
2988 |
083C: MOVLW 81 |
|
|
2989 |
083D: BCF 03.5 |
|
|
2990 |
083E: MOVWF 5F |
|
|
2991 |
083F: BCF 0A.3 |
|
|
2992 |
0840: CALL 1FB |
|
|
2993 |
0841: BSF 0A.3 |
|
|
2994 |
.................... MSB=i2c_read(1); |
|
|
2995 |
0842: MOVLW 01 |
|
|
2996 |
0843: MOVWF 77 |
|
|
2997 |
0844: BCF 0A.3 |
|
|
2998 |
0845: CALL 2B4 |
|
|
2999 |
0846: BSF 0A.3 |
|
|
3000 |
0847: MOVF 78,W |
|
|
3001 |
0848: MOVWF 4D |
|
|
3002 |
.................... LSB=i2c_read(1); |
|
|
3003 |
0849: MOVLW 01 |
|
|
3004 |
084A: MOVWF 77 |
|
|
3005 |
084B: BCF 0A.3 |
|
|
3006 |
084C: CALL 2B4 |
|
|
3007 |
084D: BSF 0A.3 |
|
|
3008 |
084E: MOVF 78,W |
|
|
3009 |
084F: MOVWF 4E |
|
|
3010 |
.................... Check=i2c_read(0); |
|
|
3011 |
0850: CLRF 77 |
|
|
3012 |
0851: BCF 0A.3 |
|
|
3013 |
0852: CALL 2B4 |
|
|
3014 |
0853: BSF 0A.3 |
|
|
3015 |
0854: MOVF 78,W |
|
|
3016 |
0855: MOVWF 4F |
|
|
3017 |
.................... i2c_stop(); |
|
|
3018 |
0856: BSF 03.5 |
|
|
3019 |
0857: BCF 06.0 |
|
|
3020 |
0858: NOP |
|
|
3021 |
0859: BSF 06.1 |
|
|
3022 |
085A: BCF 03.5 |
|
|
3023 |
085B: BTFSS 06.1 |
|
|
3024 |
085C: GOTO 05B |
|
|
3025 |
085D: NOP |
|
|
3026 |
085E: GOTO 05F |
|
|
3027 |
085F: NOP |
|
|
3028 |
0860: BSF 03.5 |
|
|
3029 |
0861: BSF 06.0 |
|
|
3030 |
0862: NOP |
|
|
3031 |
.................... |
|
|
3032 |
.................... LSB = LSB >> 2; // trow out status bits |
|
|
3033 |
0863: BCF 03.5 |
|
|
3034 |
0864: RRF 4E,F |
|
|
3035 |
0865: RRF 4E,F |
|
|
3036 |
0866: MOVLW 3F |
|
|
3037 |
0867: ANDWF 4E,F |
|
|
3038 |
.................... |
|
|
3039 |
.................... data = (((unsigned int16) MSB << 8) + (LSB << 4)); |
|
|
3040 |
0868: CLRF 53 |
|
|
3041 |
0869: MOVF 4D,W |
|
|
3042 |
086A: MOVWF 52 |
|
|
3043 |
086B: MOVWF 53 |
|
|
3044 |
086C: CLRF 52 |
|
|
3045 |
086D: SWAPF 4E,W |
|
|
3046 |
086E: MOVWF 77 |
|
|
3047 |
086F: MOVLW F0 |
|
|
3048 |
0870: ANDWF 77,F |
|
|
3049 |
0871: MOVF 77,W |
|
|
3050 |
0872: ADDWF 52,W |
|
|
3051 |
0873: MOVWF 50 |
|
|
3052 |
0874: MOVF 53,W |
|
|
3053 |
0875: MOVWF 51 |
|
|
3054 |
0876: BTFSC 03.0 |
|
|
3055 |
0877: INCF 51,F |
|
|
3056 |
.................... return(-46.85 + 175.72*((float)data/0xFFFF)); |
|
|
3057 |
0878: MOVF 51,W |
|
|
3058 |
0879: MOVWF 5F |
|
|
3059 |
087A: MOVF 50,W |
|
|
3060 |
087B: MOVWF 5E |
|
|
3061 |
087C: BCF 0A.3 |
|
|
3062 |
087D: CALL 325 |
|
|
3063 |
087E: BSF 0A.3 |
|
|
3064 |
087F: MOVF 77,W |
|
|
3065 |
0880: MOVWF 52 |
|
|
3066 |
0881: MOVF 78,W |
|
|
3067 |
0882: MOVWF 53 |
|
|
3068 |
0883: MOVF 79,W |
|
|
3069 |
0884: MOVWF 54 |
|
|
3070 |
0885: MOVF 7A,W |
|
|
3071 |
0886: MOVWF 55 |
|
|
3072 |
0887: MOVWF 65 |
|
|
3073 |
0888: MOVF 54,W |
|
|
3074 |
0889: MOVWF 64 |
|
|
3075 |
088A: MOVF 53,W |
|
|
3076 |
088B: MOVWF 63 |
|
|
3077 |
088C: MOVF 52,W |
|
|
3078 |
088D: MOVWF 62 |
|
|
3079 |
088E: CLRF 69 |
|
|
3080 |
088F: MOVLW FF |
|
|
3081 |
0890: MOVWF 68 |
|
|
3082 |
0891: MOVLW 7F |
|
|
3083 |
0892: MOVWF 67 |
|
|
3084 |
0893: MOVLW 8E |
|
|
3085 |
0894: MOVWF 66 |
|
|
3086 |
0895: BCF 0A.3 |
|
|
3087 |
0896: CALL 342 |
|
|
3088 |
0897: BSF 0A.3 |
|
|
3089 |
0898: MOVLW 52 |
|
|
3090 |
0899: MOVWF 5D |
|
|
3091 |
089A: MOVLW B8 |
|
|
3092 |
089B: MOVWF 5C |
|
|
3093 |
089C: MOVLW 2F |
|
|
3094 |
089D: MOVWF 5B |
|
|
3095 |
089E: MOVLW 86 |
|
|
3096 |
089F: MOVWF 5A |
|
|
3097 |
08A0: MOVF 7A,W |
|
|
3098 |
08A1: MOVWF 61 |
|
|
3099 |
08A2: MOVF 79,W |
|
|
3100 |
08A3: MOVWF 60 |
|
|
3101 |
08A4: MOVF 78,W |
|
|
3102 |
08A5: MOVWF 5F |
|
|
3103 |
08A6: MOVF 77,W |
|
|
3104 |
08A7: MOVWF 5E |
|
|
3105 |
08A8: BCF 0A.3 |
|
|
3106 |
08A9: CALL 736 |
|
|
3107 |
08AA: BSF 0A.3 |
|
|
3108 |
08AB: BCF 03.1 |
|
|
3109 |
08AC: MOVLW 66 |
|
|
3110 |
08AD: MOVWF 67 |
|
|
3111 |
08AE: MOVWF 66 |
|
|
3112 |
08AF: MOVLW BB |
|
|
3113 |
08B0: MOVWF 65 |
|
|
3114 |
08B1: MOVLW 84 |
|
|
3115 |
08B2: MOVWF 64 |
|
|
3116 |
08B3: MOVF 7A,W |
|
|
3117 |
08B4: MOVWF 6B |
|
|
3118 |
08B5: MOVF 79,W |
|
|
3119 |
08B6: MOVWF 6A |
|
|
3120 |
08B7: MOVF 78,W |
|
|
3121 |
08B8: MOVWF 69 |
|
|
3122 |
08B9: MOVF 77,W |
|
|
3123 |
08BA: MOVWF 68 |
|
|
3124 |
08BB: BCF 0A.3 |
|
|
3125 |
08BC: CALL 40C |
|
|
3126 |
08BD: BSF 0A.3 |
|
|
3127 |
.................... } |
|
|
3128 |
08BE: BSF 0A.3 |
|
|
3129 |
08BF: BCF 0A.4 |
|
|
3130 |
08C0: GOTO 372 (RETURN) |
|
|
3131 |
.................... |
|
|
3132 |
.................... float SHT25_get_hum() |
|
|
3133 |
.................... { |
|
|
3134 |
.................... unsigned int8 MSB, LSB, Check; |
|
|
3135 |
.................... unsigned int16 data; |
|
|
3136 |
.................... |
|
|
3137 |
.................... i2c_start(); //RH |
|
|
3138 |
08C1: BSF 03.5 |
|
|
3139 |
08C2: BSF 06.0 |
|
|
3140 |
08C3: NOP |
|
|
3141 |
08C4: BSF 06.1 |
|
|
3142 |
08C5: NOP |
|
|
3143 |
08C6: BCF 03.5 |
|
|
3144 |
08C7: BCF 06.0 |
|
|
3145 |
08C8: BSF 03.5 |
|
|
3146 |
08C9: BCF 06.0 |
|
|
3147 |
08CA: NOP |
|
|
3148 |
08CB: BCF 03.5 |
|
|
3149 |
08CC: BCF 06.1 |
|
|
3150 |
08CD: BSF 03.5 |
|
|
3151 |
08CE: BCF 06.1 |
|
|
3152 |
.................... I2C_Write(SHT25_ADDR); |
|
|
3153 |
08CF: MOVLW 80 |
|
|
3154 |
08D0: BCF 03.5 |
|
|
3155 |
08D1: MOVWF 5F |
|
|
3156 |
08D2: BCF 0A.3 |
|
|
3157 |
08D3: CALL 1FB |
|
|
3158 |
08D4: BSF 0A.3 |
|
|
3159 |
.................... I2C_write(0xE5); |
|
|
3160 |
08D5: MOVLW E5 |
|
|
3161 |
08D6: MOVWF 5F |
|
|
3162 |
08D7: BCF 0A.3 |
|
|
3163 |
08D8: CALL 1FB |
|
|
3164 |
08D9: BSF 0A.3 |
|
|
3165 |
.................... |
|
|
3166 |
.................... delay_ms(100); |
|
|
3167 |
08DA: MOVLW 64 |
|
|
3168 |
08DB: MOVWF 52 |
|
|
3169 |
08DC: BCF 0A.3 |
|
|
3170 |
08DD: CALL 2A0 |
|
|
3171 |
08DE: BSF 0A.3 |
|
|
3172 |
.................... |
|
|
3173 |
.................... i2c_start(); |
|
|
3174 |
08DF: BSF 03.5 |
|
|
3175 |
08E0: BSF 06.0 |
|
|
3176 |
08E1: NOP |
|
|
3177 |
08E2: BSF 06.1 |
|
|
3178 |
08E3: NOP |
|
|
3179 |
08E4: BCF 03.5 |
|
|
3180 |
08E5: BTFSS 06.1 |
|
|
3181 |
08E6: GOTO 0E5 |
|
|
3182 |
08E7: BCF 06.0 |
|
|
3183 |
08E8: BSF 03.5 |
|
|
3184 |
08E9: BCF 06.0 |
|
|
3185 |
08EA: NOP |
|
|
3186 |
08EB: BCF 03.5 |
|
|
3187 |
08EC: BCF 06.1 |
|
|
3188 |
08ED: BSF 03.5 |
|
|
3189 |
08EE: BCF 06.1 |
|
|
3190 |
.................... I2C_Write(SHT25_ADDR+1); |
|
|
3191 |
08EF: MOVLW 81 |
|
|
3192 |
08F0: BCF 03.5 |
|
|
3193 |
08F1: MOVWF 5F |
|
|
3194 |
08F2: BCF 0A.3 |
|
|
3195 |
08F3: CALL 1FB |
|
|
3196 |
08F4: BSF 0A.3 |
|
|
3197 |
.................... MSB=i2c_read(1); |
|
|
3198 |
08F5: MOVLW 01 |
|
|
3199 |
08F6: MOVWF 77 |
|
|
3200 |
08F7: BCF 0A.3 |
|
|
3201 |
08F8: CALL 2B4 |
|
|
3202 |
08F9: BSF 0A.3 |
|
|
3203 |
08FA: MOVF 78,W |
|
|
3204 |
08FB: MOVWF 4D |
|
|
3205 |
.................... LSB=i2c_read(1); |
|
|
3206 |
08FC: MOVLW 01 |
|
|
3207 |
08FD: MOVWF 77 |
|
|
3208 |
08FE: BCF 0A.3 |
|
|
3209 |
08FF: CALL 2B4 |
|
|
3210 |
0900: BSF 0A.3 |
|
|
3211 |
0901: MOVF 78,W |
|
|
3212 |
0902: MOVWF 4E |
|
|
3213 |
.................... Check=i2c_read(0); |
|
|
3214 |
0903: CLRF 77 |
|
|
3215 |
0904: BCF 0A.3 |
|
|
3216 |
0905: CALL 2B4 |
|
|
3217 |
0906: BSF 0A.3 |
|
|
3218 |
0907: MOVF 78,W |
|
|
3219 |
0908: MOVWF 4F |
|
|
3220 |
.................... i2c_stop(); |
|
|
3221 |
0909: BSF 03.5 |
|
|
3222 |
090A: BCF 06.0 |
|
|
3223 |
090B: NOP |
|
|
3224 |
090C: BSF 06.1 |
|
|
3225 |
090D: BCF 03.5 |
|
|
3226 |
090E: BTFSS 06.1 |
|
|
3227 |
090F: GOTO 10E |
|
|
3228 |
0910: NOP |
|
|
3229 |
0911: GOTO 112 |
|
|
3230 |
0912: NOP |
|
|
3231 |
0913: BSF 03.5 |
|
|
3232 |
0914: BSF 06.0 |
|
|
3233 |
0915: NOP |
|
|
3234 |
.................... |
|
|
3235 |
.................... LSB = LSB >> 2; // trow out status bits |
|
|
3236 |
0916: BCF 03.5 |
|
|
3237 |
0917: RRF 4E,F |
|
|
3238 |
0918: RRF 4E,F |
|
|
3239 |
0919: MOVLW 3F |
|
|
3240 |
091A: ANDWF 4E,F |
|
|
3241 |
.................... |
|
|
3242 |
.................... data = (((unsigned int16) MSB << 8) + (LSB << 4) ); |
|
|
3243 |
091B: CLRF 53 |
|
|
3244 |
091C: MOVF 4D,W |
|
|
3245 |
091D: MOVWF 52 |
|
|
3246 |
091E: MOVWF 53 |
|
|
3247 |
091F: CLRF 52 |
|
|
3248 |
0920: SWAPF 4E,W |
|
|
3249 |
0921: MOVWF 77 |
|
|
3250 |
0922: MOVLW F0 |
|
|
3251 |
0923: ANDWF 77,F |
|
|
3252 |
0924: MOVF 77,W |
|
|
3253 |
0925: ADDWF 52,W |
|
|
3254 |
0926: MOVWF 50 |
|
|
3255 |
0927: MOVF 53,W |
|
|
3256 |
0928: MOVWF 51 |
|
|
3257 |
0929: BTFSC 03.0 |
|
|
3258 |
092A: INCF 51,F |
|
|
3259 |
.................... return( -6.0 + 125.0*((float)data/0xFFFF)); |
|
|
3260 |
092B: MOVF 51,W |
|
|
3261 |
092C: MOVWF 5F |
|
|
3262 |
092D: MOVF 50,W |
|
|
3263 |
092E: MOVWF 5E |
|
|
3264 |
092F: BCF 0A.3 |
|
|
3265 |
0930: CALL 325 |
|
|
3266 |
0931: BSF 0A.3 |
|
|
3267 |
0932: MOVF 77,W |
|
|
3268 |
0933: MOVWF 52 |
|
|
3269 |
0934: MOVF 78,W |
|
|
3270 |
0935: MOVWF 53 |
|
|
3271 |
0936: MOVF 79,W |
|
|
3272 |
0937: MOVWF 54 |
|
|
3273 |
0938: MOVF 7A,W |
|
|
3274 |
0939: MOVWF 55 |
|
|
3275 |
093A: MOVWF 65 |
|
|
3276 |
093B: MOVF 79,W |
|
|
3277 |
093C: MOVWF 64 |
|
|
3278 |
093D: MOVF 78,W |
|
|
3279 |
093E: MOVWF 63 |
|
|
3280 |
093F: MOVF 77,W |
|
|
3281 |
0940: MOVWF 62 |
|
|
3282 |
0941: CLRF 69 |
|
|
3283 |
0942: MOVLW FF |
|
|
3284 |
0943: MOVWF 68 |
|
|
3285 |
0944: MOVLW 7F |
|
|
3286 |
0945: MOVWF 67 |
|
|
3287 |
0946: MOVLW 8E |
|
|
3288 |
0947: MOVWF 66 |
|
|
3289 |
0948: BCF 0A.3 |
|
|
3290 |
0949: CALL 342 |
|
|
3291 |
094A: BSF 0A.3 |
|
|
3292 |
094B: CLRF 5D |
|
|
3293 |
094C: CLRF 5C |
|
|
3294 |
094D: MOVLW 7A |
|
|
3295 |
094E: MOVWF 5B |
|
|
3296 |
094F: MOVLW 85 |
|
|
3297 |
0950: MOVWF 5A |
|
|
3298 |
0951: MOVF 7A,W |
|
|
3299 |
0952: MOVWF 61 |
|
|
3300 |
0953: MOVF 79,W |
|
|
3301 |
0954: MOVWF 60 |
|
|
3302 |
0955: MOVF 78,W |
|
|
3303 |
0956: MOVWF 5F |
|
|
3304 |
0957: MOVF 77,W |
|
|
3305 |
0958: MOVWF 5E |
|
|
3306 |
0959: BCF 0A.3 |
|
|
3307 |
095A: CALL 736 |
|
|
3308 |
095B: BSF 0A.3 |
|
|
3309 |
095C: BCF 03.1 |
|
|
3310 |
095D: CLRF 67 |
|
|
3311 |
095E: CLRF 66 |
|
|
3312 |
095F: MOVLW C0 |
|
|
3313 |
0960: MOVWF 65 |
|
|
3314 |
0961: MOVLW 81 |
|
|
3315 |
0962: MOVWF 64 |
|
|
3316 |
0963: MOVF 7A,W |
|
|
3317 |
0964: MOVWF 6B |
|
|
3318 |
0965: MOVF 79,W |
|
|
3319 |
0966: MOVWF 6A |
|
|
3320 |
0967: MOVF 78,W |
|
|
3321 |
0968: MOVWF 69 |
|
|
3322 |
0969: MOVF 77,W |
|
|
3323 |
096A: MOVWF 68 |
|
|
3324 |
096B: BCF 0A.3 |
|
|
3325 |
096C: CALL 40C |
|
|
3326 |
096D: BSF 0A.3 |
|
|
3327 |
.................... } |
|
|
3328 |
096E: BSF 0A.3 |
|
|
3329 |
096F: BCF 0A.4 |
|
|
3330 |
0970: GOTO 37B (RETURN) |
|
|
3331 |
.................... |
|
|
3332 |
.................... |
|
|
3333 |
.................... |
|
|
3334 |
.................... |
|
|
3335 |
.................... #include "MPL3115.h" |
|
|
3336 |
.................... #define MPL3115_ADDR_R 0xC1 //addresa pro cteni |
|
|
3337 |
.................... #define MPL3115_ADDR_W 0xC0 |
|
|
3338 |
.................... |
|
|
3339 |
.................... #include "MPL3115.c" |
|
|
3340 |
.................... void mpl3115_setA (void) //nastavenà pro výšku |
|
|
3341 |
.................... { |
|
|
3342 |
.................... |
|
|
3343 |
.................... |
|
|
3344 |
.................... i2c_start(); //STANDBY mode |
|
|
3345 |
* |
|
|
3346 |
0658: BSF 03.5 |
|
|
3347 |
0659: BSF 06.0 |
|
|
3348 |
065A: NOP |
|
|
3349 |
065B: BSF 06.1 |
|
|
3350 |
065C: NOP |
|
|
3351 |
065D: BCF 03.5 |
|
|
3352 |
065E: BCF 06.0 |
|
|
3353 |
065F: BSF 03.5 |
|
|
3354 |
0660: BCF 06.0 |
|
|
3355 |
0661: NOP |
|
|
3356 |
0662: BCF 03.5 |
|
|
3357 |
0663: BCF 06.1 |
|
|
3358 |
0664: BSF 03.5 |
|
|
3359 |
0665: BCF 06.1 |
|
|
3360 |
.................... I2C_Write(MPL3115_ADDR_W); |
|
|
3361 |
0666: MOVLW C0 |
|
|
3362 |
0667: BCF 03.5 |
|
|
3363 |
0668: MOVWF 5F |
|
|
3364 |
0669: CALL 1FB |
|
|
3365 |
.................... I2C_write(0x26); |
|
|
3366 |
066A: MOVLW 26 |
|
|
3367 |
066B: MOVWF 5F |
|
|
3368 |
066C: CALL 1FB |
|
|
3369 |
.................... I2C_write(0xB8); |
|
|
3370 |
066D: MOVLW B8 |
|
|
3371 |
066E: MOVWF 5F |
|
|
3372 |
066F: CALL 1FB |
|
|
3373 |
.................... i2c_stop(); |
|
|
3374 |
0670: BSF 03.5 |
|
|
3375 |
0671: BCF 06.0 |
|
|
3376 |
0672: NOP |
|
|
3377 |
0673: BSF 06.1 |
|
|
3378 |
0674: BCF 03.5 |
|
|
3379 |
0675: BTFSS 06.1 |
|
|
3380 |
0676: GOTO 675 |
|
|
3381 |
0677: NOP |
|
|
3382 |
0678: GOTO 679 |
|
|
3383 |
0679: NOP |
|
|
3384 |
067A: BSF 03.5 |
|
|
3385 |
067B: BSF 06.0 |
|
|
3386 |
067C: NOP |
|
|
3387 |
.................... |
|
|
3388 |
.................... i2c_start(); //PT_DATA_CFG set |
|
|
3389 |
067D: BSF 06.0 |
|
|
3390 |
067E: NOP |
|
|
3391 |
067F: BSF 06.1 |
|
|
3392 |
0680: NOP |
|
|
3393 |
0681: BCF 03.5 |
|
|
3394 |
0682: BCF 06.0 |
|
|
3395 |
0683: BSF 03.5 |
|
|
3396 |
0684: BCF 06.0 |
|
|
3397 |
0685: NOP |
|
|
3398 |
0686: BCF 03.5 |
|
|
3399 |
0687: BCF 06.1 |
|
|
3400 |
0688: BSF 03.5 |
|
|
3401 |
0689: BCF 06.1 |
|
|
3402 |
.................... I2C_Write(MPL3115_ADDR_W); |
|
|
3403 |
068A: MOVLW C0 |
|
|
3404 |
068B: BCF 03.5 |
|
|
3405 |
068C: MOVWF 5F |
|
|
3406 |
068D: CALL 1FB |
|
|
3407 |
.................... I2C_write(0x13); |
|
|
3408 |
068E: MOVLW 13 |
|
|
3409 |
068F: MOVWF 5F |
|
|
3410 |
0690: CALL 1FB |
|
|
3411 |
.................... I2C_write(0x07); //hodnota |
|
|
3412 |
0691: MOVLW 07 |
|
|
3413 |
0692: MOVWF 5F |
|
|
3414 |
0693: CALL 1FB |
|
|
3415 |
.................... i2c_stop(); |
|
|
3416 |
0694: BSF 03.5 |
|
|
3417 |
0695: BCF 06.0 |
|
|
3418 |
0696: NOP |
|
|
3419 |
0697: BSF 06.1 |
|
|
3420 |
0698: BCF 03.5 |
|
|
3421 |
0699: BTFSS 06.1 |
|
|
3422 |
069A: GOTO 699 |
|
|
3423 |
069B: NOP |
|
|
3424 |
069C: GOTO 69D |
|
|
3425 |
069D: NOP |
|
|
3426 |
069E: BSF 03.5 |
|
|
3427 |
069F: BSF 06.0 |
|
|
3428 |
06A0: NOP |
|
|
3429 |
.................... |
|
|
3430 |
.................... i2c_start(); //ACTIVE mode |
|
|
3431 |
06A1: BSF 06.0 |
|
|
3432 |
06A2: NOP |
|
|
3433 |
06A3: BSF 06.1 |
|
|
3434 |
06A4: NOP |
|
|
3435 |
06A5: BCF 03.5 |
|
|
3436 |
06A6: BCF 06.0 |
|
|
3437 |
06A7: BSF 03.5 |
|
|
3438 |
06A8: BCF 06.0 |
|
|
3439 |
06A9: NOP |
|
|
3440 |
06AA: BCF 03.5 |
|
|
3441 |
06AB: BCF 06.1 |
|
|
3442 |
06AC: BSF 03.5 |
|
|
3443 |
06AD: BCF 06.1 |
|
|
3444 |
.................... I2C_Write(MPL3115_ADDR_W); |
|
|
3445 |
06AE: MOVLW C0 |
|
|
3446 |
06AF: BCF 03.5 |
|
|
3447 |
06B0: MOVWF 5F |
|
|
3448 |
06B1: CALL 1FB |
|
|
3449 |
.................... I2C_write(0x26); |
|
|
3450 |
06B2: MOVLW 26 |
|
|
3451 |
06B3: MOVWF 5F |
|
|
3452 |
06B4: CALL 1FB |
|
|
3453 |
.................... I2C_write(0xB9); |
|
|
3454 |
06B5: MOVLW B9 |
|
|
3455 |
06B6: MOVWF 5F |
|
|
3456 |
06B7: CALL 1FB |
|
|
3457 |
.................... i2c_stop(); |
|
|
3458 |
06B8: BSF 03.5 |
|
|
3459 |
06B9: BCF 06.0 |
|
|
3460 |
06BA: NOP |
|
|
3461 |
06BB: BSF 06.1 |
|
|
3462 |
06BC: BCF 03.5 |
|
|
3463 |
06BD: BTFSS 06.1 |
|
|
3464 |
06BE: GOTO 6BD |
|
|
3465 |
06BF: NOP |
|
|
3466 |
06C0: GOTO 6C1 |
|
|
3467 |
06C1: NOP |
|
|
3468 |
06C2: BSF 03.5 |
|
|
3469 |
06C3: BSF 06.0 |
|
|
3470 |
06C4: NOP |
|
|
3471 |
.................... } |
|
|
3472 |
06C5: BCF 03.5 |
|
|
3473 |
06C6: BSF 0A.3 |
|
|
3474 |
06C7: BCF 0A.4 |
|
|
3475 |
06C8: GOTO 35B (RETURN) |
|
|
3476 |
.................... |
|
|
3477 |
.................... void mpl3115_setP (void) //nastavenà pro tlak |
|
|
3478 |
.................... { |
|
|
3479 |
.................... |
|
|
3480 |
.................... |
|
|
3481 |
.................... i2c_start(); //STANDBY mode |
|
|
3482 |
* |
|
|
3483 |
022F: BSF 03.5 |
|
|
3484 |
0230: BSF 06.0 |
|
|
3485 |
0231: NOP |
|
|
3486 |
0232: BSF 06.1 |
|
|
3487 |
0233: NOP |
|
|
3488 |
0234: BCF 03.5 |
|
|
3489 |
0235: BCF 06.0 |
|
|
3490 |
0236: BSF 03.5 |
|
|
3491 |
0237: BCF 06.0 |
|
|
3492 |
0238: NOP |
|
|
3493 |
0239: BCF 03.5 |
|
|
3494 |
023A: BCF 06.1 |
|
|
3495 |
023B: BSF 03.5 |
|
|
3496 |
023C: BCF 06.1 |
|
|
3497 |
.................... I2C_Write(MPL3115_ADDR_W); |
|
|
3498 |
023D: MOVLW C0 |
|
|
3499 |
023E: BCF 03.5 |
|
|
3500 |
023F: MOVWF 5F |
|
|
3501 |
0240: CALL 1FB |
|
|
3502 |
.................... I2C_write(0x26); |
|
|
3503 |
0241: MOVLW 26 |
|
|
3504 |
0242: MOVWF 5F |
|
|
3505 |
0243: CALL 1FB |
|
|
3506 |
.................... I2C_write(0xB8); |
|
|
3507 |
0244: MOVLW B8 |
|
|
3508 |
0245: MOVWF 5F |
|
|
3509 |
0246: CALL 1FB |
|
|
3510 |
.................... i2c_stop(); |
|
|
3511 |
0247: BSF 03.5 |
|
|
3512 |
0248: BCF 06.0 |
|
|
3513 |
0249: NOP |
|
|
3514 |
024A: BSF 06.1 |
|
|
3515 |
024B: BCF 03.5 |
|
|
3516 |
024C: BTFSS 06.1 |
|
|
3517 |
024D: GOTO 24C |
|
|
3518 |
024E: NOP |
|
|
3519 |
024F: GOTO 250 |
|
|
3520 |
0250: NOP |
|
|
3521 |
0251: BSF 03.5 |
|
|
3522 |
0252: BSF 06.0 |
|
|
3523 |
0253: NOP |
|
|
3524 |
.................... |
|
|
3525 |
.................... i2c_start(); //PT_DATA_CFG set |
|
|
3526 |
0254: BSF 06.0 |
|
|
3527 |
0255: NOP |
|
|
3528 |
0256: BSF 06.1 |
|
|
3529 |
0257: NOP |
|
|
3530 |
0258: BCF 03.5 |
|
|
3531 |
0259: BCF 06.0 |
|
|
3532 |
025A: BSF 03.5 |
|
|
3533 |
025B: BCF 06.0 |
|
|
3534 |
025C: NOP |
|
|
3535 |
025D: BCF 03.5 |
|
|
3536 |
025E: BCF 06.1 |
|
|
3537 |
025F: BSF 03.5 |
|
|
3538 |
0260: BCF 06.1 |
|
|
3539 |
.................... I2C_Write(MPL3115_ADDR_W); |
|
|
3540 |
0261: MOVLW C0 |
|
|
3541 |
0262: BCF 03.5 |
|
|
3542 |
0263: MOVWF 5F |
|
|
3543 |
0264: CALL 1FB |
|
|
3544 |
.................... I2C_write(0x13); |
|
|
3545 |
0265: MOVLW 13 |
|
|
3546 |
0266: MOVWF 5F |
|
|
3547 |
0267: CALL 1FB |
|
|
3548 |
.................... I2C_write(0x07); //hodnota |
|
|
3549 |
0268: MOVLW 07 |
|
|
3550 |
0269: MOVWF 5F |
|
|
3551 |
026A: CALL 1FB |
|
|
3552 |
.................... i2c_stop(); |
|
|
3553 |
026B: BSF 03.5 |
|
|
3554 |
026C: BCF 06.0 |
|
|
3555 |
026D: NOP |
|
|
3556 |
026E: BSF 06.1 |
|
|
3557 |
026F: BCF 03.5 |
|
|
3558 |
0270: BTFSS 06.1 |
|
|
3559 |
0271: GOTO 270 |
|
|
3560 |
0272: NOP |
|
|
3561 |
0273: GOTO 274 |
|
|
3562 |
0274: NOP |
|
|
3563 |
0275: BSF 03.5 |
|
|
3564 |
0276: BSF 06.0 |
|
|
3565 |
0277: NOP |
|
|
3566 |
.................... |
|
|
3567 |
.................... i2c_start(); //ACTIVE mode |
|
|
3568 |
0278: BSF 06.0 |
|
|
3569 |
0279: NOP |
|
|
3570 |
027A: BSF 06.1 |
|
|
3571 |
027B: NOP |
|
|
3572 |
027C: BCF 03.5 |
|
|
3573 |
027D: BCF 06.0 |
|
|
3574 |
027E: BSF 03.5 |
|
|
3575 |
027F: BCF 06.0 |
|
|
3576 |
0280: NOP |
|
|
3577 |
0281: BCF 03.5 |
|
|
3578 |
0282: BCF 06.1 |
|
|
3579 |
0283: BSF 03.5 |
|
|
3580 |
0284: BCF 06.1 |
|
|
3581 |
.................... I2C_Write(MPL3115_ADDR_W); |
|
|
3582 |
0285: MOVLW C0 |
|
|
3583 |
0286: BCF 03.5 |
|
|
3584 |
0287: MOVWF 5F |
|
|
3585 |
0288: CALL 1FB |
|
|
3586 |
.................... I2C_write(0x26); |
|
|
3587 |
0289: MOVLW 26 |
|
|
3588 |
028A: MOVWF 5F |
|
|
3589 |
028B: CALL 1FB |
|
|
3590 |
.................... I2C_write(0x39); |
|
|
3591 |
028C: MOVLW 39 |
|
|
3592 |
028D: MOVWF 5F |
|
|
3593 |
028E: CALL 1FB |
|
|
3594 |
.................... i2c_stop(); |
|
|
3595 |
028F: BSF 03.5 |
|
|
3596 |
0290: BCF 06.0 |
|
|
3597 |
0291: NOP |
|
|
3598 |
0292: BSF 06.1 |
|
|
3599 |
0293: BCF 03.5 |
|
|
3600 |
0294: BTFSS 06.1 |
|
|
3601 |
0295: GOTO 294 |
|
|
3602 |
0296: NOP |
|
|
3603 |
0297: GOTO 298 |
|
|
3604 |
0298: NOP |
|
|
3605 |
0299: BSF 03.5 |
|
|
3606 |
029A: BSF 06.0 |
|
|
3607 |
029B: NOP |
|
|
3608 |
.................... } |
|
|
3609 |
029C: BCF 03.5 |
|
|
3610 |
029D: BSF 0A.3 |
|
|
3611 |
029E: BCF 0A.4 |
|
|
3612 |
029F: GOTO 339 (RETURN) |
|
|
3613 |
.................... |
|
|
3614 |
.................... |
|
|
3615 |
.................... byte mpl3115_read (byte reg) |
|
|
3616 |
.................... { |
|
|
3617 |
.................... byte i; |
|
|
3618 |
.................... |
|
|
3619 |
.................... i2c_start(); |
|
|
3620 |
* |
|
|
3621 |
02E7: BSF 03.5 |
|
|
3622 |
02E8: BSF 06.0 |
|
|
3623 |
02E9: NOP |
|
|
3624 |
02EA: BSF 06.1 |
|
|
3625 |
02EB: NOP |
|
|
3626 |
02EC: BCF 03.5 |
|
|
3627 |
02ED: BCF 06.0 |
|
|
3628 |
02EE: BSF 03.5 |
|
|
3629 |
02EF: BCF 06.0 |
|
|
3630 |
02F0: NOP |
|
|
3631 |
02F1: BCF 03.5 |
|
|
3632 |
02F2: BCF 06.1 |
|
|
3633 |
02F3: BSF 03.5 |
|
|
3634 |
02F4: BCF 06.1 |
|
|
3635 |
.................... I2C_Write(MPL3115_ADDR_W); |
|
|
3636 |
02F5: MOVLW C0 |
|
|
3637 |
02F6: BCF 03.5 |
|
|
3638 |
02F7: MOVWF 5F |
|
|
3639 |
02F8: CALL 1FB |
|
|
3640 |
.................... I2C_write(reg); |
|
|
3641 |
02F9: MOVF 5D,W |
|
|
3642 |
02FA: MOVWF 5F |
|
|
3643 |
02FB: CALL 1FB |
|
|
3644 |
.................... i2c_start(); |
|
|
3645 |
02FC: BSF 03.5 |
|
|
3646 |
02FD: BSF 06.0 |
|
|
3647 |
02FE: NOP |
|
|
3648 |
02FF: BSF 06.1 |
|
|
3649 |
0300: NOP |
|
|
3650 |
0301: BCF 03.5 |
|
|
3651 |
0302: BTFSS 06.1 |
|
|
3652 |
0303: GOTO 302 |
|
|
3653 |
0304: BCF 06.0 |
|
|
3654 |
0305: BSF 03.5 |
|
|
3655 |
0306: BCF 06.0 |
|
|
3656 |
0307: NOP |
|
|
3657 |
0308: BCF 03.5 |
|
|
3658 |
0309: BCF 06.1 |
|
|
3659 |
030A: BSF 03.5 |
|
|
3660 |
030B: BCF 06.1 |
|
|
3661 |
.................... I2C_Write(MPL3115_ADDR_R); |
|
|
3662 |
030C: MOVLW C1 |
|
|
3663 |
030D: BCF 03.5 |
|
|
3664 |
030E: MOVWF 5F |
|
|
3665 |
030F: CALL 1FB |
|
|
3666 |
.................... i=i2c_read(0); |
|
|
3667 |
0310: CLRF 77 |
|
|
3668 |
0311: CALL 2B4 |
|
|
3669 |
0312: MOVF 78,W |
|
|
3670 |
0313: MOVWF 5E |
|
|
3671 |
.................... i2c_stop(); |
|
|
3672 |
0314: BSF 03.5 |
|
|
3673 |
0315: BCF 06.0 |
|
|
3674 |
0316: NOP |
|
|
3675 |
0317: BSF 06.1 |
|
|
3676 |
0318: BCF 03.5 |
|
|
3677 |
0319: BTFSS 06.1 |
|
|
3678 |
031A: GOTO 319 |
|
|
3679 |
031B: NOP |
|
|
3680 |
031C: GOTO 31D |
|
|
3681 |
031D: NOP |
|
|
3682 |
031E: BSF 03.5 |
|
|
3683 |
031F: BSF 06.0 |
|
|
3684 |
0320: NOP |
|
|
3685 |
.................... |
|
|
3686 |
.................... return i; |
|
|
3687 |
0321: BCF 03.5 |
|
|
3688 |
0322: MOVF 5E,W |
|
|
3689 |
0323: MOVWF 78 |
|
|
3690 |
.................... } |
|
|
3691 |
0324: RETURN |
|
|
3692 |
.................... |
|
|
3693 |
.................... |
|
|
3694 |
.................... float mpl3115_T (void) //teplota ve stupnich |
|
|
3695 |
.................... { |
|
|
3696 |
.................... int m; |
|
|
3697 |
.................... float l, t; |
|
|
3698 |
.................... |
|
|
3699 |
.................... m= mpl3115_read (0x04); |
|
|
3700 |
* |
|
|
3701 |
054D: MOVLW 04 |
|
|
3702 |
054E: MOVWF 5D |
|
|
3703 |
054F: CALL 2E7 |
|
|
3704 |
0550: MOVF 78,W |
|
|
3705 |
0551: MOVWF 4D |
|
|
3706 |
.................... l= (float)(mpl3115_read(0x05)>>4)/16.0; |
|
|
3707 |
0552: MOVLW 05 |
|
|
3708 |
0553: MOVWF 5D |
|
|
3709 |
0554: CALL 2E7 |
|
|
3710 |
0555: SWAPF 78,W |
|
|
3711 |
0556: MOVWF 77 |
|
|
3712 |
0557: MOVLW 0F |
|
|
3713 |
0558: ANDWF 77,F |
|
|
3714 |
0559: MOVF 77,W |
|
|
3715 |
055A: CLRF 5F |
|
|
3716 |
055B: MOVWF 5E |
|
|
3717 |
055C: CALL 325 |
|
|
3718 |
055D: MOVF 77,W |
|
|
3719 |
055E: MOVWF 56 |
|
|
3720 |
055F: MOVF 78,W |
|
|
3721 |
0560: MOVWF 57 |
|
|
3722 |
0561: MOVF 79,W |
|
|
3723 |
0562: MOVWF 58 |
|
|
3724 |
0563: MOVF 7A,W |
|
|
3725 |
0564: MOVWF 59 |
|
|
3726 |
0565: MOVWF 65 |
|
|
3727 |
0566: MOVF 79,W |
|
|
3728 |
0567: MOVWF 64 |
|
|
3729 |
0568: MOVF 78,W |
|
|
3730 |
0569: MOVWF 63 |
|
|
3731 |
056A: MOVF 77,W |
|
|
3732 |
056B: MOVWF 62 |
|
|
3733 |
056C: CLRF 69 |
|
|
3734 |
056D: CLRF 68 |
|
|
3735 |
056E: CLRF 67 |
|
|
3736 |
056F: MOVLW 83 |
|
|
3737 |
0570: MOVWF 66 |
|
|
3738 |
0571: CALL 342 |
|
|
3739 |
0572: MOVF 7A,W |
|
|
3740 |
0573: MOVWF 51 |
|
|
3741 |
0574: MOVF 79,W |
|
|
3742 |
0575: MOVWF 50 |
|
|
3743 |
0576: MOVF 78,W |
|
|
3744 |
0577: MOVWF 4F |
|
|
3745 |
0578: MOVF 77,W |
|
|
3746 |
0579: MOVWF 4E |
|
|
3747 |
.................... t = (float)(M + L); |
|
|
3748 |
057A: CLRF 5F |
|
|
3749 |
057B: MOVF 4D,W |
|
|
3750 |
057C: MOVWF 5E |
|
|
3751 |
057D: CALL 325 |
|
|
3752 |
057E: BCF 03.1 |
|
|
3753 |
057F: MOVF 7A,W |
|
|
3754 |
0580: MOVWF 67 |
|
|
3755 |
0581: MOVF 79,W |
|
|
3756 |
0582: MOVWF 66 |
|
|
3757 |
0583: MOVF 78,W |
|
|
3758 |
0584: MOVWF 65 |
|
|
3759 |
0585: MOVF 77,W |
|
|
3760 |
0586: MOVWF 64 |
|
|
3761 |
0587: MOVF 51,W |
|
|
3762 |
0588: MOVWF 6B |
|
|
3763 |
0589: MOVF 50,W |
|
|
3764 |
058A: MOVWF 6A |
|
|
3765 |
058B: MOVF 4F,W |
|
|
3766 |
058C: MOVWF 69 |
|
|
3767 |
058D: MOVF 4E,W |
|
|
3768 |
058E: MOVWF 68 |
|
|
3769 |
058F: CALL 40C |
|
|
3770 |
0590: MOVF 7A,W |
|
|
3771 |
0591: MOVWF 55 |
|
|
3772 |
0592: MOVF 79,W |
|
|
3773 |
0593: MOVWF 54 |
|
|
3774 |
0594: MOVF 78,W |
|
|
3775 |
0595: MOVWF 53 |
|
|
3776 |
0596: MOVF 77,W |
|
|
3777 |
0597: MOVWF 52 |
|
|
3778 |
.................... return t; |
|
|
3779 |
0598: MOVF 52,W |
|
|
3780 |
0599: MOVWF 77 |
|
|
3781 |
059A: MOVF 53,W |
|
|
3782 |
059B: MOVWF 78 |
|
|
3783 |
059C: MOVF 54,W |
|
|
3784 |
059D: MOVWF 79 |
|
|
3785 |
059E: MOVF 55,W |
|
|
3786 |
059F: MOVWF 7A |
|
|
3787 |
.................... } |
|
|
3788 |
05A0: BSF 0A.3 |
|
|
3789 |
05A1: BCF 0A.4 |
|
|
3790 |
05A2: GOTO 345 (RETURN) |
|
|
3791 |
.................... |
|
|
3792 |
.................... float mpl3115_A (void) //vyska v m |
|
|
3793 |
.................... { |
|
|
3794 |
.................... |
|
|
3795 |
.................... int16 m; |
|
|
3796 |
.................... unsigned int8 c; |
|
|
3797 |
.................... float l, a; |
|
|
3798 |
.................... |
|
|
3799 |
.................... m= mpl3115_read (0x01); |
|
|
3800 |
* |
|
|
3801 |
06C9: MOVLW 01 |
|
|
3802 |
06CA: MOVWF 5D |
|
|
3803 |
06CB: CALL 2E7 |
|
|
3804 |
06CC: CLRF 4E |
|
|
3805 |
06CD: MOVF 78,W |
|
|
3806 |
06CE: MOVWF 4D |
|
|
3807 |
.................... c= mpl3115_read (0x02); |
|
|
3808 |
06CF: MOVLW 02 |
|
|
3809 |
06D0: MOVWF 5D |
|
|
3810 |
06D1: CALL 2E7 |
|
|
3811 |
06D2: MOVF 78,W |
|
|
3812 |
06D3: MOVWF 4F |
|
|
3813 |
.................... l= (float)(mpl3115_read(0x03)>>4)/16.0; |
|
|
3814 |
06D4: MOVLW 03 |
|
|
3815 |
06D5: MOVWF 5D |
|
|
3816 |
06D6: CALL 2E7 |
|
|
3817 |
06D7: SWAPF 78,W |
|
|
3818 |
06D8: MOVWF 77 |
|
|
3819 |
06D9: MOVLW 0F |
|
|
3820 |
06DA: ANDWF 77,F |
|
|
3821 |
06DB: MOVF 77,W |
|
|
3822 |
06DC: CLRF 5F |
|
|
3823 |
06DD: MOVWF 5E |
|
|
3824 |
06DE: CALL 325 |
|
|
3825 |
06DF: MOVF 77,W |
|
|
3826 |
06E0: MOVWF 58 |
|
|
3827 |
06E1: MOVF 78,W |
|
|
3828 |
06E2: MOVWF 59 |
|
|
3829 |
06E3: MOVF 79,W |
|
|
3830 |
06E4: MOVWF 5A |
|
|
3831 |
06E5: MOVF 7A,W |
|
|
3832 |
06E6: MOVWF 5B |
|
|
3833 |
06E7: MOVWF 65 |
|
|
3834 |
06E8: MOVF 79,W |
|
|
3835 |
06E9: MOVWF 64 |
|
|
3836 |
06EA: MOVF 78,W |
|
|
3837 |
06EB: MOVWF 63 |
|
|
3838 |
06EC: MOVF 77,W |
|
|
3839 |
06ED: MOVWF 62 |
|
|
3840 |
06EE: CLRF 69 |
|
|
3841 |
06EF: CLRF 68 |
|
|
3842 |
06F0: CLRF 67 |
|
|
3843 |
06F1: MOVLW 83 |
|
|
3844 |
06F2: MOVWF 66 |
|
|
3845 |
06F3: CALL 342 |
|
|
3846 |
06F4: MOVF 7A,W |
|
|
3847 |
06F5: MOVWF 53 |
|
|
3848 |
06F6: MOVF 79,W |
|
|
3849 |
06F7: MOVWF 52 |
|
|
3850 |
06F8: MOVF 78,W |
|
|
3851 |
06F9: MOVWF 51 |
|
|
3852 |
06FA: MOVF 77,W |
|
|
3853 |
06FB: MOVWF 50 |
|
|
3854 |
.................... a = (float)((m << 8)|c) + l; |
|
|
3855 |
06FC: MOVF 4D,W |
|
|
3856 |
06FD: MOVWF 5A |
|
|
3857 |
06FE: CLRF 59 |
|
|
3858 |
06FF: MOVF 59,W |
|
|
3859 |
0700: IORWF 4F,W |
|
|
3860 |
0701: MOVWF 77 |
|
|
3861 |
0702: MOVF 4D,W |
|
|
3862 |
0703: MOVWF 7A |
|
|
3863 |
0704: MOVF 77,W |
|
|
3864 |
0705: MOVWF 5E |
|
|
3865 |
0706: MOVF 4D,W |
|
|
3866 |
0707: MOVWF 5F |
|
|
3867 |
0708: CALL 325 |
|
|
3868 |
0709: MOVF 77,W |
|
|
3869 |
070A: MOVWF 59 |
|
|
3870 |
070B: MOVF 78,W |
|
|
3871 |
070C: MOVWF 5A |
|
|
3872 |
070D: MOVF 79,W |
|
|
3873 |
070E: MOVWF 5B |
|
|
3874 |
070F: MOVF 7A,W |
|
|
3875 |
0710: MOVWF 5C |
|
|
3876 |
0711: BCF 03.1 |
|
|
3877 |
0712: MOVF 7A,W |
|
|
3878 |
0713: MOVWF 67 |
|
|
3879 |
0714: MOVF 79,W |
|
|
3880 |
0715: MOVWF 66 |
|
|
3881 |
0716: MOVF 78,W |
|
|
3882 |
0717: MOVWF 65 |
|
|
3883 |
0718: MOVF 77,W |
|
|
3884 |
0719: MOVWF 64 |
|
|
3885 |
071A: MOVF 53,W |
|
|
3886 |
071B: MOVWF 6B |
|
|
3887 |
071C: MOVF 52,W |
|
|
3888 |
071D: MOVWF 6A |
|
|
3889 |
071E: MOVF 51,W |
|
|
3890 |
071F: MOVWF 69 |
|
|
3891 |
0720: MOVF 50,W |
|
|
3892 |
0721: MOVWF 68 |
|
|
3893 |
0722: CALL 40C |
|
|
3894 |
0723: MOVF 7A,W |
|
|
3895 |
0724: MOVWF 57 |
|
|
3896 |
0725: MOVF 79,W |
|
|
3897 |
0726: MOVWF 56 |
|
|
3898 |
0727: MOVF 78,W |
|
|
3899 |
0728: MOVWF 55 |
|
|
3900 |
0729: MOVF 77,W |
|
|
3901 |
072A: MOVWF 54 |
|
|
3902 |
.................... return a; |
|
|
3903 |
072B: MOVF 54,W |
|
|
3904 |
072C: MOVWF 77 |
|
|
3905 |
072D: MOVF 55,W |
|
|
3906 |
072E: MOVWF 78 |
|
|
3907 |
072F: MOVF 56,W |
|
|
3908 |
0730: MOVWF 79 |
|
|
3909 |
0731: MOVF 57,W |
|
|
3910 |
0732: MOVWF 7A |
|
|
3911 |
.................... } |
|
|
3912 |
0733: BSF 0A.3 |
|
|
3913 |
0734: BCF 0A.4 |
|
|
3914 |
0735: GOTO 367 (RETURN) |
|
|
3915 |
.................... |
|
|
3916 |
.................... |
|
|
3917 |
.................... float mpl3115_P (void) //tlak v Pa |
|
|
3918 |
.................... { |
|
|
3919 |
.................... unsigned int32 m; |
|
|
3920 |
.................... unsigned int16 c; |
|
|
3921 |
.................... unsigned int8 l,l2; |
|
|
3922 |
.................... float p, l1; |
|
|
3923 |
.................... |
|
|
3924 |
.................... m= mpl3115_read (0x01); |
|
|
3925 |
* |
|
|
3926 |
05A3: MOVLW 01 |
|
|
3927 |
05A4: MOVWF 5D |
|
|
3928 |
05A5: CALL 2E7 |
|
|
3929 |
05A6: CLRF 50 |
|
|
3930 |
05A7: CLRF 4F |
|
|
3931 |
05A8: CLRF 4E |
|
|
3932 |
05A9: MOVF 78,W |
|
|
3933 |
05AA: MOVWF 4D |
|
|
3934 |
.................... c= mpl3115_read (0x02); |
|
|
3935 |
05AB: MOVLW 02 |
|
|
3936 |
05AC: MOVWF 5D |
|
|
3937 |
05AD: CALL 2E7 |
|
|
3938 |
05AE: CLRF 52 |
|
|
3939 |
05AF: MOVF 78,W |
|
|
3940 |
05B0: MOVWF 51 |
|
|
3941 |
.................... l=mpl3115_read(0x03); |
|
|
3942 |
05B1: MOVLW 03 |
|
|
3943 |
05B2: MOVWF 5D |
|
|
3944 |
05B3: CALL 2E7 |
|
|
3945 |
05B4: MOVF 78,W |
|
|
3946 |
05B5: MOVWF 53 |
|
|
3947 |
.................... l2=l<<2; |
|
|
3948 |
05B6: RLF 53,W |
|
|
3949 |
05B7: MOVWF 54 |
|
|
3950 |
05B8: RLF 54,F |
|
|
3951 |
05B9: MOVLW FC |
|
|
3952 |
05BA: ANDWF 54,F |
|
|
3953 |
.................... l1= (float)(l>>6)/4.0; |
|
|
3954 |
05BB: SWAPF 53,W |
|
|
3955 |
05BC: MOVWF 77 |
|
|
3956 |
05BD: RRF 77,F |
|
|
3957 |
05BE: RRF 77,F |
|
|
3958 |
05BF: MOVLW 03 |
|
|
3959 |
05C0: ANDWF 77,F |
|
|
3960 |
05C1: MOVF 77,W |
|
|
3961 |
05C2: CLRF 5F |
|
|
3962 |
05C3: MOVWF 5E |
|
|
3963 |
05C4: CALL 325 |
|
|
3964 |
05C5: MOVF 77,W |
|
|
3965 |
05C6: MOVWF 5E |
|
|
3966 |
05C7: MOVF 78,W |
|
|
3967 |
05C8: MOVWF 5F |
|
|
3968 |
05C9: MOVF 79,W |
|
|
3969 |
05CA: MOVWF 60 |
|
|
3970 |
05CB: MOVF 7A,W |
|
|
3971 |
05CC: MOVWF 61 |
|
|
3972 |
05CD: MOVWF 65 |
|
|
3973 |
05CE: MOVF 79,W |
|
|
3974 |
05CF: MOVWF 64 |
|
|
3975 |
05D0: MOVF 78,W |
|
|
3976 |
05D1: MOVWF 63 |
|
|
3977 |
05D2: MOVF 77,W |
|
|
3978 |
05D3: MOVWF 62 |
|
|
3979 |
05D4: CLRF 69 |
|
|
3980 |
05D5: CLRF 68 |
|
|
3981 |
05D6: CLRF 67 |
|
|
3982 |
05D7: MOVLW 81 |
|
|
3983 |
05D8: MOVWF 66 |
|
|
3984 |
05D9: CALL 342 |
|
|
3985 |
05DA: MOVF 7A,W |
|
|
3986 |
05DB: MOVWF 5C |
|
|
3987 |
05DC: MOVF 79,W |
|
|
3988 |
05DD: MOVWF 5B |
|
|
3989 |
05DE: MOVF 78,W |
|
|
3990 |
05DF: MOVWF 5A |
|
|
3991 |
05E0: MOVF 77,W |
|
|
3992 |
05E1: MOVWF 59 |
|
|
3993 |
.................... p = (float)((m << 10)|(c<<2)|(l>>6)) + l1; |
|
|
3994 |
05E2: CLRF 5E |
|
|
3995 |
05E3: RLF 4D,W |
|
|
3996 |
05E4: MOVWF 5F |
|
|
3997 |
05E5: RLF 4E,W |
|
|
3998 |
05E6: MOVWF 60 |
|
|
3999 |
05E7: RLF 4F,W |
|
|
4000 |
05E8: MOVWF 61 |
|
|
4001 |
05E9: RLF 5F,F |
|
|
4002 |
05EA: RLF 60,F |
|
|
4003 |
05EB: RLF 61,F |
|
|
4004 |
05EC: MOVLW FC |
|
|
4005 |
05ED: ANDWF 5F,F |
|
|
4006 |
05EE: RLF 51,W |
|
|
4007 |
05EF: MOVWF 79 |
|
|
4008 |
05F0: RLF 52,W |
|
|
4009 |
05F1: MOVWF 7A |
|
|
4010 |
05F2: RLF 79,F |
|
|
4011 |
05F3: RLF 7A,F |
|
|
4012 |
05F4: MOVLW FC |
|
|
4013 |
05F5: ANDWF 79,F |
|
|
4014 |
05F6: MOVF 79,W |
|
|
4015 |
05F7: IORWF 5E,F |
|
|
4016 |
05F8: MOVF 7A,W |
|
|
4017 |
05F9: IORWF 5F,F |
|
|
4018 |
05FA: SWAPF 53,W |
|
|
4019 |
05FB: MOVWF 77 |
|
|
4020 |
05FC: RRF 77,F |
|
|
4021 |
05FD: RRF 77,F |
|
|
4022 |
05FE: MOVLW 03 |
|
|
4023 |
05FF: ANDWF 77,F |
|
|
4024 |
0600: MOVF 77,W |
|
|
4025 |
0601: IORWF 5E,W |
|
|
4026 |
0602: MOVWF 77 |
|
|
4027 |
0603: MOVF 5F,W |
|
|
4028 |
0604: MOVWF 78 |
|
|
4029 |
0605: MOVF 60,W |
|
|
4030 |
0606: MOVWF 79 |
|
|
4031 |
0607: MOVF 61,W |
|
|
4032 |
0608: MOVWF 7A |
|
|
4033 |
0609: MOVF 7A,W |
|
|
4034 |
060A: MOVWF 67 |
|
|
4035 |
060B: MOVF 79,W |
|
|
4036 |
060C: MOVWF 66 |
|
|
4037 |
060D: MOVF 78,W |
|
|
4038 |
060E: MOVWF 65 |
|
|
4039 |
060F: MOVF 77,W |
|
|
4040 |
0610: MOVWF 64 |
|
|
4041 |
* |
|
|
4042 |
062B: MOVF 77,W |
|
|
4043 |
062C: MOVWF 5E |
|
|
4044 |
062D: MOVF 78,W |
|
|
4045 |
062E: MOVWF 5F |
|
|
4046 |
062F: MOVF 79,W |
|
|
4047 |
0630: MOVWF 60 |
|
|
4048 |
0631: MOVF 7A,W |
|
|
4049 |
0632: MOVWF 61 |
|
|
4050 |
0633: BCF 03.1 |
|
|
4051 |
0634: MOVF 7A,W |
|
|
4052 |
0635: MOVWF 67 |
|
|
4053 |
0636: MOVF 79,W |
|
|
4054 |
0637: MOVWF 66 |
|
|
4055 |
0638: MOVF 78,W |
|
|
4056 |
0639: MOVWF 65 |
|
|
4057 |
063A: MOVF 77,W |
|
|
4058 |
063B: MOVWF 64 |
|
|
4059 |
063C: MOVF 5C,W |
|
|
4060 |
063D: MOVWF 6B |
|
|
4061 |
063E: MOVF 5B,W |
|
|
4062 |
063F: MOVWF 6A |
|
|
4063 |
0640: MOVF 5A,W |
|
|
4064 |
0641: MOVWF 69 |
|
|
4065 |
0642: MOVF 59,W |
|
|
4066 |
0643: MOVWF 68 |
|
|
4067 |
0644: CALL 40C |
|
|
4068 |
0645: MOVF 7A,W |
|
|
4069 |
0646: MOVWF 58 |
|
|
4070 |
0647: MOVF 79,W |
|
|
4071 |
0648: MOVWF 57 |
|
|
4072 |
0649: MOVF 78,W |
|
|
4073 |
064A: MOVWF 56 |
|
|
4074 |
064B: MOVF 77,W |
|
|
4075 |
064C: MOVWF 55 |
|
|
4076 |
.................... |
|
|
4077 |
.................... return p; |
|
|
4078 |
064D: MOVF 55,W |
|
|
4079 |
064E: MOVWF 77 |
|
|
4080 |
064F: MOVF 56,W |
|
|
4081 |
0650: MOVWF 78 |
|
|
4082 |
0651: MOVF 57,W |
|
|
4083 |
0652: MOVWF 79 |
|
|
4084 |
0653: MOVF 58,W |
|
|
4085 |
0654: MOVWF 7A |
|
|
4086 |
.................... } |
|
|
4087 |
0655: BSF 0A.3 |
|
|
4088 |
0656: BCF 0A.4 |
|
|
4089 |
0657: GOTO 350 (RETURN) |
|
|
4090 |
.................... |
|
|
4091 |
.................... |
|
|
4092 |
.................... |
|
|
4093 |
.................... |
|
|
4094 |
.................... |
|
|
4095 |
.................... |
|
|
4096 |
.................... #define SEND_DELAY 50 // Time between two characters on RS232 |
|
|
4097 |
.................... |
|
|
4098 |
.................... |
|
|
4099 |
.................... char VER[4]=VERSION; // Buffer for concatenate of a version string |
|
|
4100 |
* |
|
|
4101 |
0B28: MOVLW 30 |
|
|
4102 |
0B29: MOVWF 22 |
|
|
4103 |
0B2A: MOVLW 2E |
|
|
4104 |
0B2B: MOVWF 23 |
|
|
4105 |
0B2C: MOVLW 31 |
|
|
4106 |
0B2D: MOVWF 24 |
|
|
4107 |
0B2E: CLRF 25 |
|
|
4108 |
.................... |
|
|
4109 |
.................... void uvitani(void) // uvitaci zprava |
|
|
4110 |
.................... { |
|
|
4111 |
.................... |
|
|
4112 |
.................... printf("\r\n\r\n# Meteorologicka stanice %s (C) 2013 www.mlab.cz \r\n",VERSION); |
|
|
4113 |
* |
|
|
4114 |
0172: MOVLW 04 |
|
|
4115 |
0173: BSF 03.6 |
|
|
4116 |
0174: MOVWF 0D |
|
|
4117 |
0175: MOVLW 00 |
|
|
4118 |
0176: MOVWF 0F |
|
|
4119 |
0177: BCF 03.0 |
|
|
4120 |
0178: MOVLW 1D |
|
|
4121 |
0179: BCF 03.6 |
|
|
4122 |
017A: MOVWF 4D |
|
|
4123 |
017B: CALL 0BC |
|
|
4124 |
017C: MOVLW 20 |
|
|
4125 |
017D: BSF 03.6 |
|
|
4126 |
017E: MOVWF 0D |
|
|
4127 |
017F: MOVLW 00 |
|
|
4128 |
0180: MOVWF 0F |
|
|
4129 |
0181: BCF 03.6 |
|
|
4130 |
0182: CALL 10B |
|
|
4131 |
0183: MOVLW 13 |
|
|
4132 |
0184: BSF 03.6 |
|
|
4133 |
0185: MOVWF 0D |
|
|
4134 |
0186: MOVLW 00 |
|
|
4135 |
0187: MOVWF 0F |
|
|
4136 |
0188: BSF 03.0 |
|
|
4137 |
0189: MOVLW 18 |
|
|
4138 |
018A: BCF 03.6 |
|
|
4139 |
018B: MOVWF 4D |
|
|
4140 |
018C: CALL 0BC |
|
|
4141 |
.................... printf("\r\n# Autor: %s Posledni uprava: %s \r\n",AUTOR, DATE);// Welcome message |
|
|
4142 |
018D: MOVLW 22 |
|
|
4143 |
018E: BSF 03.6 |
|
|
4144 |
018F: MOVWF 0D |
|
|
4145 |
0190: MOVLW 00 |
|
|
4146 |
0191: MOVWF 0F |
|
|
4147 |
0192: BCF 03.0 |
|
|
4148 |
0193: MOVLW 0B |
|
|
4149 |
0194: BCF 03.6 |
|
|
4150 |
0195: MOVWF 4D |
|
|
4151 |
0196: CALL 0BC |
|
|
4152 |
0197: MOVLW 35 |
|
|
4153 |
0198: BSF 03.6 |
|
|
4154 |
0199: MOVWF 0D |
|
|
4155 |
019A: MOVLW 00 |
|
|
4156 |
019B: MOVWF 0F |
|
|
4157 |
019C: BCF 03.6 |
|
|
4158 |
019D: CALL 10B |
|
|
4159 |
019E: MOVLW 28 |
|
|
4160 |
019F: BSF 03.6 |
|
|
4161 |
01A0: MOVWF 0D |
|
|
4162 |
01A1: MOVLW 00 |
|
|
4163 |
01A2: MOVWF 0F |
|
|
4164 |
01A3: BSF 03.0 |
|
|
4165 |
01A4: MOVLW 12 |
|
|
4166 |
01A5: BCF 03.6 |
|
|
4167 |
01A6: MOVWF 4D |
|
|
4168 |
01A7: CALL 0BC |
|
|
4169 |
01A8: MOVLW 3B |
|
|
4170 |
01A9: BSF 03.6 |
|
|
4171 |
01AA: MOVWF 0D |
|
|
4172 |
01AB: MOVLW 00 |
|
|
4173 |
01AC: MOVWF 0F |
|
|
4174 |
01AD: BCF 03.6 |
|
|
4175 |
01AE: CALL 10B |
|
|
4176 |
01AF: MOVLW 20 |
|
|
4177 |
01B0: MOVWF 51 |
|
|
4178 |
01B1: CALL 09A |
|
|
4179 |
01B2: MOVLW 0D |
|
|
4180 |
01B3: MOVWF 51 |
|
|
4181 |
01B4: CALL 09A |
|
|
4182 |
01B5: MOVLW 0A |
|
|
4183 |
01B6: MOVWF 51 |
|
|
4184 |
01B7: CALL 09A |
|
|
4185 |
.................... //printf("#%s\r\n",&REV[4]); |
|
|
4186 |
.................... printf("# ver poradi "); |
|
|
4187 |
01B8: MOVLW 40 |
|
|
4188 |
01B9: BSF 03.6 |
|
|
4189 |
01BA: MOVWF 0D |
|
|
4190 |
01BB: MOVLW 00 |
|
|
4191 |
01BC: MOVWF 0F |
|
|
4192 |
01BD: BCF 03.6 |
|
|
4193 |
01BE: CALL 10B |
|
|
4194 |
.................... printf("altimet_t[°C] altimet_a[m] altimet_p[Pa] "); |
|
|
4195 |
01BF: MOVLW 47 |
|
|
4196 |
01C0: BSF 03.6 |
|
|
4197 |
01C1: MOVWF 0D |
|
|
4198 |
01C2: MOVLW 00 |
|
|
4199 |
01C3: MOVWF 0F |
|
|
4200 |
.................... printf("sht_t[°C] sht_h[%%] Anemo[m/s]check\r\n\r\n"); |
|
|
4201 |
* |
|
|
4202 |
01E4: MOVLW 71 |
|
|
4203 |
01E5: MOVWF 0D |
|
|
4204 |
01E6: MOVLW 00 |
|
|
4205 |
01E7: MOVWF 0F |
|
|
4206 |
01E8: MOVLW 10 |
|
|
4207 |
01E9: BCF 03.6 |
|
|
4208 |
01EA: MOVWF 4D |
|
|
4209 |
01EB: CALL 151 |
|
|
4210 |
01EC: MOVLW 25 |
|
|
4211 |
01ED: MOVWF 51 |
|
|
4212 |
01EE: CALL 09A |
|
|
4213 |
01EF: MOVLW 83 |
|
|
4214 |
01F0: BSF 03.6 |
|
|
4215 |
01F1: MOVWF 0D |
|
|
4216 |
01F2: MOVLW 00 |
|
|
4217 |
01F3: MOVWF 0F |
|
|
4218 |
01F4: MOVLW 16 |
|
|
4219 |
01F5: BCF 03.6 |
|
|
4220 |
01F6: MOVWF 4D |
|
|
4221 |
01F7: CALL 151 |
|
|
4222 |
.................... } |
|
|
4223 |
01F8: BSF 0A.3 |
|
|
4224 |
01F9: BCF 0A.4 |
|
|
4225 |
01FA: GOTO 335 (RETURN) |
|
|
4226 |
.................... |
|
|
4227 |
.................... |
|
|
4228 |
.................... |
|
|
4229 |
.................... |
|
|
4230 |
.................... |
|
|
4231 |
.................... void main () |
|
|
4232 |
.................... { |
|
|
4233 |
* |
|
|
4234 |
0B0B: CLRF 04 |
|
|
4235 |
0B0C: BCF 03.7 |
|
|
4236 |
0B0D: MOVLW 1F |
|
|
4237 |
0B0E: ANDWF 03,F |
|
|
4238 |
0B0F: MOVLW 71 |
|
|
4239 |
0B10: BSF 03.5 |
|
|
4240 |
0B11: MOVWF 0F |
|
|
4241 |
0B12: MOVF 0F,W |
|
|
4242 |
0B13: BCF 06.3 |
|
|
4243 |
0B14: BCF 03.5 |
|
|
4244 |
0B15: BSF 06.3 |
|
|
4245 |
0B16: BSF 03.5 |
|
|
4246 |
0B17: BSF 03.6 |
|
|
4247 |
0B18: MOVF 09,W |
|
|
4248 |
0B19: ANDLW C0 |
|
|
4249 |
0B1A: MOVWF 09 |
|
|
4250 |
0B1B: BCF 03.6 |
|
|
4251 |
0B1C: BCF 1F.4 |
|
|
4252 |
0B1D: BCF 1F.5 |
|
|
4253 |
0B1E: MOVLW 00 |
|
|
4254 |
0B1F: BSF 03.6 |
|
|
4255 |
0B20: MOVWF 08 |
|
|
4256 |
0B21: BCF 03.5 |
|
|
4257 |
0B22: CLRF 07 |
|
|
4258 |
0B23: CLRF 08 |
|
|
4259 |
0B24: CLRF 09 |
|
|
4260 |
* |
|
|
4261 |
0B31: CLRF 3D |
|
|
4262 |
0B32: CLRF 3C |
|
|
4263 |
.................... float altimet_t; //teplota z MPL3115 |
|
|
4264 |
.................... float altimet_p; //tlak z MPL3115 |
|
|
4265 |
.................... float altimet_a; //vyska z MPL3115 |
|
|
4266 |
.................... float sht25_t; |
|
|
4267 |
.................... float sht25_h; |
|
|
4268 |
.................... |
|
|
4269 |
.................... unsigned int16 poradi=0; |
|
|
4270 |
.................... |
|
|
4271 |
.................... uvitani(); |
|
|
4272 |
0B33: BCF 0A.3 |
|
|
4273 |
0B34: GOTO 172 |
|
|
4274 |
0B35: BSF 0A.3 |
|
|
4275 |
.................... |
|
|
4276 |
.................... |
|
|
4277 |
.................... while(TRUE) |
|
|
4278 |
.................... { |
|
|
4279 |
.................... char output[12]; // Output buffer |
|
|
4280 |
.................... int8 j; // String pointer |
|
|
4281 |
.................... int8 check=0; // Checksum is calculated between '$' and '*' |
|
|
4282 |
.................... unsigned int sht_config; |
|
|
4283 |
0B36: CLRF 4B |
|
|
4284 |
.................... |
|
|
4285 |
.................... mpl3115_setP(); //nastaveni pro tlak a teplotu |
|
|
4286 |
0B37: BCF 0A.3 |
|
|
4287 |
0B38: GOTO 22F |
|
|
4288 |
0B39: BSF 0A.3 |
|
|
4289 |
.................... delay_ms (500); |
|
|
4290 |
0B3A: MOVLW 02 |
|
|
4291 |
0B3B: MOVWF 4D |
|
|
4292 |
0B3C: MOVLW FA |
|
|
4293 |
0B3D: MOVWF 52 |
|
|
4294 |
0B3E: BCF 0A.3 |
|
|
4295 |
0B3F: CALL 2A0 |
|
|
4296 |
0B40: BSF 0A.3 |
|
|
4297 |
0B41: DECFSZ 4D,F |
|
|
4298 |
0B42: GOTO 33C |
|
|
4299 |
.................... altimet_t=mpl3115_T(); |
|
|
4300 |
0B43: BCF 0A.3 |
|
|
4301 |
0B44: GOTO 54D |
|
|
4302 |
0B45: BSF 0A.3 |
|
|
4303 |
0B46: MOVF 7A,W |
|
|
4304 |
0B47: MOVWF 2B |
|
|
4305 |
0B48: MOVF 79,W |
|
|
4306 |
0B49: MOVWF 2A |
|
|
4307 |
0B4A: MOVF 78,W |
|
|
4308 |
0B4B: MOVWF 29 |
|
|
4309 |
0B4C: MOVF 77,W |
|
|
4310 |
0B4D: MOVWF 28 |
|
|
4311 |
.................... altimet_p=mpl3115_P(); |
|
|
4312 |
0B4E: BCF 0A.3 |
|
|
4313 |
0B4F: GOTO 5A3 |
|
|
4314 |
0B50: BSF 0A.3 |
|
|
4315 |
0B51: MOVF 7A,W |
|
|
4316 |
0B52: MOVWF 2F |
|
|
4317 |
0B53: MOVF 79,W |
|
|
4318 |
0B54: MOVWF 2E |
|
|
4319 |
0B55: MOVF 78,W |
|
|
4320 |
0B56: MOVWF 2D |
|
|
4321 |
0B57: MOVF 77,W |
|
|
4322 |
0B58: MOVWF 2C |
|
|
4323 |
.................... |
|
|
4324 |
.................... mpl3115_setA(); //nastaveni pro vysku a teplotu |
|
|
4325 |
0B59: BCF 0A.3 |
|
|
4326 |
0B5A: GOTO 658 |
|
|
4327 |
0B5B: BSF 0A.3 |
|
|
4328 |
.................... delay_ms (500); |
|
|
4329 |
0B5C: MOVLW 02 |
|
|
4330 |
0B5D: MOVWF 4D |
|
|
4331 |
0B5E: MOVLW FA |
|
|
4332 |
0B5F: MOVWF 52 |
|
|
4333 |
0B60: BCF 0A.3 |
|
|
4334 |
0B61: CALL 2A0 |
|
|
4335 |
0B62: BSF 0A.3 |
|
|
4336 |
0B63: DECFSZ 4D,F |
|
|
4337 |
0B64: GOTO 35E |
|
|
4338 |
.................... altimet_a=mpl3115_A(); |
|
|
4339 |
0B65: BCF 0A.3 |
|
|
4340 |
0B66: GOTO 6C9 |
|
|
4341 |
0B67: BSF 0A.3 |
|
|
4342 |
0B68: MOVF 7A,W |
|
|
4343 |
0B69: MOVWF 33 |
|
|
4344 |
0B6A: MOVF 79,W |
|
|
4345 |
0B6B: MOVWF 32 |
|
|
4346 |
0B6C: MOVF 78,W |
|
|
4347 |
0B6D: MOVWF 31 |
|
|
4348 |
0B6E: MOVF 77,W |
|
|
4349 |
0B6F: MOVWF 30 |
|
|
4350 |
.................... |
|
|
4351 |
.................... |
|
|
4352 |
.................... //printf("Teplota: %10.4f(stupne)\r\n", t); |
|
|
4353 |
.................... //printf("Tlak: %10.4f(Pa)\r\n", altimet_p); |
|
|
4354 |
.................... //printf("Výška: %10.4f(m)\r\n", a); |
|
|
4355 |
.................... |
|
|
4356 |
.................... |
|
|
4357 |
.................... |
|
|
4358 |
.................... |
|
|
4359 |
.................... sht_config = SHT25_RH12_T14 | SHT25_HEATER_OFF; //vypnuti topeni v |
|
|
4360 |
0B70: CLRF 4C |
|
|
4361 |
.................... |
|
|
4362 |
.................... |
|
|
4363 |
.................... |
|
|
4364 |
.................... |
|
|
4365 |
.................... |
|
|
4366 |
.................... sht25_t=SHT25_get_temp(); |
|
|
4367 |
0B71: GOTO 000 |
|
|
4368 |
0B72: MOVF 7A,W |
|
|
4369 |
0B73: MOVWF 37 |
|
|
4370 |
0B74: MOVF 79,W |
|
|
4371 |
0B75: MOVWF 36 |
|
|
4372 |
0B76: MOVF 78,W |
|
|
4373 |
0B77: MOVWF 35 |
|
|
4374 |
0B78: MOVF 77,W |
|
|
4375 |
0B79: MOVWF 34 |
|
|
4376 |
.................... sht25_h=SHT25_get_hum(); |
|
|
4377 |
0B7A: GOTO 0C1 |
|
|
4378 |
0B7B: MOVF 7A,W |
|
|
4379 |
0B7C: MOVWF 3B |
|
|
4380 |
0B7D: MOVF 79,W |
|
|
4381 |
0B7E: MOVWF 3A |
|
|
4382 |
0B7F: MOVF 78,W |
|
|
4383 |
0B80: MOVWF 39 |
|
|
4384 |
0B81: MOVF 77,W |
|
|
4385 |
0B82: MOVWF 38 |
|
|
4386 |
.................... |
|
|
4387 |
.................... |
|
|
4388 |
.................... delay_us(SEND_DELAY); |
|
|
4389 |
0B83: MOVLW 21 |
|
|
4390 |
0B84: MOVWF 77 |
|
|
4391 |
0B85: DECFSZ 77,F |
|
|
4392 |
0B86: GOTO 385 |
|
|
4393 |
.................... putc('$'); |
|
|
4394 |
0B87: MOVLW 24 |
|
|
4395 |
0B88: MOVWF 51 |
|
|
4396 |
0B89: BCF 0A.3 |
|
|
4397 |
0B8A: CALL 09A |
|
|
4398 |
0B8B: BSF 0A.3 |
|
|
4399 |
.................... delay_us(SEND_DELAY); |
|
|
4400 |
0B8C: MOVLW 21 |
|
|
4401 |
0B8D: MOVWF 77 |
|
|
4402 |
0B8E: DECFSZ 77,F |
|
|
4403 |
0B8F: GOTO 38E |
|
|
4404 |
.................... sprintf(output,"MST%s \0",VER); |
|
|
4405 |
0B90: CLRF 27 |
|
|
4406 |
0B91: MOVLW 3E |
|
|
4407 |
0B92: MOVWF 26 |
|
|
4408 |
0B93: MOVLW 4D |
|
|
4409 |
0B94: MOVWF 5A |
|
|
4410 |
0B95: BCF 0A.3 |
|
|
4411 |
0B96: CALL 7AB |
|
|
4412 |
0B97: BSF 0A.3 |
|
|
4413 |
0B98: MOVLW 53 |
|
|
4414 |
0B99: MOVWF 5A |
|
|
4415 |
0B9A: BCF 0A.3 |
|
|
4416 |
0B9B: CALL 7AB |
|
|
4417 |
0B9C: BSF 0A.3 |
|
|
4418 |
0B9D: MOVLW 54 |
|
|
4419 |
0B9E: MOVWF 5A |
|
|
4420 |
0B9F: BCF 0A.3 |
|
|
4421 |
0BA0: CALL 7AB |
|
|
4422 |
0BA1: BSF 0A.3 |
|
|
4423 |
0BA2: MOVLW 22 |
|
|
4424 |
0BA3: MOVWF 04 |
|
|
4425 |
0BA4: BCF 03.7 |
|
|
4426 |
0BA5: BCF 0A.3 |
|
|
4427 |
0BA6: GOTO 7B8 |
|
|
4428 |
0BA7: BSF 0A.3 |
|
|
4429 |
0BA8: MOVLW 20 |
|
|
4430 |
0BA9: MOVWF 5A |
|
|
4431 |
0BAA: BCF 0A.3 |
|
|
4432 |
0BAB: CALL 7AB |
|
|
4433 |
0BAC: BSF 0A.3 |
|
|
4434 |
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; } |
|
|
4435 |
0BAD: CLRF 4A |
|
|
4436 |
0BAE: MOVLW 3E |
|
|
4437 |
0BAF: ADDWF 4A,W |
|
|
4438 |
0BB0: MOVWF 04 |
|
|
4439 |
0BB1: BCF 03.7 |
|
|
4440 |
0BB2: MOVF 00,F |
|
|
4441 |
0BB3: BTFSC 03.2 |
|
|
4442 |
0BB4: GOTO 3CC |
|
|
4443 |
0BB5: MOVLW 21 |
|
|
4444 |
0BB6: MOVWF 77 |
|
|
4445 |
0BB7: DECFSZ 77,F |
|
|
4446 |
0BB8: GOTO 3B7 |
|
|
4447 |
0BB9: MOVLW 3E |
|
|
4448 |
0BBA: ADDWF 4A,W |
|
|
4449 |
0BBB: MOVWF 04 |
|
|
4450 |
0BBC: BCF 03.7 |
|
|
4451 |
0BBD: MOVF 00,W |
|
|
4452 |
0BBE: MOVWF 4D |
|
|
4453 |
0BBF: MOVF 4D,W |
|
|
4454 |
0BC0: MOVWF 51 |
|
|
4455 |
0BC1: BCF 0A.3 |
|
|
4456 |
0BC2: CALL 09A |
|
|
4457 |
0BC3: BSF 0A.3 |
|
|
4458 |
0BC4: MOVF 4A,W |
|
|
4459 |
0BC5: INCF 4A,F |
|
|
4460 |
0BC6: ADDLW 3E |
|
|
4461 |
0BC7: MOVWF 04 |
|
|
4462 |
0BC8: BCF 03.7 |
|
|
4463 |
0BC9: MOVF 00,W |
|
|
4464 |
0BCA: XORWF 4B,F |
|
|
4465 |
0BCB: GOTO 3AE |
|
|
4466 |
.................... sprintf(output,"%4.0Lu \0", poradi); |
|
|
4467 |
0BCC: CLRF 27 |
|
|
4468 |
0BCD: MOVLW 3E |
|
|
4469 |
0BCE: MOVWF 26 |
|
|
4470 |
0BCF: MOVLW 01 |
|
|
4471 |
0BD0: MOVWF 04 |
|
|
4472 |
0BD1: MOVF 3D,W |
|
|
4473 |
0BD2: MOVWF 4E |
|
|
4474 |
0BD3: MOVF 3C,W |
|
|
4475 |
0BD4: MOVWF 4D |
|
|
4476 |
0BD5: GOTO 171 |
|
|
4477 |
0BD6: MOVLW 20 |
|
|
4478 |
0BD7: MOVWF 5A |
|
|
4479 |
0BD8: BCF 0A.3 |
|
|
4480 |
0BD9: CALL 7AB |
|
|
4481 |
0BDA: BSF 0A.3 |
|
|
4482 |
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; } |
|
|
4483 |
0BDB: CLRF 4A |
|
|
4484 |
0BDC: MOVLW 3E |
|
|
4485 |
0BDD: ADDWF 4A,W |
|
|
4486 |
0BDE: MOVWF 04 |
|
|
4487 |
0BDF: BCF 03.7 |
|
|
4488 |
0BE0: MOVF 00,F |
|
|
4489 |
0BE1: BTFSC 03.2 |
|
|
4490 |
0BE2: GOTO 3FA |
|
|
4491 |
0BE3: MOVLW 21 |
|
|
4492 |
0BE4: MOVWF 77 |
|
|
4493 |
0BE5: DECFSZ 77,F |
|
|
4494 |
0BE6: GOTO 3E5 |
|
|
4495 |
0BE7: MOVLW 3E |
|
|
4496 |
0BE8: ADDWF 4A,W |
|
|
4497 |
0BE9: MOVWF 04 |
|
|
4498 |
0BEA: BCF 03.7 |
|
|
4499 |
0BEB: MOVF 00,W |
|
|
4500 |
0BEC: MOVWF 4D |
|
|
4501 |
0BED: MOVF 4D,W |
|
|
4502 |
0BEE: MOVWF 51 |
|
|
4503 |
0BEF: BCF 0A.3 |
|
|
4504 |
0BF0: CALL 09A |
|
|
4505 |
0BF1: BSF 0A.3 |
|
|
4506 |
0BF2: MOVF 4A,W |
|
|
4507 |
0BF3: INCF 4A,F |
|
|
4508 |
0BF4: ADDLW 3E |
|
|
4509 |
0BF5: MOVWF 04 |
|
|
4510 |
0BF6: BCF 03.7 |
|
|
4511 |
0BF7: MOVF 00,W |
|
|
4512 |
0BF8: XORWF 4B,F |
|
|
4513 |
0BF9: GOTO 3DC |
|
|
4514 |
.................... sprintf(output,"%3.2f \0", altimet_t ); |
|
|
4515 |
0BFA: CLRF 27 |
|
|
4516 |
0BFB: MOVLW 3E |
|
|
4517 |
0BFC: MOVWF 26 |
|
|
4518 |
0BFD: MOVLW 02 |
|
|
4519 |
0BFE: MOVWF 04 |
|
|
4520 |
0BFF: MOVF 2B,W |
|
|
4521 |
0C00: MOVWF 50 |
|
|
4522 |
0C01: MOVF 2A,W |
|
|
4523 |
0C02: MOVWF 4F |
|
|
4524 |
0C03: MOVF 29,W |
|
|
4525 |
0C04: MOVWF 4E |
|
|
4526 |
0C05: MOVF 28,W |
|
|
4527 |
0C06: MOVWF 4D |
|
|
4528 |
0C07: MOVLW 02 |
|
|
4529 |
0C08: MOVWF 51 |
|
|
4530 |
0C09: CALL 21A |
|
|
4531 |
0C0A: MOVLW 20 |
|
|
4532 |
0C0B: MOVWF 5A |
|
|
4533 |
0C0C: BCF 0A.3 |
|
|
4534 |
0C0D: CALL 7AB |
|
|
4535 |
0C0E: BSF 0A.3 |
|
|
4536 |
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; } |
|
|
4537 |
0C0F: CLRF 4A |
|
|
4538 |
0C10: MOVLW 3E |
|
|
4539 |
0C11: ADDWF 4A,W |
|
|
4540 |
0C12: MOVWF 04 |
|
|
4541 |
0C13: BCF 03.7 |
|
|
4542 |
0C14: MOVF 00,F |
|
|
4543 |
0C15: BTFSC 03.2 |
|
|
4544 |
0C16: GOTO 42E |
|
|
4545 |
0C17: MOVLW 21 |
|
|
4546 |
0C18: MOVWF 77 |
|
|
4547 |
0C19: DECFSZ 77,F |
|
|
4548 |
0C1A: GOTO 419 |
|
|
4549 |
0C1B: MOVLW 3E |
|
|
4550 |
0C1C: ADDWF 4A,W |
|
|
4551 |
0C1D: MOVWF 04 |
|
|
4552 |
0C1E: BCF 03.7 |
|
|
4553 |
0C1F: MOVF 00,W |
|
|
4554 |
0C20: MOVWF 4D |
|
|
4555 |
0C21: MOVF 4D,W |
|
|
4556 |
0C22: MOVWF 51 |
|
|
4557 |
0C23: BCF 0A.3 |
|
|
4558 |
0C24: CALL 09A |
|
|
4559 |
0C25: BSF 0A.3 |
|
|
4560 |
0C26: MOVF 4A,W |
|
|
4561 |
0C27: INCF 4A,F |
|
|
4562 |
0C28: ADDLW 3E |
|
|
4563 |
0C29: MOVWF 04 |
|
|
4564 |
0C2A: BCF 03.7 |
|
|
4565 |
0C2B: MOVF 00,W |
|
|
4566 |
0C2C: XORWF 4B,F |
|
|
4567 |
0C2D: GOTO 410 |
|
|
4568 |
.................... sprintf(output,"%5.2f \0", altimet_a); |
|
|
4569 |
0C2E: CLRF 27 |
|
|
4570 |
0C2F: MOVLW 3E |
|
|
4571 |
0C30: MOVWF 26 |
|
|
4572 |
0C31: MOVLW 04 |
|
|
4573 |
0C32: MOVWF 04 |
|
|
4574 |
0C33: MOVF 33,W |
|
|
4575 |
0C34: MOVWF 50 |
|
|
4576 |
0C35: MOVF 32,W |
|
|
4577 |
0C36: MOVWF 4F |
|
|
4578 |
0C37: MOVF 31,W |
|
|
4579 |
0C38: MOVWF 4E |
|
|
4580 |
0C39: MOVF 30,W |
|
|
4581 |
0C3A: MOVWF 4D |
|
|
4582 |
0C3B: MOVLW 02 |
|
|
4583 |
0C3C: MOVWF 51 |
|
|
4584 |
0C3D: CALL 21A |
|
|
4585 |
0C3E: MOVLW 20 |
|
|
4586 |
0C3F: MOVWF 5A |
|
|
4587 |
0C40: BCF 0A.3 |
|
|
4588 |
0C41: CALL 7AB |
|
|
4589 |
0C42: BSF 0A.3 |
|
|
4590 |
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; } |
|
|
4591 |
0C43: CLRF 4A |
|
|
4592 |
0C44: MOVLW 3E |
|
|
4593 |
0C45: ADDWF 4A,W |
|
|
4594 |
0C46: MOVWF 04 |
|
|
4595 |
0C47: BCF 03.7 |
|
|
4596 |
0C48: MOVF 00,F |
|
|
4597 |
0C49: BTFSC 03.2 |
|
|
4598 |
0C4A: GOTO 462 |
|
|
4599 |
0C4B: MOVLW 21 |
|
|
4600 |
0C4C: MOVWF 77 |
|
|
4601 |
0C4D: DECFSZ 77,F |
|
|
4602 |
0C4E: GOTO 44D |
|
|
4603 |
0C4F: MOVLW 3E |
|
|
4604 |
0C50: ADDWF 4A,W |
|
|
4605 |
0C51: MOVWF 04 |
|
|
4606 |
0C52: BCF 03.7 |
|
|
4607 |
0C53: MOVF 00,W |
|
|
4608 |
0C54: MOVWF 4D |
|
|
4609 |
0C55: MOVF 4D,W |
|
|
4610 |
0C56: MOVWF 51 |
|
|
4611 |
0C57: BCF 0A.3 |
|
|
4612 |
0C58: CALL 09A |
|
|
4613 |
0C59: BSF 0A.3 |
|
|
4614 |
0C5A: MOVF 4A,W |
|
|
4615 |
0C5B: INCF 4A,F |
|
|
4616 |
0C5C: ADDLW 3E |
|
|
4617 |
0C5D: MOVWF 04 |
|
|
4618 |
0C5E: BCF 03.7 |
|
|
4619 |
0C5F: MOVF 00,W |
|
|
4620 |
0C60: XORWF 4B,F |
|
|
4621 |
0C61: GOTO 444 |
|
|
4622 |
.................... sprintf(output,"%6.2f \0", altimet_p); |
|
|
4623 |
0C62: CLRF 27 |
|
|
4624 |
0C63: MOVLW 3E |
|
|
4625 |
0C64: MOVWF 26 |
|
|
4626 |
0C65: MOVLW 05 |
|
|
4627 |
0C66: MOVWF 04 |
|
|
4628 |
0C67: MOVF 2F,W |
|
|
4629 |
0C68: MOVWF 50 |
|
|
4630 |
0C69: MOVF 2E,W |
|
|
4631 |
0C6A: MOVWF 4F |
|
|
4632 |
0C6B: MOVF 2D,W |
|
|
4633 |
0C6C: MOVWF 4E |
|
|
4634 |
0C6D: MOVF 2C,W |
|
|
4635 |
0C6E: MOVWF 4D |
|
|
4636 |
0C6F: MOVLW 02 |
|
|
4637 |
0C70: MOVWF 51 |
|
|
4638 |
0C71: CALL 21A |
|
|
4639 |
0C72: MOVLW 20 |
|
|
4640 |
0C73: MOVWF 5A |
|
|
4641 |
0C74: BCF 0A.3 |
|
|
4642 |
0C75: CALL 7AB |
|
|
4643 |
0C76: BSF 0A.3 |
|
|
4644 |
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; } |
|
|
4645 |
0C77: CLRF 4A |
|
|
4646 |
0C78: MOVLW 3E |
|
|
4647 |
0C79: ADDWF 4A,W |
|
|
4648 |
0C7A: MOVWF 04 |
|
|
4649 |
0C7B: BCF 03.7 |
|
|
4650 |
0C7C: MOVF 00,F |
|
|
4651 |
0C7D: BTFSC 03.2 |
|
|
4652 |
0C7E: GOTO 496 |
|
|
4653 |
0C7F: MOVLW 21 |
|
|
4654 |
0C80: MOVWF 77 |
|
|
4655 |
0C81: DECFSZ 77,F |
|
|
4656 |
0C82: GOTO 481 |
|
|
4657 |
0C83: MOVLW 3E |
|
|
4658 |
0C84: ADDWF 4A,W |
|
|
4659 |
0C85: MOVWF 04 |
|
|
4660 |
0C86: BCF 03.7 |
|
|
4661 |
0C87: MOVF 00,W |
|
|
4662 |
0C88: MOVWF 4D |
|
|
4663 |
0C89: MOVF 4D,W |
|
|
4664 |
0C8A: MOVWF 51 |
|
|
4665 |
0C8B: BCF 0A.3 |
|
|
4666 |
0C8C: CALL 09A |
|
|
4667 |
0C8D: BSF 0A.3 |
|
|
4668 |
0C8E: MOVF 4A,W |
|
|
4669 |
0C8F: INCF 4A,F |
|
|
4670 |
0C90: ADDLW 3E |
|
|
4671 |
0C91: MOVWF 04 |
|
|
4672 |
0C92: BCF 03.7 |
|
|
4673 |
0C93: MOVF 00,W |
|
|
4674 |
0C94: XORWF 4B,F |
|
|
4675 |
0C95: GOTO 478 |
|
|
4676 |
.................... sprintf(output,"%5.2f \0", sht25_t); |
|
|
4677 |
0C96: CLRF 27 |
|
|
4678 |
0C97: MOVLW 3E |
|
|
4679 |
0C98: MOVWF 26 |
|
|
4680 |
0C99: MOVLW 04 |
|
|
4681 |
0C9A: MOVWF 04 |
|
|
4682 |
0C9B: MOVF 37,W |
|
|
4683 |
0C9C: MOVWF 50 |
|
|
4684 |
0C9D: MOVF 36,W |
|
|
4685 |
0C9E: MOVWF 4F |
|
|
4686 |
0C9F: MOVF 35,W |
|
|
4687 |
0CA0: MOVWF 4E |
|
|
4688 |
0CA1: MOVF 34,W |
|
|
4689 |
0CA2: MOVWF 4D |
|
|
4690 |
0CA3: MOVLW 02 |
|
|
4691 |
0CA4: MOVWF 51 |
|
|
4692 |
0CA5: CALL 21A |
|
|
4693 |
0CA6: MOVLW 20 |
|
|
4694 |
0CA7: MOVWF 5A |
|
|
4695 |
0CA8: BCF 0A.3 |
|
|
4696 |
0CA9: CALL 7AB |
|
|
4697 |
0CAA: BSF 0A.3 |
|
|
4698 |
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; } |
|
|
4699 |
0CAB: CLRF 4A |
|
|
4700 |
0CAC: MOVLW 3E |
|
|
4701 |
0CAD: ADDWF 4A,W |
|
|
4702 |
0CAE: MOVWF 04 |
|
|
4703 |
0CAF: BCF 03.7 |
|
|
4704 |
0CB0: MOVF 00,F |
|
|
4705 |
0CB1: BTFSC 03.2 |
|
|
4706 |
0CB2: GOTO 4CA |
|
|
4707 |
0CB3: MOVLW 21 |
|
|
4708 |
0CB4: MOVWF 77 |
|
|
4709 |
0CB5: DECFSZ 77,F |
|
|
4710 |
0CB6: GOTO 4B5 |
|
|
4711 |
0CB7: MOVLW 3E |
|
|
4712 |
0CB8: ADDWF 4A,W |
|
|
4713 |
0CB9: MOVWF 04 |
|
|
4714 |
0CBA: BCF 03.7 |
|
|
4715 |
0CBB: MOVF 00,W |
|
|
4716 |
0CBC: MOVWF 4D |
|
|
4717 |
0CBD: MOVF 4D,W |
|
|
4718 |
0CBE: MOVWF 51 |
|
|
4719 |
0CBF: BCF 0A.3 |
|
|
4720 |
0CC0: CALL 09A |
|
|
4721 |
0CC1: BSF 0A.3 |
|
|
4722 |
0CC2: MOVF 4A,W |
|
|
4723 |
0CC3: INCF 4A,F |
|
|
4724 |
0CC4: ADDLW 3E |
|
|
4725 |
0CC5: MOVWF 04 |
|
|
4726 |
0CC6: BCF 03.7 |
|
|
4727 |
0CC7: MOVF 00,W |
|
|
4728 |
0CC8: XORWF 4B,F |
|
|
4729 |
0CC9: GOTO 4AC |
|
|
4730 |
.................... sprintf(output,"%3.2f \0", sht25_h); |
|
|
4731 |
0CCA: CLRF 27 |
|
|
4732 |
0CCB: MOVLW 3E |
|
|
4733 |
0CCC: MOVWF 26 |
|
|
4734 |
0CCD: MOVLW 02 |
|
|
4735 |
0CCE: MOVWF 04 |
|
|
4736 |
0CCF: MOVF 3B,W |
|
|
4737 |
0CD0: MOVWF 50 |
|
|
4738 |
0CD1: MOVF 3A,W |
|
|
4739 |
0CD2: MOVWF 4F |
|
|
4740 |
0CD3: MOVF 39,W |
|
|
4741 |
0CD4: MOVWF 4E |
|
|
4742 |
0CD5: MOVF 38,W |
|
|
4743 |
0CD6: MOVWF 4D |
|
|
4744 |
0CD7: MOVLW 02 |
|
|
4745 |
0CD8: MOVWF 51 |
|
|
4746 |
0CD9: CALL 21A |
|
|
4747 |
0CDA: MOVLW 20 |
|
|
4748 |
0CDB: MOVWF 5A |
|
|
4749 |
0CDC: BCF 0A.3 |
|
|
4750 |
0CDD: CALL 7AB |
|
|
4751 |
0CDE: BSF 0A.3 |
|
|
4752 |
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; } |
|
|
4753 |
0CDF: CLRF 4A |
|
|
4754 |
0CE0: MOVLW 3E |
|
|
4755 |
0CE1: ADDWF 4A,W |
|
|
4756 |
0CE2: MOVWF 04 |
|
|
4757 |
0CE3: BCF 03.7 |
|
|
4758 |
0CE4: MOVF 00,F |
|
|
4759 |
0CE5: BTFSC 03.2 |
|
|
4760 |
0CE6: GOTO 4FE |
|
|
4761 |
0CE7: MOVLW 21 |
|
|
4762 |
0CE8: MOVWF 77 |
|
|
4763 |
0CE9: DECFSZ 77,F |
|
|
4764 |
0CEA: GOTO 4E9 |
|
|
4765 |
0CEB: MOVLW 3E |
|
|
4766 |
0CEC: ADDWF 4A,W |
|
|
4767 |
0CED: MOVWF 04 |
|
|
4768 |
0CEE: BCF 03.7 |
|
|
4769 |
0CEF: MOVF 00,W |
|
|
4770 |
0CF0: MOVWF 4D |
|
|
4771 |
0CF1: MOVF 4D,W |
|
|
4772 |
0CF2: MOVWF 51 |
|
|
4773 |
0CF3: BCF 0A.3 |
|
|
4774 |
0CF4: CALL 09A |
|
|
4775 |
0CF5: BSF 0A.3 |
|
|
4776 |
0CF6: MOVF 4A,W |
|
|
4777 |
0CF7: INCF 4A,F |
|
|
4778 |
0CF8: ADDLW 3E |
|
|
4779 |
0CF9: MOVWF 04 |
|
|
4780 |
0CFA: BCF 03.7 |
|
|
4781 |
0CFB: MOVF 00,W |
|
|
4782 |
0CFC: XORWF 4B,F |
|
|
4783 |
0CFD: GOTO 4E0 |
|
|
4784 |
.................... sprintf(output,"%5.0f \0", altimet_t); |
|
|
4785 |
0CFE: CLRF 27 |
|
|
4786 |
0CFF: MOVLW 3E |
|
|
4787 |
0D00: MOVWF 26 |
|
|
4788 |
0D01: MOVLW 04 |
|
|
4789 |
0D02: MOVWF 04 |
|
|
4790 |
0D03: MOVF 2B,W |
|
|
4791 |
0D04: MOVWF 50 |
|
|
4792 |
0D05: MOVF 2A,W |
|
|
4793 |
0D06: MOVWF 4F |
|
|
4794 |
0D07: MOVF 29,W |
|
|
4795 |
0D08: MOVWF 4E |
|
|
4796 |
0D09: MOVF 28,W |
|
|
4797 |
0D0A: MOVWF 4D |
|
|
4798 |
0D0B: CLRF 51 |
|
|
4799 |
0D0C: CALL 21A |
|
|
4800 |
0D0D: MOVLW 20 |
|
|
4801 |
0D0E: MOVWF 5A |
|
|
4802 |
0D0F: BCF 0A.3 |
|
|
4803 |
0D10: CALL 7AB |
|
|
4804 |
0D11: BSF 0A.3 |
|
|
4805 |
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; } |
|
|
4806 |
0D12: CLRF 4A |
|
|
4807 |
0D13: MOVLW 3E |
|
|
4808 |
0D14: ADDWF 4A,W |
|
|
4809 |
0D15: MOVWF 04 |
|
|
4810 |
0D16: BCF 03.7 |
|
|
4811 |
0D17: MOVF 00,F |
|
|
4812 |
0D18: BTFSC 03.2 |
|
|
4813 |
0D19: GOTO 531 |
|
|
4814 |
0D1A: MOVLW 21 |
|
|
4815 |
0D1B: MOVWF 77 |
|
|
4816 |
0D1C: DECFSZ 77,F |
|
|
4817 |
0D1D: GOTO 51C |
|
|
4818 |
0D1E: MOVLW 3E |
|
|
4819 |
0D1F: ADDWF 4A,W |
|
|
4820 |
0D20: MOVWF 04 |
|
|
4821 |
0D21: BCF 03.7 |
|
|
4822 |
0D22: MOVF 00,W |
|
|
4823 |
0D23: MOVWF 4D |
|
|
4824 |
0D24: MOVF 4D,W |
|
|
4825 |
0D25: MOVWF 51 |
|
|
4826 |
0D26: BCF 0A.3 |
|
|
4827 |
0D27: CALL 09A |
|
|
4828 |
0D28: BSF 0A.3 |
|
|
4829 |
0D29: MOVF 4A,W |
|
|
4830 |
0D2A: INCF 4A,F |
|
|
4831 |
0D2B: ADDLW 3E |
|
|
4832 |
0D2C: MOVWF 04 |
|
|
4833 |
0D2D: BCF 03.7 |
|
|
4834 |
0D2E: MOVF 00,W |
|
|
4835 |
0D2F: XORWF 4B,F |
|
|
4836 |
0D30: GOTO 513 |
|
|
4837 |
.................... sprintf(output,"%5.1f \0", altimet_t); |
|
|
4838 |
0D31: CLRF 27 |
|
|
4839 |
0D32: MOVLW 3E |
|
|
4840 |
0D33: MOVWF 26 |
|
|
4841 |
0D34: MOVLW 04 |
|
|
4842 |
0D35: MOVWF 04 |
|
|
4843 |
0D36: MOVF 2B,W |
|
|
4844 |
0D37: MOVWF 50 |
|
|
4845 |
0D38: MOVF 2A,W |
|
|
4846 |
0D39: MOVWF 4F |
|
|
4847 |
0D3A: MOVF 29,W |
|
|
4848 |
0D3B: MOVWF 4E |
|
|
4849 |
0D3C: MOVF 28,W |
|
|
4850 |
0D3D: MOVWF 4D |
|
|
4851 |
0D3E: MOVLW 01 |
|
|
4852 |
0D3F: MOVWF 51 |
|
|
4853 |
0D40: CALL 21A |
|
|
4854 |
0D41: MOVLW 20 |
|
|
4855 |
0D42: MOVWF 5A |
|
|
4856 |
0D43: BCF 0A.3 |
|
|
4857 |
0D44: CALL 7AB |
|
|
4858 |
0D45: BSF 0A.3 |
|
|
4859 |
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; } |
|
|
4860 |
0D46: CLRF 4A |
|
|
4861 |
0D47: MOVLW 3E |
|
|
4862 |
0D48: ADDWF 4A,W |
|
|
4863 |
0D49: MOVWF 04 |
|
|
4864 |
0D4A: BCF 03.7 |
|
|
4865 |
0D4B: MOVF 00,F |
|
|
4866 |
0D4C: BTFSC 03.2 |
|
|
4867 |
0D4D: GOTO 565 |
|
|
4868 |
0D4E: MOVLW 21 |
|
|
4869 |
0D4F: MOVWF 77 |
|
|
4870 |
0D50: DECFSZ 77,F |
|
|
4871 |
0D51: GOTO 550 |
|
|
4872 |
0D52: MOVLW 3E |
|
|
4873 |
0D53: ADDWF 4A,W |
|
|
4874 |
0D54: MOVWF 04 |
|
|
4875 |
0D55: BCF 03.7 |
|
|
4876 |
0D56: MOVF 00,W |
|
|
4877 |
0D57: MOVWF 4D |
|
|
4878 |
0D58: MOVF 4D,W |
|
|
4879 |
0D59: MOVWF 51 |
|
|
4880 |
0D5A: BCF 0A.3 |
|
|
4881 |
0D5B: CALL 09A |
|
|
4882 |
0D5C: BSF 0A.3 |
|
|
4883 |
0D5D: MOVF 4A,W |
|
|
4884 |
0D5E: INCF 4A,F |
|
|
4885 |
0D5F: ADDLW 3E |
|
|
4886 |
0D60: MOVWF 04 |
|
|
4887 |
0D61: BCF 03.7 |
|
|
4888 |
0D62: MOVF 00,W |
|
|
4889 |
0D63: XORWF 4B,F |
|
|
4890 |
0D64: GOTO 547 |
|
|
4891 |
.................... sprintf(output,"%3.1f \0", altimet_t); |
|
|
4892 |
0D65: CLRF 27 |
|
|
4893 |
0D66: MOVLW 3E |
|
|
4894 |
0D67: MOVWF 26 |
|
|
4895 |
0D68: MOVLW 02 |
|
|
4896 |
0D69: MOVWF 04 |
|
|
4897 |
0D6A: MOVF 2B,W |
|
|
4898 |
0D6B: MOVWF 50 |
|
|
4899 |
0D6C: MOVF 2A,W |
|
|
4900 |
0D6D: MOVWF 4F |
|
|
4901 |
0D6E: MOVF 29,W |
|
|
4902 |
0D6F: MOVWF 4E |
|
|
4903 |
0D70: MOVF 28,W |
|
|
4904 |
0D71: MOVWF 4D |
|
|
4905 |
0D72: MOVLW 01 |
|
|
4906 |
0D73: MOVWF 51 |
|
|
4907 |
0D74: CALL 21A |
|
|
4908 |
0D75: MOVLW 20 |
|
|
4909 |
0D76: MOVWF 5A |
|
|
4910 |
0D77: BCF 0A.3 |
|
|
4911 |
0D78: CALL 7AB |
|
|
4912 |
0D79: BSF 0A.3 |
|
|
4913 |
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; } |
|
|
4914 |
0D7A: CLRF 4A |
|
|
4915 |
0D7B: MOVLW 3E |
|
|
4916 |
0D7C: ADDWF 4A,W |
|
|
4917 |
0D7D: MOVWF 04 |
|
|
4918 |
0D7E: BCF 03.7 |
|
|
4919 |
0D7F: MOVF 00,F |
|
|
4920 |
0D80: BTFSC 03.2 |
|
|
4921 |
0D81: GOTO 599 |
|
|
4922 |
0D82: MOVLW 21 |
|
|
4923 |
0D83: MOVWF 77 |
|
|
4924 |
0D84: DECFSZ 77,F |
|
|
4925 |
0D85: GOTO 584 |
|
|
4926 |
0D86: MOVLW 3E |
|
|
4927 |
0D87: ADDWF 4A,W |
|
|
4928 |
0D88: MOVWF 04 |
|
|
4929 |
0D89: BCF 03.7 |
|
|
4930 |
0D8A: MOVF 00,W |
|
|
4931 |
0D8B: MOVWF 4D |
|
|
4932 |
0D8C: MOVF 4D,W |
|
|
4933 |
0D8D: MOVWF 51 |
|
|
4934 |
0D8E: BCF 0A.3 |
|
|
4935 |
0D8F: CALL 09A |
|
|
4936 |
0D90: BSF 0A.3 |
|
|
4937 |
0D91: MOVF 4A,W |
|
|
4938 |
0D92: INCF 4A,F |
|
|
4939 |
0D93: ADDLW 3E |
|
|
4940 |
0D94: MOVWF 04 |
|
|
4941 |
0D95: BCF 03.7 |
|
|
4942 |
0D96: MOVF 00,W |
|
|
4943 |
0D97: XORWF 4B,F |
|
|
4944 |
0D98: GOTO 57B |
|
|
4945 |
.................... sprintf(output,"*%X\r\n\0", check); |
|
|
4946 |
0D99: CLRF 27 |
|
|
4947 |
0D9A: MOVLW 3E |
|
|
4948 |
0D9B: MOVWF 26 |
|
|
4949 |
0D9C: MOVLW 2A |
|
|
4950 |
0D9D: MOVWF 5A |
|
|
4951 |
0D9E: BCF 0A.3 |
|
|
4952 |
0D9F: CALL 7AB |
|
|
4953 |
0DA0: BSF 0A.3 |
|
|
4954 |
0DA1: MOVF 4B,W |
|
|
4955 |
0DA2: MOVWF 4D |
|
|
4956 |
0DA3: MOVLW 37 |
|
|
4957 |
0DA4: MOVWF 4E |
|
|
4958 |
0DA5: BCF 0A.3 |
|
|
4959 |
0DA6: GOTO 7D0 |
|
|
4960 |
0DA7: BSF 0A.3 |
|
|
4961 |
0DA8: MOVLW 0D |
|
|
4962 |
0DA9: MOVWF 5A |
|
|
4963 |
0DAA: BCF 0A.3 |
|
|
4964 |
0DAB: CALL 7AB |
|
|
4965 |
0DAC: BSF 0A.3 |
|
|
4966 |
0DAD: MOVLW 0A |
|
|
4967 |
0DAE: MOVWF 5A |
|
|
4968 |
0DAF: BCF 0A.3 |
|
|
4969 |
0DB0: CALL 7AB |
|
|
4970 |
0DB1: BSF 0A.3 |
|
|
4971 |
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j++]); } |
|
|
4972 |
0DB2: CLRF 4A |
|
|
4973 |
0DB3: MOVLW 3E |
|
|
4974 |
0DB4: ADDWF 4A,W |
|
|
4975 |
0DB5: MOVWF 04 |
|
|
4976 |
0DB6: BCF 03.7 |
|
|
4977 |
0DB7: MOVF 00,F |
|
|
4978 |
0DB8: BTFSC 03.2 |
|
|
4979 |
0DB9: GOTO 5CB |
|
|
4980 |
0DBA: MOVLW 21 |
|
|
4981 |
0DBB: MOVWF 77 |
|
|
4982 |
0DBC: DECFSZ 77,F |
|
|
4983 |
0DBD: GOTO 5BC |
|
|
4984 |
0DBE: MOVF 4A,W |
|
|
4985 |
0DBF: INCF 4A,F |
|
|
4986 |
0DC0: ADDLW 3E |
|
|
4987 |
0DC1: MOVWF 04 |
|
|
4988 |
0DC2: BCF 03.7 |
|
|
4989 |
0DC3: MOVF 00,W |
|
|
4990 |
0DC4: MOVWF 4D |
|
|
4991 |
0DC5: MOVF 4D,W |
|
|
4992 |
0DC6: MOVWF 51 |
|
|
4993 |
0DC7: BCF 0A.3 |
|
|
4994 |
0DC8: CALL 09A |
|
|
4995 |
0DC9: BSF 0A.3 |
|
|
4996 |
0DCA: GOTO 5B3 |
|
|
4997 |
.................... delay_us(SEND_DELAY); |
|
|
4998 |
0DCB: MOVLW 21 |
|
|
4999 |
0DCC: MOVWF 77 |
|
|
5000 |
0DCD: DECFSZ 77,F |
|
|
5001 |
0DCE: GOTO 5CD |
|
|
5002 |
.................... |
|
|
5003 |
.................... poradi++; |
|
|
5004 |
0DCF: INCF 3C,F |
|
|
5005 |
0DD0: BTFSC 03.2 |
|
|
5006 |
0DD1: INCF 3D,F |
|
|
5007 |
.................... |
|
|
5008 |
.................... |
|
|
5009 |
.................... |
|
|
5010 |
.................... |
|
|
5011 |
.................... |
|
|
5012 |
.................... |
|
|
5013 |
.................... |
|
|
5014 |
.................... |
|
|
5015 |
.................... } |
|
|
5016 |
0DD2: GOTO 336 |
|
|
5017 |
.................... |
|
|
5018 |
.................... |
|
|
5019 |
.................... } |
|
|
5020 |
0DD3: SLEEP |
|
|
5021 |
|
|
|
5022 |
Configuration Fuses: |
|
|
5023 |
Word 1: 2CF5 INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG |
|
|
5024 |
Word 2: 3FFF NOWRT BORV40 |