Line 1... |
Line 1... |
1 |
CCS PCM C Compiler, Version 4.106, 47914 26-VIII-13 19:04 |
1 |
CCS PCM C Compiler, Version 4.106, 47914 03-IX-13 00:32 |
2 |
|
2 |
|
3 |
Filename: Z:\home\kaklik\svnMLAB\Designs\Measuring_instruments\GeoMet01A\SW\PIC16F887\main.lst |
3 |
Filename: D:\MLAB\Designs\Measuring_instruments\GeoMet01A\SW\PIC16F887\main.lst |
4 |
|
4 |
|
5 |
ROM used: 2940 words (36%) |
5 |
ROM used: 3183 words (39%) |
6 |
Largest free fragment is 2048 |
6 |
Largest free fragment is 2048 |
7 |
RAM used: 21 (6%) at main() level |
7 |
RAM used: 27 (7%) at main() level |
8 |
46 (12%) worst case |
8 |
52 (14%) worst case |
9 |
Stack: 5 locations |
9 |
Stack: 5 locations |
10 |
|
10 |
|
11 |
* |
11 |
* |
12 |
0000: MOVLW 0A |
12 |
0000: MOVLW 0A |
13 |
0001: MOVWF 0A |
13 |
0001: MOVWF 0A |
14 |
0002: GOTO 228 |
14 |
0002: GOTO 2B7 |
15 |
0003: NOP |
15 |
0003: NOP |
16 |
.................... #include "main.h" |
16 |
.................... #include "main.h" |
17 |
.................... #include <16F887.h> |
17 |
.................... #include <16F887.h> |
18 |
.................... //////// Standard Header file for the PIC16F887 device //////////////// |
18 |
.................... //////// Standard Header file for the PIC16F887 device //////////////// |
19 |
.................... #device PIC16F887 |
19 |
.................... #device PIC16F887 |
Line 35... |
Line 35... |
35 |
.................... #FUSES NOWRT //Program memory not write protected |
35 |
.................... #FUSES NOWRT //Program memory not write protected |
36 |
.................... #FUSES BORV40 //Brownout reset at 4.0V |
36 |
.................... #FUSES BORV40 //Brownout reset at 4.0V |
37 |
.................... |
37 |
.................... |
38 |
.................... #use delay(clock=8000000) |
38 |
.................... #use delay(clock=8000000) |
39 |
* |
39 |
* |
40 |
0078: MOVLW 3D |
40 |
00FB: MOVLW 43 |
41 |
0079: MOVWF 04 |
41 |
00FC: MOVWF 04 |
42 |
007A: BCF 03.7 |
42 |
00FD: BCF 03.7 |
43 |
007B: MOVF 00,W |
43 |
00FE: MOVF 00,W |
44 |
007C: BTFSC 03.2 |
44 |
00FF: BTFSC 03.2 |
45 |
007D: GOTO 08B |
45 |
0100: GOTO 10E |
46 |
007E: MOVLW 02 |
46 |
0101: MOVLW 02 |
47 |
007F: MOVWF 78 |
47 |
0102: MOVWF 78 |
48 |
0080: CLRF 77 |
48 |
0103: CLRF 77 |
49 |
0081: DECFSZ 77,F |
49 |
0104: DECFSZ 77,F |
50 |
0082: GOTO 081 |
50 |
0105: GOTO 104 |
51 |
0083: DECFSZ 78,F |
51 |
0106: DECFSZ 78,F |
52 |
0084: GOTO 080 |
52 |
0107: GOTO 103 |
53 |
0085: MOVLW 97 |
53 |
0108: MOVLW 97 |
54 |
0086: MOVWF 77 |
54 |
0109: MOVWF 77 |
55 |
0087: DECFSZ 77,F |
55 |
010A: DECFSZ 77,F |
56 |
0088: GOTO 087 |
56 |
010B: GOTO 10A |
57 |
0089: DECFSZ 00,F |
57 |
010C: DECFSZ 00,F |
58 |
008A: GOTO 07E |
58 |
010D: GOTO 101 |
59 |
008B: RETURN |
59 |
010E: RETURN |
60 |
.................... #use i2c(master, sda=PIN_C4, scl=PIN_C3) |
60 |
.................... #use i2c(master, sda=PIN_C4, scl=PIN_C3) |
61 |
* |
61 |
* |
62 |
0202: MOVLW 08 |
62 |
0078: MOVLW 08 |
63 |
0203: MOVWF 78 |
63 |
0079: MOVWF 78 |
64 |
0204: NOP |
64 |
007A: NOP |
65 |
0205: BCF 07.3 |
65 |
007B: BCF 07.3 |
66 |
0206: BCF 20.3 |
66 |
007C: BCF 20.3 |
67 |
0207: MOVF 20,W |
67 |
007D: MOVF 20,W |
68 |
0208: BSF 03.5 |
68 |
007E: BSF 03.5 |
69 |
0209: MOVWF 07 |
69 |
007F: MOVWF 07 |
70 |
020A: NOP |
70 |
0080: NOP |
71 |
020B: BCF 03.5 |
71 |
0081: BCF 03.5 |
72 |
020C: RLF 34,F |
72 |
0082: RLF 3B,F |
73 |
020D: BCF 07.4 |
73 |
0083: BCF 07.4 |
74 |
020E: BTFSS 03.0 |
74 |
0084: BTFSS 03.0 |
75 |
020F: GOTO 216 |
75 |
0085: GOTO 08C |
76 |
0210: BSF 20.4 |
76 |
0086: BSF 20.4 |
77 |
0211: MOVF 20,W |
77 |
0087: MOVF 20,W |
78 |
0212: BSF 03.5 |
78 |
0088: BSF 03.5 |
79 |
0213: MOVWF 07 |
79 |
0089: MOVWF 07 |
80 |
0214: GOTO 21A |
80 |
008A: GOTO 090 |
81 |
0215: BCF 03.5 |
81 |
008B: BCF 03.5 |
82 |
0216: BCF 20.4 |
82 |
008C: BCF 20.4 |
83 |
0217: MOVF 20,W |
83 |
008D: MOVF 20,W |
84 |
0218: BSF 03.5 |
84 |
008E: BSF 03.5 |
85 |
0219: MOVWF 07 |
85 |
008F: MOVWF 07 |
86 |
021A: NOP |
86 |
0090: NOP |
87 |
021B: BCF 03.5 |
87 |
0091: BCF 03.5 |
88 |
021C: BSF 20.3 |
88 |
0092: BSF 20.3 |
89 |
021D: MOVF 20,W |
89 |
0093: MOVF 20,W |
90 |
021E: BSF 03.5 |
90 |
0094: BSF 03.5 |
91 |
021F: MOVWF 07 |
91 |
0095: MOVWF 07 |
92 |
0220: BCF 03.5 |
92 |
0096: BCF 03.5 |
93 |
0221: BTFSS 07.3 |
93 |
0097: BTFSS 07.3 |
94 |
0222: GOTO 221 |
94 |
0098: GOTO 097 |
95 |
0223: DECFSZ 78,F |
95 |
0099: DECFSZ 78,F |
96 |
0224: GOTO 204 |
96 |
009A: GOTO 07A |
97 |
0225: NOP |
97 |
009B: NOP |
98 |
0226: BCF 07.3 |
98 |
009C: BCF 07.3 |
99 |
0227: BCF 20.3 |
99 |
009D: BCF 20.3 |
100 |
0228: MOVF 20,W |
100 |
009E: MOVF 20,W |
101 |
0229: BSF 03.5 |
101 |
009F: BSF 03.5 |
102 |
022A: MOVWF 07 |
102 |
00A0: MOVWF 07 |
103 |
022B: NOP |
103 |
00A1: NOP |
104 |
022C: BCF 03.5 |
104 |
00A2: BCF 03.5 |
105 |
022D: BSF 20.4 |
105 |
00A3: BSF 20.4 |
106 |
022E: MOVF 20,W |
106 |
00A4: MOVF 20,W |
107 |
022F: BSF 03.5 |
107 |
00A5: BSF 03.5 |
108 |
0230: MOVWF 07 |
108 |
00A6: MOVWF 07 |
109 |
0231: NOP |
109 |
00A7: NOP |
110 |
0232: NOP |
110 |
00A8: NOP |
111 |
0233: BCF 03.5 |
111 |
00A9: BCF 03.5 |
112 |
0234: BSF 20.3 |
112 |
00AA: BSF 20.3 |
113 |
0235: MOVF 20,W |
113 |
00AB: MOVF 20,W |
114 |
0236: BSF 03.5 |
114 |
00AC: BSF 03.5 |
115 |
0237: MOVWF 07 |
115 |
00AD: MOVWF 07 |
116 |
0238: BCF 03.5 |
116 |
00AE: BCF 03.5 |
117 |
0239: BTFSS 07.3 |
117 |
00AF: BTFSS 07.3 |
118 |
023A: GOTO 239 |
118 |
00B0: GOTO 0AF |
119 |
023B: CLRF 78 |
119 |
00B1: CLRF 78 |
120 |
023C: NOP |
120 |
00B2: NOP |
121 |
023D: BTFSC 07.4 |
121 |
00B3: BTFSC 07.4 |
122 |
023E: BSF 78.0 |
122 |
00B4: BSF 78.0 |
123 |
023F: BCF 07.3 |
123 |
00B5: BCF 07.3 |
124 |
0240: BCF 20.3 |
124 |
00B6: BCF 20.3 |
125 |
0241: MOVF 20,W |
125 |
00B7: MOVF 20,W |
126 |
0242: BSF 03.5 |
126 |
00B8: BSF 03.5 |
127 |
0243: MOVWF 07 |
127 |
00B9: MOVWF 07 |
128 |
0244: BCF 03.5 |
128 |
00BA: BCF 03.5 |
129 |
0245: BCF 07.4 |
129 |
00BB: BCF 07.4 |
130 |
0246: BCF 20.4 |
130 |
00BC: BCF 20.4 |
131 |
0247: MOVF 20,W |
131 |
00BD: MOVF 20,W |
132 |
0248: BSF 03.5 |
132 |
00BE: BSF 03.5 |
133 |
0249: MOVWF 07 |
133 |
00BF: MOVWF 07 |
134 |
024A: BCF 03.5 |
134 |
00C0: BCF 03.5 |
135 |
024B: RETURN |
135 |
00C1: RETURN |
136 |
024C: MOVLW 08 |
136 |
* |
137 |
024D: MOVWF 35 |
137 |
0285: MOVLW 08 |
138 |
024E: MOVF 77,W |
138 |
0286: MOVWF 3C |
139 |
024F: MOVWF 36 |
139 |
0287: MOVF 77,W |
140 |
0250: BSF 20.4 |
140 |
0288: MOVWF 3D |
141 |
0251: MOVF 20,W |
141 |
0289: BSF 20.4 |
142 |
0252: BSF 03.5 |
142 |
028A: MOVF 20,W |
143 |
0253: MOVWF 07 |
143 |
028B: BSF 03.5 |
144 |
0254: NOP |
144 |
028C: MOVWF 07 |
145 |
0255: BCF 03.5 |
145 |
028D: NOP |
146 |
0256: BSF 20.3 |
146 |
028E: BCF 03.5 |
147 |
0257: MOVF 20,W |
147 |
028F: BSF 20.3 |
148 |
0258: BSF 03.5 |
148 |
0290: MOVF 20,W |
149 |
0259: MOVWF 07 |
149 |
0291: BSF 03.5 |
150 |
025A: BCF 03.5 |
150 |
0292: MOVWF 07 |
151 |
025B: BTFSS 07.3 |
151 |
0293: BCF 03.5 |
152 |
025C: GOTO 25B |
152 |
0294: BTFSS 07.3 |
153 |
025D: BTFSC 07.4 |
153 |
0295: GOTO 294 |
154 |
025E: BSF 03.0 |
154 |
0296: BTFSC 07.4 |
155 |
025F: BTFSS 07.4 |
155 |
0297: BSF 03.0 |
156 |
0260: BCF 03.0 |
156 |
0298: BTFSS 07.4 |
157 |
0261: RLF 78,F |
157 |
0299: BCF 03.0 |
158 |
0262: NOP |
158 |
029A: RLF 78,F |
159 |
0263: BCF 20.3 |
159 |
029B: NOP |
160 |
0264: MOVF 20,W |
160 |
029C: BCF 20.3 |
161 |
0265: BSF 03.5 |
161 |
029D: MOVF 20,W |
162 |
0266: MOVWF 07 |
162 |
029E: BSF 03.5 |
163 |
0267: BCF 03.5 |
163 |
029F: MOVWF 07 |
164 |
0268: BCF 07.3 |
164 |
02A0: BCF 03.5 |
165 |
0269: DECFSZ 35,F |
165 |
02A1: BCF 07.3 |
166 |
026A: GOTO 250 |
166 |
02A2: DECFSZ 3C,F |
167 |
026B: BSF 20.4 |
167 |
02A3: GOTO 289 |
168 |
026C: MOVF 20,W |
168 |
02A4: BSF 20.4 |
169 |
026D: BSF 03.5 |
169 |
02A5: MOVF 20,W |
170 |
026E: MOVWF 07 |
170 |
02A6: BSF 03.5 |
171 |
026F: NOP |
171 |
02A7: MOVWF 07 |
172 |
0270: BCF 03.5 |
172 |
02A8: NOP |
173 |
0271: BCF 07.4 |
173 |
02A9: BCF 03.5 |
174 |
0272: MOVF 36,W |
174 |
02AA: BCF 07.4 |
175 |
0273: BTFSC 03.2 |
175 |
02AB: MOVF 3D,W |
176 |
0274: GOTO 27A |
176 |
02AC: BTFSC 03.2 |
177 |
0275: BCF 20.4 |
177 |
02AD: GOTO 2B3 |
178 |
0276: MOVF 20,W |
178 |
02AE: BCF 20.4 |
179 |
0277: BSF 03.5 |
179 |
02AF: MOVF 20,W |
180 |
0278: MOVWF 07 |
180 |
02B0: BSF 03.5 |
181 |
0279: BCF 03.5 |
181 |
02B1: MOVWF 07 |
182 |
027A: NOP |
182 |
02B2: BCF 03.5 |
183 |
027B: BSF 20.3 |
183 |
02B3: NOP |
184 |
027C: MOVF 20,W |
184 |
02B4: BSF 20.3 |
185 |
027D: BSF 03.5 |
185 |
02B5: MOVF 20,W |
186 |
027E: MOVWF 07 |
186 |
02B6: BSF 03.5 |
187 |
027F: BCF 03.5 |
187 |
02B7: MOVWF 07 |
188 |
0280: BTFSS 07.3 |
188 |
02B8: BCF 03.5 |
189 |
0281: GOTO 280 |
189 |
02B9: BTFSS 07.3 |
190 |
0282: NOP |
190 |
02BA: GOTO 2B9 |
191 |
0283: BCF 07.3 |
191 |
02BB: NOP |
192 |
0284: BCF 20.3 |
192 |
02BC: BCF 07.3 |
193 |
0285: MOVF 20,W |
193 |
02BD: BCF 20.3 |
194 |
0286: BSF 03.5 |
194 |
02BE: MOVF 20,W |
195 |
0287: MOVWF 07 |
195 |
02BF: BSF 03.5 |
196 |
0288: NOP |
196 |
02C0: MOVWF 07 |
197 |
0289: BCF 03.5 |
197 |
02C1: NOP |
198 |
028A: BCF 07.4 |
198 |
02C2: BCF 03.5 |
199 |
028B: BCF 20.4 |
199 |
02C3: BCF 07.4 |
200 |
028C: MOVF 20,W |
200 |
02C4: BCF 20.4 |
201 |
028D: BSF 03.5 |
201 |
02C5: MOVF 20,W |
202 |
028E: MOVWF 07 |
202 |
02C6: BSF 03.5 |
203 |
028F: BCF 03.5 |
203 |
02C7: MOVWF 07 |
204 |
0290: RETURN |
204 |
02C8: BCF 03.5 |
- |
|
205 |
02C9: RETURN |
205 |
.................... #use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8) |
206 |
.................... #use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8) |
206 |
.................... |
207 |
.................... |
207 |
.................... |
208 |
.................... |
208 |
.................... |
209 |
.................... |
209 |
.................... #define LCD_ENABLE_PIN PIN_E0 //// |
210 |
.................... #define LCD_ENABLE_PIN PIN_E0 //// |
Line 408... |
Line 409... |
408 |
.................... set_tris_lcd(LCD_INPUT_MAP); |
409 |
.................... set_tris_lcd(LCD_INPUT_MAP); |
409 |
.................... #else |
410 |
.................... #else |
410 |
.................... #if (defined(LCD_DATA4) && defined(LCD_DATA5) && defined(LCD_DATA6) && defined(LCD_DATA7)) |
411 |
.................... #if (defined(LCD_DATA4) && defined(LCD_DATA5) && defined(LCD_DATA6) && defined(LCD_DATA7)) |
411 |
.................... output_float(LCD_DATA4); |
412 |
.................... output_float(LCD_DATA4); |
412 |
* |
413 |
* |
413 |
00F1: BSF 08.4 |
414 |
0174: BSF 08.4 |
414 |
.................... output_float(LCD_DATA5); |
415 |
.................... output_float(LCD_DATA5); |
415 |
00F2: BSF 08.5 |
416 |
0175: BSF 08.5 |
416 |
.................... output_float(LCD_DATA6); |
417 |
.................... output_float(LCD_DATA6); |
417 |
00F3: BSF 08.6 |
418 |
0176: BSF 08.6 |
418 |
.................... output_float(LCD_DATA7); |
419 |
.................... output_float(LCD_DATA7); |
419 |
00F4: BSF 08.7 |
420 |
0177: BSF 08.7 |
420 |
.................... #else |
421 |
.................... #else |
421 |
.................... lcdtris.data = 0xF; |
422 |
.................... lcdtris.data = 0xF; |
422 |
.................... #endif |
423 |
.................... #endif |
423 |
.................... #endif |
424 |
.................... #endif |
424 |
.................... |
425 |
.................... |
425 |
.................... lcd_output_rw(1); |
426 |
.................... lcd_output_rw(1); |
426 |
00F5: BCF 03.5 |
427 |
0178: BCF 03.5 |
427 |
00F6: BSF 09.2 |
428 |
0179: BSF 09.2 |
428 |
00F7: BSF 03.5 |
429 |
017A: BSF 03.5 |
429 |
00F8: BCF 09.2 |
430 |
017B: BCF 09.2 |
430 |
.................... delay_cycles(1); |
431 |
.................... delay_cycles(1); |
431 |
00F9: NOP |
432 |
017C: NOP |
432 |
.................... lcd_output_enable(1); |
433 |
.................... lcd_output_enable(1); |
433 |
00FA: BCF 03.5 |
434 |
017D: BCF 03.5 |
434 |
00FB: BSF 09.0 |
435 |
017E: BSF 09.0 |
435 |
00FC: BSF 03.5 |
436 |
017F: BSF 03.5 |
436 |
00FD: BCF 09.0 |
437 |
0180: BCF 09.0 |
437 |
.................... delay_cycles(1); |
438 |
.................... delay_cycles(1); |
438 |
00FE: NOP |
439 |
0181: NOP |
439 |
.................... high = lcd_read_nibble(); |
440 |
.................... high = lcd_read_nibble(); |
440 |
00FF: BCF 03.5 |
441 |
0182: BCF 03.5 |
441 |
0100: CALL 0B8 |
442 |
0183: CALL 13B |
442 |
0101: MOVF 78,W |
443 |
0184: MOVF 78,W |
443 |
0102: MOVWF 44 |
444 |
0185: MOVWF 4A |
444 |
.................... |
445 |
.................... |
445 |
.................... lcd_output_enable(0); |
446 |
.................... lcd_output_enable(0); |
446 |
0103: BCF 09.0 |
447 |
0186: BCF 09.0 |
447 |
0104: BSF 03.5 |
448 |
0187: BSF 03.5 |
448 |
0105: BCF 09.0 |
449 |
0188: BCF 09.0 |
449 |
.................... delay_cycles(1); |
450 |
.................... delay_cycles(1); |
450 |
0106: NOP |
451 |
0189: NOP |
451 |
.................... lcd_output_enable(1); |
452 |
.................... lcd_output_enable(1); |
452 |
0107: BCF 03.5 |
453 |
018A: BCF 03.5 |
453 |
0108: BSF 09.0 |
454 |
018B: BSF 09.0 |
454 |
0109: BSF 03.5 |
455 |
018C: BSF 03.5 |
455 |
010A: BCF 09.0 |
456 |
018D: BCF 09.0 |
456 |
.................... delay_us(1); |
457 |
.................... delay_us(1); |
457 |
010B: GOTO 10C |
458 |
018E: GOTO 18F |
458 |
.................... low = lcd_read_nibble(); |
459 |
.................... low = lcd_read_nibble(); |
459 |
010C: BCF 03.5 |
460 |
018F: BCF 03.5 |
460 |
010D: CALL 0B8 |
461 |
0190: CALL 13B |
461 |
010E: MOVF 78,W |
462 |
0191: MOVF 78,W |
462 |
010F: MOVWF 43 |
463 |
0192: MOVWF 49 |
463 |
.................... |
464 |
.................... |
464 |
.................... lcd_output_enable(0); |
465 |
.................... lcd_output_enable(0); |
465 |
0110: BCF 09.0 |
466 |
0193: BCF 09.0 |
466 |
0111: BSF 03.5 |
467 |
0194: BSF 03.5 |
467 |
0112: BCF 09.0 |
468 |
0195: BCF 09.0 |
468 |
.................... |
469 |
.................... |
469 |
.................... #if defined(__PCB__) |
470 |
.................... #if defined(__PCB__) |
470 |
.................... set_tris_lcd(LCD_OUTPUT_MAP); |
471 |
.................... set_tris_lcd(LCD_OUTPUT_MAP); |
471 |
.................... #else |
472 |
.................... #else |
472 |
.................... #if (defined(LCD_DATA4) && defined(LCD_DATA5) && defined(LCD_DATA6) && defined(LCD_DATA7)) |
473 |
.................... #if (defined(LCD_DATA4) && defined(LCD_DATA5) && defined(LCD_DATA6) && defined(LCD_DATA7)) |
473 |
.................... output_drive(LCD_DATA4); |
474 |
.................... output_drive(LCD_DATA4); |
474 |
0113: BCF 08.4 |
475 |
0196: BCF 08.4 |
475 |
.................... output_drive(LCD_DATA5); |
476 |
.................... output_drive(LCD_DATA5); |
476 |
0114: BCF 08.5 |
477 |
0197: BCF 08.5 |
477 |
.................... output_drive(LCD_DATA6); |
478 |
.................... output_drive(LCD_DATA6); |
478 |
0115: BCF 08.6 |
479 |
0198: BCF 08.6 |
479 |
.................... output_drive(LCD_DATA7); |
480 |
.................... output_drive(LCD_DATA7); |
480 |
0116: BCF 08.7 |
481 |
0199: BCF 08.7 |
481 |
.................... #else |
482 |
.................... #else |
482 |
.................... lcdtris.data = 0x0; |
483 |
.................... lcdtris.data = 0x0; |
483 |
.................... #endif |
484 |
.................... #endif |
484 |
.................... #endif |
485 |
.................... #endif |
485 |
.................... |
486 |
.................... |
486 |
.................... return( (high<<4) | low); |
487 |
.................... return( (high<<4) | low); |
487 |
0117: BCF 03.5 |
488 |
019A: BCF 03.5 |
488 |
0118: SWAPF 44,W |
489 |
019B: SWAPF 4A,W |
489 |
0119: MOVWF 77 |
490 |
019C: MOVWF 77 |
490 |
011A: MOVLW F0 |
491 |
019D: MOVLW F0 |
491 |
011B: ANDWF 77,F |
492 |
019E: ANDWF 77,F |
492 |
011C: MOVF 77,W |
493 |
019F: MOVF 77,W |
493 |
011D: IORWF 43,W |
494 |
01A0: IORWF 49,W |
494 |
011E: MOVWF 78 |
495 |
01A1: MOVWF 78 |
495 |
.................... } |
496 |
.................... } |
496 |
.................... |
497 |
.................... |
497 |
.................... BYTE lcd_read_nibble(void) |
498 |
.................... BYTE lcd_read_nibble(void) |
498 |
.................... { |
499 |
.................... { |
499 |
.................... #if (defined(LCD_DATA4) && defined(LCD_DATA5) && defined(LCD_DATA6) && defined(LCD_DATA7)) |
500 |
.................... #if (defined(LCD_DATA4) && defined(LCD_DATA5) && defined(LCD_DATA6) && defined(LCD_DATA7)) |
500 |
* |
501 |
* |
501 |
00B8: CLRF 45 |
502 |
013B: CLRF 4B |
502 |
.................... BYTE n = 0x00; |
503 |
.................... BYTE n = 0x00; |
503 |
.................... |
504 |
.................... |
504 |
.................... /* Read the data port */ |
505 |
.................... /* Read the data port */ |
505 |
.................... n |= input(LCD_DATA4); |
506 |
.................... n |= input(LCD_DATA4); |
506 |
00B9: BSF 03.5 |
507 |
013C: BSF 03.5 |
507 |
00BA: BSF 08.4 |
508 |
013D: BSF 08.4 |
508 |
00BB: MOVLW 00 |
509 |
013E: MOVLW 00 |
509 |
00BC: BCF 03.5 |
510 |
013F: BCF 03.5 |
510 |
00BD: BTFSC 08.4 |
511 |
0140: BTFSC 08.4 |
511 |
00BE: MOVLW 01 |
512 |
0141: MOVLW 01 |
512 |
00BF: IORWF 45,F |
513 |
0142: IORWF 4B,F |
513 |
.................... n |= input(LCD_DATA5) << 1; |
514 |
.................... n |= input(LCD_DATA5) << 1; |
514 |
00C0: BSF 03.5 |
515 |
0143: BSF 03.5 |
515 |
00C1: BSF 08.5 |
516 |
0144: BSF 08.5 |
516 |
00C2: MOVLW 00 |
517 |
0145: MOVLW 00 |
517 |
00C3: BCF 03.5 |
518 |
0146: BCF 03.5 |
518 |
00C4: BTFSC 08.5 |
519 |
0147: BTFSC 08.5 |
519 |
00C5: MOVLW 01 |
520 |
0148: MOVLW 01 |
520 |
00C6: MOVWF 77 |
521 |
0149: MOVWF 77 |
521 |
00C7: BCF 03.0 |
522 |
014A: BCF 03.0 |
522 |
00C8: RLF 77,F |
523 |
014B: RLF 77,F |
523 |
00C9: MOVF 77,W |
524 |
014C: MOVF 77,W |
524 |
00CA: IORWF 45,F |
525 |
014D: IORWF 4B,F |
525 |
.................... n |= input(LCD_DATA6) << 2; |
526 |
.................... n |= input(LCD_DATA6) << 2; |
526 |
00CB: BSF 03.5 |
527 |
014E: BSF 03.5 |
527 |
00CC: BSF 08.6 |
528 |
014F: BSF 08.6 |
528 |
00CD: MOVLW 00 |
529 |
0150: MOVLW 00 |
529 |
00CE: BCF 03.5 |
530 |
0151: BCF 03.5 |
530 |
00CF: BTFSC 08.6 |
531 |
0152: BTFSC 08.6 |
531 |
00D0: MOVLW 01 |
532 |
0153: MOVLW 01 |
532 |
00D1: MOVWF 77 |
533 |
0154: MOVWF 77 |
533 |
00D2: RLF 77,F |
534 |
0155: RLF 77,F |
534 |
00D3: RLF 77,F |
535 |
0156: RLF 77,F |
535 |
00D4: MOVLW FC |
536 |
0157: MOVLW FC |
536 |
00D5: ANDWF 77,F |
537 |
0158: ANDWF 77,F |
537 |
00D6: MOVF 77,W |
538 |
0159: MOVF 77,W |
538 |
00D7: IORWF 45,F |
539 |
015A: IORWF 4B,F |
539 |
.................... n |= input(LCD_DATA7) << 3; |
540 |
.................... n |= input(LCD_DATA7) << 3; |
540 |
00D8: BSF 03.5 |
541 |
015B: BSF 03.5 |
541 |
00D9: BSF 08.7 |
542 |
015C: BSF 08.7 |
542 |
00DA: MOVLW 00 |
543 |
015D: MOVLW 00 |
543 |
00DB: BCF 03.5 |
544 |
015E: BCF 03.5 |
544 |
00DC: BTFSC 08.7 |
545 |
015F: BTFSC 08.7 |
545 |
00DD: MOVLW 01 |
546 |
0160: MOVLW 01 |
546 |
00DE: MOVWF 77 |
547 |
0161: MOVWF 77 |
547 |
00DF: RLF 77,F |
548 |
0162: RLF 77,F |
548 |
00E0: RLF 77,F |
549 |
0163: RLF 77,F |
549 |
00E1: RLF 77,F |
550 |
0164: RLF 77,F |
550 |
00E2: MOVLW F8 |
551 |
0165: MOVLW F8 |
551 |
00E3: ANDWF 77,F |
552 |
0166: ANDWF 77,F |
552 |
00E4: MOVF 77,W |
553 |
0167: MOVF 77,W |
553 |
00E5: IORWF 45,F |
554 |
0168: IORWF 4B,F |
554 |
.................... |
555 |
.................... |
555 |
.................... return(n); |
556 |
.................... return(n); |
556 |
00E6: MOVF 45,W |
557 |
0169: MOVF 4B,W |
557 |
00E7: MOVWF 78 |
558 |
016A: MOVWF 78 |
558 |
.................... #else |
559 |
.................... #else |
559 |
.................... return(lcd.data); |
560 |
.................... return(lcd.data); |
560 |
.................... #endif |
561 |
.................... #endif |
561 |
.................... } |
562 |
.................... } |
562 |
00E8: RETURN |
563 |
016B: RETURN |
563 |
.................... |
564 |
.................... |
564 |
.................... void lcd_send_nibble(BYTE n) |
565 |
.................... void lcd_send_nibble(BYTE n) |
565 |
.................... { |
566 |
.................... { |
566 |
.................... #if (defined(LCD_DATA4) && defined(LCD_DATA5) && defined(LCD_DATA6) && defined(LCD_DATA7)) |
567 |
.................... #if (defined(LCD_DATA4) && defined(LCD_DATA5) && defined(LCD_DATA6) && defined(LCD_DATA7)) |
567 |
.................... /* Write to the data port */ |
568 |
.................... /* Write to the data port */ |
568 |
.................... output_bit(LCD_DATA4, bit_test(n, 0)); |
569 |
.................... output_bit(LCD_DATA4, bit_test(n, 0)); |
569 |
* |
570 |
* |
570 |
008C: BTFSC 44.0 |
571 |
010F: BTFSC 4A.0 |
571 |
008D: GOTO 090 |
572 |
0110: GOTO 113 |
572 |
008E: BCF 08.4 |
573 |
0111: BCF 08.4 |
573 |
008F: GOTO 091 |
574 |
0112: GOTO 114 |
574 |
0090: BSF 08.4 |
575 |
0113: BSF 08.4 |
575 |
0091: BSF 03.5 |
576 |
0114: BSF 03.5 |
576 |
0092: BCF 08.4 |
577 |
0115: BCF 08.4 |
577 |
.................... output_bit(LCD_DATA5, bit_test(n, 1)); |
578 |
.................... output_bit(LCD_DATA5, bit_test(n, 1)); |
578 |
0093: BCF 03.5 |
579 |
0116: BCF 03.5 |
579 |
0094: BTFSC 44.1 |
580 |
0117: BTFSC 4A.1 |
580 |
0095: GOTO 098 |
581 |
0118: GOTO 11B |
581 |
0096: BCF 08.5 |
582 |
0119: BCF 08.5 |
582 |
0097: GOTO 099 |
583 |
011A: GOTO 11C |
583 |
0098: BSF 08.5 |
584 |
011B: BSF 08.5 |
584 |
0099: BSF 03.5 |
585 |
011C: BSF 03.5 |
585 |
009A: BCF 08.5 |
586 |
011D: BCF 08.5 |
586 |
.................... output_bit(LCD_DATA6, bit_test(n, 2)); |
587 |
.................... output_bit(LCD_DATA6, bit_test(n, 2)); |
587 |
009B: BCF 03.5 |
588 |
011E: BCF 03.5 |
588 |
009C: BTFSC 44.2 |
589 |
011F: BTFSC 4A.2 |
589 |
009D: GOTO 0A0 |
590 |
0120: GOTO 123 |
590 |
009E: BCF 08.6 |
591 |
0121: BCF 08.6 |
591 |
009F: GOTO 0A1 |
592 |
0122: GOTO 124 |
592 |
00A0: BSF 08.6 |
593 |
0123: BSF 08.6 |
593 |
00A1: BSF 03.5 |
594 |
0124: BSF 03.5 |
594 |
00A2: BCF 08.6 |
595 |
0125: BCF 08.6 |
595 |
.................... output_bit(LCD_DATA7, bit_test(n, 3)); |
596 |
.................... output_bit(LCD_DATA7, bit_test(n, 3)); |
596 |
00A3: BCF 03.5 |
597 |
0126: BCF 03.5 |
597 |
00A4: BTFSC 44.3 |
598 |
0127: BTFSC 4A.3 |
598 |
00A5: GOTO 0A8 |
599 |
0128: GOTO 12B |
599 |
00A6: BCF 08.7 |
600 |
0129: BCF 08.7 |
600 |
00A7: GOTO 0A9 |
601 |
012A: GOTO 12C |
601 |
00A8: BSF 08.7 |
602 |
012B: BSF 08.7 |
602 |
00A9: BSF 03.5 |
603 |
012C: BSF 03.5 |
603 |
00AA: BCF 08.7 |
604 |
012D: BCF 08.7 |
604 |
.................... #else |
605 |
.................... #else |
605 |
.................... lcdlat.data = n; |
606 |
.................... lcdlat.data = n; |
606 |
.................... #endif |
607 |
.................... #endif |
607 |
.................... |
608 |
.................... |
608 |
.................... delay_cycles(1); |
609 |
.................... delay_cycles(1); |
609 |
00AB: NOP |
610 |
012E: NOP |
610 |
.................... lcd_output_enable(1); |
611 |
.................... lcd_output_enable(1); |
611 |
00AC: BCF 03.5 |
612 |
012F: BCF 03.5 |
612 |
00AD: BSF 09.0 |
613 |
0130: BSF 09.0 |
613 |
00AE: BSF 03.5 |
614 |
0131: BSF 03.5 |
614 |
00AF: BCF 09.0 |
615 |
0132: BCF 09.0 |
615 |
.................... delay_us(2); |
616 |
.................... delay_us(2); |
616 |
00B0: GOTO 0B1 |
617 |
0133: GOTO 134 |
617 |
00B1: GOTO 0B2 |
618 |
0134: GOTO 135 |
618 |
.................... lcd_output_enable(0); |
619 |
.................... lcd_output_enable(0); |
619 |
00B2: BCF 03.5 |
620 |
0135: BCF 03.5 |
620 |
00B3: BCF 09.0 |
621 |
0136: BCF 09.0 |
621 |
00B4: BSF 03.5 |
622 |
0137: BSF 03.5 |
622 |
00B5: BCF 09.0 |
623 |
0138: BCF 09.0 |
623 |
.................... } |
624 |
.................... } |
624 |
00B6: BCF 03.5 |
625 |
0139: BCF 03.5 |
625 |
00B7: RETURN |
626 |
013A: RETURN |
626 |
.................... |
627 |
.................... |
627 |
.................... void lcd_send_byte(BYTE address, BYTE n) |
628 |
.................... void lcd_send_byte(BYTE address, BYTE n) |
628 |
.................... { |
629 |
.................... { |
629 |
.................... #if defined(__PCB__) |
630 |
.................... #if defined(__PCB__) |
630 |
.................... set_tris_lcd(LCD_OUTPUT_MAP); |
631 |
.................... set_tris_lcd(LCD_OUTPUT_MAP); |
631 |
.................... #else |
632 |
.................... #else |
632 |
.................... lcd_enable_tris(); |
633 |
.................... lcd_enable_tris(); |
633 |
* |
634 |
* |
634 |
00E9: BSF 03.5 |
635 |
016C: BSF 03.5 |
635 |
00EA: BCF 09.0 |
636 |
016D: BCF 09.0 |
636 |
.................... lcd_rs_tris(); |
637 |
.................... lcd_rs_tris(); |
637 |
00EB: BCF 09.1 |
638 |
016E: BCF 09.1 |
638 |
.................... lcd_rw_tris(); |
639 |
.................... lcd_rw_tris(); |
639 |
00EC: BCF 09.2 |
640 |
016F: BCF 09.2 |
640 |
.................... #endif |
641 |
.................... #endif |
641 |
.................... |
642 |
.................... |
642 |
.................... lcd_output_rs(0); |
643 |
.................... lcd_output_rs(0); |
643 |
00ED: BCF 03.5 |
644 |
0170: BCF 03.5 |
644 |
00EE: BCF 09.1 |
645 |
0171: BCF 09.1 |
645 |
00EF: BSF 03.5 |
646 |
0172: BSF 03.5 |
646 |
00F0: BCF 09.1 |
647 |
0173: BCF 09.1 |
647 |
.................... while ( bit_test(lcd_read_byte(),7) ) ; |
648 |
.................... while ( bit_test(lcd_read_byte(),7) ) ; |
648 |
* |
649 |
* |
649 |
011F: MOVF 78,W |
650 |
01A2: MOVF 78,W |
650 |
0120: MOVWF 43 |
651 |
01A3: MOVWF 49 |
651 |
0121: BTFSS 43.7 |
652 |
01A4: BTFSS 49.7 |
652 |
0122: GOTO 125 |
653 |
01A5: GOTO 1A8 |
653 |
0123: BSF 03.5 |
654 |
01A6: BSF 03.5 |
654 |
0124: GOTO 0F1 |
655 |
01A7: GOTO 174 |
655 |
.................... lcd_output_rs(address); |
656 |
.................... lcd_output_rs(address); |
656 |
0125: MOVF 41,F |
657 |
01A8: MOVF 47,F |
657 |
0126: BTFSS 03.2 |
658 |
01A9: BTFSS 03.2 |
658 |
0127: GOTO 12A |
659 |
01AA: GOTO 1AD |
659 |
0128: BCF 09.1 |
660 |
01AB: BCF 09.1 |
660 |
0129: GOTO 12B |
661 |
01AC: GOTO 1AE |
661 |
012A: BSF 09.1 |
662 |
01AD: BSF 09.1 |
662 |
012B: BSF 03.5 |
663 |
01AE: BSF 03.5 |
663 |
012C: BCF 09.1 |
664 |
01AF: BCF 09.1 |
664 |
.................... delay_cycles(1); |
665 |
.................... delay_cycles(1); |
665 |
012D: NOP |
666 |
01B0: NOP |
666 |
.................... lcd_output_rw(0); |
667 |
.................... lcd_output_rw(0); |
667 |
012E: BCF 03.5 |
668 |
01B1: BCF 03.5 |
668 |
012F: BCF 09.2 |
669 |
01B2: BCF 09.2 |
669 |
0130: BSF 03.5 |
670 |
01B3: BSF 03.5 |
670 |
0131: BCF 09.2 |
671 |
01B4: BCF 09.2 |
671 |
.................... delay_cycles(1); |
672 |
.................... delay_cycles(1); |
672 |
0132: NOP |
673 |
01B5: NOP |
673 |
.................... lcd_output_enable(0); |
674 |
.................... lcd_output_enable(0); |
674 |
0133: BCF 03.5 |
675 |
01B6: BCF 03.5 |
675 |
0134: BCF 09.0 |
676 |
01B7: BCF 09.0 |
676 |
0135: BSF 03.5 |
677 |
01B8: BSF 03.5 |
677 |
0136: BCF 09.0 |
678 |
01B9: BCF 09.0 |
678 |
.................... lcd_send_nibble(n >> 4); |
679 |
.................... lcd_send_nibble(n >> 4); |
679 |
0137: BCF 03.5 |
680 |
01BA: BCF 03.5 |
680 |
0138: SWAPF 42,W |
681 |
01BB: SWAPF 48,W |
681 |
0139: MOVWF 43 |
682 |
01BC: MOVWF 49 |
682 |
013A: MOVLW 0F |
683 |
01BD: MOVLW 0F |
683 |
013B: ANDWF 43,F |
684 |
01BE: ANDWF 49,F |
684 |
013C: MOVF 43,W |
685 |
01BF: MOVF 49,W |
685 |
013D: MOVWF 44 |
686 |
01C0: MOVWF 4A |
686 |
013E: CALL 08C |
687 |
01C1: CALL 10F |
687 |
.................... lcd_send_nibble(n & 0xf); |
688 |
.................... lcd_send_nibble(n & 0xf); |
688 |
013F: MOVF 42,W |
689 |
01C2: MOVF 48,W |
689 |
0140: ANDLW 0F |
690 |
01C3: ANDLW 0F |
690 |
0141: MOVWF 43 |
691 |
01C4: MOVWF 49 |
691 |
0142: MOVWF 44 |
692 |
01C5: MOVWF 4A |
692 |
0143: CALL 08C |
693 |
01C6: CALL 10F |
693 |
.................... } |
694 |
.................... } |
694 |
0144: RETURN |
695 |
01C7: RETURN |
695 |
.................... |
696 |
.................... |
696 |
.................... #if defined(LCD_EXTENDED_NEWLINE) |
697 |
.................... #if defined(LCD_EXTENDED_NEWLINE) |
697 |
.................... unsigned int8 g_LcdX, g_LcdY; |
698 |
.................... unsigned int8 g_LcdX, g_LcdY; |
698 |
.................... #endif |
699 |
.................... #endif |
699 |
.................... |
700 |
.................... |
Line 704... |
Line 705... |
704 |
.................... #if defined(__PCB__) |
705 |
.................... #if defined(__PCB__) |
705 |
.................... set_tris_lcd(LCD_OUTPUT_MAP); |
706 |
.................... set_tris_lcd(LCD_OUTPUT_MAP); |
706 |
.................... #else |
707 |
.................... #else |
707 |
.................... #if (defined(LCD_DATA4) && defined(LCD_DATA5) && defined(LCD_DATA6) && defined(LCD_DATA7)) |
708 |
.................... #if (defined(LCD_DATA4) && defined(LCD_DATA5) && defined(LCD_DATA6) && defined(LCD_DATA7)) |
708 |
.................... output_drive(LCD_DATA4); |
709 |
.................... output_drive(LCD_DATA4); |
709 |
0145: BSF 03.5 |
710 |
01C8: BSF 03.5 |
710 |
0146: BCF 08.4 |
711 |
01C9: BCF 08.4 |
711 |
.................... output_drive(LCD_DATA5); |
712 |
.................... output_drive(LCD_DATA5); |
712 |
0147: BCF 08.5 |
713 |
01CA: BCF 08.5 |
713 |
.................... output_drive(LCD_DATA6); |
714 |
.................... output_drive(LCD_DATA6); |
714 |
0148: BCF 08.6 |
715 |
01CB: BCF 08.6 |
715 |
.................... output_drive(LCD_DATA7); |
716 |
.................... output_drive(LCD_DATA7); |
716 |
0149: BCF 08.7 |
717 |
01CC: BCF 08.7 |
717 |
.................... #else |
718 |
.................... #else |
718 |
.................... lcdtris.data = 0x0; |
719 |
.................... lcdtris.data = 0x0; |
719 |
.................... #endif |
720 |
.................... #endif |
720 |
.................... lcd_enable_tris(); |
721 |
.................... lcd_enable_tris(); |
721 |
014A: BCF 09.0 |
722 |
01CD: BCF 09.0 |
722 |
.................... lcd_rs_tris(); |
723 |
.................... lcd_rs_tris(); |
723 |
014B: BCF 09.1 |
724 |
01CE: BCF 09.1 |
724 |
.................... lcd_rw_tris(); |
725 |
.................... lcd_rw_tris(); |
725 |
014C: BCF 09.2 |
726 |
01CF: BCF 09.2 |
726 |
.................... #endif |
727 |
.................... #endif |
727 |
.................... |
728 |
.................... |
728 |
.................... lcd_output_rs(0); |
729 |
.................... lcd_output_rs(0); |
729 |
014D: BCF 03.5 |
730 |
01D0: BCF 03.5 |
730 |
014E: BCF 09.1 |
731 |
01D1: BCF 09.1 |
731 |
014F: BSF 03.5 |
732 |
01D2: BSF 03.5 |
732 |
0150: BCF 09.1 |
733 |
01D3: BCF 09.1 |
733 |
.................... lcd_output_rw(0); |
734 |
.................... lcd_output_rw(0); |
734 |
0151: BCF 03.5 |
735 |
01D4: BCF 03.5 |
735 |
0152: BCF 09.2 |
736 |
01D5: BCF 09.2 |
736 |
0153: BSF 03.5 |
737 |
01D6: BSF 03.5 |
737 |
0154: BCF 09.2 |
738 |
01D7: BCF 09.2 |
738 |
.................... lcd_output_enable(0); |
739 |
.................... lcd_output_enable(0); |
739 |
0155: BCF 03.5 |
740 |
01D8: BCF 03.5 |
740 |
0156: BCF 09.0 |
741 |
01D9: BCF 09.0 |
741 |
0157: BSF 03.5 |
742 |
01DA: BSF 03.5 |
742 |
0158: BCF 09.0 |
743 |
01DB: BCF 09.0 |
743 |
.................... |
744 |
.................... |
744 |
.................... delay_ms(15); |
745 |
.................... delay_ms(15); |
745 |
0159: MOVLW 0F |
746 |
01DC: MOVLW 0F |
746 |
015A: BCF 03.5 |
747 |
01DD: BCF 03.5 |
747 |
015B: MOVWF 3D |
748 |
01DE: MOVWF 43 |
748 |
015C: CALL 078 |
749 |
01DF: CALL 0FB |
749 |
.................... for(i=1;i<=3;++i) |
750 |
.................... for(i=1;i<=3;++i) |
750 |
015D: MOVLW 01 |
751 |
01E0: MOVLW 01 |
751 |
015E: MOVWF 2F |
752 |
01E1: MOVWF 35 |
752 |
015F: MOVF 2F,W |
753 |
01E2: MOVF 35,W |
753 |
0160: SUBLW 03 |
754 |
01E3: SUBLW 03 |
754 |
0161: BTFSS 03.0 |
755 |
01E4: BTFSS 03.0 |
755 |
0162: GOTO 16B |
756 |
01E5: GOTO 1EE |
756 |
.................... { |
757 |
.................... { |
757 |
.................... lcd_send_nibble(3); |
758 |
.................... lcd_send_nibble(3); |
758 |
0163: MOVLW 03 |
759 |
01E6: MOVLW 03 |
759 |
0164: MOVWF 44 |
760 |
01E7: MOVWF 4A |
760 |
0165: CALL 08C |
761 |
01E8: CALL 10F |
761 |
.................... delay_ms(5); |
762 |
.................... delay_ms(5); |
762 |
0166: MOVLW 05 |
763 |
01E9: MOVLW 05 |
763 |
0167: MOVWF 3D |
764 |
01EA: MOVWF 43 |
764 |
0168: CALL 078 |
765 |
01EB: CALL 0FB |
765 |
.................... } |
766 |
.................... } |
766 |
0169: INCF 2F,F |
767 |
01EC: INCF 35,F |
767 |
016A: GOTO 15F |
768 |
01ED: GOTO 1E2 |
768 |
.................... |
769 |
.................... |
769 |
.................... lcd_send_nibble(2); |
770 |
.................... lcd_send_nibble(2); |
770 |
016B: MOVLW 02 |
771 |
01EE: MOVLW 02 |
771 |
016C: MOVWF 44 |
772 |
01EF: MOVWF 4A |
772 |
016D: CALL 08C |
773 |
01F0: CALL 10F |
773 |
.................... for(i=0;i<=3;++i) |
774 |
.................... for(i=0;i<=3;++i) |
774 |
016E: CLRF 2F |
775 |
01F1: CLRF 35 |
775 |
016F: MOVF 2F,W |
776 |
01F2: MOVF 35,W |
776 |
0170: SUBLW 03 |
777 |
01F3: SUBLW 03 |
777 |
0171: BTFSS 03.0 |
778 |
01F4: BTFSS 03.0 |
778 |
0172: GOTO 17C |
779 |
01F5: GOTO 1FF |
779 |
.................... lcd_send_byte(0,LCD_INIT_STRING[i]); |
780 |
.................... lcd_send_byte(0,LCD_INIT_STRING[i]); |
780 |
0173: MOVF 2F,W |
781 |
01F6: MOVF 35,W |
781 |
0174: CALL 004 |
782 |
01F7: CALL 004 |
782 |
0175: MOVWF 30 |
783 |
01F8: MOVWF 36 |
783 |
0176: CLRF 41 |
784 |
01F9: CLRF 47 |
784 |
0177: MOVF 30,W |
785 |
01FA: MOVF 36,W |
785 |
0178: MOVWF 42 |
786 |
01FB: MOVWF 48 |
786 |
0179: CALL 0E9 |
787 |
01FC: CALL 16C |
787 |
.................... |
788 |
.................... |
788 |
.................... #if defined(LCD_EXTENDED_NEWLINE) |
789 |
.................... #if defined(LCD_EXTENDED_NEWLINE) |
789 |
017A: INCF 2F,F |
790 |
01FD: INCF 35,F |
790 |
017B: GOTO 16F |
791 |
01FE: GOTO 1F2 |
791 |
.................... g_LcdX = 0; |
792 |
.................... g_LcdX = 0; |
792 |
.................... g_LcdY = 0; |
793 |
.................... g_LcdY = 0; |
793 |
.................... #endif |
794 |
.................... #endif |
794 |
.................... } |
795 |
.................... } |
795 |
017C: RETURN |
796 |
01FF: RETURN |
796 |
.................... |
797 |
.................... |
797 |
.................... void lcd_gotoxy(BYTE x, BYTE y) |
798 |
.................... void lcd_gotoxy(BYTE x, BYTE y) |
798 |
.................... { |
799 |
.................... { |
799 |
.................... BYTE address; |
800 |
.................... BYTE address; |
800 |
.................... |
801 |
.................... |
801 |
.................... if(y!=1) |
802 |
.................... if(y!=1) |
802 |
017D: DECFSZ 3E,W |
803 |
0200: DECFSZ 44,W |
803 |
017E: GOTO 180 |
804 |
0201: GOTO 203 |
804 |
017F: GOTO 183 |
805 |
0202: GOTO 206 |
805 |
.................... address=LCD_LINE_TWO; |
806 |
.................... address=LCD_LINE_TWO; |
806 |
0180: MOVLW 40 |
807 |
0203: MOVLW 40 |
807 |
0181: MOVWF 3F |
808 |
0204: MOVWF 45 |
808 |
.................... else |
809 |
.................... else |
809 |
0182: GOTO 184 |
810 |
0205: GOTO 207 |
810 |
.................... address=0; |
811 |
.................... address=0; |
811 |
0183: CLRF 3F |
812 |
0206: CLRF 45 |
812 |
.................... |
813 |
.................... |
813 |
.................... address+=x-1; |
814 |
.................... address+=x-1; |
814 |
0184: MOVLW 01 |
815 |
0207: MOVLW 01 |
815 |
0185: SUBWF 3D,W |
816 |
0208: SUBWF 43,W |
816 |
0186: ADDWF 3F,F |
817 |
0209: ADDWF 45,F |
817 |
.................... lcd_send_byte(0,0x80|address); |
818 |
.................... lcd_send_byte(0,0x80|address); |
818 |
0187: MOVF 3F,W |
819 |
020A: MOVF 45,W |
819 |
0188: IORLW 80 |
820 |
020B: IORLW 80 |
820 |
0189: MOVWF 40 |
821 |
020C: MOVWF 46 |
821 |
018A: CLRF 41 |
822 |
020D: CLRF 47 |
822 |
018B: MOVF 40,W |
823 |
020E: MOVF 46,W |
823 |
018C: MOVWF 42 |
824 |
020F: MOVWF 48 |
824 |
018D: CALL 0E9 |
825 |
0210: CALL 16C |
825 |
.................... |
826 |
.................... |
826 |
.................... #if defined(LCD_EXTENDED_NEWLINE) |
827 |
.................... #if defined(LCD_EXTENDED_NEWLINE) |
827 |
.................... g_LcdX = x - 1; |
828 |
.................... g_LcdX = x - 1; |
828 |
.................... g_LcdY = y - 1; |
829 |
.................... g_LcdY = y - 1; |
829 |
.................... #endif |
830 |
.................... #endif |
830 |
.................... } |
831 |
.................... } |
831 |
018E: RETURN |
832 |
0211: RETURN |
832 |
.................... |
833 |
.................... |
833 |
.................... void lcd_putc(char c) |
834 |
.................... void lcd_putc(char c) |
834 |
.................... { |
835 |
.................... { |
835 |
.................... switch (c) |
836 |
.................... switch (c) |
836 |
.................... { |
837 |
.................... { |
837 |
018F: MOVF 3C,W |
838 |
0212: MOVF 42,W |
838 |
0190: XORLW 07 |
839 |
0213: XORLW 07 |
839 |
0191: BTFSC 03.2 |
840 |
0214: BTFSC 03.2 |
840 |
0192: GOTO 19D |
841 |
0215: GOTO 220 |
841 |
0193: XORLW 0B |
842 |
0216: XORLW 0B |
842 |
0194: BTFSC 03.2 |
843 |
0217: BTFSC 03.2 |
843 |
0195: GOTO 1A2 |
844 |
0218: GOTO 225 |
844 |
0196: XORLW 06 |
845 |
0219: XORLW 06 |
845 |
0197: BTFSC 03.2 |
846 |
021A: BTFSC 03.2 |
846 |
0198: GOTO 1AA |
847 |
021B: GOTO 22D |
847 |
0199: XORLW 02 |
848 |
021C: XORLW 02 |
848 |
019A: BTFSC 03.2 |
849 |
021D: BTFSC 03.2 |
849 |
019B: GOTO 1B0 |
850 |
021E: GOTO 233 |
850 |
019C: GOTO 1B5 |
851 |
021F: GOTO 238 |
851 |
.................... case '\a' : lcd_gotoxy(1,1); break; |
852 |
.................... case '\a' : lcd_gotoxy(1,1); break; |
852 |
019D: MOVLW 01 |
853 |
0220: MOVLW 01 |
853 |
019E: MOVWF 3D |
854 |
0221: MOVWF 43 |
854 |
019F: MOVWF 3E |
855 |
0222: MOVWF 44 |
855 |
01A0: CALL 17D |
856 |
0223: CALL 200 |
856 |
01A1: GOTO 1BB |
857 |
0224: GOTO 23E |
857 |
.................... |
858 |
.................... |
858 |
.................... case '\f' : lcd_send_byte(0,1); |
859 |
.................... case '\f' : lcd_send_byte(0,1); |
859 |
01A2: CLRF 41 |
860 |
0225: CLRF 47 |
860 |
01A3: MOVLW 01 |
861 |
0226: MOVLW 01 |
861 |
01A4: MOVWF 42 |
862 |
0227: MOVWF 48 |
862 |
01A5: CALL 0E9 |
863 |
0228: CALL 16C |
863 |
.................... delay_ms(2); |
864 |
.................... delay_ms(2); |
864 |
01A6: MOVLW 02 |
865 |
0229: MOVLW 02 |
865 |
01A7: MOVWF 3D |
866 |
022A: MOVWF 43 |
866 |
01A8: CALL 078 |
867 |
022B: CALL 0FB |
867 |
.................... #if defined(LCD_EXTENDED_NEWLINE) |
868 |
.................... #if defined(LCD_EXTENDED_NEWLINE) |
868 |
.................... g_LcdX = 0; |
869 |
.................... g_LcdX = 0; |
869 |
.................... g_LcdY = 0; |
870 |
.................... g_LcdY = 0; |
870 |
.................... #endif |
871 |
.................... #endif |
871 |
.................... break; |
872 |
.................... break; |
872 |
01A9: GOTO 1BB |
873 |
022C: GOTO 23E |
873 |
.................... |
874 |
.................... |
874 |
.................... #if defined(LCD_EXTENDED_NEWLINE) |
875 |
.................... #if defined(LCD_EXTENDED_NEWLINE) |
875 |
.................... case '\r' : lcd_gotoxy(1, g_LcdY+1); break; |
876 |
.................... case '\r' : lcd_gotoxy(1, g_LcdY+1); break; |
876 |
.................... case '\n' : |
877 |
.................... case '\n' : |
877 |
.................... while (g_LcdX++ < LCD_LINE_LENGTH) |
878 |
.................... while (g_LcdX++ < LCD_LINE_LENGTH) |
Line 880... |
Line 881... |
880 |
.................... } |
881 |
.................... } |
881 |
.................... lcd_gotoxy(1, g_LcdY+2); |
882 |
.................... lcd_gotoxy(1, g_LcdY+2); |
882 |
.................... break; |
883 |
.................... break; |
883 |
.................... #else |
884 |
.................... #else |
884 |
.................... case '\n' : lcd_gotoxy(1,2); break; |
885 |
.................... case '\n' : lcd_gotoxy(1,2); break; |
885 |
01AA: MOVLW 01 |
886 |
022D: MOVLW 01 |
886 |
01AB: MOVWF 3D |
887 |
022E: MOVWF 43 |
887 |
01AC: MOVLW 02 |
888 |
022F: MOVLW 02 |
888 |
01AD: MOVWF 3E |
889 |
0230: MOVWF 44 |
889 |
01AE: CALL 17D |
890 |
0231: CALL 200 |
890 |
01AF: GOTO 1BB |
891 |
0232: GOTO 23E |
891 |
.................... #endif |
892 |
.................... #endif |
892 |
.................... |
893 |
.................... |
893 |
.................... case '\b' : lcd_send_byte(0,0x10); break; |
894 |
.................... case '\b' : lcd_send_byte(0,0x10); break; |
894 |
01B0: CLRF 41 |
895 |
0233: CLRF 47 |
895 |
01B1: MOVLW 10 |
896 |
0234: MOVLW 10 |
896 |
01B2: MOVWF 42 |
897 |
0235: MOVWF 48 |
897 |
01B3: CALL 0E9 |
898 |
0236: CALL 16C |
898 |
01B4: GOTO 1BB |
899 |
0237: GOTO 23E |
899 |
.................... |
900 |
.................... |
900 |
.................... #if defined(LCD_EXTENDED_NEWLINE) |
901 |
.................... #if defined(LCD_EXTENDED_NEWLINE) |
901 |
.................... default : |
902 |
.................... default : |
902 |
.................... if (g_LcdX < LCD_LINE_LENGTH) |
903 |
.................... if (g_LcdX < LCD_LINE_LENGTH) |
903 |
.................... { |
904 |
.................... { |
Line 905... |
Line 906... |
905 |
.................... g_LcdX++; |
906 |
.................... g_LcdX++; |
906 |
.................... } |
907 |
.................... } |
907 |
.................... break; |
908 |
.................... break; |
908 |
.................... #else |
909 |
.................... #else |
909 |
.................... default : lcd_send_byte(1,c); break; |
910 |
.................... default : lcd_send_byte(1,c); break; |
910 |
01B5: MOVLW 01 |
911 |
0238: MOVLW 01 |
911 |
01B6: MOVWF 41 |
912 |
0239: MOVWF 47 |
912 |
01B7: MOVF 3C,W |
913 |
023A: MOVF 42,W |
913 |
01B8: MOVWF 42 |
914 |
023B: MOVWF 48 |
914 |
01B9: CALL 0E9 |
915 |
023C: CALL 16C |
915 |
01BA: GOTO 1BB |
916 |
023D: GOTO 23E |
916 |
.................... #endif |
917 |
.................... #endif |
917 |
.................... } |
918 |
.................... } |
918 |
.................... } |
919 |
.................... } |
919 |
01BB: RETURN |
920 |
023E: RETURN |
920 |
.................... |
921 |
.................... |
921 |
.................... char lcd_getc(BYTE x, BYTE y) |
922 |
.................... char lcd_getc(BYTE x, BYTE y) |
922 |
.................... { |
923 |
.................... { |
923 |
.................... char value; |
924 |
.................... char value; |
924 |
.................... |
925 |
.................... |
Line 992... |
Line 993... |
992 |
.................... unsigned int8 MSB, LSB, Check; |
993 |
.................... unsigned int8 MSB, LSB, Check; |
993 |
.................... unsigned int16 data; |
994 |
.................... unsigned int16 data; |
994 |
.................... |
995 |
.................... |
995 |
.................... i2c_start(); |
996 |
.................... i2c_start(); |
996 |
* |
997 |
* |
997 |
052E: BSF 20.4 |
998 |
0567: BSF 20.4 |
998 |
052F: MOVF 20,W |
999 |
0568: MOVF 20,W |
999 |
0530: BSF 03.5 |
1000 |
0569: BSF 03.5 |
1000 |
0531: MOVWF 07 |
1001 |
056A: MOVWF 07 |
1001 |
0532: NOP |
1002 |
056B: NOP |
1002 |
0533: BCF 03.5 |
1003 |
056C: BCF 03.5 |
1003 |
0534: BSF 20.3 |
1004 |
056D: BSF 20.3 |
1004 |
0535: MOVF 20,W |
1005 |
056E: MOVF 20,W |
1005 |
0536: BSF 03.5 |
1006 |
056F: BSF 03.5 |
1006 |
0537: MOVWF 07 |
1007 |
0570: MOVWF 07 |
1007 |
0538: NOP |
1008 |
0571: NOP |
1008 |
0539: BCF 03.5 |
1009 |
0572: BCF 03.5 |
1009 |
053A: BTFSS 07.3 |
1010 |
0573: BTFSS 07.3 |
1010 |
053B: GOTO 53A |
1011 |
0574: GOTO 573 |
1011 |
053C: BCF 07.4 |
1012 |
0575: BCF 07.4 |
1012 |
053D: BCF 20.4 |
1013 |
0576: BCF 20.4 |
1013 |
053E: MOVF 20,W |
1014 |
0577: MOVF 20,W |
1014 |
053F: BSF 03.5 |
1015 |
0578: BSF 03.5 |
1015 |
0540: MOVWF 07 |
1016 |
0579: MOVWF 07 |
1016 |
0541: NOP |
1017 |
057A: NOP |
1017 |
0542: BCF 03.5 |
1018 |
057B: BCF 03.5 |
1018 |
0543: BCF 07.3 |
1019 |
057C: BCF 07.3 |
1019 |
0544: BCF 20.3 |
1020 |
057D: BCF 20.3 |
1020 |
0545: MOVF 20,W |
1021 |
057E: MOVF 20,W |
1021 |
0546: BSF 03.5 |
1022 |
057F: BSF 03.5 |
1022 |
0547: MOVWF 07 |
1023 |
0580: MOVWF 07 |
1023 |
.................... I2C_Write(SHT25_ADDR); |
1024 |
.................... I2C_Write(SHT25_ADDR); |
1024 |
0548: MOVLW 80 |
1025 |
0581: MOVLW 80 |
1025 |
0549: BCF 03.5 |
1026 |
0582: BCF 03.5 |
1026 |
054A: MOVWF 34 |
1027 |
0583: MOVWF 3B |
1027 |
054B: CALL 202 |
1028 |
0584: CALL 078 |
1028 |
.................... I2C_write(0xE3); |
1029 |
.................... I2C_write(0xE3); |
1029 |
054C: MOVLW E3 |
1030 |
0585: MOVLW E3 |
1030 |
054D: MOVWF 34 |
1031 |
0586: MOVWF 3B |
1031 |
054E: CALL 202 |
1032 |
0587: CALL 078 |
1032 |
.................... i2c_stop(); |
1033 |
.................... i2c_stop(); |
1033 |
054F: BCF 20.4 |
1034 |
0588: BCF 20.4 |
1034 |
0550: MOVF 20,W |
1035 |
0589: MOVF 20,W |
1035 |
0551: BSF 03.5 |
1036 |
058A: BSF 03.5 |
1036 |
0552: MOVWF 07 |
1037 |
058B: MOVWF 07 |
1037 |
0553: NOP |
1038 |
058C: NOP |
1038 |
0554: BCF 03.5 |
1039 |
058D: BCF 03.5 |
1039 |
0555: BSF 20.3 |
1040 |
058E: BSF 20.3 |
1040 |
0556: MOVF 20,W |
1041 |
058F: MOVF 20,W |
1041 |
0557: BSF 03.5 |
1042 |
0590: BSF 03.5 |
1042 |
0558: MOVWF 07 |
1043 |
0591: MOVWF 07 |
1043 |
0559: BCF 03.5 |
1044 |
0592: BCF 03.5 |
1044 |
055A: BTFSS 07.3 |
1045 |
0593: BTFSS 07.3 |
1045 |
055B: GOTO 55A |
1046 |
0594: GOTO 593 |
1046 |
055C: NOP |
1047 |
0595: NOP |
1047 |
055D: GOTO 55E |
1048 |
0596: GOTO 597 |
1048 |
055E: NOP |
1049 |
0597: NOP |
1049 |
055F: BSF 20.4 |
1050 |
0598: BSF 20.4 |
1050 |
0560: MOVF 20,W |
1051 |
0599: MOVF 20,W |
1051 |
0561: BSF 03.5 |
1052 |
059A: BSF 03.5 |
1052 |
0562: MOVWF 07 |
1053 |
059B: MOVWF 07 |
1053 |
0563: NOP |
1054 |
059C: NOP |
1054 |
.................... |
1055 |
.................... |
1055 |
.................... delay_ms(100); |
1056 |
.................... delay_ms(100); |
1056 |
0564: MOVLW 64 |
1057 |
059D: MOVLW 64 |
1057 |
0565: BCF 03.5 |
1058 |
059E: BCF 03.5 |
1058 |
0566: MOVWF 3D |
1059 |
059F: MOVWF 43 |
1059 |
0567: CALL 078 |
1060 |
05A0: CALL 0FB |
1060 |
.................... |
1061 |
.................... |
1061 |
.................... i2c_start(); |
1062 |
.................... i2c_start(); |
1062 |
0568: BSF 20.4 |
1063 |
05A1: BSF 20.4 |
1063 |
0569: MOVF 20,W |
1064 |
05A2: MOVF 20,W |
1064 |
056A: BSF 03.5 |
1065 |
05A3: BSF 03.5 |
1065 |
056B: MOVWF 07 |
1066 |
05A4: MOVWF 07 |
1066 |
056C: NOP |
1067 |
05A5: NOP |
1067 |
056D: BCF 03.5 |
1068 |
05A6: BCF 03.5 |
1068 |
056E: BSF 20.3 |
1069 |
05A7: BSF 20.3 |
1069 |
056F: MOVF 20,W |
1070 |
05A8: MOVF 20,W |
1070 |
0570: BSF 03.5 |
1071 |
05A9: BSF 03.5 |
1071 |
0571: MOVWF 07 |
1072 |
05AA: MOVWF 07 |
1072 |
0572: NOP |
1073 |
05AB: NOP |
1073 |
0573: BCF 03.5 |
1074 |
05AC: BCF 03.5 |
1074 |
0574: BCF 07.4 |
1075 |
05AD: BCF 07.4 |
1075 |
0575: BCF 20.4 |
1076 |
05AE: BCF 20.4 |
1076 |
0576: MOVF 20,W |
1077 |
05AF: MOVF 20,W |
1077 |
0577: BSF 03.5 |
1078 |
05B0: BSF 03.5 |
1078 |
0578: MOVWF 07 |
1079 |
05B1: MOVWF 07 |
1079 |
0579: NOP |
1080 |
05B2: NOP |
1080 |
057A: BCF 03.5 |
1081 |
05B3: BCF 03.5 |
1081 |
057B: BCF 07.3 |
1082 |
05B4: BCF 07.3 |
1082 |
057C: BCF 20.3 |
1083 |
05B5: BCF 20.3 |
1083 |
057D: MOVF 20,W |
1084 |
05B6: MOVF 20,W |
1084 |
057E: BSF 03.5 |
1085 |
05B7: BSF 03.5 |
1085 |
057F: MOVWF 07 |
1086 |
05B8: MOVWF 07 |
1086 |
.................... I2C_Write(SHT25_ADDR+1); |
1087 |
.................... I2C_Write(SHT25_ADDR+1); |
1087 |
0580: MOVLW 81 |
1088 |
05B9: MOVLW 81 |
1088 |
0581: BCF 03.5 |
1089 |
05BA: BCF 03.5 |
1089 |
0582: MOVWF 34 |
1090 |
05BB: MOVWF 3B |
1090 |
0583: CALL 202 |
1091 |
05BC: CALL 078 |
1091 |
.................... MSB=i2c_read(1); |
1092 |
.................... MSB=i2c_read(1); |
1092 |
0584: MOVLW 01 |
1093 |
05BD: MOVLW 01 |
1093 |
0585: MOVWF 77 |
1094 |
05BE: MOVWF 77 |
1094 |
0586: CALL 24C |
1095 |
05BF: CALL 285 |
1095 |
0587: MOVF 78,W |
1096 |
05C0: MOVF 78,W |
1096 |
0588: MOVWF 2F |
1097 |
05C1: MOVWF 35 |
1097 |
.................... LSB=i2c_read(1); |
1098 |
.................... LSB=i2c_read(1); |
1098 |
0589: MOVLW 01 |
1099 |
05C2: MOVLW 01 |
1099 |
058A: MOVWF 77 |
1100 |
05C3: MOVWF 77 |
1100 |
058B: CALL 24C |
1101 |
05C4: CALL 285 |
1101 |
058C: MOVF 78,W |
1102 |
05C5: MOVF 78,W |
1102 |
058D: MOVWF 30 |
1103 |
05C6: MOVWF 36 |
1103 |
.................... Check=i2c_read(0); |
1104 |
.................... Check=i2c_read(0); |
1104 |
058E: CLRF 77 |
1105 |
05C7: CLRF 77 |
1105 |
058F: CALL 24C |
1106 |
05C8: CALL 285 |
1106 |
0590: MOVF 78,W |
1107 |
05C9: MOVF 78,W |
1107 |
0591: MOVWF 31 |
1108 |
05CA: MOVWF 37 |
1108 |
.................... i2c_stop(); |
1109 |
.................... i2c_stop(); |
1109 |
0592: BCF 20.4 |
1110 |
05CB: BCF 20.4 |
1110 |
0593: MOVF 20,W |
1111 |
05CC: MOVF 20,W |
1111 |
0594: BSF 03.5 |
1112 |
05CD: BSF 03.5 |
1112 |
0595: MOVWF 07 |
1113 |
05CE: MOVWF 07 |
1113 |
0596: NOP |
1114 |
05CF: NOP |
1114 |
0597: BCF 03.5 |
1115 |
05D0: BCF 03.5 |
1115 |
0598: BSF 20.3 |
1116 |
05D1: BSF 20.3 |
1116 |
0599: MOVF 20,W |
1117 |
05D2: MOVF 20,W |
1117 |
059A: BSF 03.5 |
1118 |
05D3: BSF 03.5 |
1118 |
059B: MOVWF 07 |
1119 |
05D4: MOVWF 07 |
1119 |
059C: BCF 03.5 |
1120 |
05D5: BCF 03.5 |
1120 |
059D: BTFSS 07.3 |
1121 |
05D6: BTFSS 07.3 |
1121 |
059E: GOTO 59D |
1122 |
05D7: GOTO 5D6 |
1122 |
059F: NOP |
1123 |
05D8: NOP |
1123 |
05A0: GOTO 5A1 |
1124 |
05D9: GOTO 5DA |
1124 |
05A1: NOP |
1125 |
05DA: NOP |
1125 |
05A2: BSF 20.4 |
1126 |
05DB: BSF 20.4 |
1126 |
05A3: MOVF 20,W |
1127 |
05DC: MOVF 20,W |
1127 |
05A4: BSF 03.5 |
1128 |
05DD: BSF 03.5 |
1128 |
05A5: MOVWF 07 |
1129 |
05DE: MOVWF 07 |
1129 |
05A6: NOP |
1130 |
05DF: NOP |
1130 |
.................... |
1131 |
.................... |
1131 |
.................... LSB = LSB >> 2; // trow out status bits |
1132 |
.................... LSB = LSB >> 2; // trow out status bits |
1132 |
05A7: BCF 03.5 |
1133 |
05E0: BCF 03.5 |
1133 |
05A8: RRF 30,F |
1134 |
05E1: RRF 36,F |
1134 |
05A9: RRF 30,F |
1135 |
05E2: RRF 36,F |
1135 |
05AA: MOVLW 3F |
1136 |
05E3: MOVLW 3F |
1136 |
05AB: ANDWF 30,F |
1137 |
05E4: ANDWF 36,F |
1137 |
.................... |
1138 |
.................... |
1138 |
.................... data = (((unsigned int16) MSB << 8) + (LSB << 4)); |
1139 |
.................... data = (((unsigned int16) MSB << 8) + (LSB << 4)); |
1139 |
05AC: CLRF 35 |
1140 |
05E5: CLRF 3B |
1140 |
05AD: MOVF 2F,W |
1141 |
05E6: MOVF 35,W |
1141 |
05AE: MOVWF 34 |
1142 |
05E7: MOVWF 3A |
1142 |
05AF: MOVWF 35 |
1143 |
05E8: MOVWF 3B |
1143 |
05B0: CLRF 34 |
1144 |
05E9: CLRF 3A |
1144 |
05B1: SWAPF 30,W |
1145 |
05EA: SWAPF 36,W |
1145 |
05B2: MOVWF 77 |
1146 |
05EB: MOVWF 77 |
1146 |
05B3: MOVLW F0 |
1147 |
05EC: MOVLW F0 |
1147 |
05B4: ANDWF 77,F |
1148 |
05ED: ANDWF 77,F |
1148 |
05B5: MOVF 77,W |
1149 |
05EE: MOVF 77,W |
1149 |
05B6: ADDWF 34,W |
1150 |
05EF: ADDWF 3A,W |
1150 |
05B7: MOVWF 32 |
1151 |
05F0: MOVWF 38 |
1151 |
05B8: MOVF 35,W |
1152 |
05F1: MOVF 3B,W |
1152 |
05B9: MOVWF 33 |
1153 |
05F2: MOVWF 39 |
1153 |
05BA: BTFSC 03.0 |
1154 |
05F3: BTFSC 03.0 |
1154 |
05BB: INCF 33,F |
1155 |
05F4: INCF 39,F |
1155 |
.................... return(-46.85 + 175.72*((float)data/0xFFFF)); |
1156 |
.................... return(-46.85 + 175.72*((float)data/0xFFFF)); |
1156 |
05BC: MOVF 33,W |
1157 |
05F5: MOVF 39,W |
1157 |
05BD: MOVWF 35 |
1158 |
05F6: MOVWF 3B |
1158 |
05BE: MOVF 32,W |
1159 |
05F7: MOVF 38,W |
1159 |
05BF: MOVWF 34 |
1160 |
05F8: MOVWF 3A |
1160 |
05C0: CALL 291 |
1161 |
05F9: CALL 2CA |
1161 |
05C1: MOVF 77,W |
1162 |
05FA: MOVF 77,W |
1162 |
05C2: MOVWF 34 |
1163 |
05FB: MOVWF 3A |
1163 |
05C3: MOVF 78,W |
1164 |
05FC: MOVF 78,W |
1164 |
05C4: MOVWF 35 |
1165 |
05FD: MOVWF 3B |
1165 |
05C5: MOVF 79,W |
1166 |
05FE: MOVF 79,W |
1166 |
05C6: MOVWF 36 |
1167 |
05FF: MOVWF 3C |
1167 |
05C7: MOVF 7A,W |
1168 |
0600: MOVF 7A,W |
1168 |
05C8: MOVWF 37 |
1169 |
0601: MOVWF 3D |
1169 |
05C9: MOVWF 3B |
1170 |
0602: MOVWF 41 |
1170 |
05CA: MOVF 79,W |
1171 |
0603: MOVF 79,W |
1171 |
05CB: MOVWF 3A |
1172 |
0604: MOVWF 40 |
1172 |
05CC: MOVF 78,W |
1173 |
0605: MOVF 78,W |
1173 |
05CD: MOVWF 39 |
1174 |
0606: MOVWF 3F |
1174 |
05CE: MOVF 77,W |
1175 |
0607: MOVF 77,W |
1175 |
05CF: MOVWF 38 |
1176 |
0608: MOVWF 3E |
1176 |
05D0: CLRF 3F |
1177 |
0609: CLRF 45 |
1177 |
05D1: MOVLW FF |
1178 |
060A: MOVLW FF |
1178 |
05D2: MOVWF 3E |
1179 |
060B: MOVWF 44 |
1179 |
05D3: MOVLW 7F |
1180 |
060C: MOVLW 7F |
1180 |
05D4: MOVWF 3D |
1181 |
060D: MOVWF 43 |
1181 |
05D5: MOVLW 8E |
1182 |
060E: MOVLW 8E |
1182 |
05D6: MOVWF 3C |
1183 |
060F: MOVWF 42 |
1183 |
05D7: CALL 2AE |
1184 |
0610: CALL 2E7 |
1184 |
05D8: MOVLW 52 |
1185 |
0611: MOVLW 52 |
1185 |
05D9: MOVWF 3F |
1186 |
0612: MOVWF 45 |
1186 |
05DA: MOVLW B8 |
1187 |
0613: MOVLW B8 |
1187 |
05DB: MOVWF 3E |
1188 |
0614: MOVWF 44 |
1188 |
05DC: MOVLW 2F |
1189 |
0615: MOVLW 2F |
1189 |
05DD: MOVWF 3D |
1190 |
0616: MOVWF 43 |
1190 |
05DE: MOVLW 86 |
1191 |
0617: MOVLW 86 |
1191 |
05DF: MOVWF 3C |
1192 |
0618: MOVWF 42 |
1192 |
05E0: MOVF 7A,W |
1193 |
0619: MOVF 7A,W |
1193 |
05E1: MOVWF 43 |
1194 |
061A: MOVWF 49 |
1194 |
05E2: MOVF 79,W |
1195 |
061B: MOVF 79,W |
1195 |
05E3: MOVWF 42 |
1196 |
061C: MOVWF 48 |
1196 |
05E4: MOVF 78,W |
1197 |
061D: MOVF 78,W |
1197 |
05E5: MOVWF 41 |
1198 |
061E: MOVWF 47 |
1198 |
05E6: MOVF 77,W |
1199 |
061F: MOVF 77,W |
1199 |
05E7: MOVWF 40 |
1200 |
0620: MOVWF 46 |
1200 |
05E8: CALL 378 |
1201 |
0621: CALL 3B1 |
1201 |
05E9: BCF 03.1 |
1202 |
0622: BCF 03.1 |
1202 |
05EA: MOVLW 66 |
1203 |
0623: MOVLW 66 |
1203 |
05EB: MOVWF 37 |
1204 |
0624: MOVWF 3D |
1204 |
05EC: MOVWF 36 |
1205 |
0625: MOVWF 3C |
1205 |
05ED: MOVLW BB |
1206 |
0626: MOVLW BB |
1206 |
05EE: MOVWF 35 |
1207 |
0627: MOVWF 3B |
1207 |
05EF: MOVLW 84 |
1208 |
0628: MOVLW 84 |
1208 |
05F0: MOVWF 34 |
1209 |
0629: MOVWF 3A |
1209 |
05F1: MOVF 7A,W |
1210 |
062A: MOVF 7A,W |
1210 |
05F2: MOVWF 3B |
1211 |
062B: MOVWF 41 |
1211 |
05F3: MOVF 79,W |
1212 |
062C: MOVF 79,W |
1212 |
05F4: MOVWF 3A |
1213 |
062D: MOVWF 40 |
1213 |
05F5: MOVF 78,W |
1214 |
062E: MOVF 78,W |
1214 |
05F6: MOVWF 39 |
1215 |
062F: MOVWF 3F |
1215 |
05F7: MOVF 77,W |
1216 |
0630: MOVF 77,W |
1216 |
05F8: MOVWF 38 |
1217 |
0631: MOVWF 3E |
1217 |
05F9: CALL 3ED |
1218 |
0632: CALL 426 |
1218 |
.................... } |
1219 |
.................... } |
1219 |
05FA: BSF 0A.3 |
1220 |
0633: BSF 0A.3 |
1220 |
05FB: BCF 0A.4 |
1221 |
0634: BCF 0A.4 |
1221 |
05FC: GOTO 2E4 (RETURN) |
1222 |
0635: GOTO 38B (RETURN) |
1222 |
.................... |
1223 |
.................... |
1223 |
.................... float SHT25_get_hum() |
1224 |
.................... float SHT25_get_hum() |
1224 |
.................... { |
1225 |
.................... { |
1225 |
.................... unsigned int8 MSB, LSB, Check; |
1226 |
.................... unsigned int8 MSB, LSB, Check; |
1226 |
.................... unsigned int16 data; |
1227 |
.................... unsigned int16 data; |
1227 |
.................... |
1228 |
.................... |
1228 |
.................... i2c_start(); //RH |
1229 |
.................... i2c_start(); //RH |
1229 |
05FD: BSF 20.4 |
1230 |
0636: BSF 20.4 |
1230 |
05FE: MOVF 20,W |
1231 |
0637: MOVF 20,W |
1231 |
05FF: BSF 03.5 |
1232 |
0638: BSF 03.5 |
1232 |
0600: MOVWF 07 |
1233 |
0639: MOVWF 07 |
1233 |
0601: NOP |
1234 |
063A: NOP |
1234 |
0602: BCF 03.5 |
1235 |
063B: BCF 03.5 |
1235 |
0603: BSF 20.3 |
1236 |
063C: BSF 20.3 |
1236 |
0604: MOVF 20,W |
1237 |
063D: MOVF 20,W |
1237 |
0605: BSF 03.5 |
1238 |
063E: BSF 03.5 |
1238 |
0606: MOVWF 07 |
1239 |
063F: MOVWF 07 |
1239 |
0607: NOP |
1240 |
0640: NOP |
1240 |
0608: BCF 03.5 |
1241 |
0641: BCF 03.5 |
1241 |
0609: BCF 07.4 |
1242 |
0642: BCF 07.4 |
1242 |
060A: BCF 20.4 |
1243 |
0643: BCF 20.4 |
1243 |
060B: MOVF 20,W |
1244 |
0644: MOVF 20,W |
1244 |
060C: BSF 03.5 |
1245 |
0645: BSF 03.5 |
1245 |
060D: MOVWF 07 |
1246 |
0646: MOVWF 07 |
1246 |
060E: NOP |
1247 |
0647: NOP |
1247 |
060F: BCF 03.5 |
1248 |
0648: BCF 03.5 |
1248 |
0610: BCF 07.3 |
1249 |
0649: BCF 07.3 |
1249 |
0611: BCF 20.3 |
1250 |
064A: BCF 20.3 |
1250 |
0612: MOVF 20,W |
1251 |
064B: MOVF 20,W |
1251 |
0613: BSF 03.5 |
1252 |
064C: BSF 03.5 |
1252 |
0614: MOVWF 07 |
1253 |
064D: MOVWF 07 |
1253 |
.................... I2C_Write(SHT25_ADDR); |
1254 |
.................... I2C_Write(SHT25_ADDR); |
1254 |
0615: MOVLW 80 |
1255 |
064E: MOVLW 80 |
1255 |
0616: BCF 03.5 |
1256 |
064F: BCF 03.5 |
1256 |
0617: MOVWF 34 |
1257 |
0650: MOVWF 3B |
1257 |
0618: CALL 202 |
1258 |
0651: CALL 078 |
1258 |
.................... I2C_write(0xE5); |
1259 |
.................... I2C_write(0xE5); |
1259 |
0619: MOVLW E5 |
1260 |
0652: MOVLW E5 |
1260 |
061A: MOVWF 34 |
1261 |
0653: MOVWF 3B |
1261 |
061B: CALL 202 |
1262 |
0654: CALL 078 |
1262 |
.................... |
1263 |
.................... |
1263 |
.................... delay_ms(100); |
1264 |
.................... delay_ms(100); |
1264 |
061C: MOVLW 64 |
1265 |
0655: MOVLW 64 |
1265 |
061D: MOVWF 3D |
1266 |
0656: MOVWF 43 |
1266 |
061E: CALL 078 |
1267 |
0657: CALL 0FB |
1267 |
.................... |
1268 |
.................... |
1268 |
.................... i2c_start(); |
1269 |
.................... i2c_start(); |
1269 |
061F: BSF 20.4 |
1270 |
0658: BSF 20.4 |
1270 |
0620: MOVF 20,W |
1271 |
0659: MOVF 20,W |
1271 |
0621: BSF 03.5 |
1272 |
065A: BSF 03.5 |
1272 |
0622: MOVWF 07 |
1273 |
065B: MOVWF 07 |
1273 |
0623: NOP |
1274 |
065C: NOP |
1274 |
0624: BCF 03.5 |
1275 |
065D: BCF 03.5 |
1275 |
0625: BSF 20.3 |
1276 |
065E: BSF 20.3 |
1276 |
0626: MOVF 20,W |
1277 |
065F: MOVF 20,W |
1277 |
0627: BSF 03.5 |
1278 |
0660: BSF 03.5 |
1278 |
0628: MOVWF 07 |
1279 |
0661: MOVWF 07 |
1279 |
0629: NOP |
1280 |
0662: NOP |
1280 |
062A: BCF 03.5 |
1281 |
0663: BCF 03.5 |
1281 |
062B: BTFSS 07.3 |
1282 |
0664: BTFSS 07.3 |
1282 |
062C: GOTO 62B |
1283 |
0665: GOTO 664 |
1283 |
062D: BCF 07.4 |
1284 |
0666: BCF 07.4 |
1284 |
062E: BCF 20.4 |
1285 |
0667: BCF 20.4 |
1285 |
062F: MOVF 20,W |
1286 |
0668: MOVF 20,W |
1286 |
0630: BSF 03.5 |
1287 |
0669: BSF 03.5 |
1287 |
0631: MOVWF 07 |
1288 |
066A: MOVWF 07 |
1288 |
0632: NOP |
1289 |
066B: NOP |
1289 |
0633: BCF 03.5 |
1290 |
066C: BCF 03.5 |
1290 |
0634: BCF 07.3 |
1291 |
066D: BCF 07.3 |
1291 |
0635: BCF 20.3 |
1292 |
066E: BCF 20.3 |
1292 |
0636: MOVF 20,W |
1293 |
066F: MOVF 20,W |
1293 |
0637: BSF 03.5 |
1294 |
0670: BSF 03.5 |
1294 |
0638: MOVWF 07 |
1295 |
0671: MOVWF 07 |
1295 |
.................... I2C_Write(SHT25_ADDR+1); |
1296 |
.................... I2C_Write(SHT25_ADDR+1); |
1296 |
0639: MOVLW 81 |
1297 |
0672: MOVLW 81 |
1297 |
063A: BCF 03.5 |
1298 |
0673: BCF 03.5 |
1298 |
063B: MOVWF 34 |
1299 |
0674: MOVWF 3B |
1299 |
063C: CALL 202 |
1300 |
0675: CALL 078 |
1300 |
.................... MSB=i2c_read(1); |
1301 |
.................... MSB=i2c_read(1); |
1301 |
063D: MOVLW 01 |
1302 |
0676: MOVLW 01 |
1302 |
063E: MOVWF 77 |
1303 |
0677: MOVWF 77 |
1303 |
063F: CALL 24C |
1304 |
0678: CALL 285 |
1304 |
0640: MOVF 78,W |
1305 |
0679: MOVF 78,W |
1305 |
0641: MOVWF 2F |
1306 |
067A: MOVWF 35 |
1306 |
.................... LSB=i2c_read(1); |
1307 |
.................... LSB=i2c_read(1); |
1307 |
0642: MOVLW 01 |
1308 |
067B: MOVLW 01 |
1308 |
0643: MOVWF 77 |
1309 |
067C: MOVWF 77 |
1309 |
0644: CALL 24C |
1310 |
067D: CALL 285 |
1310 |
0645: MOVF 78,W |
1311 |
067E: MOVF 78,W |
1311 |
0646: MOVWF 30 |
1312 |
067F: MOVWF 36 |
1312 |
.................... Check=i2c_read(0); |
1313 |
.................... Check=i2c_read(0); |
1313 |
0647: CLRF 77 |
1314 |
0680: CLRF 77 |
1314 |
0648: CALL 24C |
1315 |
0681: CALL 285 |
1315 |
0649: MOVF 78,W |
1316 |
0682: MOVF 78,W |
1316 |
064A: MOVWF 31 |
1317 |
0683: MOVWF 37 |
1317 |
.................... i2c_stop(); |
1318 |
.................... i2c_stop(); |
1318 |
064B: BCF 20.4 |
1319 |
0684: BCF 20.4 |
1319 |
064C: MOVF 20,W |
1320 |
0685: MOVF 20,W |
1320 |
064D: BSF 03.5 |
1321 |
0686: BSF 03.5 |
1321 |
064E: MOVWF 07 |
1322 |
0687: MOVWF 07 |
1322 |
064F: NOP |
1323 |
0688: NOP |
1323 |
0650: BCF 03.5 |
1324 |
0689: BCF 03.5 |
1324 |
0651: BSF 20.3 |
1325 |
068A: BSF 20.3 |
1325 |
0652: MOVF 20,W |
1326 |
068B: MOVF 20,W |
1326 |
0653: BSF 03.5 |
1327 |
068C: BSF 03.5 |
1327 |
0654: MOVWF 07 |
1328 |
068D: MOVWF 07 |
1328 |
0655: BCF 03.5 |
1329 |
068E: BCF 03.5 |
1329 |
0656: BTFSS 07.3 |
1330 |
068F: BTFSS 07.3 |
1330 |
0657: GOTO 656 |
1331 |
0690: GOTO 68F |
1331 |
0658: NOP |
1332 |
0691: NOP |
1332 |
0659: GOTO 65A |
1333 |
0692: GOTO 693 |
1333 |
065A: NOP |
1334 |
0693: NOP |
1334 |
065B: BSF 20.4 |
1335 |
0694: BSF 20.4 |
1335 |
065C: MOVF 20,W |
1336 |
0695: MOVF 20,W |
1336 |
065D: BSF 03.5 |
1337 |
0696: BSF 03.5 |
1337 |
065E: MOVWF 07 |
1338 |
0697: MOVWF 07 |
1338 |
065F: NOP |
1339 |
0698: NOP |
1339 |
.................... |
1340 |
.................... |
1340 |
.................... LSB = LSB >> 2; // trow out status bits |
1341 |
.................... LSB = LSB >> 2; // trow out status bits |
1341 |
0660: BCF 03.5 |
1342 |
0699: BCF 03.5 |
1342 |
0661: RRF 30,F |
1343 |
069A: RRF 36,F |
1343 |
0662: RRF 30,F |
1344 |
069B: RRF 36,F |
1344 |
0663: MOVLW 3F |
1345 |
069C: MOVLW 3F |
1345 |
0664: ANDWF 30,F |
1346 |
069D: ANDWF 36,F |
1346 |
.................... |
1347 |
.................... |
1347 |
.................... data = (((unsigned int16) MSB << 8) + (LSB << 4) ); |
1348 |
.................... data = (((unsigned int16) MSB << 8) + (LSB << 4) ); |
1348 |
0665: CLRF 35 |
1349 |
069E: CLRF 3B |
1349 |
0666: MOVF 2F,W |
1350 |
069F: MOVF 35,W |
1350 |
0667: MOVWF 34 |
1351 |
06A0: MOVWF 3A |
1351 |
0668: MOVWF 35 |
1352 |
06A1: MOVWF 3B |
1352 |
0669: CLRF 34 |
1353 |
06A2: CLRF 3A |
1353 |
066A: SWAPF 30,W |
1354 |
06A3: SWAPF 36,W |
1354 |
066B: MOVWF 77 |
1355 |
06A4: MOVWF 77 |
1355 |
066C: MOVLW F0 |
1356 |
06A5: MOVLW F0 |
1356 |
066D: ANDWF 77,F |
1357 |
06A6: ANDWF 77,F |
1357 |
066E: MOVF 77,W |
1358 |
06A7: MOVF 77,W |
1358 |
066F: ADDWF 34,W |
1359 |
06A8: ADDWF 3A,W |
1359 |
0670: MOVWF 32 |
1360 |
06A9: MOVWF 38 |
1360 |
0671: MOVF 35,W |
1361 |
06AA: MOVF 3B,W |
1361 |
0672: MOVWF 33 |
1362 |
06AB: MOVWF 39 |
1362 |
0673: BTFSC 03.0 |
1363 |
06AC: BTFSC 03.0 |
1363 |
0674: INCF 33,F |
1364 |
06AD: INCF 39,F |
1364 |
.................... return( -6.0 + 125.0*((float)data/0xFFFF)); |
1365 |
.................... return( -6.0 + 125.0*((float)data/0xFFFF)); |
1365 |
0675: MOVF 33,W |
1366 |
06AE: MOVF 39,W |
1366 |
0676: MOVWF 35 |
1367 |
06AF: MOVWF 3B |
1367 |
0677: MOVF 32,W |
1368 |
06B0: MOVF 38,W |
1368 |
0678: MOVWF 34 |
1369 |
06B1: MOVWF 3A |
1369 |
0679: CALL 291 |
1370 |
06B2: CALL 2CA |
1370 |
067A: MOVF 77,W |
1371 |
06B3: MOVF 77,W |
1371 |
067B: MOVWF 34 |
1372 |
06B4: MOVWF 3A |
1372 |
067C: MOVF 78,W |
1373 |
06B5: MOVF 78,W |
1373 |
067D: MOVWF 35 |
1374 |
06B6: MOVWF 3B |
1374 |
067E: MOVF 79,W |
1375 |
06B7: MOVF 79,W |
1375 |
067F: MOVWF 36 |
1376 |
06B8: MOVWF 3C |
1376 |
0680: MOVF 7A,W |
1377 |
06B9: MOVF 7A,W |
1377 |
0681: MOVWF 37 |
1378 |
06BA: MOVWF 3D |
1378 |
0682: MOVWF 3B |
1379 |
06BB: MOVWF 41 |
1379 |
0683: MOVF 79,W |
1380 |
06BC: MOVF 79,W |
1380 |
0684: MOVWF 3A |
1381 |
06BD: MOVWF 40 |
1381 |
0685: MOVF 78,W |
1382 |
06BE: MOVF 78,W |
1382 |
0686: MOVWF 39 |
1383 |
06BF: MOVWF 3F |
1383 |
0687: MOVF 77,W |
1384 |
06C0: MOVF 77,W |
1384 |
0688: MOVWF 38 |
1385 |
06C1: MOVWF 3E |
1385 |
0689: CLRF 3F |
1386 |
06C2: CLRF 45 |
1386 |
068A: MOVLW FF |
1387 |
06C3: MOVLW FF |
1387 |
068B: MOVWF 3E |
1388 |
06C4: MOVWF 44 |
1388 |
068C: MOVLW 7F |
1389 |
06C5: MOVLW 7F |
1389 |
068D: MOVWF 3D |
1390 |
06C6: MOVWF 43 |
1390 |
068E: MOVLW 8E |
1391 |
06C7: MOVLW 8E |
1391 |
068F: MOVWF 3C |
1392 |
06C8: MOVWF 42 |
1392 |
0690: CALL 2AE |
1393 |
06C9: CALL 2E7 |
1393 |
0691: CLRF 3F |
1394 |
06CA: CLRF 45 |
1394 |
0692: CLRF 3E |
1395 |
06CB: CLRF 44 |
1395 |
0693: MOVLW 7A |
1396 |
06CC: MOVLW 7A |
1396 |
0694: MOVWF 3D |
1397 |
06CD: MOVWF 43 |
1397 |
0695: MOVLW 85 |
1398 |
06CE: MOVLW 85 |
1398 |
0696: MOVWF 3C |
1399 |
06CF: MOVWF 42 |
1399 |
0697: MOVF 7A,W |
1400 |
06D0: MOVF 7A,W |
1400 |
0698: MOVWF 43 |
1401 |
06D1: MOVWF 49 |
1401 |
0699: MOVF 79,W |
1402 |
06D2: MOVF 79,W |
1402 |
069A: MOVWF 42 |
1403 |
06D3: MOVWF 48 |
1403 |
069B: MOVF 78,W |
1404 |
06D4: MOVF 78,W |
1404 |
069C: MOVWF 41 |
1405 |
06D5: MOVWF 47 |
1405 |
069D: MOVF 77,W |
1406 |
06D6: MOVF 77,W |
1406 |
069E: MOVWF 40 |
1407 |
06D7: MOVWF 46 |
1407 |
069F: CALL 378 |
1408 |
06D8: CALL 3B1 |
1408 |
06A0: BCF 03.1 |
1409 |
06D9: BCF 03.1 |
1409 |
06A1: CLRF 37 |
1410 |
06DA: CLRF 3D |
1410 |
06A2: CLRF 36 |
1411 |
06DB: CLRF 3C |
1411 |
06A3: MOVLW C0 |
1412 |
06DC: MOVLW C0 |
1412 |
06A4: MOVWF 35 |
1413 |
06DD: MOVWF 3B |
1413 |
06A5: MOVLW 81 |
1414 |
06DE: MOVLW 81 |
1414 |
06A6: MOVWF 34 |
1415 |
06DF: MOVWF 3A |
1415 |
06A7: MOVF 7A,W |
1416 |
06E0: MOVF 7A,W |
1416 |
06A8: MOVWF 3B |
1417 |
06E1: MOVWF 41 |
1417 |
06A9: MOVF 79,W |
1418 |
06E2: MOVF 79,W |
1418 |
06AA: MOVWF 3A |
1419 |
06E3: MOVWF 40 |
1419 |
06AB: MOVF 78,W |
1420 |
06E4: MOVF 78,W |
1420 |
06AC: MOVWF 39 |
1421 |
06E5: MOVWF 3F |
1421 |
06AD: MOVF 77,W |
1422 |
06E6: MOVF 77,W |
1422 |
06AE: MOVWF 38 |
1423 |
06E7: MOVWF 3E |
1423 |
06AF: CALL 3ED |
1424 |
06E8: CALL 426 |
1424 |
.................... } |
1425 |
.................... } |
1425 |
06B0: BSF 0A.3 |
1426 |
06E9: BSF 0A.3 |
1426 |
06B1: BCF 0A.4 |
1427 |
06EA: BCF 0A.4 |
1427 |
06B2: GOTO 2EF (RETURN) |
1428 |
06EB: GOTO 396 (RETURN) |
1428 |
.................... |
1429 |
.................... |
1429 |
.................... |
1430 |
.................... |
1430 |
.................... |
1431 |
.................... |
1431 |
.................... |
1432 |
.................... |
1432 |
.................... #include "../LTS01.h" |
1433 |
.................... #include "../LTS01.h" |
Line 1441... |
Line 1442... |
1441 |
.................... unsigned int8 MSB; |
1442 |
.................... unsigned int8 MSB; |
1442 |
.................... unsigned int8 LSB; |
1443 |
.................... unsigned int8 LSB; |
1443 |
.................... signed int16 data; |
1444 |
.................... signed int16 data; |
1444 |
.................... |
1445 |
.................... |
1445 |
.................... i2c_start(); |
1446 |
.................... i2c_start(); |
1446 |
06B3: BSF 20.4 |
1447 |
06EC: BSF 20.4 |
1447 |
06B4: MOVF 20,W |
1448 |
06ED: MOVF 20,W |
1448 |
06B5: BSF 03.5 |
1449 |
06EE: BSF 03.5 |
1449 |
06B6: MOVWF 07 |
1450 |
06EF: MOVWF 07 |
1450 |
06B7: NOP |
1451 |
06F0: NOP |
1451 |
06B8: BCF 03.5 |
1452 |
06F1: BCF 03.5 |
1452 |
06B9: BSF 20.3 |
1453 |
06F2: BSF 20.3 |
1453 |
06BA: MOVF 20,W |
1454 |
06F3: MOVF 20,W |
1454 |
06BB: BSF 03.5 |
1455 |
06F4: BSF 03.5 |
1455 |
06BC: MOVWF 07 |
1456 |
06F5: MOVWF 07 |
1456 |
06BD: NOP |
1457 |
06F6: NOP |
1457 |
06BE: BCF 03.5 |
1458 |
06F7: BCF 03.5 |
1458 |
06BF: BCF 07.4 |
1459 |
06F8: BCF 07.4 |
1459 |
06C0: BCF 20.4 |
1460 |
06F9: BCF 20.4 |
1460 |
06C1: MOVF 20,W |
1461 |
06FA: MOVF 20,W |
1461 |
06C2: BSF 03.5 |
1462 |
06FB: BSF 03.5 |
1462 |
06C3: MOVWF 07 |
1463 |
06FC: MOVWF 07 |
1463 |
06C4: NOP |
1464 |
06FD: NOP |
1464 |
06C5: BCF 03.5 |
1465 |
06FE: BCF 03.5 |
1465 |
06C6: BCF 07.3 |
1466 |
06FF: BCF 07.3 |
1466 |
06C7: BCF 20.3 |
1467 |
0700: BCF 20.3 |
1467 |
06C8: MOVF 20,W |
1468 |
0701: MOVF 20,W |
1468 |
06C9: BSF 03.5 |
1469 |
0702: BSF 03.5 |
1469 |
06CA: MOVWF 07 |
1470 |
0703: MOVWF 07 |
1470 |
.................... I2C_Write(LTS01A_address); |
1471 |
.................... I2C_Write(LTS01A_address); |
1471 |
06CB: MOVLW 90 |
1472 |
0704: MOVLW 90 |
1472 |
06CC: BCF 03.5 |
1473 |
0705: BCF 03.5 |
1473 |
06CD: MOVWF 34 |
1474 |
0706: MOVWF 3B |
1474 |
06CE: CALL 202 |
1475 |
0707: CALL 078 |
1475 |
.................... I2C_write(0x00); |
1476 |
.................... I2C_write(0x00); |
1476 |
06CF: CLRF 34 |
1477 |
0708: CLRF 3B |
1477 |
06D0: CALL 202 |
1478 |
0709: CALL 078 |
1478 |
.................... i2c_stop(); |
1479 |
.................... i2c_stop(); |
1479 |
06D1: BCF 20.4 |
1480 |
070A: BCF 20.4 |
1480 |
06D2: MOVF 20,W |
1481 |
070B: MOVF 20,W |
1481 |
06D3: BSF 03.5 |
1482 |
070C: BSF 03.5 |
1482 |
06D4: MOVWF 07 |
1483 |
070D: MOVWF 07 |
1483 |
06D5: NOP |
1484 |
070E: NOP |
1484 |
06D6: BCF 03.5 |
1485 |
070F: BCF 03.5 |
1485 |
06D7: BSF 20.3 |
1486 |
0710: BSF 20.3 |
1486 |
06D8: MOVF 20,W |
1487 |
0711: MOVF 20,W |
1487 |
06D9: BSF 03.5 |
1488 |
0712: BSF 03.5 |
1488 |
06DA: MOVWF 07 |
1489 |
0713: MOVWF 07 |
1489 |
06DB: BCF 03.5 |
1490 |
0714: BCF 03.5 |
1490 |
06DC: BTFSS 07.3 |
1491 |
0715: BTFSS 07.3 |
1491 |
06DD: GOTO 6DC |
1492 |
0716: GOTO 715 |
1492 |
06DE: NOP |
1493 |
0717: NOP |
1493 |
06DF: GOTO 6E0 |
1494 |
0718: GOTO 719 |
1494 |
06E0: NOP |
1495 |
0719: NOP |
1495 |
06E1: BSF 20.4 |
1496 |
071A: BSF 20.4 |
1496 |
06E2: MOVF 20,W |
1497 |
071B: MOVF 20,W |
1497 |
06E3: BSF 03.5 |
1498 |
071C: BSF 03.5 |
1498 |
06E4: MOVWF 07 |
1499 |
071D: MOVWF 07 |
1499 |
06E5: NOP |
1500 |
071E: NOP |
1500 |
.................... i2c_start(); |
1501 |
.................... i2c_start(); |
1501 |
06E6: BCF 03.5 |
1502 |
071F: BCF 03.5 |
1502 |
06E7: BSF 20.4 |
1503 |
0720: BSF 20.4 |
1503 |
06E8: MOVF 20,W |
1504 |
0721: MOVF 20,W |
1504 |
06E9: BSF 03.5 |
1505 |
0722: BSF 03.5 |
1505 |
06EA: MOVWF 07 |
1506 |
0723: MOVWF 07 |
1506 |
06EB: NOP |
1507 |
0724: NOP |
1507 |
06EC: BCF 03.5 |
1508 |
0725: BCF 03.5 |
1508 |
06ED: BSF 20.3 |
1509 |
0726: BSF 20.3 |
1509 |
06EE: MOVF 20,W |
1510 |
0727: MOVF 20,W |
1510 |
06EF: BSF 03.5 |
1511 |
0728: BSF 03.5 |
1511 |
06F0: MOVWF 07 |
1512 |
0729: MOVWF 07 |
1512 |
06F1: NOP |
1513 |
072A: NOP |
1513 |
06F2: BCF 03.5 |
1514 |
072B: BCF 03.5 |
1514 |
06F3: BCF 07.4 |
1515 |
072C: BCF 07.4 |
1515 |
06F4: BCF 20.4 |
1516 |
072D: BCF 20.4 |
1516 |
06F5: MOVF 20,W |
1517 |
072E: MOVF 20,W |
1517 |
06F6: BSF 03.5 |
1518 |
072F: BSF 03.5 |
1518 |
06F7: MOVWF 07 |
1519 |
0730: MOVWF 07 |
1519 |
06F8: NOP |
1520 |
0731: NOP |
1520 |
06F9: BCF 03.5 |
1521 |
0732: BCF 03.5 |
1521 |
06FA: BCF 07.3 |
1522 |
0733: BCF 07.3 |
1522 |
06FB: BCF 20.3 |
1523 |
0734: BCF 20.3 |
1523 |
06FC: MOVF 20,W |
1524 |
0735: MOVF 20,W |
1524 |
06FD: BSF 03.5 |
1525 |
0736: BSF 03.5 |
1525 |
06FE: MOVWF 07 |
1526 |
0737: MOVWF 07 |
1526 |
.................... I2C_Write(LTS01A_address+1); |
1527 |
.................... I2C_Write(LTS01A_address+1); |
1527 |
06FF: MOVLW 91 |
1528 |
0738: MOVLW 91 |
1528 |
0700: BCF 03.5 |
1529 |
0739: BCF 03.5 |
1529 |
0701: MOVWF 34 |
1530 |
073A: MOVWF 3B |
1530 |
0702: CALL 202 |
1531 |
073B: CALL 078 |
1531 |
.................... MSB=i2c_read(1); |
1532 |
.................... MSB=i2c_read(1); |
1532 |
0703: MOVLW 01 |
1533 |
073C: MOVLW 01 |
1533 |
0704: MOVWF 77 |
1534 |
073D: MOVWF 77 |
1534 |
0705: CALL 24C |
1535 |
073E: CALL 285 |
1535 |
0706: MOVF 78,W |
1536 |
073F: MOVF 78,W |
1536 |
0707: MOVWF 2F |
1537 |
0740: MOVWF 35 |
1537 |
.................... LSB=i2c_read(0); |
1538 |
.................... LSB=i2c_read(0); |
1538 |
0708: CLRF 77 |
1539 |
0741: CLRF 77 |
1539 |
0709: CALL 24C |
1540 |
0742: CALL 285 |
1540 |
070A: MOVF 78,W |
1541 |
0743: MOVF 78,W |
1541 |
070B: MOVWF 30 |
1542 |
0744: MOVWF 36 |
1542 |
.................... i2c_stop(); |
1543 |
.................... i2c_stop(); |
1543 |
070C: BCF 20.4 |
1544 |
0745: BCF 20.4 |
1544 |
070D: MOVF 20,W |
1545 |
0746: MOVF 20,W |
1545 |
070E: BSF 03.5 |
1546 |
0747: BSF 03.5 |
1546 |
070F: MOVWF 07 |
1547 |
0748: MOVWF 07 |
1547 |
0710: NOP |
1548 |
0749: NOP |
1548 |
0711: BCF 03.5 |
1549 |
074A: BCF 03.5 |
1549 |
0712: BSF 20.3 |
1550 |
074B: BSF 20.3 |
1550 |
0713: MOVF 20,W |
1551 |
074C: MOVF 20,W |
1551 |
0714: BSF 03.5 |
1552 |
074D: BSF 03.5 |
1552 |
0715: MOVWF 07 |
1553 |
074E: MOVWF 07 |
1553 |
0716: BCF 03.5 |
1554 |
074F: BCF 03.5 |
1554 |
0717: BTFSS 07.3 |
1555 |
0750: BTFSS 07.3 |
1555 |
0718: GOTO 717 |
1556 |
0751: GOTO 750 |
1556 |
0719: NOP |
1557 |
0752: NOP |
1557 |
071A: GOTO 71B |
1558 |
0753: GOTO 754 |
1558 |
071B: NOP |
1559 |
0754: NOP |
1559 |
071C: BSF 20.4 |
1560 |
0755: BSF 20.4 |
1560 |
071D: MOVF 20,W |
1561 |
0756: MOVF 20,W |
1561 |
071E: BSF 03.5 |
1562 |
0757: BSF 03.5 |
1562 |
071F: MOVWF 07 |
1563 |
0758: MOVWF 07 |
1563 |
0720: NOP |
1564 |
0759: NOP |
1564 |
.................... |
1565 |
.................... |
1565 |
.................... data = MAKE16(MSB,LSB); |
1566 |
.................... data = MAKE16(MSB,LSB); |
1566 |
0721: BCF 03.5 |
1567 |
075A: BCF 03.5 |
1567 |
0722: MOVF 2F,W |
1568 |
075B: MOVF 35,W |
1568 |
0723: MOVWF 32 |
1569 |
075C: MOVWF 38 |
1569 |
0724: MOVF 30,W |
1570 |
075D: MOVF 36,W |
1570 |
0725: MOVWF 31 |
1571 |
075E: MOVWF 37 |
1571 |
.................... |
1572 |
.................... |
1572 |
.................... return (data * 0.00390625 ); |
1573 |
.................... return (data * 0.00390625 ); |
1573 |
0726: MOVF 32,W |
1574 |
075F: MOVF 38,W |
1574 |
0727: MOVWF 34 |
1575 |
0760: MOVWF 3A |
1575 |
0728: MOVF 31,W |
1576 |
0761: MOVF 37,W |
1576 |
0729: MOVWF 33 |
1577 |
0762: MOVWF 39 |
1577 |
072A: MOVF 34,W |
1578 |
0763: MOVF 3A,W |
1578 |
072B: MOVWF 36 |
1579 |
0764: MOVWF 3C |
1579 |
072C: MOVF 33,W |
1580 |
0765: MOVF 39,W |
1580 |
072D: MOVWF 35 |
1581 |
0766: MOVWF 3B |
1581 |
* |
1582 |
* |
1582 |
0752: MOVF 7A,W |
1583 |
078B: MOVF 7A,W |
1583 |
0753: MOVWF 3F |
1584 |
078C: MOVWF 45 |
1584 |
0754: MOVF 79,W |
1585 |
078D: MOVF 79,W |
1585 |
0755: MOVWF 3E |
1586 |
078E: MOVWF 44 |
1586 |
0756: MOVF 78,W |
1587 |
078F: MOVF 78,W |
1587 |
0757: MOVWF 3D |
1588 |
0790: MOVWF 43 |
1588 |
0758: MOVF 77,W |
1589 |
0791: MOVF 77,W |
1589 |
0759: MOVWF 3C |
1590 |
0792: MOVWF 42 |
1590 |
075A: CLRF 43 |
1591 |
0793: CLRF 49 |
1591 |
075B: CLRF 42 |
1592 |
0794: CLRF 48 |
1592 |
075C: CLRF 41 |
1593 |
0795: CLRF 47 |
1593 |
075D: MOVLW 77 |
1594 |
0796: MOVLW 77 |
1594 |
075E: MOVWF 40 |
1595 |
0797: MOVWF 46 |
1595 |
075F: CALL 378 |
1596 |
0798: CALL 3B1 |
1596 |
.................... |
1597 |
.................... |
1597 |
.................... } |
1598 |
.................... } |
1598 |
0760: BSF 0A.3 |
1599 |
0799: BSF 0A.3 |
1599 |
0761: BCF 0A.4 |
1600 |
079A: BCF 0A.4 |
1600 |
0762: GOTO 2FA (RETURN) |
1601 |
079B: GOTO 3A1 (RETURN) |
- |
|
1602 |
.................... |
- |
|
1603 |
.................... |
- |
|
1604 |
.................... |
- |
|
1605 |
.................... #include "./HMC5883L.h" |
- |
|
1606 |
.................... // i2c slave addresses |
- |
|
1607 |
.................... #define HMC5883L_WRT_ADDR 0x3C |
- |
|
1608 |
.................... #define HMC5883L_READ_ADDR 0x3D |
- |
|
1609 |
.................... |
- |
|
1610 |
.................... // Register addresses |
- |
|
1611 |
.................... #define HMC5883L_CFG_A_REG 0x00 |
- |
|
1612 |
.................... #define HMC5883L_CFG_B_REG 0x01 |
- |
|
1613 |
.................... #define HMC5883L_MODE_REG 0x02 |
- |
|
1614 |
.................... #define HMC5883L_X_MSB_REG 0x03 |
- |
|
1615 |
.................... |
- |
|
1616 |
.................... //Konstanty nastavujici rozsah |
- |
|
1617 |
.................... //pro void set_mag_roz (unsigned int8 h) |
- |
|
1618 |
.................... #define MAG_ROZ088 0x00 |
- |
|
1619 |
.................... #define MAG_ROZ130 0x20 |
- |
|
1620 |
.................... #define MAG_ROZ190 0x40 |
- |
|
1621 |
.................... #define MAG_ROZ250 0x60 |
- |
|
1622 |
.................... #define MAG_ROZ400 0x80 |
- |
|
1623 |
.................... #define MAG_ROZ470 0xA0 |
- |
|
1624 |
.................... #define MAG_ROZ560 0xC0 |
- |
|
1625 |
.................... #define MAG_ROZ810 0xE0 |
- |
|
1626 |
.................... |
- |
|
1627 |
.................... |
- |
|
1628 |
.................... #include "HMC5883L.c" |
- |
|
1629 |
.................... //------------------------------ |
- |
|
1630 |
.................... // Low level routines |
- |
|
1631 |
.................... //------------------------------ |
- |
|
1632 |
.................... void hmc5883l_write_reg(int8 reg, int8 data) |
- |
|
1633 |
.................... { |
- |
|
1634 |
.................... i2c_start(); |
- |
|
1635 |
* |
- |
|
1636 |
00C2: BSF 20.4 |
- |
|
1637 |
00C3: MOVF 20,W |
- |
|
1638 |
00C4: BSF 03.5 |
- |
|
1639 |
00C5: MOVWF 07 |
- |
|
1640 |
00C6: NOP |
- |
|
1641 |
00C7: BCF 03.5 |
- |
|
1642 |
00C8: BSF 20.3 |
- |
|
1643 |
00C9: MOVF 20,W |
- |
|
1644 |
00CA: BSF 03.5 |
- |
|
1645 |
00CB: MOVWF 07 |
- |
|
1646 |
00CC: NOP |
- |
|
1647 |
00CD: BCF 03.5 |
- |
|
1648 |
00CE: BCF 07.4 |
- |
|
1649 |
00CF: BCF 20.4 |
- |
|
1650 |
00D0: MOVF 20,W |
- |
|
1651 |
00D1: BSF 03.5 |
- |
|
1652 |
00D2: MOVWF 07 |
- |
|
1653 |
00D3: NOP |
- |
|
1654 |
00D4: BCF 03.5 |
- |
|
1655 |
00D5: BCF 07.3 |
- |
|
1656 |
00D6: BCF 20.3 |
- |
|
1657 |
00D7: MOVF 20,W |
- |
|
1658 |
00D8: BSF 03.5 |
- |
|
1659 |
00D9: MOVWF 07 |
- |
|
1660 |
.................... i2c_write(HMC5883L_WRT_ADDR); |
- |
|
1661 |
00DA: MOVLW 3C |
- |
|
1662 |
00DB: BCF 03.5 |
- |
|
1663 |
00DC: MOVWF 3B |
- |
|
1664 |
00DD: CALL 078 |
- |
|
1665 |
.................... i2c_write(reg); |
- |
|
1666 |
00DE: MOVF 35,W |
- |
|
1667 |
00DF: MOVWF 3B |
- |
|
1668 |
00E0: CALL 078 |
- |
|
1669 |
.................... i2c_write(data); |
- |
|
1670 |
00E1: MOVF 36,W |
- |
|
1671 |
00E2: MOVWF 3B |
- |
|
1672 |
00E3: CALL 078 |
- |
|
1673 |
.................... i2c_stop(); |
- |
|
1674 |
00E4: BCF 20.4 |
- |
|
1675 |
00E5: MOVF 20,W |
- |
|
1676 |
00E6: BSF 03.5 |
- |
|
1677 |
00E7: MOVWF 07 |
- |
|
1678 |
00E8: NOP |
- |
|
1679 |
00E9: BCF 03.5 |
- |
|
1680 |
00EA: BSF 20.3 |
- |
|
1681 |
00EB: MOVF 20,W |
- |
|
1682 |
00EC: BSF 03.5 |
- |
|
1683 |
00ED: MOVWF 07 |
- |
|
1684 |
00EE: BCF 03.5 |
- |
|
1685 |
00EF: BTFSS 07.3 |
- |
|
1686 |
00F0: GOTO 0EF |
- |
|
1687 |
00F1: NOP |
- |
|
1688 |
00F2: GOTO 0F3 |
- |
|
1689 |
00F3: NOP |
- |
|
1690 |
00F4: BSF 20.4 |
- |
|
1691 |
00F5: MOVF 20,W |
- |
|
1692 |
00F6: BSF 03.5 |
- |
|
1693 |
00F7: MOVWF 07 |
- |
|
1694 |
00F8: NOP |
- |
|
1695 |
.................... } |
- |
|
1696 |
00F9: BCF 03.5 |
- |
|
1697 |
00FA: RETURN |
- |
|
1698 |
.................... |
- |
|
1699 |
.................... //------------------------------ |
- |
|
1700 |
.................... int8 hmc5883l_read_reg(int8 reg) |
- |
|
1701 |
.................... { |
- |
|
1702 |
.................... int8 retval; |
- |
|
1703 |
.................... |
- |
|
1704 |
.................... i2c_start(); |
- |
|
1705 |
.................... i2c_write(HMC5883L_WRT_ADDR); |
- |
|
1706 |
.................... i2c_write(reg); |
- |
|
1707 |
.................... i2c_start(); |
- |
|
1708 |
.................... i2c_write(HMC5883L_READ_ADDR); |
- |
|
1709 |
.................... retval = i2c_read(0); |
- |
|
1710 |
.................... i2c_stop(); |
- |
|
1711 |
.................... |
- |
|
1712 |
.................... return(retval); |
- |
|
1713 |
.................... } |
- |
|
1714 |
.................... |
- |
|
1715 |
.................... //------------------------------ |
- |
|
1716 |
.................... typedef struct |
- |
|
1717 |
.................... { |
- |
|
1718 |
.................... signed int16 x; |
- |
|
1719 |
.................... signed int16 y; |
- |
|
1720 |
.................... signed int16 z; |
- |
|
1721 |
.................... }hmc5883l_result; |
- |
|
1722 |
.................... |
- |
|
1723 |
.................... // This global structure holds the values read |
- |
|
1724 |
.................... // from the HMC5883L x,y,z registers. |
- |
|
1725 |
.................... hmc5883l_result compass = {0,0,0}; |
- |
|
1726 |
* |
- |
|
1727 |
0ADB: CLRF 21 |
- |
|
1728 |
0ADC: CLRF 22 |
- |
|
1729 |
0ADD: CLRF 23 |
- |
|
1730 |
0ADE: CLRF 24 |
- |
|
1731 |
0ADF: CLRF 25 |
- |
|
1732 |
0AE0: CLRF 26 |
- |
|
1733 |
.................... |
- |
|
1734 |
.................... //------------------------------ |
- |
|
1735 |
.................... void hmc5883l_read_data(void) |
- |
|
1736 |
.................... { |
- |
|
1737 |
.................... unsigned int8 x_lsb; |
- |
|
1738 |
.................... unsigned int8 x_msb; |
- |
|
1739 |
.................... |
- |
|
1740 |
.................... unsigned int8 y_lsb; |
- |
|
1741 |
.................... unsigned int8 y_msb; |
- |
|
1742 |
.................... |
- |
|
1743 |
.................... unsigned int8 z_lsb; |
- |
|
1744 |
.................... unsigned int8 z_msb; |
- |
|
1745 |
.................... |
- |
|
1746 |
.................... i2c_start(); |
- |
|
1747 |
* |
- |
|
1748 |
0800: BSF 20.4 |
- |
|
1749 |
0801: MOVF 20,W |
- |
|
1750 |
0802: BSF 03.5 |
- |
|
1751 |
0803: MOVWF 07 |
- |
|
1752 |
0804: NOP |
- |
|
1753 |
0805: BCF 03.5 |
- |
|
1754 |
0806: BSF 20.3 |
- |
|
1755 |
0807: MOVF 20,W |
- |
|
1756 |
0808: BSF 03.5 |
- |
|
1757 |
0809: MOVWF 07 |
- |
|
1758 |
080A: NOP |
- |
|
1759 |
080B: BCF 03.5 |
- |
|
1760 |
080C: BCF 07.4 |
- |
|
1761 |
080D: BCF 20.4 |
- |
|
1762 |
080E: MOVF 20,W |
- |
|
1763 |
080F: BSF 03.5 |
- |
|
1764 |
0810: MOVWF 07 |
- |
|
1765 |
0811: NOP |
- |
|
1766 |
0812: BCF 03.5 |
- |
|
1767 |
0813: BCF 07.3 |
- |
|
1768 |
0814: BCF 20.3 |
- |
|
1769 |
0815: MOVF 20,W |
- |
|
1770 |
0816: BSF 03.5 |
- |
|
1771 |
0817: MOVWF 07 |
- |
|
1772 |
.................... i2c_write(HMC5883L_WRT_ADDR); |
- |
|
1773 |
0818: MOVLW 3C |
- |
|
1774 |
0819: BCF 03.5 |
- |
|
1775 |
081A: MOVWF 3B |
- |
|
1776 |
081B: BCF 0A.3 |
- |
|
1777 |
081C: CALL 078 |
- |
|
1778 |
081D: BSF 0A.3 |
- |
|
1779 |
.................... i2c_write(HMC5883L_X_MSB_REG); // Point to X-msb register |
- |
|
1780 |
081E: MOVLW 03 |
- |
|
1781 |
081F: MOVWF 3B |
- |
|
1782 |
0820: BCF 0A.3 |
- |
|
1783 |
0821: CALL 078 |
- |
|
1784 |
0822: BSF 0A.3 |
- |
|
1785 |
.................... i2c_start(); |
- |
|
1786 |
0823: BSF 20.4 |
- |
|
1787 |
0824: MOVF 20,W |
- |
|
1788 |
0825: BSF 03.5 |
- |
|
1789 |
0826: MOVWF 07 |
- |
|
1790 |
0827: NOP |
- |
|
1791 |
0828: BCF 03.5 |
- |
|
1792 |
0829: BSF 20.3 |
- |
|
1793 |
082A: MOVF 20,W |
- |
|
1794 |
082B: BSF 03.5 |
- |
|
1795 |
082C: MOVWF 07 |
- |
|
1796 |
082D: NOP |
- |
|
1797 |
082E: BCF 03.5 |
- |
|
1798 |
082F: BTFSS 07.3 |
- |
|
1799 |
0830: GOTO 02F |
- |
|
1800 |
0831: BCF 07.4 |
- |
|
1801 |
0832: BCF 20.4 |
- |
|
1802 |
0833: MOVF 20,W |
- |
|
1803 |
0834: BSF 03.5 |
- |
|
1804 |
0835: MOVWF 07 |
- |
|
1805 |
0836: NOP |
- |
|
1806 |
0837: BCF 03.5 |
- |
|
1807 |
0838: BCF 07.3 |
- |
|
1808 |
0839: BCF 20.3 |
- |
|
1809 |
083A: MOVF 20,W |
- |
|
1810 |
083B: BSF 03.5 |
- |
|
1811 |
083C: MOVWF 07 |
- |
|
1812 |
.................... i2c_write(HMC5883L_READ_ADDR); |
- |
|
1813 |
083D: MOVLW 3D |
- |
|
1814 |
083E: BCF 03.5 |
- |
|
1815 |
083F: MOVWF 3B |
- |
|
1816 |
0840: BCF 0A.3 |
- |
|
1817 |
0841: CALL 078 |
- |
|
1818 |
0842: BSF 0A.3 |
- |
|
1819 |
.................... |
- |
|
1820 |
.................... x_msb = i2c_read(); |
- |
|
1821 |
0843: MOVLW 01 |
- |
|
1822 |
0844: MOVWF 77 |
- |
|
1823 |
0845: BCF 0A.3 |
- |
|
1824 |
0846: CALL 285 |
- |
|
1825 |
0847: BSF 0A.3 |
- |
|
1826 |
0848: MOVF 78,W |
- |
|
1827 |
0849: MOVWF 36 |
- |
|
1828 |
.................... x_lsb = i2c_read(); |
- |
|
1829 |
084A: MOVLW 01 |
- |
|
1830 |
084B: MOVWF 77 |
- |
|
1831 |
084C: BCF 0A.3 |
- |
|
1832 |
084D: CALL 285 |
- |
|
1833 |
084E: BSF 0A.3 |
- |
|
1834 |
084F: MOVF 78,W |
- |
|
1835 |
0850: MOVWF 35 |
- |
|
1836 |
.................... |
- |
|
1837 |
.................... z_msb = i2c_read(); |
- |
|
1838 |
0851: MOVLW 01 |
- |
|
1839 |
0852: MOVWF 77 |
- |
|
1840 |
0853: BCF 0A.3 |
- |
|
1841 |
0854: CALL 285 |
- |
|
1842 |
0855: BSF 0A.3 |
- |
|
1843 |
0856: MOVF 78,W |
- |
|
1844 |
0857: MOVWF 3A |
- |
|
1845 |
.................... z_lsb = i2c_read(); |
- |
|
1846 |
0858: MOVLW 01 |
- |
|
1847 |
0859: MOVWF 77 |
- |
|
1848 |
085A: BCF 0A.3 |
- |
|
1849 |
085B: CALL 285 |
- |
|
1850 |
085C: BSF 0A.3 |
- |
|
1851 |
085D: MOVF 78,W |
- |
|
1852 |
085E: MOVWF 39 |
- |
|
1853 |
.................... |
- |
|
1854 |
.................... y_msb = i2c_read(); |
- |
|
1855 |
085F: MOVLW 01 |
- |
|
1856 |
0860: MOVWF 77 |
- |
|
1857 |
0861: BCF 0A.3 |
- |
|
1858 |
0862: CALL 285 |
- |
|
1859 |
0863: BSF 0A.3 |
- |
|
1860 |
0864: MOVF 78,W |
- |
|
1861 |
0865: MOVWF 38 |
- |
|
1862 |
.................... y_lsb = i2c_read(0); // do a NACK on last read |
- |
|
1863 |
0866: CLRF 77 |
- |
|
1864 |
0867: BCF 0A.3 |
- |
|
1865 |
0868: CALL 285 |
- |
|
1866 |
0869: BSF 0A.3 |
- |
|
1867 |
086A: MOVF 78,W |
- |
|
1868 |
086B: MOVWF 37 |
- |
|
1869 |
.................... |
- |
|
1870 |
.................... i2c_stop(); |
- |
|
1871 |
086C: BCF 20.4 |
- |
|
1872 |
086D: MOVF 20,W |
- |
|
1873 |
086E: BSF 03.5 |
- |
|
1874 |
086F: MOVWF 07 |
- |
|
1875 |
0870: NOP |
- |
|
1876 |
0871: BCF 03.5 |
- |
|
1877 |
0872: BSF 20.3 |
- |
|
1878 |
0873: MOVF 20,W |
- |
|
1879 |
0874: BSF 03.5 |
- |
|
1880 |
0875: MOVWF 07 |
- |
|
1881 |
0876: BCF 03.5 |
- |
|
1882 |
0877: BTFSS 07.3 |
- |
|
1883 |
0878: GOTO 077 |
- |
|
1884 |
0879: NOP |
- |
|
1885 |
087A: GOTO 07B |
- |
|
1886 |
087B: NOP |
- |
|
1887 |
087C: BSF 20.4 |
- |
|
1888 |
087D: MOVF 20,W |
- |
|
1889 |
087E: BSF 03.5 |
- |
|
1890 |
087F: MOVWF 07 |
- |
|
1891 |
0880: NOP |
- |
|
1892 |
.................... |
- |
|
1893 |
.................... // Combine high and low bytes into 16-bit values. |
- |
|
1894 |
.................... compass.x = make16(x_msb, x_lsb); |
- |
|
1895 |
0881: BCF 03.5 |
- |
|
1896 |
0882: MOVF 36,W |
- |
|
1897 |
0883: MOVWF 22 |
- |
|
1898 |
0884: MOVF 35,W |
- |
|
1899 |
0885: MOVWF 21 |
- |
|
1900 |
.................... compass.y = make16(y_msb, y_lsb); |
- |
|
1901 |
0886: MOVF 38,W |
- |
|
1902 |
0887: MOVWF 24 |
- |
|
1903 |
0888: MOVF 37,W |
- |
|
1904 |
0889: MOVWF 23 |
- |
|
1905 |
.................... compass.z = make16(z_msb, z_lsb); |
- |
|
1906 |
088A: MOVF 3A,W |
- |
|
1907 |
088B: MOVWF 26 |
- |
|
1908 |
088C: MOVF 39,W |
- |
|
1909 |
088D: MOVWF 25 |
- |
|
1910 |
.................... } |
- |
|
1911 |
088E: BSF 0A.3 |
- |
|
1912 |
088F: BCF 0A.4 |
- |
|
1913 |
0890: GOTO 3AB (RETURN) |
- |
|
1914 |
.................... |
- |
|
1915 |
.................... |
- |
|
1916 |
.................... |
- |
|
1917 |
.................... |
- |
|
1918 |
.................... #include <math.h> |
- |
|
1919 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
1920 |
.................... //// (C) Copyright 1996,2008 Custom Computer Services //// |
- |
|
1921 |
.................... //// This source code may only be used by licensed users of the CCS C //// |
- |
|
1922 |
.................... //// compiler. This source code may only be distributed to other //// |
- |
|
1923 |
.................... //// licensed users of the CCS C compiler. No other use, reproduction //// |
- |
|
1924 |
.................... //// or distribution is permitted without written permission. //// |
- |
|
1925 |
.................... //// Derivative programs created using this software in object code //// |
- |
|
1926 |
.................... //// form are not restricted in any way. //// |
- |
|
1927 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
1928 |
.................... //// //// |
- |
|
1929 |
.................... //// History: //// |
- |
|
1930 |
.................... //// * 9/20/2001 : Improvments are made to sin/cos code. //// |
- |
|
1931 |
.................... //// The code now is small, much faster, //// |
- |
|
1932 |
.................... //// and more accurate. //// |
- |
|
1933 |
.................... //// * 2/21/2007 : Compiler handles & operator differently and does |
- |
|
1934 |
.................... //// not return generic (int8 *) so type cast is done //// |
- |
|
1935 |
.................... //// //// |
- |
|
1936 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
1937 |
.................... |
- |
|
1938 |
.................... #ifndef MATH_H |
- |
|
1939 |
.................... #define MATH_H |
- |
|
1940 |
.................... |
- |
|
1941 |
.................... #ifdef PI |
- |
|
1942 |
.................... #undef PI |
- |
|
1943 |
.................... #endif |
- |
|
1944 |
.................... #define PI 3.1415926535897932 |
- |
|
1945 |
.................... |
- |
|
1946 |
.................... |
- |
|
1947 |
.................... #define SQRT2 1.4142135623730950 |
- |
|
1948 |
.................... |
- |
|
1949 |
.................... //float const ps[4] = {5.9304945, 21.125224, 8.9403076, 0.29730279}; |
- |
|
1950 |
.................... //float const qs[4] = {1.0000000, 15.035723, 17.764134, 2.4934718}; |
- |
|
1951 |
.................... |
- |
|
1952 |
.................... ///////////////////////////// Round Functions ////////////////////////////// |
- |
|
1953 |
.................... |
- |
|
1954 |
.................... float32 CEIL_FLOOR(float32 x, unsigned int8 n) |
- |
|
1955 |
.................... { |
- |
|
1956 |
.................... float32 y, res; |
- |
|
1957 |
.................... unsigned int16 l; |
- |
|
1958 |
.................... int1 s; |
- |
|
1959 |
.................... |
- |
|
1960 |
.................... s = 0; |
- |
|
1961 |
.................... y = x; |
- |
|
1962 |
.................... |
- |
|
1963 |
.................... if (x < 0) |
- |
|
1964 |
.................... { |
- |
|
1965 |
.................... s = 1; |
- |
|
1966 |
.................... y = -y; |
- |
|
1967 |
.................... } |
- |
|
1968 |
.................... |
- |
|
1969 |
.................... if (y <= 32768.0) |
- |
|
1970 |
.................... res = (float32)(unsigned int16)y; |
- |
|
1971 |
.................... |
- |
|
1972 |
.................... else if (y < 10000000.0) |
- |
|
1973 |
.................... { |
- |
|
1974 |
.................... l = (unsigned int16)(y/32768.0); |
- |
|
1975 |
.................... y = 32768.0*(y/32768.0 - (float32)l); |
- |
|
1976 |
.................... res = 32768.0*(float32)l; |
- |
|
1977 |
.................... res += (float32)(unsigned int16)y; |
- |
|
1978 |
.................... } |
- |
|
1979 |
.................... |
- |
|
1980 |
.................... else |
- |
|
1981 |
.................... res = y; |
- |
|
1982 |
.................... |
- |
|
1983 |
.................... y = y - (float32)(unsigned int16)y; |
- |
|
1984 |
.................... |
- |
|
1985 |
.................... if (s) |
- |
|
1986 |
.................... res = -res; |
- |
|
1987 |
.................... |
- |
|
1988 |
.................... if (y != 0) |
- |
|
1989 |
.................... { |
- |
|
1990 |
.................... if (s == 1 && n == 0) |
- |
|
1991 |
.................... res -= 1.0; |
- |
|
1992 |
.................... |
- |
|
1993 |
.................... if (s == 0 && n == 1) |
- |
|
1994 |
.................... res += 1.0; |
- |
|
1995 |
.................... } |
- |
|
1996 |
.................... if (x == 0) |
- |
|
1997 |
.................... res = 0; |
- |
|
1998 |
.................... |
- |
|
1999 |
.................... return (res); |
- |
|
2000 |
.................... } |
- |
|
2001 |
.................... |
- |
|
2002 |
.................... // Overloaded Functions to take care for new Data types in PCD |
- |
|
2003 |
.................... // Overloaded function CEIL_FLOOR() for data type - Float48 |
- |
|
2004 |
.................... #if defined(__PCD__) |
- |
|
2005 |
.................... float48 CEIL_FLOOR(float48 x, unsigned int8 n) |
- |
|
2006 |
.................... { |
- |
|
2007 |
.................... float48 y, res; |
- |
|
2008 |
.................... unsigned int16 l; |
- |
|
2009 |
.................... int1 s; |
- |
|
2010 |
.................... |
- |
|
2011 |
.................... s = 0; |
- |
|
2012 |
.................... y = x; |
- |
|
2013 |
.................... |
- |
|
2014 |
.................... if (x < 0) |
- |
|
2015 |
.................... { |
- |
|
2016 |
.................... s = 1; |
- |
|
2017 |
.................... y = -y; |
- |
|
2018 |
.................... } |
- |
|
2019 |
.................... |
- |
|
2020 |
.................... if (y <= 32768.0) |
- |
|
2021 |
.................... res = (float48)(unsigned int16)y; |
- |
|
2022 |
.................... |
- |
|
2023 |
.................... else if (y < 10000000.0) |
- |
|
2024 |
.................... { |
- |
|
2025 |
.................... l = (unsigned int16)(y/32768.0); |
- |
|
2026 |
.................... y = 32768.0*(y/32768.0 - (float48)l); |
- |
|
2027 |
.................... res = 32768.0*(float32)l; |
- |
|
2028 |
.................... res += (float48)(unsigned int16)y; |
- |
|
2029 |
.................... } |
- |
|
2030 |
.................... |
- |
|
2031 |
.................... else |
- |
|
2032 |
.................... res = y; |
- |
|
2033 |
.................... |
- |
|
2034 |
.................... y = y - (float48)(unsigned int16)y; |
- |
|
2035 |
.................... |
- |
|
2036 |
.................... if (s) |
- |
|
2037 |
.................... res = -res; |
- |
|
2038 |
.................... |
- |
|
2039 |
.................... if (y != 0) |
- |
|
2040 |
.................... { |
- |
|
2041 |
.................... if (s == 1 && n == 0) |
- |
|
2042 |
.................... res -= 1.0; |
- |
|
2043 |
.................... |
- |
|
2044 |
.................... if (s == 0 && n == 1) |
- |
|
2045 |
.................... res += 1.0; |
- |
|
2046 |
.................... } |
- |
|
2047 |
.................... if (x == 0) |
- |
|
2048 |
.................... res = 0; |
- |
|
2049 |
.................... |
- |
|
2050 |
.................... return (res); |
- |
|
2051 |
.................... } |
- |
|
2052 |
.................... |
- |
|
2053 |
.................... |
- |
|
2054 |
.................... // Overloaded function CEIL_FLOOR() for data type - Float64 |
- |
|
2055 |
.................... float64 CEIL_FLOOR(float64 x, unsigned int8 n) |
- |
|
2056 |
.................... { |
- |
|
2057 |
.................... float64 y, res; |
- |
|
2058 |
.................... unsigned int16 l; |
- |
|
2059 |
.................... int1 s; |
- |
|
2060 |
.................... |
- |
|
2061 |
.................... s = 0; |
- |
|
2062 |
.................... y = x; |
- |
|
2063 |
.................... |
- |
|
2064 |
.................... if (x < 0) |
- |
|
2065 |
.................... { |
- |
|
2066 |
.................... s = 1; |
- |
|
2067 |
.................... y = -y; |
- |
|
2068 |
.................... } |
- |
|
2069 |
.................... |
- |
|
2070 |
.................... if (y <= 32768.0) |
- |
|
2071 |
.................... res = (float64)(unsigned int16)y; |
- |
|
2072 |
.................... |
- |
|
2073 |
.................... else if (y < 10000000.0) |
- |
|
2074 |
.................... { |
- |
|
2075 |
.................... l = (unsigned int16)(y/32768.0); |
- |
|
2076 |
.................... y = 32768.0*(y/32768.0 - (float64)l); |
- |
|
2077 |
.................... res = 32768.0*(float64)l; |
- |
|
2078 |
.................... res += (float64)(unsigned int16)y; |
- |
|
2079 |
.................... } |
- |
|
2080 |
.................... |
- |
|
2081 |
.................... else |
- |
|
2082 |
.................... res = y; |
- |
|
2083 |
.................... |
- |
|
2084 |
.................... y = y - (float64)(unsigned int16)y; |
- |
|
2085 |
.................... |
- |
|
2086 |
.................... if (s) |
- |
|
2087 |
.................... res = -res; |
- |
|
2088 |
.................... |
- |
|
2089 |
.................... if (y != 0) |
- |
|
2090 |
.................... { |
- |
|
2091 |
.................... if (s == 1 && n == 0) |
- |
|
2092 |
.................... res -= 1.0; |
- |
|
2093 |
.................... |
- |
|
2094 |
.................... if (s == 0 && n == 1) |
- |
|
2095 |
.................... res += 1.0; |
- |
|
2096 |
.................... } |
- |
|
2097 |
.................... if (x == 0) |
- |
|
2098 |
.................... res = 0; |
- |
|
2099 |
.................... |
- |
|
2100 |
.................... return (res); |
- |
|
2101 |
.................... } |
- |
|
2102 |
.................... #endif |
- |
|
2103 |
.................... |
- |
|
2104 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
2105 |
.................... // float floor(float x) |
- |
|
2106 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
2107 |
.................... // Description : rounds down the number x. |
- |
|
2108 |
.................... // Date : N/A |
- |
|
2109 |
.................... // |
- |
|
2110 |
.................... float32 floor(float32 x) |
- |
|
2111 |
.................... { |
- |
|
2112 |
.................... return CEIL_FLOOR(x, 0); |
- |
|
2113 |
.................... } |
- |
|
2114 |
.................... // Following 2 functions are overloaded functions of floor() for PCD |
- |
|
2115 |
.................... // Overloaded function floor() for data type - Float48 |
- |
|
2116 |
.................... #if defined(__PCD__) |
- |
|
2117 |
.................... float48 floor(float48 x) |
- |
|
2118 |
.................... { |
- |
|
2119 |
.................... return CEIL_FLOOR(x, 0); |
- |
|
2120 |
.................... } |
- |
|
2121 |
.................... |
- |
|
2122 |
.................... // Overloaded function floor() for data type - Float64 |
- |
|
2123 |
.................... float64 floor(float64 x) |
- |
|
2124 |
.................... { |
- |
|
2125 |
.................... return CEIL_FLOOR(x, 0); |
- |
|
2126 |
.................... } |
- |
|
2127 |
.................... #endif |
- |
|
2128 |
.................... |
- |
|
2129 |
.................... |
- |
|
2130 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
2131 |
.................... // float ceil(float x) |
- |
|
2132 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
2133 |
.................... // Description : rounds up the number x. |
- |
|
2134 |
.................... // Date : N/A |
- |
|
2135 |
.................... // |
- |
|
2136 |
.................... float32 ceil(float32 x) |
- |
|
2137 |
.................... { |
- |
|
2138 |
.................... return CEIL_FLOOR(x, 1); |
- |
|
2139 |
.................... } |
- |
|
2140 |
.................... // Following 2 functions are overloaded functions of ceil() for PCD |
- |
|
2141 |
.................... // Overloaded function ceil() for data type - Float48 |
- |
|
2142 |
.................... #if defined(__PCD__) |
- |
|
2143 |
.................... float48 ceil(float48 x) |
- |
|
2144 |
.................... { |
- |
|
2145 |
.................... return CEIL_FLOOR(x, 1); |
- |
|
2146 |
.................... } |
- |
|
2147 |
.................... |
- |
|
2148 |
.................... // Overloaded function ceil() for data type - Float64 |
- |
|
2149 |
.................... float64 ceil(float64 x) |
- |
|
2150 |
.................... { |
- |
|
2151 |
.................... return CEIL_FLOOR(x, 1); |
- |
|
2152 |
.................... } |
- |
|
2153 |
.................... #endif |
- |
|
2154 |
.................... |
- |
|
2155 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
2156 |
.................... // float fabs(float x) |
- |
|
2157 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
2158 |
.................... // Description : Computes the absolute value of floating point number x |
- |
|
2159 |
.................... // Returns : returns the absolute value of x |
- |
|
2160 |
.................... // Date : N/A |
- |
|
2161 |
.................... // |
- |
|
2162 |
.................... #define fabs abs |
- |
|
2163 |
.................... |
- |
|
2164 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
2165 |
.................... // float fmod(float x) |
- |
|
2166 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
2167 |
.................... // Description : Computes the floating point remainder of x/y |
- |
|
2168 |
.................... // Returns : returns the value of x= i*y, for some integer i such that, if y |
- |
|
2169 |
.................... // is non zero, the result has the same isgn of x na dmagnitude less than the |
- |
|
2170 |
.................... // magnitude of y. If y is zero then a domain error occurs. |
- |
|
2171 |
.................... // Date : N/A |
- |
|
2172 |
.................... // |
- |
|
2173 |
.................... |
- |
|
2174 |
.................... float fmod(float32 x,float32 y) |
- |
|
2175 |
.................... { |
- |
|
2176 |
.................... float32 i; |
- |
|
2177 |
.................... if (y!=0.0) |
- |
|
2178 |
.................... { |
- |
|
2179 |
.................... i=(x/y < 0.0)? ceil(x/y): floor(x/y); |
- |
|
2180 |
.................... return(x-(i*y)); |
- |
|
2181 |
.................... } |
- |
|
2182 |
.................... else |
- |
|
2183 |
.................... { |
- |
|
2184 |
.................... #ifdef _ERRNO |
- |
|
2185 |
.................... { |
- |
|
2186 |
.................... errno=EDOM; |
- |
|
2187 |
.................... } |
- |
|
2188 |
.................... #endif |
- |
|
2189 |
.................... } |
- |
|
2190 |
.................... } |
- |
|
2191 |
.................... //Overloaded function for fmod() for PCD |
- |
|
2192 |
.................... // Overloaded function fmod() for data type - Float48 |
- |
|
2193 |
.................... #if defined(__PCD__) |
- |
|
2194 |
.................... float48 fmod(float48 x,float48 y) |
- |
|
2195 |
.................... { |
- |
|
2196 |
.................... float48 i; |
- |
|
2197 |
.................... if (y!=0.0) |
- |
|
2198 |
.................... { |
- |
|
2199 |
.................... i=(x/y < 0.0)? ceil(x/y): floor(x/y); |
- |
|
2200 |
.................... return(x-(i*y)); |
- |
|
2201 |
.................... } |
- |
|
2202 |
.................... else |
- |
|
2203 |
.................... { |
- |
|
2204 |
.................... #ifdef _ERRNO |
- |
|
2205 |
.................... { |
- |
|
2206 |
.................... errno=EDOM; |
- |
|
2207 |
.................... } |
- |
|
2208 |
.................... #endif |
- |
|
2209 |
.................... } |
- |
|
2210 |
.................... } |
- |
|
2211 |
.................... // Overloaded function fmod() for data type - Float64 |
- |
|
2212 |
.................... float64 fmod(float64 x,float64 y) |
- |
|
2213 |
.................... { |
- |
|
2214 |
.................... float64 i; |
- |
|
2215 |
.................... if (y!=0.0) |
- |
|
2216 |
.................... { |
- |
|
2217 |
.................... i=(x/y < 0.0)? ceil(x/y): floor(x/y); |
- |
|
2218 |
.................... return(x-(i*y)); |
- |
|
2219 |
.................... } |
- |
|
2220 |
.................... else |
- |
|
2221 |
.................... { |
- |
|
2222 |
.................... #ifdef _ERRNO |
- |
|
2223 |
.................... { |
- |
|
2224 |
.................... errno=EDOM; |
- |
|
2225 |
.................... } |
- |
|
2226 |
.................... #endif |
- |
|
2227 |
.................... } |
- |
|
2228 |
.................... } |
- |
|
2229 |
.................... #endif |
- |
|
2230 |
.................... //////////////////// Exponential and logarithmic functions //////////////////// |
- |
|
2231 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
2232 |
.................... // float exp(float x) |
- |
|
2233 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
2234 |
.................... // Description : returns the value (e^x) |
- |
|
2235 |
.................... // Date : N/A |
- |
|
2236 |
.................... // |
- |
|
2237 |
.................... #define LN2 0.6931471805599453 |
- |
|
2238 |
.................... |
- |
|
2239 |
.................... float const pe[6] = {0.000207455774, 0.00127100575, 0.00965065093, |
- |
|
2240 |
.................... 0.0554965651, 0.240227138, 0.693147172}; |
- |
|
2241 |
.................... |
- |
|
2242 |
.................... |
- |
|
2243 |
.................... float32 exp(float32 x) |
- |
|
2244 |
.................... { |
- |
|
2245 |
.................... float32 y, res, r; |
- |
|
2246 |
.................... #if defined(__PCD__) |
- |
|
2247 |
.................... int8 data1; |
- |
|
2248 |
.................... #endif |
- |
|
2249 |
.................... signed int8 n; |
- |
|
2250 |
.................... int1 s; |
- |
|
2251 |
.................... #ifdef _ERRNO |
- |
|
2252 |
.................... if(x > 88.722838) |
- |
|
2253 |
.................... { |
- |
|
2254 |
.................... errno=ERANGE; |
- |
|
2255 |
.................... return(0); |
- |
|
2256 |
.................... } |
- |
|
2257 |
.................... #endif |
- |
|
2258 |
.................... n = (signed int16)(x/LN2); |
- |
|
2259 |
.................... s = 0; |
- |
|
2260 |
.................... y = x; |
- |
|
2261 |
.................... |
- |
|
2262 |
.................... if (x < 0) |
- |
|
2263 |
.................... { |
- |
|
2264 |
.................... s = 1; |
- |
|
2265 |
.................... n = -n; |
- |
|
2266 |
.................... y = -y; |
- |
|
2267 |
.................... } |
- |
|
2268 |
.................... |
- |
|
2269 |
.................... res = 0.0; |
- |
|
2270 |
.................... #if !defined(__PCD__) |
- |
|
2271 |
.................... *((unsigned int8 *)(&res)) = n + 0x7F; |
- |
|
2272 |
.................... #endif |
- |
|
2273 |
.................... |
- |
|
2274 |
.................... #if defined(__PCD__) // Takes care of IEEE format for PCD |
- |
|
2275 |
.................... data1 = n+0x7F; |
- |
|
2276 |
.................... if(bit_test(data1,0)) |
- |
|
2277 |
.................... bit_set(*(((unsigned int8 *)(&res)+2)),7); |
- |
|
2278 |
.................... rotate_right(&data1,1); |
- |
|
2279 |
.................... bit_clear(data1,7); |
- |
|
2280 |
.................... *(((unsigned int8 *)(&res)+3)) = data1; |
- |
|
2281 |
.................... #endif |
- |
|
2282 |
.................... |
- |
|
2283 |
.................... y = y/LN2 - (float32)n; |
- |
|
2284 |
.................... |
- |
|
2285 |
.................... r = pe[0]*y + pe[1]; |
- |
|
2286 |
.................... r = r*y + pe[2]; |
- |
|
2287 |
.................... r = r*y + pe[3]; |
- |
|
2288 |
.................... r = r*y + pe[4]; |
- |
|
2289 |
.................... r = r*y + pe[5]; |
- |
|
2290 |
.................... |
- |
|
2291 |
.................... res = res*(1.0 + y*r); |
- |
|
2292 |
.................... |
- |
|
2293 |
.................... if (s) |
- |
|
2294 |
.................... res = 1.0/res; |
- |
|
2295 |
.................... return(res); |
- |
|
2296 |
.................... } |
- |
|
2297 |
.................... |
- |
|
2298 |
.................... |
- |
|
2299 |
.................... //Overloaded function for exp() for PCD |
- |
|
2300 |
.................... // Overloaded function exp() for data type - Float48 |
- |
|
2301 |
.................... #if defined(__PCD__) |
- |
|
2302 |
.................... float48 exp(float48 x) |
- |
|
2303 |
.................... { |
- |
|
2304 |
.................... float48 y, res, r; |
- |
|
2305 |
.................... int8 data1; |
- |
|
2306 |
.................... signed int8 n; |
- |
|
2307 |
.................... int1 s; |
- |
|
2308 |
.................... #ifdef _ERRNO |
- |
|
2309 |
.................... if(x > 88.722838) |
- |
|
2310 |
.................... { |
- |
|
2311 |
.................... errno=ERANGE; |
- |
|
2312 |
.................... return(0); |
- |
|
2313 |
.................... } |
- |
|
2314 |
.................... #endif |
- |
|
2315 |
.................... n = (signed int16)(x/LN2); |
- |
|
2316 |
.................... s = 0; |
- |
|
2317 |
.................... y = x; |
- |
|
2318 |
.................... |
- |
|
2319 |
.................... if (x < 0) |
- |
|
2320 |
.................... { |
- |
|
2321 |
.................... s = 1; |
- |
|
2322 |
.................... n = -n; |
- |
|
2323 |
.................... y = -y; |
- |
|
2324 |
.................... } |
- |
|
2325 |
.................... |
- |
|
2326 |
.................... res = 0.0; |
- |
|
2327 |
.................... |
- |
|
2328 |
.................... data1 = n+0x7F; |
- |
|
2329 |
.................... if(bit_test(data1,0)) |
- |
|
2330 |
.................... bit_set(*(((unsigned int8 *)(&res)+4)),7); |
- |
|
2331 |
.................... rotate_right(&data1,1); |
- |
|
2332 |
.................... bit_clear(data1,7); |
- |
|
2333 |
.................... *(((unsigned int8 *)(&res)+5)) = data1; |
- |
|
2334 |
.................... |
- |
|
2335 |
.................... y = y/LN2 - (float48)n; |
- |
|
2336 |
.................... |
- |
|
2337 |
.................... r = pe[0]*y + pe[1]; |
- |
|
2338 |
.................... r = r*y + pe[2]; |
- |
|
2339 |
.................... r = r*y + pe[3]; |
- |
|
2340 |
.................... r = r*y + pe[4]; |
- |
|
2341 |
.................... r = r*y + pe[5]; |
- |
|
2342 |
.................... |
- |
|
2343 |
.................... res = res*(1.0 + y*r); |
- |
|
2344 |
.................... |
- |
|
2345 |
.................... if (s) |
- |
|
2346 |
.................... res = 1.0/res; |
- |
|
2347 |
.................... return(res); |
- |
|
2348 |
.................... } |
- |
|
2349 |
.................... |
- |
|
2350 |
.................... // Overloaded function exp() for data type - Float64 |
- |
|
2351 |
.................... float64 exp(float64 x) |
- |
|
2352 |
.................... { |
- |
|
2353 |
.................... float64 y, res, r; |
- |
|
2354 |
.................... unsigned int16 data1, data2; |
- |
|
2355 |
.................... unsigned int16 *p; |
- |
|
2356 |
.................... signed int16 n; |
- |
|
2357 |
.................... int1 s; |
- |
|
2358 |
.................... #ifdef _ERRNO |
- |
|
2359 |
.................... if(x > 709.7827128) |
- |
|
2360 |
.................... { |
- |
|
2361 |
.................... errno=ERANGE; |
- |
|
2362 |
.................... return(0); |
- |
|
2363 |
.................... } |
- |
|
2364 |
.................... #endif |
- |
|
2365 |
.................... n = (signed int16)(x/LN2); |
- |
|
2366 |
.................... s = 0; |
- |
|
2367 |
.................... y = x; |
- |
|
2368 |
.................... |
- |
|
2369 |
.................... if (x < 0) |
- |
|
2370 |
.................... { |
- |
|
2371 |
.................... s = 1; |
- |
|
2372 |
.................... n = -n; |
- |
|
2373 |
.................... y = -y; |
- |
|
2374 |
.................... } |
- |
|
2375 |
.................... |
- |
|
2376 |
.................... res = 0.0; |
- |
|
2377 |
.................... |
- |
|
2378 |
.................... #if !defined(__PCD__) |
- |
|
2379 |
.................... *((unsigned int16 *)(&res)) = n + 0x7F; |
- |
|
2380 |
.................... #endif |
- |
|
2381 |
.................... p= (((unsigned int16 *)(&res))+3); |
- |
|
2382 |
.................... data1 = *p; |
- |
|
2383 |
.................... data2 = *p; |
- |
|
2384 |
.................... data1 = n + 0x3FF; |
- |
|
2385 |
.................... data1 = data1 <<4; |
- |
|
2386 |
.................... if(bit_test(data2,15)) |
- |
|
2387 |
.................... bit_set(data1,15); |
- |
|
2388 |
.................... data2 = data2 & 0x000F; |
- |
|
2389 |
.................... data1 ^= data2; |
- |
|
2390 |
.................... |
- |
|
2391 |
.................... *(((unsigned int16 *)(&res)+3)) = data1; |
- |
|
2392 |
.................... |
- |
|
2393 |
.................... |
- |
|
2394 |
.................... y = y/LN2 - (float64)n; |
- |
|
2395 |
.................... |
- |
|
2396 |
.................... r = pe[0]*y + pe[1]; |
- |
|
2397 |
.................... r = r*y + pe[2]; |
- |
|
2398 |
.................... r = r*y + pe[3]; |
- |
|
2399 |
.................... r = r*y + pe[4]; |
- |
|
2400 |
.................... r = r*y + pe[5]; |
- |
|
2401 |
.................... |
- |
|
2402 |
.................... res = res*(1.0 + y*r); |
- |
|
2403 |
.................... |
- |
|
2404 |
.................... if (s) |
- |
|
2405 |
.................... res = 1.0/res; |
- |
|
2406 |
.................... return(res); |
- |
|
2407 |
.................... } |
- |
|
2408 |
.................... |
- |
|
2409 |
.................... #ENDIF |
- |
|
2410 |
.................... |
- |
|
2411 |
.................... |
- |
|
2412 |
.................... /************************************************************/ |
- |
|
2413 |
.................... |
- |
|
2414 |
.................... float32 const pl[4] = {0.45145214, -9.0558803, 26.940971, -19.860189}; |
- |
|
2415 |
.................... float32 const ql[4] = {1.0000000, -8.1354259, 16.780517, -9.9300943}; |
- |
|
2416 |
.................... |
- |
|
2417 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
2418 |
.................... // float log(float x) |
- |
|
2419 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
2420 |
.................... // Description : returns the the natural log of x |
- |
|
2421 |
.................... // Date : N/A |
- |
|
2422 |
.................... // |
- |
|
2423 |
.................... float32 log(float32 x) |
- |
|
2424 |
.................... { |
- |
|
2425 |
.................... float32 y, res, r, y2; |
- |
|
2426 |
.................... #if defined(__PCD__) |
- |
|
2427 |
.................... unsigned int8 data1,data2; |
- |
|
2428 |
.................... #endif |
- |
|
2429 |
.................... signed int8 n; |
- |
|
2430 |
.................... #ifdef _ERRNO |
- |
|
2431 |
.................... if(x <0) |
- |
|
2432 |
.................... { |
- |
|
2433 |
.................... errno=EDOM; |
- |
|
2434 |
.................... } |
- |
|
2435 |
.................... if(x ==0) |
- |
|
2436 |
.................... { |
- |
|
2437 |
.................... errno=ERANGE; |
- |
|
2438 |
.................... return(0); |
- |
|
2439 |
.................... } |
- |
|
2440 |
.................... #endif |
- |
|
2441 |
.................... y = x; |
- |
|
2442 |
.................... |
- |
|
2443 |
.................... if (y != 1.0) |
- |
|
2444 |
.................... { |
- |
|
2445 |
.................... #if !defined(__PCD__) |
- |
|
2446 |
.................... *((unsigned int8 *)(&y)) = 0x7E; |
- |
|
2447 |
.................... #endif |
- |
|
2448 |
.................... |
- |
|
2449 |
.................... #if defined(__PCD__) // Takes care of IEEE format |
- |
|
2450 |
.................... data2 = *(((unsigned int8 *)(&y))+3); |
- |
|
2451 |
.................... *(((unsigned int8 *)(&y))+3) = 0x3F; |
- |
|
2452 |
.................... data1 = *(((unsigned int8 *)(&y))+2); |
- |
|
2453 |
.................... bit_clear(data1,7); |
- |
|
2454 |
.................... *(((unsigned int8 *)(&y))+2) = data1; |
- |
|
2455 |
.................... if(bit_test(data2,7)) |
- |
|
2456 |
.................... bit_set(*(((unsigned int8 *)(&y))+3),7); |
- |
|
2457 |
.................... #endif |
- |
|
2458 |
.................... |
- |
|
2459 |
.................... y = (y - 1.0)/(y + 1.0); |
- |
|
2460 |
.................... |
- |
|
2461 |
.................... y2=y*y; |
- |
|
2462 |
.................... |
- |
|
2463 |
.................... res = pl[0]*y2 + pl[1]; |
- |
|
2464 |
.................... res = res*y2 + pl[2]; |
- |
|
2465 |
.................... res = res*y2 + pl[3]; |
- |
|
2466 |
.................... |
- |
|
2467 |
.................... r = ql[0]*y2 + ql[1]; |
- |
|
2468 |
.................... r = r*y2 + ql[2]; |
- |
|
2469 |
.................... r = r*y2 + ql[3]; |
- |
|
2470 |
.................... |
- |
|
2471 |
.................... res = y*res/r; |
- |
|
2472 |
.................... #if !defined(__PCD__) |
- |
|
2473 |
.................... n = *((unsigned int8 *)(&x)) - 0x7E; |
- |
|
2474 |
.................... #endif |
- |
|
2475 |
.................... #if defined(__PCD__) |
- |
|
2476 |
.................... data1 = *(((unsigned int8 *)(&x)+3)); |
- |
|
2477 |
.................... rotate_left(&data1,1); |
- |
|
2478 |
.................... data2 = *(((unsigned int8 *)(&x)+2)); |
- |
|
2479 |
.................... if(bit_test (data2,7)) |
- |
|
2480 |
.................... bit_set(data1,0); |
- |
|
2481 |
.................... n = data1 - 0x7E; |
- |
|
2482 |
.................... #endif |
- |
|
2483 |
.................... |
- |
|
2484 |
.................... if (n<0) |
- |
|
2485 |
.................... r = -(float32)-n; |
- |
|
2486 |
.................... else |
- |
|
2487 |
.................... r = (float32)n; |
- |
|
2488 |
.................... |
- |
|
2489 |
.................... res += r*LN2; |
- |
|
2490 |
.................... } |
- |
|
2491 |
.................... |
- |
|
2492 |
.................... else |
- |
|
2493 |
.................... res = 0.0; |
- |
|
2494 |
.................... |
- |
|
2495 |
.................... return(res); |
- |
|
2496 |
.................... } |
- |
|
2497 |
.................... |
- |
|
2498 |
.................... //Overloaded function for log() for PCD |
- |
|
2499 |
.................... // Overloaded function log() for data type - Float48 |
- |
|
2500 |
.................... #if defined(__PCD__) |
- |
|
2501 |
.................... float48 log(float48 x) |
- |
|
2502 |
.................... { |
- |
|
2503 |
.................... float48 y, res, r, y2; |
- |
|
2504 |
.................... unsigned int8 data1,data2; |
- |
|
2505 |
.................... signed int8 n; |
- |
|
2506 |
.................... #ifdef _ERRNO |
- |
|
2507 |
.................... if(x <0) |
- |
|
2508 |
.................... { |
- |
|
2509 |
.................... errno=EDOM; |
- |
|
2510 |
.................... } |
- |
|
2511 |
.................... if(x ==0) |
- |
|
2512 |
.................... { |
- |
|
2513 |
.................... errno=ERANGE; |
- |
|
2514 |
.................... return(0); |
- |
|
2515 |
.................... } |
- |
|
2516 |
.................... #endif |
- |
|
2517 |
.................... y = x; |
- |
|
2518 |
.................... |
- |
|
2519 |
.................... if (y != 1.0) |
- |
|
2520 |
.................... { |
- |
|
2521 |
.................... |
- |
|
2522 |
.................... #if !defined(__PCD__) |
- |
|
2523 |
.................... *((unsigned int8 *)(&y)) = 0x7E; |
- |
|
2524 |
.................... #endif |
- |
|
2525 |
.................... data2 = *(((unsigned int8 *)(&y))+5); |
- |
|
2526 |
.................... *(((unsigned int8 *)(&y))+5) = 0x3F; |
- |
|
2527 |
.................... data1 = *(((unsigned int8 *)(&y))+4); |
- |
|
2528 |
.................... bit_clear(data1,7); |
- |
|
2529 |
.................... *(((unsigned int8 *)(&y))+4) = data1; |
- |
|
2530 |
.................... |
- |
|
2531 |
.................... if(bit_test(data2,7)) |
- |
|
2532 |
.................... bit_set(*(((unsigned int8 *)(&y))+4),7); |
- |
|
2533 |
.................... y = (y - 1.0)/(y + 1.0); |
- |
|
2534 |
.................... |
- |
|
2535 |
.................... y2=y*y; |
- |
|
2536 |
.................... |
- |
|
2537 |
.................... res = pl[0]*y2 + pl[1]; |
- |
|
2538 |
.................... res = res*y2 + pl[2]; |
- |
|
2539 |
.................... res = res*y2 + pl[3]; |
- |
|
2540 |
.................... |
- |
|
2541 |
.................... r = ql[0]*y2 + ql[1]; |
- |
|
2542 |
.................... r = r*y2 + ql[2]; |
- |
|
2543 |
.................... r = r*y2 + ql[3]; |
- |
|
2544 |
.................... |
- |
|
2545 |
.................... res = y*res/r; |
- |
|
2546 |
.................... |
- |
|
2547 |
.................... data1 = *(((unsigned int8 *)(&x)+5)); |
- |
|
2548 |
.................... rotate_left(&data1,1); |
- |
|
2549 |
.................... data2 = *(((unsigned int8 *)(&x)+4)); |
- |
|
2550 |
.................... if(bit_test (data2,7)) |
- |
|
2551 |
.................... bit_set(data1,0); |
- |
|
2552 |
.................... |
- |
|
2553 |
.................... n = data1 - 0x7E; |
- |
|
2554 |
.................... |
- |
|
2555 |
.................... if (n<0) |
- |
|
2556 |
.................... r = -(float48)-n; |
- |
|
2557 |
.................... else |
- |
|
2558 |
.................... r = (float48)n; |
- |
|
2559 |
.................... |
- |
|
2560 |
.................... res += r*LN2; |
- |
|
2561 |
.................... } |
- |
|
2562 |
.................... |
- |
|
2563 |
.................... else |
- |
|
2564 |
.................... res = 0.0; |
- |
|
2565 |
.................... |
- |
|
2566 |
.................... return(res); |
- |
|
2567 |
.................... } |
- |
|
2568 |
.................... |
- |
|
2569 |
.................... // Overloaded function log() for data type - Float48 |
- |
|
2570 |
.................... #if defined(__PCD__) |
- |
|
2571 |
.................... float32 const pl_64[4] = {0.45145214, -9.0558803, 26.940971, -19.860189}; |
- |
|
2572 |
.................... float32 const ql_64[4] = {1.0000000, -8.1354259, 16.780517, -9.9300943}; |
- |
|
2573 |
.................... #endif |
- |
|
2574 |
.................... float64 log(float64 x) |
- |
|
2575 |
.................... { |
- |
|
2576 |
.................... float64 y, res, r, y2; |
- |
|
2577 |
.................... unsigned int16 data1,data2; |
- |
|
2578 |
.................... unsigned int16 *p; |
- |
|
2579 |
.................... signed int16 n; |
- |
|
2580 |
.................... #ifdef _ERRNO |
- |
|
2581 |
.................... if(x <0) |
- |
|
2582 |
.................... { |
- |
|
2583 |
.................... errno=EDOM; |
- |
|
2584 |
.................... } |
- |
|
2585 |
.................... if(x ==0) |
- |
|
2586 |
.................... { |
- |
|
2587 |
.................... errno=ERANGE; |
- |
|
2588 |
.................... return(0); |
- |
|
2589 |
.................... } |
- |
|
2590 |
.................... #endif |
- |
|
2591 |
.................... y = x; |
- |
|
2592 |
.................... |
- |
|
2593 |
.................... if (y != 1.0) |
- |
|
2594 |
.................... { |
- |
|
2595 |
.................... #if !defined(__PCD__) |
- |
|
2596 |
.................... *((unsigned int8 *)(&y)) = 0x7E; |
- |
|
2597 |
.................... #endif |
- |
|
2598 |
.................... p= (((unsigned int16 *)(&y))+3); |
- |
|
2599 |
.................... data1 = *p; |
- |
|
2600 |
.................... data2 = *p; |
- |
|
2601 |
.................... data1 = 0x3FE; |
- |
|
2602 |
.................... data1 = data1 <<4; |
- |
|
2603 |
.................... if(bit_test (data2,15)) |
- |
|
2604 |
.................... bit_set(data1,15); |
- |
|
2605 |
.................... data2 = data2 & 0x000F; |
- |
|
2606 |
.................... data1 ^=data2; |
- |
|
2607 |
.................... |
- |
|
2608 |
.................... *p = data1; |
- |
|
2609 |
.................... |
- |
|
2610 |
.................... y = (y - 1.0)/(y + 1.0); |
- |
|
2611 |
.................... |
- |
|
2612 |
.................... y2=y*y; |
- |
|
2613 |
.................... |
- |
|
2614 |
.................... res = pl_64[0]*y2 + pl_64[1]; |
- |
|
2615 |
.................... res = res*y2 + pl_64[2]; |
- |
|
2616 |
.................... res = res*y2 + pl_64[3]; |
- |
|
2617 |
.................... |
- |
|
2618 |
.................... r = ql_64[0]*y2 + ql_64[1]; |
- |
|
2619 |
.................... r = r*y2 + ql_64[2]; |
- |
|
2620 |
.................... r = r*y2 + ql_64[3]; |
- |
|
2621 |
.................... |
- |
|
2622 |
.................... res = y*res/r; |
- |
|
2623 |
.................... |
- |
|
2624 |
.................... p= (((unsigned int16 *)(&x))+3); |
- |
|
2625 |
.................... data1 = *p; |
- |
|
2626 |
.................... bit_clear(data1,15); |
- |
|
2627 |
.................... data1 = data1 >>4; |
- |
|
2628 |
.................... n = data1 - 0x3FE; |
- |
|
2629 |
.................... |
- |
|
2630 |
.................... |
- |
|
2631 |
.................... if (n<0) |
- |
|
2632 |
.................... r = -(float64)-n; |
- |
|
2633 |
.................... else |
- |
|
2634 |
.................... r = (float64)n; |
- |
|
2635 |
.................... |
- |
|
2636 |
.................... res += r*LN2; |
- |
|
2637 |
.................... } |
- |
|
2638 |
.................... |
- |
|
2639 |
.................... else |
- |
|
2640 |
.................... res = 0.0; |
- |
|
2641 |
.................... |
- |
|
2642 |
.................... return(res); |
- |
|
2643 |
.................... } |
- |
|
2644 |
.................... #endif |
- |
|
2645 |
.................... |
- |
|
2646 |
.................... |
- |
|
2647 |
.................... #define LN10 2.3025850929940456 |
- |
|
2648 |
.................... |
- |
|
2649 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
2650 |
.................... // float log10(float x) |
- |
|
2651 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
2652 |
.................... // Description : returns the the log base 10 of x |
- |
|
2653 |
.................... // Date : N/A |
- |
|
2654 |
.................... // |
- |
|
2655 |
.................... float32 log10(float32 x) |
- |
|
2656 |
.................... { |
- |
|
2657 |
.................... float32 r; |
- |
|
2658 |
.................... |
- |
|
2659 |
.................... r = log(x); |
- |
|
2660 |
.................... r = r/LN10; |
- |
|
2661 |
.................... return(r); |
- |
|
2662 |
.................... } |
- |
|
2663 |
.................... |
- |
|
2664 |
.................... //Overloaded functions for log10() for PCD |
- |
|
2665 |
.................... // Overloaded function log10() for data type - Float48 |
- |
|
2666 |
.................... #if defined(__PCD__) |
- |
|
2667 |
.................... float48 log10(float48 x) |
- |
|
2668 |
.................... { |
- |
|
2669 |
.................... float48 r; |
- |
|
2670 |
.................... |
- |
|
2671 |
.................... r = log(x); |
- |
|
2672 |
.................... r = r/LN10; |
- |
|
2673 |
.................... return(r); |
- |
|
2674 |
.................... } |
- |
|
2675 |
.................... |
- |
|
2676 |
.................... // Overloaded function log10() for data type - Float64 |
- |
|
2677 |
.................... float64 log10(float64 x) |
- |
|
2678 |
.................... { |
- |
|
2679 |
.................... float64 r; |
- |
|
2680 |
.................... |
- |
|
2681 |
.................... r = log(x); |
- |
|
2682 |
.................... r = r/LN10; |
- |
|
2683 |
.................... return(r); |
- |
|
2684 |
.................... } |
- |
|
2685 |
.................... #endif |
- |
|
2686 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
2687 |
.................... // float modf(float x) |
- |
|
2688 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
2689 |
.................... // Description :breaks the argument value int integral and fractional parts, |
- |
|
2690 |
.................... // ach of which have the same sign as the argument. It stores the integral part |
- |
|
2691 |
.................... // as a float in the object pointed to by the iptr |
- |
|
2692 |
.................... // Returns : returns the signed fractional part of value. |
- |
|
2693 |
.................... // Date : N/A |
- |
|
2694 |
.................... // |
- |
|
2695 |
.................... |
- |
|
2696 |
.................... float32 modf(float32 value,float32 *iptr) |
- |
|
2697 |
.................... { |
- |
|
2698 |
.................... *iptr=(value < 0.0)? ceil(value): floor(value); |
- |
|
2699 |
.................... return(value - *iptr); |
- |
|
2700 |
.................... } |
- |
|
2701 |
.................... //Overloaded functions for modf() for PCD |
- |
|
2702 |
.................... // Overloaded function modf() for data type - Float48 |
- |
|
2703 |
.................... #if defined(__PCD__) |
- |
|
2704 |
.................... float48 modf(float48 value,float48 *iptr) |
- |
|
2705 |
.................... { |
- |
|
2706 |
.................... *iptr=(value < 0.0)? ceil(value): floor(value); |
- |
|
2707 |
.................... return(value - *iptr); |
- |
|
2708 |
.................... } |
- |
|
2709 |
.................... // Overloaded function modf() for data type - Float64 |
- |
|
2710 |
.................... float64 modf(float64 value,float64 *iptr) |
- |
|
2711 |
.................... { |
- |
|
2712 |
.................... *iptr=(value < 0.0)? ceil(value): floor(value); |
- |
|
2713 |
.................... return(value - *iptr); |
- |
|
2714 |
.................... } |
- |
|
2715 |
.................... #endif |
- |
|
2716 |
.................... |
- |
|
2717 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
2718 |
.................... // float pwr(float x,float y) |
- |
|
2719 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
2720 |
.................... // Description : returns the value (x^y) |
- |
|
2721 |
.................... // Date : N/A |
- |
|
2722 |
.................... // Note : 0 is returned when the function will generate an imaginary number |
- |
|
2723 |
.................... // |
- |
|
2724 |
.................... float32 pwr(float32 x,float32 y) |
- |
|
2725 |
.................... { |
- |
|
2726 |
.................... if(0 > x && fmod(y, 1) == 0) { |
- |
|
2727 |
.................... if(fmod(y, 2) == 0) { |
- |
|
2728 |
.................... return (exp(log(-x) * y)); |
- |
|
2729 |
.................... } else { |
- |
|
2730 |
.................... return (-exp(log(-x) * y)); |
- |
|
2731 |
.................... } |
- |
|
2732 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
- |
|
2733 |
.................... return 0; |
- |
|
2734 |
.................... } else { |
- |
|
2735 |
.................... if(x != 0 || 0 >= y) { |
- |
|
2736 |
.................... return (exp(log(x) * y)); |
- |
|
2737 |
.................... } |
- |
|
2738 |
.................... } |
- |
|
2739 |
.................... } |
- |
|
2740 |
.................... //Overloaded functions for pwr() for PCD |
- |
|
2741 |
.................... // Overloaded function pwr() for data type - Float48 |
- |
|
2742 |
.................... #if defined(__PCD__) |
- |
|
2743 |
.................... float48 pwr(float48 x,float48 y) |
- |
|
2744 |
.................... { |
- |
|
2745 |
.................... if(0 > x && fmod(y, 1) == 0) { |
- |
|
2746 |
.................... if(fmod(y, 2) == 0) { |
- |
|
2747 |
.................... return (exp(log(-x) * y)); |
- |
|
2748 |
.................... } else { |
- |
|
2749 |
.................... return (-exp(log(-x) * y)); |
- |
|
2750 |
.................... } |
- |
|
2751 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
- |
|
2752 |
.................... return 0; |
- |
|
2753 |
.................... } else { |
- |
|
2754 |
.................... if(x != 0 || 0 >= y) { |
- |
|
2755 |
.................... return (exp(log(x) * y)); |
- |
|
2756 |
.................... } |
- |
|
2757 |
.................... } |
- |
|
2758 |
.................... } |
- |
|
2759 |
.................... // Overloaded function pwr() for data type - Float64 |
- |
|
2760 |
.................... float64 pwr(float64 x,float64 y) |
- |
|
2761 |
.................... { |
- |
|
2762 |
.................... if(0 > x && fmod(y, 1) == 0) { |
- |
|
2763 |
.................... if(fmod(y, 2) == 0) { |
- |
|
2764 |
.................... return (exp(log(-x) * y)); |
- |
|
2765 |
.................... } else { |
- |
|
2766 |
.................... return (-exp(log(-x) * y)); |
- |
|
2767 |
.................... } |
- |
|
2768 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
- |
|
2769 |
.................... return 0; |
- |
|
2770 |
.................... } else { |
- |
|
2771 |
.................... if(x != 0 || 0 >= y) { |
- |
|
2772 |
.................... return (exp(log(x) * y)); |
- |
|
2773 |
.................... } |
- |
|
2774 |
.................... } |
- |
|
2775 |
.................... } |
- |
|
2776 |
.................... #endif |
- |
|
2777 |
.................... |
- |
|
2778 |
.................... //////////////////// Power functions //////////////////// |
- |
|
2779 |
.................... |
- |
|
2780 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
2781 |
.................... // float pow(float x,float y) |
- |
|
2782 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
2783 |
.................... // Description : returns the value (x^y) |
- |
|
2784 |
.................... // Date : N/A |
- |
|
2785 |
.................... // Note : 0 is returned when the function will generate an imaginary number |
- |
|
2786 |
.................... // |
- |
|
2787 |
.................... float32 pow(float32 x,float32 y) |
- |
|
2788 |
.................... { |
- |
|
2789 |
.................... if(0 > x && fmod(y, 1) == 0) { |
- |
|
2790 |
.................... if(fmod(y, 2) == 0) { |
- |
|
2791 |
.................... return (exp(log(-x) * y)); |
- |
|
2792 |
.................... } else { |
- |
|
2793 |
.................... return (-exp(log(-x) * y)); |
- |
|
2794 |
.................... } |
- |
|
2795 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
- |
|
2796 |
.................... return 0; |
- |
|
2797 |
.................... } else { |
- |
|
2798 |
.................... if(x != 0 || 0 >= y) { |
- |
|
2799 |
.................... return (exp(log(x) * y)); |
- |
|
2800 |
.................... } |
- |
|
2801 |
.................... } |
- |
|
2802 |
.................... } |
- |
|
2803 |
.................... //Overloaded functions for pow() for PCD |
- |
|
2804 |
.................... // Overloaded function for pow() data type - Float48 |
- |
|
2805 |
.................... #if defined(__PCD__) |
- |
|
2806 |
.................... float48 pow(float48 x,float48 y) |
- |
|
2807 |
.................... { |
- |
|
2808 |
.................... if(0 > x && fmod(y, 1) == 0) { |
- |
|
2809 |
.................... if(fmod(y, 2) == 0) { |
- |
|
2810 |
.................... return (exp(log(-x) * y)); |
- |
|
2811 |
.................... } else { |
- |
|
2812 |
.................... return (-exp(log(-x) * y)); |
- |
|
2813 |
.................... } |
- |
|
2814 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
- |
|
2815 |
.................... return 0; |
- |
|
2816 |
.................... } else { |
- |
|
2817 |
.................... if(x != 0 || 0 >= y) { |
- |
|
2818 |
.................... return (exp(log(x) * y)); |
- |
|
2819 |
.................... } |
- |
|
2820 |
.................... } |
- |
|
2821 |
.................... } |
- |
|
2822 |
.................... |
- |
|
2823 |
.................... // Overloaded function pow() for data type - Float64 |
- |
|
2824 |
.................... float64 pow(float64 x,float64 y) |
- |
|
2825 |
.................... { |
- |
|
2826 |
.................... if(0 > x && fmod(y, 1) == 0) { |
- |
|
2827 |
.................... if(fmod(y, 2) == 0) { |
- |
|
2828 |
.................... return (exp(log(-x) * y)); |
- |
|
2829 |
.................... } else { |
- |
|
2830 |
.................... return (-exp(log(-x) * y)); |
- |
|
2831 |
.................... } |
- |
|
2832 |
.................... } else if(0 > x && fmod(y, 1) != 0) { |
- |
|
2833 |
.................... return 0; |
- |
|
2834 |
.................... } else { |
- |
|
2835 |
.................... if(x != 0 || 0 >= y) { |
- |
|
2836 |
.................... return (exp(log(x) * y)); |
- |
|
2837 |
.................... } |
- |
|
2838 |
.................... } |
- |
|
2839 |
.................... } |
- |
|
2840 |
.................... #endif |
- |
|
2841 |
.................... |
- |
|
2842 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
2843 |
.................... // float sqrt(float x) |
- |
|
2844 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
2845 |
.................... // Description : returns the square root of x |
- |
|
2846 |
.................... // Date : N/A |
- |
|
2847 |
.................... // |
- |
|
2848 |
.................... float32 sqrt(float32 x) |
- |
|
2849 |
.................... { |
- |
|
2850 |
.................... float32 y, res; |
- |
|
2851 |
.................... #if defined(__PCD__) |
- |
|
2852 |
.................... unsigned int16 data1,data2; |
- |
|
2853 |
.................... #endif |
- |
|
2854 |
.................... BYTE *p; |
- |
|
2855 |
.................... |
- |
|
2856 |
.................... #ifdef _ERRNO |
- |
|
2857 |
.................... if(x < 0) |
- |
|
2858 |
.................... { |
- |
|
2859 |
.................... errno=EDOM; |
- |
|
2860 |
.................... } |
- |
|
2861 |
.................... #endif |
- |
|
2862 |
.................... |
- |
|
2863 |
.................... if( x<=0.0) |
- |
|
2864 |
.................... return(0.0); |
- |
|
2865 |
.................... |
- |
|
2866 |
.................... y=x; |
- |
|
2867 |
.................... |
- |
|
2868 |
.................... #if !defined(__PCD__) |
- |
|
2869 |
.................... p=&y; |
- |
|
2870 |
.................... (*p)=(BYTE)((((unsigned int16)(*p)) + 127) >> 1); |
- |
|
2871 |
.................... #endif |
- |
|
2872 |
.................... |
- |
|
2873 |
.................... #if defined(__PCD__) |
- |
|
2874 |
.................... p = (((unsigned int8 *)(&y))+3); |
- |
|
2875 |
.................... data1 = *(((unsigned int8 *)(&y))+3); |
- |
|
2876 |
.................... data2 = *(((unsigned int8 *)(&y))+2); |
- |
|
2877 |
.................... rotate_left(&data1,1); |
- |
|
2878 |
.................... if(bit_test(data2,7)) |
- |
|
2879 |
.................... bit_set(data1,0); |
- |
|
2880 |
.................... data1 = ((data1+127) >>1); |
- |
|
2881 |
.................... bit_clear(data2,7); |
- |
|
2882 |
.................... if(bit_test(data1,0)) |
- |
|
2883 |
.................... bit_set(data2,7); |
- |
|
2884 |
.................... data1 = data1 >>1; |
- |
|
2885 |
.................... *(((unsigned int8 *)(&y))+3) = data1; |
- |
|
2886 |
.................... *(((unsigned int8 *)(&y))+2) = data2; |
- |
|
2887 |
.................... |
- |
|
2888 |
.................... #endif |
- |
|
2889 |
.................... |
- |
|
2890 |
.................... do { |
- |
|
2891 |
.................... res=y; |
- |
|
2892 |
.................... y+=(x/y); |
- |
|
2893 |
.................... |
- |
|
2894 |
.................... #if !defined(__PCD__) |
- |
|
2895 |
.................... (*p)--; |
- |
|
2896 |
.................... #endif |
- |
|
2897 |
.................... |
- |
|
2898 |
.................... #if defined(__PCD__) |
- |
|
2899 |
.................... data1 = *(((unsigned int8 *)(&y))+3); |
- |
|
2900 |
.................... data2 = *(((unsigned int8 *)(&y))+2); |
- |
|
2901 |
.................... rotate_left(&data1,1); |
- |
|
2902 |
.................... if(bit_test(data2,7)) |
- |
|
2903 |
.................... bit_set(data1,0); |
- |
|
2904 |
.................... data1--; |
- |
|
2905 |
.................... bit_clear(data2,7); |
- |
|
2906 |
.................... if(bit_test(data1,0)) |
- |
|
2907 |
.................... bit_set(data2,7); |
- |
|
2908 |
.................... data1 = data1 >>1; |
- |
|
2909 |
.................... *(((unsigned int8 *)(&y))+3) = data1; |
- |
|
2910 |
.................... *(((unsigned int8 *)(&y))+2) = data2; |
- |
|
2911 |
.................... |
- |
|
2912 |
.................... #endif |
- |
|
2913 |
.................... } while(res != y); |
- |
|
2914 |
.................... |
- |
|
2915 |
.................... return(res); |
- |
|
2916 |
.................... } |
- |
|
2917 |
.................... //Overloaded functions for sqrt() for PCD |
- |
|
2918 |
.................... // Overloaded function sqrt() for data type - Float48 |
- |
|
2919 |
.................... #if defined(__PCD__) |
- |
|
2920 |
.................... float48 sqrt(float48 x) |
- |
|
2921 |
.................... { |
- |
|
2922 |
.................... float48 y, res; |
- |
|
2923 |
.................... unsigned int16 data1,data2; |
- |
|
2924 |
.................... BYTE *p; |
- |
|
2925 |
.................... |
- |
|
2926 |
.................... #ifdef _ERRNO |
- |
|
2927 |
.................... if(x < 0) |
- |
|
2928 |
.................... { |
- |
|
2929 |
.................... errno=EDOM; |
- |
|
2930 |
.................... } |
- |
|
2931 |
.................... #endif |
- |
|
2932 |
.................... |
- |
|
2933 |
.................... if( x<=0.0) |
- |
|
2934 |
.................... return(0.0); |
- |
|
2935 |
.................... |
- |
|
2936 |
.................... y=x; |
- |
|
2937 |
.................... |
- |
|
2938 |
.................... #if !defined(__PCD__) |
- |
|
2939 |
.................... p=&y; |
- |
|
2940 |
.................... (*p)=(BYTE)((((unsigned int16)(*p)) + 127) >> 1); |
- |
|
2941 |
.................... #endif |
- |
|
2942 |
.................... |
- |
|
2943 |
.................... #if defined(__PCD__) |
- |
|
2944 |
.................... p = (((unsigned int8 *)(&y))+5); |
- |
|
2945 |
.................... data1 = *(((unsigned int8 *)(&y))+5); |
- |
|
2946 |
.................... data2 = *(((unsigned int8 *)(&y))+4); |
- |
|
2947 |
.................... rotate_left(&data1,1); |
- |
|
2948 |
.................... if(bit_test(data2,7)) |
- |
|
2949 |
.................... bit_set(data1,0); |
- |
|
2950 |
.................... data1 = ((data1+127) >>1); |
- |
|
2951 |
.................... bit_clear(data2,7); |
- |
|
2952 |
.................... if(bit_test(data1,0)) |
- |
|
2953 |
.................... bit_set(data2,7); |
- |
|
2954 |
.................... data1 = data1 >>1; |
- |
|
2955 |
.................... *(((unsigned int8 *)(&y))+5) = data1; |
- |
|
2956 |
.................... *(((unsigned int8 *)(&y))+4) = data2; |
- |
|
2957 |
.................... |
- |
|
2958 |
.................... #endif |
- |
|
2959 |
.................... |
- |
|
2960 |
.................... do { |
- |
|
2961 |
.................... res=y; |
- |
|
2962 |
.................... y+=(x/y); |
- |
|
2963 |
.................... |
- |
|
2964 |
.................... #if !defined(__PCD__) |
- |
|
2965 |
.................... (*p)--; |
- |
|
2966 |
.................... #endif |
- |
|
2967 |
.................... |
- |
|
2968 |
.................... data1 = *(((unsigned int8 *)(&y))+5); |
- |
|
2969 |
.................... data2 = *(((unsigned int8 *)(&y))+4); |
- |
|
2970 |
.................... rotate_left(&data1,1); |
- |
|
2971 |
.................... if(bit_test(data2,7)) |
- |
|
2972 |
.................... bit_set(data1,0); |
- |
|
2973 |
.................... data1--; |
- |
|
2974 |
.................... bit_clear(data2,7); |
- |
|
2975 |
.................... if(bit_test(data1,0)) |
- |
|
2976 |
.................... bit_set(data2,7); |
- |
|
2977 |
.................... data1 = data1 >>1; |
- |
|
2978 |
.................... *(((unsigned int8 *)(&y))+5) = data1; |
- |
|
2979 |
.................... *(((unsigned int8 *)(&y))+4) = data2; |
- |
|
2980 |
.................... |
- |
|
2981 |
.................... } while(res != y); |
- |
|
2982 |
.................... |
- |
|
2983 |
.................... return(res); |
- |
|
2984 |
.................... } |
- |
|
2985 |
.................... |
- |
|
2986 |
.................... // Overloaded function sqrt() for data type - Float64 |
- |
|
2987 |
.................... float64 sqrt(float64 x) |
- |
|
2988 |
.................... { |
- |
|
2989 |
.................... float64 y, res; |
- |
|
2990 |
.................... unsigned int16 *p; |
- |
|
2991 |
.................... unsigned int16 temp1,temp2; |
- |
|
2992 |
.................... |
- |
|
2993 |
.................... #ifdef _ERRNO |
- |
|
2994 |
.................... if(x < 0) |
- |
|
2995 |
.................... { |
- |
|
2996 |
.................... errno=EDOM; |
- |
|
2997 |
.................... } |
- |
|
2998 |
.................... #endif |
- |
|
2999 |
.................... |
- |
|
3000 |
.................... if( x<=0.0) |
- |
|
3001 |
.................... return(0.0); |
- |
|
3002 |
.................... |
- |
|
3003 |
.................... y=x; |
- |
|
3004 |
.................... p= (((unsigned int16 *)(&y))+3); |
- |
|
3005 |
.................... temp1 = *p; |
- |
|
3006 |
.................... temp2 = *p; |
- |
|
3007 |
.................... bit_clear(temp1,15); |
- |
|
3008 |
.................... temp1 = (temp1>>4)+1023; |
- |
|
3009 |
.................... temp1 = temp1 >> 1; |
- |
|
3010 |
.................... temp1 = (temp1<<4) & 0xFFF0; |
- |
|
3011 |
.................... if(bit_test(temp2,15)) |
- |
|
3012 |
.................... bit_set(temp1,15); |
- |
|
3013 |
.................... temp2 = temp2 & 0x000F; |
- |
|
3014 |
.................... temp1 ^= temp2; |
- |
|
3015 |
.................... |
- |
|
3016 |
.................... (*p) = temp1; |
- |
|
3017 |
.................... |
- |
|
3018 |
.................... do { |
- |
|
3019 |
.................... res=y; |
- |
|
3020 |
.................... y+=(x/y); |
- |
|
3021 |
.................... temp1 = *p; |
- |
|
3022 |
.................... temp2 = *p; |
- |
|
3023 |
.................... bit_clear(temp1,15); |
- |
|
3024 |
.................... temp1 = (temp1>>4); |
- |
|
3025 |
.................... temp1--; |
- |
|
3026 |
.................... temp1 = (temp1<<4) & 0xFFF0; |
- |
|
3027 |
.................... if(bit_test(temp2,15)) |
- |
|
3028 |
.................... bit_set(temp1,15); |
- |
|
3029 |
.................... temp2 = temp2 & 0x000F; |
- |
|
3030 |
.................... temp1 ^= temp2; |
- |
|
3031 |
.................... (*p) = temp1; |
- |
|
3032 |
.................... |
- |
|
3033 |
.................... } while(res != y); |
- |
|
3034 |
.................... |
- |
|
3035 |
.................... return(res); |
- |
|
3036 |
.................... } |
- |
|
3037 |
.................... #endif |
- |
|
3038 |
.................... |
- |
|
3039 |
.................... ////////////////////////////// Trig Functions ////////////////////////////// |
- |
|
3040 |
.................... #ifdef PI_DIV_BY_TWO |
- |
|
3041 |
.................... #undef PI_DIV_BY_TWO |
- |
|
3042 |
.................... #endif |
- |
|
3043 |
.................... #define PI_DIV_BY_TWO 1.5707963267948966 |
- |
|
3044 |
.................... #ifdef TWOBYPI |
- |
|
3045 |
.................... #undef TWOBYPI |
- |
|
3046 |
.................... #define TWOBYPI 0.6366197723675813 |
- |
|
3047 |
.................... #endif |
- |
|
3048 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
3049 |
.................... // float cos(float x) |
- |
|
3050 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
3051 |
.................... // Description : returns the cosine value of the angle x, which is in radian |
- |
|
3052 |
.................... // Date : 9/20/2001 |
- |
|
3053 |
.................... // |
- |
|
3054 |
.................... float32 cos(float32 x) |
- |
|
3055 |
.................... { |
- |
|
3056 |
.................... float32 y, t, t2 = 1.0; |
- |
|
3057 |
.................... unsigned int8 quad, i; |
- |
|
3058 |
.................... float32 frac; |
- |
|
3059 |
.................... float32 p[6] = { //by the series definition for cosine |
- |
|
3060 |
.................... -0.5, // sum ( ( (-1)^n * x^2n )/(2n)! ) |
- |
|
3061 |
.................... 0.04166666666667, |
- |
|
3062 |
.................... -0.00138888888889, |
- |
|
3063 |
.................... 0.00002480158730, |
- |
|
3064 |
.................... -0.00000027557319, |
- |
|
3065 |
.................... 0.00000000208767, |
- |
|
3066 |
.................... //-0.00000000001147, |
- |
|
3067 |
.................... // 0.00000000000005 |
- |
|
3068 |
.................... }; |
- |
|
3069 |
.................... |
- |
|
3070 |
.................... if (x < 0) x = -x; // absolute value of input |
- |
|
3071 |
.................... |
- |
|
3072 |
.................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant |
- |
|
3073 |
.................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input |
- |
|
3074 |
.................... quad = quad % 4; // quadrant (0 to 3) |
- |
|
3075 |
.................... |
- |
|
3076 |
.................... if (quad == 0 || quad == 2) |
- |
|
3077 |
.................... t = frac * PI_DIV_BY_TWO; |
- |
|
3078 |
.................... else if (quad == 1) |
- |
|
3079 |
.................... t = (1-frac) * PI_DIV_BY_TWO; |
- |
|
3080 |
.................... else // should be 3 |
- |
|
3081 |
.................... t = (frac-1) * PI_DIV_BY_TWO; |
- |
|
3082 |
.................... |
- |
|
3083 |
.................... y = 1.0; |
- |
|
3084 |
.................... t = t * t; |
- |
|
3085 |
.................... for (i = 0; i <= 5; i++) |
- |
|
3086 |
.................... { |
- |
|
3087 |
.................... t2 = t2 * t; |
- |
|
3088 |
.................... y = y + p[i] * t2; |
- |
|
3089 |
.................... } |
- |
|
3090 |
.................... |
- |
|
3091 |
.................... if (quad == 2 || quad == 1) |
- |
|
3092 |
.................... y = -y; // correct sign |
- |
|
3093 |
.................... |
- |
|
3094 |
.................... return (y); |
- |
|
3095 |
.................... } |
- |
|
3096 |
.................... |
- |
|
3097 |
.................... |
- |
|
3098 |
.................... //Overloaded functions for cos() for PCD |
- |
|
3099 |
.................... // Overloaded function cos() for data type - Float48 |
- |
|
3100 |
.................... #if defined(__PCD__) |
- |
|
3101 |
.................... float48 cos(float48 x) |
- |
|
3102 |
.................... { |
- |
|
3103 |
.................... float48 y, t, t2 = 1.0; |
- |
|
3104 |
.................... unsigned int8 quad, i; |
- |
|
3105 |
.................... float48 frac; |
- |
|
3106 |
.................... float48 p[6] = { //by the series definition for cosine |
- |
|
3107 |
.................... -0.5, // sum ( ( (-1)^n * x^2n )/(2n)! ) |
- |
|
3108 |
.................... 0.04166666666667, |
- |
|
3109 |
.................... -0.00138888888889, |
- |
|
3110 |
.................... 0.00002480158730, |
- |
|
3111 |
.................... -0.00000027557319, |
- |
|
3112 |
.................... 0.00000000208767, |
- |
|
3113 |
.................... //-0.00000000001147, |
- |
|
3114 |
.................... // 0.00000000000005 |
- |
|
3115 |
.................... }; |
- |
|
3116 |
.................... |
- |
|
3117 |
.................... if (x < 0) x = -x; // absolute value of input |
- |
|
3118 |
.................... |
- |
|
3119 |
.................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant |
- |
|
3120 |
.................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input |
- |
|
3121 |
.................... quad = quad % 4; // quadrant (0 to 3) |
- |
|
3122 |
.................... |
- |
|
3123 |
.................... if (quad == 0 || quad == 2) |
- |
|
3124 |
.................... t = frac * PI_DIV_BY_TWO; |
- |
|
3125 |
.................... else if (quad == 1) |
- |
|
3126 |
.................... t = (1-frac) * PI_DIV_BY_TWO; |
- |
|
3127 |
.................... else // should be 3 |
- |
|
3128 |
.................... t = (frac-1) * PI_DIV_BY_TWO; |
- |
|
3129 |
.................... |
- |
|
3130 |
.................... y = 0.999999999781; |
- |
|
3131 |
.................... t = t * t; |
- |
|
3132 |
.................... for (i = 0; i <= 5; i++) |
- |
|
3133 |
.................... { |
- |
|
3134 |
.................... t2 = t2 * t; |
- |
|
3135 |
.................... y = y + p[i] * t2; |
- |
|
3136 |
.................... } |
- |
|
3137 |
.................... |
- |
|
3138 |
.................... if (quad == 2 || quad == 1) |
- |
|
3139 |
.................... y = -y; // correct sign |
- |
|
3140 |
.................... |
- |
|
3141 |
.................... return (y); |
- |
|
3142 |
.................... } |
- |
|
3143 |
.................... |
- |
|
3144 |
.................... // Overloaded function cos() for data type - Float48 |
- |
|
3145 |
.................... float64 cos(float64 x) |
- |
|
3146 |
.................... { |
- |
|
3147 |
.................... float64 y, t, t2 = 1.0; |
- |
|
3148 |
.................... unsigned int8 quad, i; |
- |
|
3149 |
.................... float64 frac; |
- |
|
3150 |
.................... float64 p[6] = { //by the series definition for cosine |
- |
|
3151 |
.................... -0.5, // sum ( ( (-1)^n * x^2n )/(2n)! ) |
- |
|
3152 |
.................... 0.04166666666667, |
- |
|
3153 |
.................... -0.00138888888889, |
- |
|
3154 |
.................... 0.00002480158730, |
- |
|
3155 |
.................... -0.00000027557319, |
- |
|
3156 |
.................... 0.00000000208767, |
- |
|
3157 |
.................... //-0.00000000001147, |
- |
|
3158 |
.................... // 0.00000000000005 |
- |
|
3159 |
.................... }; |
- |
|
3160 |
.................... |
- |
|
3161 |
.................... if (x < 0) x = -x; // absolute value of input |
- |
|
3162 |
.................... |
- |
|
3163 |
.................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant |
- |
|
3164 |
.................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input |
- |
|
3165 |
.................... quad = quad % 4; // quadrant (0 to 3) |
- |
|
3166 |
.................... |
- |
|
3167 |
.................... if (quad == 0 || quad == 2) |
- |
|
3168 |
.................... t = frac * PI_DIV_BY_TWO; |
- |
|
3169 |
.................... else if (quad == 1) |
- |
|
3170 |
.................... t = (1-frac) * PI_DIV_BY_TWO; |
- |
|
3171 |
.................... else // should be 3 |
- |
|
3172 |
.................... t = (frac-1) * PI_DIV_BY_TWO; |
- |
|
3173 |
.................... |
- |
|
3174 |
.................... y = 0.999999999781; |
- |
|
3175 |
.................... t = t * t; |
- |
|
3176 |
.................... for (i = 0; i <= 5; i++) |
- |
|
3177 |
.................... { |
- |
|
3178 |
.................... t2 = t2 * t; |
- |
|
3179 |
.................... y = y + p[i] * t2; |
- |
|
3180 |
.................... } |
- |
|
3181 |
.................... |
- |
|
3182 |
.................... if (quad == 2 || quad == 1) |
- |
|
3183 |
.................... y = -y; // correct sign |
- |
|
3184 |
.................... |
- |
|
3185 |
.................... return (y); |
- |
|
3186 |
.................... } |
- |
|
3187 |
.................... |
- |
|
3188 |
.................... #endif |
- |
|
3189 |
.................... |
- |
|
3190 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
3191 |
.................... // float sin(float x) |
- |
|
3192 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
3193 |
.................... // Description : returns the sine value of the angle x, which is in radian |
- |
|
3194 |
.................... // Date : 9/20/2001 |
- |
|
3195 |
.................... // |
- |
|
3196 |
.................... float32 sin(float32 x) |
- |
|
3197 |
.................... { |
- |
|
3198 |
.................... return cos(x - PI_DIV_BY_TWO); |
- |
|
3199 |
.................... } |
- |
|
3200 |
.................... |
- |
|
3201 |
.................... //Overloaded functions for sin() for PCD |
- |
|
3202 |
.................... // Overloaded function sin() for data type - Float48 |
- |
|
3203 |
.................... #if defined(__PCD__) |
- |
|
3204 |
.................... float48 sin(float48 x) |
- |
|
3205 |
.................... { |
- |
|
3206 |
.................... return cos(x - PI_DIV_BY_TWO); |
- |
|
3207 |
.................... } |
- |
|
3208 |
.................... |
- |
|
3209 |
.................... // Overloaded function sin() for data type - Float48 |
- |
|
3210 |
.................... float64 sin(float64 x) |
- |
|
3211 |
.................... { |
- |
|
3212 |
.................... return cos(x - PI_DIV_BY_TWO); |
- |
|
3213 |
.................... } |
- |
|
3214 |
.................... #endif |
- |
|
3215 |
.................... |
- |
|
3216 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
3217 |
.................... // float tan(float x) |
- |
|
3218 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
3219 |
.................... // Description : returns the tangent value of the angle x, which is in radian |
- |
|
3220 |
.................... // Date : 9/20/2001 |
- |
|
3221 |
.................... // |
- |
|
3222 |
.................... float32 tan(float32 x) |
- |
|
3223 |
.................... { |
- |
|
3224 |
.................... float32 c, s; |
- |
|
3225 |
.................... |
- |
|
3226 |
.................... c = cos(x); |
- |
|
3227 |
.................... if (c == 0.0) |
- |
|
3228 |
.................... return (1.0e+36); |
- |
|
3229 |
.................... |
- |
|
3230 |
.................... s = sin(x); |
- |
|
3231 |
.................... return(s/c); |
- |
|
3232 |
.................... } |
- |
|
3233 |
.................... //Overloaded functions for tan() for PCD |
- |
|
3234 |
.................... // Overloaded function tan() for data type - Float48 |
- |
|
3235 |
.................... #if defined(__PCD__) |
- |
|
3236 |
.................... float48 tan(float48 x) |
- |
|
3237 |
.................... { |
- |
|
3238 |
.................... float48 c, s; |
- |
|
3239 |
.................... |
- |
|
3240 |
.................... c = cos(x); |
- |
|
3241 |
.................... if (c == 0.0) |
- |
|
3242 |
.................... return (1.0e+36); |
- |
|
3243 |
.................... |
- |
|
3244 |
.................... s = sin(x); |
- |
|
3245 |
.................... return(s/c); |
- |
|
3246 |
.................... } |
- |
|
3247 |
.................... |
- |
|
3248 |
.................... // Overloaded function tan() for data type - Float48 |
- |
|
3249 |
.................... float64 tan(float64 x) |
- |
|
3250 |
.................... { |
- |
|
3251 |
.................... float64 c, s; |
- |
|
3252 |
.................... |
- |
|
3253 |
.................... c = cos(x); |
- |
|
3254 |
.................... if (c == 0.0) |
- |
|
3255 |
.................... return (1.0e+36); |
- |
|
3256 |
.................... |
- |
|
3257 |
.................... s = sin(x); |
- |
|
3258 |
.................... return(s/c); |
- |
|
3259 |
.................... } |
- |
|
3260 |
.................... #endif |
- |
|
3261 |
.................... |
- |
|
3262 |
.................... float32 const pas[3] = {0.49559947, -4.6145309, 5.6036290}; |
- |
|
3263 |
.................... float32 const qas[3] = {1.0000000, -5.5484666, 5.6036290}; |
- |
|
3264 |
.................... |
- |
|
3265 |
.................... float32 ASIN_COS(float32 x, unsigned int8 n) |
- |
|
3266 |
.................... { |
- |
|
3267 |
.................... float32 y, res, r, y2; |
- |
|
3268 |
.................... int1 s; |
- |
|
3269 |
.................... #ifdef _ERRNO |
- |
|
3270 |
.................... if(x <-1 || x > 1) |
- |
|
3271 |
.................... { |
- |
|
3272 |
.................... errno=EDOM; |
- |
|
3273 |
.................... } |
- |
|
3274 |
.................... #endif |
- |
|
3275 |
.................... s = 0; |
- |
|
3276 |
.................... y = x; |
- |
|
3277 |
.................... |
- |
|
3278 |
.................... if (x < 0) |
- |
|
3279 |
.................... { |
- |
|
3280 |
.................... s = 1; |
- |
|
3281 |
.................... y = -y; |
- |
|
3282 |
.................... } |
- |
|
3283 |
.................... |
- |
|
3284 |
.................... if (y > 0.5) |
- |
|
3285 |
.................... { |
- |
|
3286 |
.................... y = sqrt((1.0 - y)/2.0); |
- |
|
3287 |
.................... n += 2; |
- |
|
3288 |
.................... } |
- |
|
3289 |
.................... |
- |
|
3290 |
.................... y2=y*y; |
- |
|
3291 |
.................... |
- |
|
3292 |
.................... res = pas[0]*y2 + pas[1]; |
- |
|
3293 |
.................... res = res*y2 + pas[2]; |
- |
|
3294 |
.................... |
- |
|
3295 |
.................... r = qas[0]*y2 + qas[1]; |
- |
|
3296 |
.................... r = r*y2 + qas[2]; |
- |
|
3297 |
.................... |
- |
|
3298 |
.................... res = y*res/r; |
- |
|
3299 |
.................... |
- |
|
3300 |
.................... if (n & 2) // |x| > 0.5 |
- |
|
3301 |
.................... res = PI_DIV_BY_TWO - 2.0*res; |
- |
|
3302 |
.................... if (s) |
- |
|
3303 |
.................... res = -res; |
- |
|
3304 |
.................... if (n & 1) // take arccos |
- |
|
3305 |
.................... res = PI_DIV_BY_TWO - res; |
- |
|
3306 |
.................... |
- |
|
3307 |
.................... return(res); |
- |
|
3308 |
.................... } |
- |
|
3309 |
.................... |
- |
|
3310 |
.................... //Overloaded functions for ASIN_COS() for PCD |
- |
|
3311 |
.................... // Overloaded function ASIN_COS() for data type - Float48 |
- |
|
3312 |
.................... #if defined(__PCD__) |
- |
|
3313 |
.................... float48 ASIN_COS(float48 x, unsigned int8 n) |
- |
|
3314 |
.................... { |
- |
|
3315 |
.................... float48 y, res, r, y2; |
- |
|
3316 |
.................... int1 s; |
- |
|
3317 |
.................... #ifdef _ERRNO |
- |
|
3318 |
.................... if(x <-1 || x > 1) |
- |
|
3319 |
.................... { |
- |
|
3320 |
.................... errno=EDOM; |
- |
|
3321 |
.................... } |
- |
|
3322 |
.................... #endif |
- |
|
3323 |
.................... s = 0; |
- |
|
3324 |
.................... y = x; |
- |
|
3325 |
.................... |
- |
|
3326 |
.................... if (x < 0) |
- |
|
3327 |
.................... { |
- |
|
3328 |
.................... s = 1; |
- |
|
3329 |
.................... y = -y; |
- |
|
3330 |
.................... } |
- |
|
3331 |
.................... |
- |
|
3332 |
.................... if (y > 0.5) |
- |
|
3333 |
.................... { |
- |
|
3334 |
.................... y = sqrt((1.0 - y)/2.0); |
- |
|
3335 |
.................... n += 2; |
- |
|
3336 |
.................... } |
- |
|
3337 |
.................... |
- |
|
3338 |
.................... y2=y*y; |
- |
|
3339 |
.................... |
- |
|
3340 |
.................... res = pas[0]*y2 + pas[1]; |
- |
|
3341 |
.................... res = res*y2 + pas[2]; |
- |
|
3342 |
.................... |
- |
|
3343 |
.................... r = qas[0]*y2 + qas[1]; |
- |
|
3344 |
.................... r = r*y2 + qas[2]; |
- |
|
3345 |
.................... |
- |
|
3346 |
.................... res = y*res/r; |
- |
|
3347 |
.................... |
- |
|
3348 |
.................... if (n & 2) // |x| > 0.5 |
- |
|
3349 |
.................... res = PI_DIV_BY_TWO - 2.0*res; |
- |
|
3350 |
.................... if (s) |
- |
|
3351 |
.................... res = -res; |
- |
|
3352 |
.................... if (n & 1) // take arccos |
- |
|
3353 |
.................... res = PI_DIV_BY_TWO - res; |
- |
|
3354 |
.................... |
- |
|
3355 |
.................... return(res); |
- |
|
3356 |
.................... } |
- |
|
3357 |
.................... |
- |
|
3358 |
.................... // Overloaded function ASIN_COS() for data type - Float64 |
- |
|
3359 |
.................... float64 ASIN_COS(float64 x, unsigned int8 n) |
- |
|
3360 |
.................... { |
- |
|
3361 |
.................... float64 y, res, r, y2; |
- |
|
3362 |
.................... int1 s; |
- |
|
3363 |
.................... #ifdef _ERRNO |
- |
|
3364 |
.................... if(x <-1 || x > 1) |
- |
|
3365 |
.................... { |
- |
|
3366 |
.................... errno=EDOM; |
- |
|
3367 |
.................... } |
- |
|
3368 |
.................... #endif |
- |
|
3369 |
.................... s = 0; |
- |
|
3370 |
.................... y = x; |
- |
|
3371 |
.................... |
- |
|
3372 |
.................... if (x < 0) |
- |
|
3373 |
.................... { |
- |
|
3374 |
.................... s = 1; |
- |
|
3375 |
.................... y = -y; |
- |
|
3376 |
.................... } |
- |
|
3377 |
.................... |
- |
|
3378 |
.................... if (y > 0.5) |
- |
|
3379 |
.................... { |
- |
|
3380 |
.................... y = sqrt((1.0 - y)/2.0); |
- |
|
3381 |
.................... n += 2; |
- |
|
3382 |
.................... } |
- |
|
3383 |
.................... |
- |
|
3384 |
.................... y2=y*y; |
- |
|
3385 |
.................... |
- |
|
3386 |
.................... res = pas[0]*y2 + pas[1]; |
- |
|
3387 |
.................... res = res*y2 + pas[2]; |
- |
|
3388 |
.................... |
- |
|
3389 |
.................... r = qas[0]*y2 + qas[1]; |
- |
|
3390 |
.................... r = r*y2 + qas[2]; |
- |
|
3391 |
.................... |
- |
|
3392 |
.................... res = y*res/r; |
- |
|
3393 |
.................... |
- |
|
3394 |
.................... if (n & 2) // |x| > 0.5 |
- |
|
3395 |
.................... res = PI_DIV_BY_TWO - 2.0*res; |
- |
|
3396 |
.................... if (s) |
- |
|
3397 |
.................... res = -res; |
- |
|
3398 |
.................... if (n & 1) // take arccos |
- |
|
3399 |
.................... res = PI_DIV_BY_TWO - res; |
- |
|
3400 |
.................... |
- |
|
3401 |
.................... return(res); |
- |
|
3402 |
.................... } |
- |
|
3403 |
.................... #endif |
- |
|
3404 |
.................... |
- |
|
3405 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
3406 |
.................... // float asin(float x) |
- |
|
3407 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
3408 |
.................... // Description : returns the arcsine value of the value x. |
- |
|
3409 |
.................... // Date : N/A |
- |
|
3410 |
.................... // |
- |
|
3411 |
.................... float32 asin(float32 x) |
- |
|
3412 |
.................... { |
- |
|
3413 |
.................... float32 r; |
- |
|
3414 |
.................... |
- |
|
3415 |
.................... r = ASIN_COS(x, 0); |
- |
|
3416 |
.................... return(r); |
- |
|
3417 |
.................... } |
- |
|
3418 |
.................... //Overloaded functions for asin() for PCD |
- |
|
3419 |
.................... // Overloaded function asin() for data type - Float48 |
- |
|
3420 |
.................... #if defined(__PCD__) |
- |
|
3421 |
.................... float48 asin(float48 x) |
- |
|
3422 |
.................... { |
- |
|
3423 |
.................... float48 r; |
- |
|
3424 |
.................... |
- |
|
3425 |
.................... r = ASIN_COS(x, 0); |
- |
|
3426 |
.................... return(r); |
- |
|
3427 |
.................... } |
- |
|
3428 |
.................... |
- |
|
3429 |
.................... // Overloaded function asin() for data type - Float64 |
- |
|
3430 |
.................... float64 asin(float64 x) |
- |
|
3431 |
.................... { |
- |
|
3432 |
.................... float64 r; |
- |
|
3433 |
.................... |
- |
|
3434 |
.................... r = ASIN_COS(x, 0); |
- |
|
3435 |
.................... return(r); |
- |
|
3436 |
.................... } |
- |
|
3437 |
.................... #endif |
- |
|
3438 |
.................... |
- |
|
3439 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
3440 |
.................... // float acos(float x) |
- |
|
3441 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
3442 |
.................... // Description : returns the arccosine value of the value x. |
- |
|
3443 |
.................... // Date : N/A |
- |
|
3444 |
.................... // |
- |
|
3445 |
.................... float32 acos(float32 x) |
- |
|
3446 |
.................... { |
- |
|
3447 |
.................... float32 r; |
- |
|
3448 |
.................... |
- |
|
3449 |
.................... r = ASIN_COS(x, 1); |
- |
|
3450 |
.................... return(r); |
- |
|
3451 |
.................... } |
- |
|
3452 |
.................... //Overloaded functions for acos() for PCD |
- |
|
3453 |
.................... // Overloaded function acos() for data type - Float48 |
- |
|
3454 |
.................... #if defined(__PCD__) |
- |
|
3455 |
.................... float48 acos(float48 x) |
- |
|
3456 |
.................... { |
- |
|
3457 |
.................... float48 r; |
- |
|
3458 |
.................... |
- |
|
3459 |
.................... r = ASIN_COS(x, 1); |
- |
|
3460 |
.................... return(r); |
- |
|
3461 |
.................... } |
- |
|
3462 |
.................... |
- |
|
3463 |
.................... // Overloaded function acos() for data type - Float64 |
- |
|
3464 |
.................... float64 acos(float64 x) |
- |
|
3465 |
.................... { |
- |
|
3466 |
.................... float64 r; |
- |
|
3467 |
.................... |
- |
|
3468 |
.................... r = ASIN_COS(x, 1); |
- |
|
3469 |
.................... return(r); |
- |
|
3470 |
.................... } |
- |
|
3471 |
.................... #endif |
- |
|
3472 |
.................... |
- |
|
3473 |
.................... float32 const pat[4] = {0.17630401, 5.6710795, 22.376096, 19.818457}; |
- |
|
3474 |
.................... float32 const qat[4] = {1.0000000, 11.368190, 28.982246, 19.818457}; |
- |
|
3475 |
.................... |
- |
|
3476 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
3477 |
.................... // float atan(float x) |
- |
|
3478 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
3479 |
.................... // Description : returns the arctangent value of the value x. |
- |
|
3480 |
.................... // Date : N/A |
- |
|
3481 |
.................... // |
- |
|
3482 |
.................... float32 atan(float32 x) |
- |
|
3483 |
.................... { |
- |
|
3484 |
.................... float32 y, res, r; |
- |
|
3485 |
.................... int1 s, flag; |
- |
|
3486 |
.................... |
- |
|
3487 |
.................... s = 0; |
- |
|
3488 |
.................... flag = 0; |
- |
|
3489 |
.................... y = x; |
- |
|
3490 |
.................... |
- |
|
3491 |
.................... if (x < 0) |
- |
|
3492 |
.................... { |
- |
|
3493 |
.................... s = 1; |
- |
|
3494 |
.................... y = -y; |
- |
|
3495 |
.................... } |
- |
|
3496 |
.................... |
- |
|
3497 |
.................... if (y > 1.0) |
- |
|
3498 |
.................... { |
- |
|
3499 |
.................... y = 1.0/y; |
- |
|
3500 |
.................... flag = 1; |
- |
|
3501 |
.................... } |
- |
|
3502 |
.................... |
- |
|
3503 |
.................... res = pat[0]*y*y + pat[1]; |
- |
|
3504 |
.................... res = res*y*y + pat[2]; |
- |
|
3505 |
.................... res = res*y*y + pat[3]; |
- |
|
3506 |
.................... |
- |
|
3507 |
.................... r = qat[0]*y*y + qat[1]; |
- |
|
3508 |
.................... r = r*y*y + qat[2]; |
- |
|
3509 |
.................... r = r*y*y + qat[3]; |
- |
|
3510 |
.................... |
- |
|
3511 |
.................... res = y*res/r; |
- |
|
3512 |
.................... |
- |
|
3513 |
.................... |
- |
|
3514 |
.................... if (flag) // for |x| > 1 |
- |
|
3515 |
.................... res = PI_DIV_BY_TWO - res; |
- |
|
3516 |
.................... if (s) |
- |
|
3517 |
.................... res = -res; |
- |
|
3518 |
.................... |
- |
|
3519 |
.................... return(res); |
- |
|
3520 |
.................... } |
- |
|
3521 |
.................... //Overloaded functions for atan() for PCD |
- |
|
3522 |
.................... // Overloaded function atan() for data type - Float48 |
- |
|
3523 |
.................... #if defined(__PCD__) |
- |
|
3524 |
.................... float48 atan(float48 x) |
- |
|
3525 |
.................... { |
- |
|
3526 |
.................... float48 y, res, r; |
- |
|
3527 |
.................... int1 s, flag; |
- |
|
3528 |
.................... |
- |
|
3529 |
.................... s = 0; |
- |
|
3530 |
.................... flag = 0; |
- |
|
3531 |
.................... y = x; |
- |
|
3532 |
.................... |
- |
|
3533 |
.................... if (x < 0) |
- |
|
3534 |
.................... { |
- |
|
3535 |
.................... s = 1; |
- |
|
3536 |
.................... y = -y; |
- |
|
3537 |
.................... } |
- |
|
3538 |
.................... |
- |
|
3539 |
.................... if (y > 1.0) |
- |
|
3540 |
.................... { |
- |
|
3541 |
.................... y = 1.0/y; |
- |
|
3542 |
.................... flag = 1; |
- |
|
3543 |
.................... } |
- |
|
3544 |
.................... |
- |
|
3545 |
.................... res = pat[0]*y*y + pat[1]; |
- |
|
3546 |
.................... res = res*y*y + pat[2]; |
- |
|
3547 |
.................... res = res*y*y + pat[3]; |
- |
|
3548 |
.................... |
- |
|
3549 |
.................... r = qat[0]*y*y + qat[1]; |
- |
|
3550 |
.................... r = r*y*y + qat[2]; |
- |
|
3551 |
.................... r = r*y*y + qat[3]; |
- |
|
3552 |
.................... |
- |
|
3553 |
.................... res = y*res/r; |
- |
|
3554 |
.................... |
- |
|
3555 |
.................... |
- |
|
3556 |
.................... if (flag) // for |x| > 1 |
- |
|
3557 |
.................... res = PI_DIV_BY_TWO - res; |
- |
|
3558 |
.................... if (s) |
- |
|
3559 |
.................... res = -res; |
- |
|
3560 |
.................... |
- |
|
3561 |
.................... return(res); |
- |
|
3562 |
.................... } |
- |
|
3563 |
.................... |
- |
|
3564 |
.................... // Overloaded function atan() for data type - Float64 |
- |
|
3565 |
.................... float64 atan(float64 x) |
- |
|
3566 |
.................... { |
- |
|
3567 |
.................... float64 y, res, r; |
- |
|
3568 |
.................... int1 s, flag; |
- |
|
3569 |
.................... |
- |
|
3570 |
.................... s = 0; |
- |
|
3571 |
.................... flag = 0; |
- |
|
3572 |
.................... y = x; |
- |
|
3573 |
.................... |
- |
|
3574 |
.................... if (x < 0) |
- |
|
3575 |
.................... { |
- |
|
3576 |
.................... s = 1; |
- |
|
3577 |
.................... y = -y; |
- |
|
3578 |
.................... } |
- |
|
3579 |
.................... |
- |
|
3580 |
.................... if (y > 1.0) |
- |
|
3581 |
.................... { |
- |
|
3582 |
.................... y = 1.0/y; |
- |
|
3583 |
.................... flag = 1; |
- |
|
3584 |
.................... } |
- |
|
3585 |
.................... |
- |
|
3586 |
.................... res = pat[0]*y*y + pat[1]; |
- |
|
3587 |
.................... res = res*y*y + pat[2]; |
- |
|
3588 |
.................... res = res*y*y + pat[3]; |
- |
|
3589 |
.................... |
- |
|
3590 |
.................... r = qat[0]*y*y + qat[1]; |
- |
|
3591 |
.................... r = r*y*y + qat[2]; |
- |
|
3592 |
.................... r = r*y*y + qat[3]; |
- |
|
3593 |
.................... |
- |
|
3594 |
.................... res = y*res/r; |
- |
|
3595 |
.................... |
- |
|
3596 |
.................... |
- |
|
3597 |
.................... if (flag) // for |x| > 1 |
- |
|
3598 |
.................... res = PI_DIV_BY_TWO - res; |
- |
|
3599 |
.................... if (s) |
- |
|
3600 |
.................... res = -res; |
- |
|
3601 |
.................... |
- |
|
3602 |
.................... return(res); |
- |
|
3603 |
.................... } |
- |
|
3604 |
.................... #endif |
- |
|
3605 |
.................... |
- |
|
3606 |
.................... ///////////////////////////////////////////////////////////////////////////// |
- |
|
3607 |
.................... // float atan2(float y, float x) |
- |
|
3608 |
.................... ///////////////////////////////////////////////////////////////////////////// |
- |
|
3609 |
.................... // Description :computes the principal value of arc tangent of y/x, using the |
- |
|
3610 |
.................... // signs of both the arguments to determine the quadrant of the return value |
- |
|
3611 |
.................... // Returns : returns the arc tangent of y/x. |
- |
|
3612 |
.................... // Date : N/A |
- |
|
3613 |
.................... // |
- |
|
3614 |
.................... |
- |
|
3615 |
.................... float32 atan2(float32 y,float32 x) |
- |
|
3616 |
.................... { |
- |
|
3617 |
.................... float32 z; |
- |
|
3618 |
.................... int1 sign; |
- |
|
3619 |
.................... unsigned int8 quad; |
- |
|
3620 |
.................... sign=0; |
- |
|
3621 |
.................... quad=0; //quadrant |
- |
|
3622 |
.................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1)); |
- |
|
3623 |
.................... if(y<0.0) |
- |
|
3624 |
.................... { |
- |
|
3625 |
.................... sign=1; |
- |
|
3626 |
.................... y=-y; |
- |
|
3627 |
.................... } |
- |
|
3628 |
.................... if(x<0.0) |
- |
|
3629 |
.................... { |
- |
|
3630 |
.................... x=-x; |
- |
|
3631 |
.................... } |
- |
|
3632 |
.................... if (x==0.0) |
- |
|
3633 |
.................... { |
- |
|
3634 |
.................... if(y==0.0) |
- |
|
3635 |
.................... { |
- |
|
3636 |
.................... #ifdef _ERRNO |
- |
|
3637 |
.................... { |
- |
|
3638 |
.................... errno=EDOM; |
- |
|
3639 |
.................... } |
- |
|
3640 |
.................... #endif |
- |
|
3641 |
.................... } |
- |
|
3642 |
.................... else |
- |
|
3643 |
.................... { |
- |
|
3644 |
.................... if(sign) |
- |
|
3645 |
.................... { |
- |
|
3646 |
.................... return (-(PI_DIV_BY_TWO)); |
- |
|
3647 |
.................... } |
- |
|
3648 |
.................... else |
- |
|
3649 |
.................... { |
- |
|
3650 |
.................... return (PI_DIV_BY_TWO); |
- |
|
3651 |
.................... } |
- |
|
3652 |
.................... } |
- |
|
3653 |
.................... } |
- |
|
3654 |
.................... else |
- |
|
3655 |
.................... { |
- |
|
3656 |
.................... z=y/x; |
- |
|
3657 |
.................... switch(quad) |
- |
|
3658 |
.................... { |
- |
|
3659 |
.................... case 1: |
- |
|
3660 |
.................... { |
- |
|
3661 |
.................... return atan(z); |
- |
|
3662 |
.................... break; |
- |
|
3663 |
.................... } |
- |
|
3664 |
.................... case 2: |
- |
|
3665 |
.................... { |
- |
|
3666 |
.................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122 |
- |
|
3667 |
.................... return (PI-atan(z)); |
- |
|
3668 |
.................... break; |
- |
|
3669 |
.................... } |
- |
|
3670 |
.................... case 3: |
- |
|
3671 |
.................... { |
- |
|
3672 |
.................... return (atan(z)-PI); |
- |
|
3673 |
.................... break; |
- |
|
3674 |
.................... } |
- |
|
3675 |
.................... case 4: |
- |
|
3676 |
.................... { |
- |
|
3677 |
.................... return (-atan(z)); |
- |
|
3678 |
.................... break; |
- |
|
3679 |
.................... } |
- |
|
3680 |
.................... } |
- |
|
3681 |
.................... } |
- |
|
3682 |
.................... } |
- |
|
3683 |
.................... |
- |
|
3684 |
.................... //Overloaded functions for atan2() for PCD |
- |
|
3685 |
.................... // Overloaded function atan2() for data type - Float48 |
- |
|
3686 |
.................... #if defined(__PCD__) |
- |
|
3687 |
.................... float48 atan2(float48 y,float48 x) |
- |
|
3688 |
.................... { |
- |
|
3689 |
.................... float48 z; |
- |
|
3690 |
.................... int1 sign; |
- |
|
3691 |
.................... unsigned int8 quad; |
- |
|
3692 |
.................... sign=0; |
- |
|
3693 |
.................... quad=0; //quadrant |
- |
|
3694 |
.................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1)); |
- |
|
3695 |
.................... if(y<0.0) |
- |
|
3696 |
.................... { |
- |
|
3697 |
.................... sign=1; |
- |
|
3698 |
.................... y=-y; |
- |
|
3699 |
.................... } |
- |
|
3700 |
.................... if(x<0.0) |
- |
|
3701 |
.................... { |
- |
|
3702 |
.................... x=-x; |
- |
|
3703 |
.................... } |
- |
|
3704 |
.................... if (x==0.0) |
- |
|
3705 |
.................... { |
- |
|
3706 |
.................... if(y==0.0) |
- |
|
3707 |
.................... { |
- |
|
3708 |
.................... #ifdef _ERRNO |
- |
|
3709 |
.................... { |
- |
|
3710 |
.................... errno=EDOM; |
- |
|
3711 |
.................... } |
- |
|
3712 |
.................... #endif |
- |
|
3713 |
.................... } |
- |
|
3714 |
.................... else |
- |
|
3715 |
.................... { |
- |
|
3716 |
.................... if(sign) |
- |
|
3717 |
.................... { |
- |
|
3718 |
.................... return (-(PI_DIV_BY_TWO)); |
- |
|
3719 |
.................... } |
- |
|
3720 |
.................... else |
- |
|
3721 |
.................... { |
- |
|
3722 |
.................... return (PI_DIV_BY_TWO); |
- |
|
3723 |
.................... } |
- |
|
3724 |
.................... } |
- |
|
3725 |
.................... } |
- |
|
3726 |
.................... else |
- |
|
3727 |
.................... { |
- |
|
3728 |
.................... z=y/x; |
- |
|
3729 |
.................... switch(quad) |
- |
|
3730 |
.................... { |
- |
|
3731 |
.................... case 1: |
- |
|
3732 |
.................... { |
- |
|
3733 |
.................... return atan(z); |
- |
|
3734 |
.................... break; |
- |
|
3735 |
.................... } |
- |
|
3736 |
.................... case 2: |
- |
|
3737 |
.................... { |
- |
|
3738 |
.................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122 |
- |
|
3739 |
.................... return (PI-atan(z)); |
- |
|
3740 |
.................... break; |
- |
|
3741 |
.................... } |
- |
|
3742 |
.................... case 3: |
- |
|
3743 |
.................... { |
- |
|
3744 |
.................... return (atan(z)-PI); |
- |
|
3745 |
.................... break; |
- |
|
3746 |
.................... } |
- |
|
3747 |
.................... case 4: |
- |
|
3748 |
.................... { |
- |
|
3749 |
.................... return (-atan(z)); |
- |
|
3750 |
.................... break; |
- |
|
3751 |
.................... } |
- |
|
3752 |
.................... } |
- |
|
3753 |
.................... } |
- |
|
3754 |
.................... } |
- |
|
3755 |
.................... |
- |
|
3756 |
.................... // Overloaded function atan2() for data type - Float64 |
- |
|
3757 |
.................... float64 atan2(float64 y,float64 x) |
- |
|
3758 |
.................... { |
- |
|
3759 |
.................... float64 z; |
- |
|
3760 |
.................... int1 sign; |
- |
|
3761 |
.................... unsigned int8 quad; |
- |
|
3762 |
.................... sign=0; |
- |
|
3763 |
.................... quad=0; //quadrant |
- |
|
3764 |
.................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1)); |
- |
|
3765 |
.................... if(y<0.0) |
- |
|
3766 |
.................... { |
- |
|
3767 |
.................... sign=1; |
- |
|
3768 |
.................... y=-y; |
- |
|
3769 |
.................... } |
- |
|
3770 |
.................... if(x<0.0) |
- |
|
3771 |
.................... { |
- |
|
3772 |
.................... x=-x; |
- |
|
3773 |
.................... } |
- |
|
3774 |
.................... if (x==0.0) |
- |
|
3775 |
.................... { |
- |
|
3776 |
.................... if(y==0.0) |
- |
|
3777 |
.................... { |
- |
|
3778 |
.................... #ifdef _ERRNO |
- |
|
3779 |
.................... { |
- |
|
3780 |
.................... errno=EDOM; |
- |
|
3781 |
.................... } |
- |
|
3782 |
.................... #endif |
- |
|
3783 |
.................... } |
- |
|
3784 |
.................... else |
- |
|
3785 |
.................... { |
- |
|
3786 |
.................... if(sign) |
- |
|
3787 |
.................... { |
- |
|
3788 |
.................... return (-(PI_DIV_BY_TWO)); |
- |
|
3789 |
.................... } |
- |
|
3790 |
.................... else |
- |
|
3791 |
.................... { |
- |
|
3792 |
.................... return (PI_DIV_BY_TWO); |
- |
|
3793 |
.................... } |
- |
|
3794 |
.................... } |
- |
|
3795 |
.................... } |
- |
|
3796 |
.................... else |
- |
|
3797 |
.................... { |
- |
|
3798 |
.................... z=y/x; |
- |
|
3799 |
.................... switch(quad) |
- |
|
3800 |
.................... { |
- |
|
3801 |
.................... case 1: |
- |
|
3802 |
.................... { |
- |
|
3803 |
.................... return atan(z); |
- |
|
3804 |
.................... break; |
- |
|
3805 |
.................... } |
- |
|
3806 |
.................... case 2: |
- |
|
3807 |
.................... { |
- |
|
3808 |
.................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122 |
- |
|
3809 |
.................... return (PI-atan(z)); |
- |
|
3810 |
.................... break; |
- |
|
3811 |
.................... } |
- |
|
3812 |
.................... case 3: |
- |
|
3813 |
.................... { |
- |
|
3814 |
.................... return (atan(z)-PI); |
- |
|
3815 |
.................... break; |
- |
|
3816 |
.................... } |
- |
|
3817 |
.................... case 4: |
- |
|
3818 |
.................... { |
- |
|
3819 |
.................... return (-atan(z)); |
- |
|
3820 |
.................... break; |
- |
|
3821 |
.................... } |
- |
|
3822 |
.................... } |
- |
|
3823 |
.................... } |
- |
|
3824 |
.................... } |
- |
|
3825 |
.................... #endif |
- |
|
3826 |
.................... |
- |
|
3827 |
.................... //////////////////// Hyperbolic functions //////////////////// |
- |
|
3828 |
.................... |
- |
|
3829 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
3830 |
.................... // float cosh(float x) |
- |
|
3831 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
3832 |
.................... // Description : Computes the hyperbolic cosine value of x |
- |
|
3833 |
.................... // Returns : returns the hyperbolic cosine value of x |
- |
|
3834 |
.................... // Date : N/A |
- |
|
3835 |
.................... // |
- |
|
3836 |
.................... |
- |
|
3837 |
.................... float32 cosh(float32 x) |
- |
|
3838 |
.................... { |
- |
|
3839 |
.................... return ((exp(x)+exp(-x))/2); |
- |
|
3840 |
.................... } |
- |
|
3841 |
.................... //Overloaded functions for cosh() for PCD |
- |
|
3842 |
.................... // Overloaded function cosh() for data type - Float48 |
- |
|
3843 |
.................... #if defined(__PCD__) |
- |
|
3844 |
.................... float48 cosh(float48 x) |
- |
|
3845 |
.................... { |
- |
|
3846 |
.................... return ((exp(x)+exp(-x))/2); |
- |
|
3847 |
.................... } |
1601 |
.................... |
3848 |
.................... |
- |
|
3849 |
.................... // Overloaded function cosh() for data type - Float64 |
- |
|
3850 |
.................... float64 cosh(float64 x) |
- |
|
3851 |
.................... { |
- |
|
3852 |
.................... return ((exp(x)+exp(-x))/2); |
- |
|
3853 |
.................... } |
- |
|
3854 |
.................... #endif |
- |
|
3855 |
.................... |
- |
|
3856 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
3857 |
.................... // float sinh(float x) |
- |
|
3858 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
3859 |
.................... // Description : Computes the hyperbolic sine value of x |
- |
|
3860 |
.................... // Returns : returns the hyperbolic sine value of x |
- |
|
3861 |
.................... // Date : N/A |
- |
|
3862 |
.................... // |
- |
|
3863 |
.................... |
- |
|
3864 |
.................... float32 sinh(float32 x) |
- |
|
3865 |
.................... { |
- |
|
3866 |
.................... |
- |
|
3867 |
.................... return ((exp(x) - exp(-x))/2); |
- |
|
3868 |
.................... } |
- |
|
3869 |
.................... //Overloaded functions for sinh() for PCD |
- |
|
3870 |
.................... // Overloaded function sinh() for data type - Float48 |
- |
|
3871 |
.................... #if defined(__PCD__) |
- |
|
3872 |
.................... float48 sinh(float48 x) |
- |
|
3873 |
.................... { |
- |
|
3874 |
.................... |
- |
|
3875 |
.................... return ((exp(x) - exp(-x))/2); |
- |
|
3876 |
.................... } |
- |
|
3877 |
.................... |
- |
|
3878 |
.................... // Overloaded function sinh() for data type - Float48 |
- |
|
3879 |
.................... float64 sinh(float64 x) |
- |
|
3880 |
.................... { |
- |
|
3881 |
.................... |
- |
|
3882 |
.................... return ((exp(x) - exp(-x))/2); |
- |
|
3883 |
.................... } |
- |
|
3884 |
.................... #endif |
- |
|
3885 |
.................... |
- |
|
3886 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
3887 |
.................... // float tanh(float x) |
- |
|
3888 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
3889 |
.................... // Description : Computes the hyperbolic tangent value of x |
- |
|
3890 |
.................... // Returns : returns the hyperbolic tangent value of x |
- |
|
3891 |
.................... // Date : N/A |
- |
|
3892 |
.................... // |
- |
|
3893 |
.................... |
- |
|
3894 |
.................... float32 tanh(float32 x) |
- |
|
3895 |
.................... { |
- |
|
3896 |
.................... return(sinh(x)/cosh(x)); |
- |
|
3897 |
.................... } |
- |
|
3898 |
.................... //Overloaded functions for tanh() for PCD |
- |
|
3899 |
.................... // Overloaded function tanh() for data type - Float48 |
- |
|
3900 |
.................... #if defined(__PCD__) |
- |
|
3901 |
.................... float48 tanh(float48 x) |
- |
|
3902 |
.................... { |
- |
|
3903 |
.................... return(sinh(x)/cosh(x)); |
- |
|
3904 |
.................... } |
- |
|
3905 |
.................... |
- |
|
3906 |
.................... // Overloaded function tanh() for data type - Float64 |
- |
|
3907 |
.................... float64 tanh(float64 x) |
- |
|
3908 |
.................... { |
- |
|
3909 |
.................... return(sinh(x)/cosh(x)); |
- |
|
3910 |
.................... } |
- |
|
3911 |
.................... #endif |
- |
|
3912 |
.................... |
- |
|
3913 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
3914 |
.................... // float frexp(float x, signed int *exp) |
- |
|
3915 |
.................... //////////////////////////////////////////////////////////////////////////// |
- |
|
3916 |
.................... // Description : breaks a floating point number into a normalized fraction and an integral |
- |
|
3917 |
.................... // power of 2. It stores the integer in the signed int object pointed to by exp. |
- |
|
3918 |
.................... // Returns : returns the value x, such that x is a double with magnitude in the interval |
- |
|
3919 |
.................... // [1/2,1) or zero, and value equals x times 2 raised to the power *exp.If value is zero, |
- |
|
3920 |
.................... // both parts of the result are zero. |
- |
|
3921 |
.................... // Date : N/A |
- |
|
3922 |
.................... // |
- |
|
3923 |
.................... |
- |
|
3924 |
.................... #define LOG2 .30102999566398119521 |
- |
|
3925 |
.................... float32 frexp(float32 x, signed int8 *exp) |
- |
|
3926 |
.................... { |
- |
|
3927 |
.................... float32 res; |
- |
|
3928 |
.................... int1 sign = 0; |
- |
|
3929 |
.................... if(x == 0.0) |
- |
|
3930 |
.................... { |
- |
|
3931 |
.................... *exp=0; |
- |
|
3932 |
.................... return (0.0); |
- |
|
3933 |
.................... } |
- |
|
3934 |
.................... if(x < 0.0) |
- |
|
3935 |
.................... { |
- |
|
3936 |
.................... x=-x; |
- |
|
3937 |
.................... sign=1; |
- |
|
3938 |
.................... } |
- |
|
3939 |
.................... if (x > 1.0) |
- |
|
3940 |
.................... { |
- |
|
3941 |
.................... *exp=(ceil(log10(x)/LOG2)); |
- |
|
3942 |
.................... res=x/(pow(2, *exp)); |
- |
|
3943 |
.................... if (res == 1) |
- |
|
3944 |
.................... { |
- |
|
3945 |
.................... *exp=*exp+1; |
- |
|
3946 |
.................... res=.5; |
- |
|
3947 |
.................... } |
- |
|
3948 |
.................... } |
- |
|
3949 |
.................... else |
- |
|
3950 |
.................... { |
- |
|
3951 |
.................... if(x < 0.5) |
- |
|
3952 |
.................... { |
- |
|
3953 |
.................... *exp=-1; |
- |
|
3954 |
.................... res=x*2; |
- |
|
3955 |
.................... } |
- |
|
3956 |
.................... else |
- |
|
3957 |
.................... { |
- |
|
3958 |
.................... *exp=0; |
- |
|
3959 |
.................... res=x; |
- |
|
3960 |
.................... } |
- |
|
3961 |
.................... } |
- |
|
3962 |
.................... if(sign) |
- |
|
3963 |
.................... { |
- |
|
3964 |
.................... res=-res; |
- |
|
3965 |
.................... } |
- |
|
3966 |
.................... return res; |
- |
|
3967 |
.................... } |
- |
|
3968 |
.................... |
- |
|
3969 |
.................... //Overloaded functions for frexp() for PCD |
- |
|
3970 |
.................... // Overloaded function frexp() for data type - Float48 |
- |
|
3971 |
.................... #if defined(__PCD__) |
- |
|
3972 |
.................... float48 frexp(float48 x, signed int8 *exp) |
- |
|
3973 |
.................... { |
- |
|
3974 |
.................... float48 res; |
- |
|
3975 |
.................... int1 sign = 0; |
- |
|
3976 |
.................... if(x == 0.0) |
- |
|
3977 |
.................... { |
- |
|
3978 |
.................... *exp=0; |
- |
|
3979 |
.................... return (0.0); |
- |
|
3980 |
.................... } |
- |
|
3981 |
.................... if(x < 0.0) |
- |
|
3982 |
.................... { |
- |
|
3983 |
.................... x=-x; |
- |
|
3984 |
.................... sign=1; |
- |
|
3985 |
.................... } |
- |
|
3986 |
.................... if (x > 1.0) |
- |
|
3987 |
.................... { |
- |
|
3988 |
.................... *exp=(ceil(log10(x)/LOG2)); |
- |
|
3989 |
.................... res=x/(pow(2, *exp)); |
- |
|
3990 |
.................... if (res == 1) |
- |
|
3991 |
.................... { |
- |
|
3992 |
.................... *exp=*exp+1; |
- |
|
3993 |
.................... res=.5; |
- |
|
3994 |
.................... } |
- |
|
3995 |
.................... } |
- |
|
3996 |
.................... else |
- |
|
3997 |
.................... { |
- |
|
3998 |
.................... if(x < 0.5) |
- |
|
3999 |
.................... { |
- |
|
4000 |
.................... *exp=-1; |
- |
|
4001 |
.................... res=x*2; |
- |
|
4002 |
.................... } |
- |
|
4003 |
.................... else |
- |
|
4004 |
.................... { |
- |
|
4005 |
.................... *exp=0; |
- |
|
4006 |
.................... res=x; |
- |
|
4007 |
.................... } |
- |
|
4008 |
.................... } |
- |
|
4009 |
.................... if(sign) |
- |
|
4010 |
.................... { |
- |
|
4011 |
.................... res=-res; |
- |
|
4012 |
.................... } |
- |
|
4013 |
.................... return res; |
- |
|
4014 |
.................... } |
- |
|
4015 |
.................... |
- |
|
4016 |
.................... // Overloaded function frexp() for data type - Float64 |
- |
|
4017 |
.................... float64 frexp(float64 x, signed int8 *exp) |
- |
|
4018 |
.................... { |
- |
|
4019 |
.................... float64 res; |
- |
|
4020 |
.................... int1 sign = 0; |
- |
|
4021 |
.................... if(x == 0.0) |
- |
|
4022 |
.................... { |
- |
|
4023 |
.................... *exp=0; |
- |
|
4024 |
.................... return (0.0); |
- |
|
4025 |
.................... } |
- |
|
4026 |
.................... if(x < 0.0) |
- |
|
4027 |
.................... { |
- |
|
4028 |
.................... x=-x; |
- |
|
4029 |
.................... sign=1; |
- |
|
4030 |
.................... } |
- |
|
4031 |
.................... if (x > 1.0) |
- |
|
4032 |
.................... { |
- |
|
4033 |
.................... *exp=(ceil(log10(x)/LOG2)); |
- |
|
4034 |
.................... res=x/(pow(2, *exp)); |
- |
|
4035 |
.................... if (res == 1) |
- |
|
4036 |
.................... { |
- |
|
4037 |
.................... *exp=*exp+1; |
- |
|
4038 |
.................... res=.5; |
- |
|
4039 |
.................... } |
- |
|
4040 |
.................... } |
- |
|
4041 |
.................... else |
- |
|
4042 |
.................... { |
- |
|
4043 |
.................... if(x < 0.5) |
- |
|
4044 |
.................... { |
- |
|
4045 |
.................... *exp=-1; |
- |
|
4046 |
.................... res=x*2; |
- |
|
4047 |
.................... } |
- |
|
4048 |
.................... else |
- |
|
4049 |
.................... { |
- |
|
4050 |
.................... *exp=0; |
- |
|
4051 |
.................... res=x; |
- |
|
4052 |
.................... } |
- |
|
4053 |
.................... } |
- |
|
4054 |
.................... if(sign) |
- |
|
4055 |
.................... { |
- |
|
4056 |
.................... res=-res; |
- |
|
4057 |
.................... } |
- |
|
4058 |
.................... return res; |
- |
|
4059 |
.................... } |
- |
|
4060 |
.................... #endif |
- |
|
4061 |
.................... |
- |
|
4062 |
.................... ////////////////////////////////////////////////////////////////////////////// |
- |
|
4063 |
.................... // float ldexp(float x, signed int *exp) |
- |
|
4064 |
.................... ////////////////////////////////////////////////////////////////////////////// |
- |
|
4065 |
.................... // Description : multiplies a floating point number by an integral power of 2. |
- |
|
4066 |
.................... // Returns : returns the value of x times 2 raised to the power exp. |
- |
|
4067 |
.................... // Date : N/A |
- |
|
4068 |
.................... // |
- |
|
4069 |
.................... |
- |
|
4070 |
.................... float32 ldexp(float32 value, signed int8 exp) |
- |
|
4071 |
.................... { |
- |
|
4072 |
.................... return (value * pow(2,exp)); |
- |
|
4073 |
.................... } |
- |
|
4074 |
.................... //Overloaded functions for ldexp() for PCD |
- |
|
4075 |
.................... // Overloaded function ldexp() for data type - Float48 |
- |
|
4076 |
.................... |
- |
|
4077 |
.................... #if defined(__PCD__) |
- |
|
4078 |
.................... float48 ldexp(float48 value, signed int8 exp) |
- |
|
4079 |
.................... { |
- |
|
4080 |
.................... return (value * pow(2,exp)); |
- |
|
4081 |
.................... } |
- |
|
4082 |
.................... // Overloaded function ldexp() for data type - Float64 |
- |
|
4083 |
.................... float64 ldexp(float64 value, signed int8 exp) |
- |
|
4084 |
.................... { |
- |
|
4085 |
.................... return (value * pow(2,exp)); |
- |
|
4086 |
.................... } |
- |
|
4087 |
.................... #endif |
- |
|
4088 |
.................... |
- |
|
4089 |
.................... #endif |
1602 |
.................... |
4090 |
.................... |
1603 |
.................... |
4091 |
.................... |
1604 |
.................... |
4092 |
.................... |
1605 |
.................... void main() |
4093 |
.................... void main() |
1606 |
.................... { |
4094 |
.................... { |
1607 |
* |
4095 |
* |
1608 |
0A28: CLRF 04 |
4096 |
0AB7: CLRF 04 |
1609 |
0A29: BCF 03.7 |
4097 |
0AB8: BCF 03.7 |
1610 |
0A2A: MOVLW 1F |
4098 |
0AB9: MOVLW 1F |
1611 |
0A2B: ANDWF 03,F |
4099 |
0ABA: ANDWF 03,F |
1612 |
0A2C: MOVLW 71 |
4100 |
0ABB: MOVLW 71 |
1613 |
0A2D: BSF 03.5 |
4101 |
0ABC: BSF 03.5 |
1614 |
0A2E: MOVWF 0F |
4102 |
0ABD: MOVWF 0F |
1615 |
0A2F: MOVF 0F,W |
4103 |
0ABE: MOVF 0F,W |
1616 |
0A30: BSF 03.6 |
4104 |
0ABF: BSF 03.6 |
1617 |
0A31: BCF 07.3 |
4105 |
0AC0: BCF 07.3 |
1618 |
0A32: MOVLW 0C |
4106 |
0AC1: MOVLW 0C |
1619 |
0A33: BCF 03.6 |
4107 |
0AC2: BCF 03.6 |
1620 |
0A34: MOVWF 19 |
4108 |
0AC3: MOVWF 19 |
1621 |
0A35: MOVLW A2 |
4109 |
0AC4: MOVLW A2 |
1622 |
0A36: MOVWF 18 |
4110 |
0AC5: MOVWF 18 |
1623 |
0A37: MOVLW 90 |
4111 |
0AC6: MOVLW 90 |
1624 |
0A38: BCF 03.5 |
4112 |
0AC7: BCF 03.5 |
1625 |
0A39: MOVWF 18 |
4113 |
0AC8: MOVWF 18 |
1626 |
0A3A: BSF 03.5 |
4114 |
0AC9: BSF 03.5 |
1627 |
0A3B: BSF 03.6 |
4115 |
0ACA: BSF 03.6 |
1628 |
0A3C: MOVF 09,W |
4116 |
0ACB: MOVF 09,W |
1629 |
0A3D: ANDLW C0 |
4117 |
0ACC: ANDLW C0 |
1630 |
0A3E: MOVWF 09 |
4118 |
0ACD: MOVWF 09 |
1631 |
0A3F: BCF 03.6 |
4119 |
0ACE: BCF 03.6 |
1632 |
0A40: BCF 1F.4 |
4120 |
0ACF: BCF 1F.4 |
1633 |
0A41: BCF 1F.5 |
4121 |
0AD0: BCF 1F.5 |
1634 |
0A42: MOVLW 00 |
4122 |
0AD1: MOVLW 00 |
1635 |
0A43: BSF 03.6 |
4123 |
0AD2: BSF 03.6 |
1636 |
0A44: MOVWF 08 |
4124 |
0AD3: MOVWF 08 |
1637 |
0A45: BCF 03.5 |
4125 |
0AD4: BCF 03.5 |
1638 |
0A46: CLRF 07 |
4126 |
0AD5: CLRF 07 |
1639 |
0A47: CLRF 08 |
4127 |
0AD6: CLRF 08 |
1640 |
0A48: CLRF 09 |
4128 |
0AD7: CLRF 09 |
1641 |
* |
4129 |
* |
1642 |
0A4C: CLRF 2E |
4130 |
0AE1: CLRF 34 |
1643 |
0A4D: CLRF 2D |
4131 |
0AE2: CLRF 33 |
1644 |
.................... float temp1, temp2, humidity; |
4132 |
.................... float temp1, temp2, humidity; |
1645 |
.................... int16 i=0; |
4133 |
.................... int16 i=0; |
1646 |
.................... |
4134 |
.................... |
1647 |
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD); |
4135 |
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD); |
1648 |
0A4E: BSF 03.5 |
4136 |
0AE3: BSF 03.5 |
1649 |
0A4F: BSF 03.6 |
4137 |
0AE4: BSF 03.6 |
1650 |
0A50: MOVF 09,W |
4138 |
0AE5: MOVF 09,W |
1651 |
0A51: ANDLW C0 |
4139 |
0AE6: ANDLW C0 |
1652 |
0A52: MOVWF 09 |
4140 |
0AE7: MOVWF 09 |
1653 |
0A53: BCF 03.6 |
4141 |
0AE8: BCF 03.6 |
1654 |
0A54: BCF 1F.4 |
4142 |
0AE9: BCF 1F.4 |
1655 |
0A55: BCF 1F.5 |
4143 |
0AEA: BCF 1F.5 |
1656 |
0A56: MOVLW 00 |
4144 |
0AEB: MOVLW 00 |
1657 |
0A57: BSF 03.6 |
4145 |
0AEC: BSF 03.6 |
1658 |
0A58: MOVWF 08 |
4146 |
0AED: MOVWF 08 |
1659 |
.................... setup_adc(ADC_CLOCK_DIV_2); |
4147 |
.................... setup_adc(ADC_CLOCK_DIV_2); |
1660 |
0A59: BCF 03.5 |
4148 |
0AEE: BCF 03.5 |
1661 |
0A5A: BCF 03.6 |
4149 |
0AEF: BCF 03.6 |
1662 |
0A5B: BCF 1F.6 |
4150 |
0AF0: BCF 1F.6 |
1663 |
0A5C: BCF 1F.7 |
4151 |
0AF1: BCF 1F.7 |
1664 |
0A5D: BSF 03.5 |
4152 |
0AF2: BSF 03.5 |
1665 |
0A5E: BSF 1F.7 |
4153 |
0AF3: BSF 1F.7 |
1666 |
0A5F: BCF 03.5 |
4154 |
0AF4: BCF 03.5 |
1667 |
0A60: BSF 1F.0 |
4155 |
0AF5: BSF 1F.0 |
1668 |
.................... setup_spi(SPI_SS_DISABLED); |
4156 |
.................... setup_spi(SPI_SS_DISABLED); |
1669 |
0A61: BCF 14.5 |
4157 |
0AF6: BCF 14.5 |
1670 |
0A62: BCF 20.5 |
4158 |
0AF7: BCF 20.5 |
1671 |
0A63: MOVF 20,W |
4159 |
0AF8: MOVF 20,W |
1672 |
0A64: BSF 03.5 |
4160 |
0AF9: BSF 03.5 |
1673 |
0A65: MOVWF 07 |
4161 |
0AFA: MOVWF 07 |
1674 |
0A66: BCF 03.5 |
4162 |
0AFB: BCF 03.5 |
1675 |
0A67: BSF 20.4 |
4163 |
0AFC: BSF 20.4 |
1676 |
0A68: MOVF 20,W |
4164 |
0AFD: MOVF 20,W |
1677 |
0A69: BSF 03.5 |
4165 |
0AFE: BSF 03.5 |
1678 |
0A6A: MOVWF 07 |
4166 |
0AFF: MOVWF 07 |
1679 |
0A6B: BCF 03.5 |
4167 |
0B00: BCF 03.5 |
1680 |
0A6C: BCF 20.3 |
4168 |
0B01: BCF 20.3 |
1681 |
0A6D: MOVF 20,W |
4169 |
0B02: MOVF 20,W |
1682 |
0A6E: BSF 03.5 |
4170 |
0B03: BSF 03.5 |
1683 |
0A6F: MOVWF 07 |
4171 |
0B04: MOVWF 07 |
1684 |
0A70: MOVLW 01 |
4172 |
0B05: MOVLW 01 |
1685 |
0A71: BCF 03.5 |
4173 |
0B06: BCF 03.5 |
1686 |
0A72: MOVWF 14 |
4174 |
0B07: MOVWF 14 |
1687 |
0A73: MOVLW 00 |
4175 |
0B08: MOVLW 00 |
1688 |
0A74: BSF 03.5 |
4176 |
0B09: BSF 03.5 |
1689 |
0A75: MOVWF 14 |
4177 |
0B0A: MOVWF 14 |
1690 |
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
4178 |
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
1691 |
0A76: MOVF 01,W |
4179 |
0B0B: MOVF 01,W |
1692 |
0A77: ANDLW C7 |
4180 |
0B0C: ANDLW C7 |
1693 |
0A78: IORLW 08 |
4181 |
0B0D: IORLW 08 |
1694 |
0A79: MOVWF 01 |
4182 |
0B0E: MOVWF 01 |
1695 |
.................... setup_timer_1(T1_DISABLED); |
4183 |
.................... setup_timer_1(T1_DISABLED); |
1696 |
0A7A: BCF 03.5 |
4184 |
0B0F: BCF 03.5 |
1697 |
0A7B: CLRF 10 |
4185 |
0B10: CLRF 10 |
1698 |
.................... setup_timer_2(T2_DISABLED,0,1); |
4186 |
.................... setup_timer_2(T2_DISABLED,0,1); |
1699 |
0A7C: MOVLW 00 |
4187 |
0B11: MOVLW 00 |
1700 |
0A7D: MOVWF 78 |
4188 |
0B12: MOVWF 78 |
1701 |
0A7E: MOVWF 12 |
4189 |
0B13: MOVWF 12 |
1702 |
0A7F: MOVLW 00 |
4190 |
0B14: MOVLW 00 |
1703 |
0A80: BSF 03.5 |
4191 |
0B15: BSF 03.5 |
1704 |
0A81: MOVWF 12 |
4192 |
0B16: MOVWF 12 |
1705 |
.................... setup_ccp1(CCP_OFF); |
4193 |
.................... setup_ccp1(CCP_OFF); |
1706 |
0A82: BCF 03.5 |
4194 |
0B17: BCF 03.5 |
1707 |
0A83: BSF 20.2 |
4195 |
0B18: BSF 20.2 |
1708 |
0A84: MOVF 20,W |
4196 |
0B19: MOVF 20,W |
1709 |
0A85: BSF 03.5 |
4197 |
0B1A: BSF 03.5 |
1710 |
0A86: MOVWF 07 |
4198 |
0B1B: MOVWF 07 |
1711 |
0A87: BCF 03.5 |
4199 |
0B1C: BCF 03.5 |
1712 |
0A88: CLRF 17 |
4200 |
0B1D: CLRF 17 |
1713 |
0A89: BSF 03.5 |
4201 |
0B1E: BSF 03.5 |
1714 |
0A8A: CLRF 1B |
4202 |
0B1F: CLRF 1B |
1715 |
0A8B: CLRF 1C |
4203 |
0B20: CLRF 1C |
1716 |
0A8C: MOVLW 01 |
4204 |
0B21: MOVLW 01 |
1717 |
0A8D: MOVWF 1D |
4205 |
0B22: MOVWF 1D |
1718 |
.................... setup_comparator(NC_NC_NC_NC); // This device COMP currently not supported by the PICWizard |
4206 |
.................... setup_comparator(NC_NC_NC_NC); // This device COMP currently not supported by the PICWizard |
1719 |
0A8E: BCF 03.5 |
4207 |
0B23: BCF 03.5 |
1720 |
0A8F: BSF 03.6 |
4208 |
0B24: BSF 03.6 |
1721 |
0A90: CLRF 07 |
4209 |
0B25: CLRF 07 |
1722 |
0A91: CLRF 08 |
4210 |
0B26: CLRF 08 |
1723 |
0A92: CLRF 09 |
4211 |
0B27: CLRF 09 |
1724 |
.................... setup_oscillator(OSC_8MHZ); |
4212 |
.................... setup_oscillator(OSC_8MHZ); |
1725 |
0A93: MOVLW 71 |
4213 |
0B28: MOVLW 71 |
1726 |
0A94: BSF 03.5 |
4214 |
0B29: BSF 03.5 |
1727 |
0A95: BCF 03.6 |
4215 |
0B2A: BCF 03.6 |
1728 |
0A96: MOVWF 0F |
4216 |
0B2B: MOVWF 0F |
1729 |
0A97: MOVF 0F,W |
4217 |
0B2C: MOVF 0F,W |
1730 |
.................... |
4218 |
.................... |
1731 |
.................... |
4219 |
.................... |
1732 |
.................... printf("GeoMet01A\r\n",); |
4220 |
.................... printf("GeoMet01A\r\n"); |
1733 |
0A98: MOVLW 0C |
4221 |
0B2D: MOVLW 0C |
1734 |
0A99: BCF 03.5 |
4222 |
0B2E: BCF 03.5 |
1735 |
0A9A: BSF 03.6 |
4223 |
0B2F: BSF 03.6 |
1736 |
0A9B: MOVWF 0D |
4224 |
0B30: MOVWF 0D |
1737 |
0A9C: MOVLW 00 |
4225 |
0B31: MOVLW 00 |
1738 |
0A9D: MOVWF 0F |
4226 |
0B32: MOVWF 0F |
1739 |
0A9E: BCF 0A.3 |
4227 |
0B33: BCF 0A.3 |
1740 |
0A9F: BCF 03.6 |
4228 |
0B34: BCF 03.6 |
1741 |
0AA0: CALL 030 |
4229 |
0B35: CALL 030 |
1742 |
0AA1: BSF 0A.3 |
4230 |
0B36: BSF 0A.3 |
1743 |
.................... printf("(c) Kaklik 2013\r\n"); |
4231 |
.................... printf("(c) Kaklik 2013\r\n"); |
1744 |
0AA2: MOVLW 12 |
4232 |
0B37: MOVLW 12 |
1745 |
0AA3: BSF 03.6 |
4233 |
0B38: BSF 03.6 |
1746 |
0AA4: MOVWF 0D |
4234 |
0B39: MOVWF 0D |
1747 |
0AA5: MOVLW 00 |
4235 |
0B3A: MOVLW 00 |
1748 |
0AA6: MOVWF 0F |
4236 |
0B3B: MOVWF 0F |
1749 |
0AA7: BCF 0A.3 |
4237 |
0B3C: BCF 0A.3 |
1750 |
0AA8: BCF 03.6 |
4238 |
0B3D: BCF 03.6 |
1751 |
0AA9: CALL 030 |
4239 |
0B3E: CALL 030 |
1752 |
0AAA: BSF 0A.3 |
4240 |
0B3F: BSF 0A.3 |
1753 |
.................... printf("www.mlab.cz\r\n"); |
4241 |
.................... printf("www.mlab.cz\r\n"); |
1754 |
0AAB: MOVLW 1B |
4242 |
0B40: MOVLW 1B |
1755 |
0AAC: BSF 03.6 |
4243 |
0B41: BSF 03.6 |
1756 |
0AAD: MOVWF 0D |
4244 |
0B42: MOVWF 0D |
1757 |
0AAE: MOVLW 00 |
4245 |
0B43: MOVLW 00 |
1758 |
0AAF: MOVWF 0F |
4246 |
0B44: MOVWF 0F |
1759 |
0AB0: BCF 0A.3 |
4247 |
0B45: BCF 0A.3 |
1760 |
0AB1: BCF 03.6 |
4248 |
0B46: BCF 03.6 |
1761 |
0AB2: CALL 030 |
4249 |
0B47: CALL 030 |
- |
|
4250 |
0B48: BSF 0A.3 |
- |
|
4251 |
.................... |
- |
|
4252 |
.................... // Init the HMC5883L. Set Mode register for |
- |
|
4253 |
.................... // continuous measurements. |
- |
|
4254 |
.................... hmc5883l_write_reg(HMC5883L_CFG_A_REG, 0x18); // no average, maximal update range |
- |
|
4255 |
0B49: CLRF 35 |
- |
|
4256 |
0B4A: MOVLW 18 |
- |
|
4257 |
0B4B: MOVWF 36 |
- |
|
4258 |
0B4C: BCF 0A.3 |
- |
|
4259 |
0B4D: CALL 0C2 |
- |
|
4260 |
0B4E: BSF 0A.3 |
- |
|
4261 |
.................... hmc5883l_write_reg(HMC5883L_CFG_B_REG, 0x00); // minimal range |
- |
|
4262 |
0B4F: MOVLW 01 |
- |
|
4263 |
0B50: MOVWF 35 |
- |
|
4264 |
0B51: CLRF 36 |
- |
|
4265 |
0B52: BCF 0A.3 |
- |
|
4266 |
0B53: CALL 0C2 |
- |
|
4267 |
0B54: BSF 0A.3 |
- |
|
4268 |
.................... hmc5883l_write_reg(HMC5883L_MODE_REG, 0x00); |
- |
|
4269 |
0B55: MOVLW 02 |
- |
|
4270 |
0B56: MOVWF 35 |
- |
|
4271 |
0B57: CLRF 36 |
- |
|
4272 |
0B58: BCF 0A.3 |
- |
|
4273 |
0B59: CALL 0C2 |
1762 |
0AB3: BSF 0A.3 |
4274 |
0B5A: BSF 0A.3 |
1763 |
.................... |
4275 |
.................... |
1764 |
.................... lcd_init(); |
4276 |
.................... lcd_init(); |
1765 |
0AB4: BCF 0A.3 |
4277 |
0B5B: BCF 0A.3 |
1766 |
0AB5: CALL 145 |
4278 |
0B5C: CALL 1C8 |
1767 |
0AB6: BSF 0A.3 |
4279 |
0B5D: BSF 0A.3 |
1768 |
.................... lcd_putc("(c) Kaklik 2013"); |
4280 |
.................... lcd_putc("(c) Kaklik 2013"); |
1769 |
0AB7: MOVLW 22 |
4281 |
0B5E: MOVLW 22 |
1770 |
0AB8: BSF 03.6 |
4282 |
0B5F: BSF 03.6 |
1771 |
0AB9: MOVWF 0D |
4283 |
0B60: MOVWF 0D |
1772 |
0ABA: MOVLW 00 |
4284 |
0B61: MOVLW 00 |
1773 |
0ABB: MOVWF 0F |
4285 |
0B62: MOVWF 0F |
1774 |
0ABC: BCF 0A.3 |
4286 |
0B63: BCF 0A.3 |
1775 |
0ABD: BCF 03.6 |
4287 |
0B64: BCF 03.6 |
1776 |
0ABE: CALL 1BC |
4288 |
0B65: CALL 23F |
1777 |
0ABF: BSF 0A.3 |
4289 |
0B66: BSF 0A.3 |
1778 |
.................... lcd_gotoxy(3,2); |
4290 |
.................... lcd_gotoxy(3,2); |
1779 |
0AC0: MOVLW 03 |
4291 |
0B67: MOVLW 03 |
1780 |
0AC1: MOVWF 3D |
4292 |
0B68: MOVWF 43 |
1781 |
0AC2: MOVLW 02 |
4293 |
0B69: MOVLW 02 |
1782 |
0AC3: MOVWF 3E |
4294 |
0B6A: MOVWF 44 |
1783 |
0AC4: BCF 0A.3 |
4295 |
0B6B: BCF 0A.3 |
1784 |
0AC5: CALL 17D |
4296 |
0B6C: CALL 200 |
1785 |
0AC6: BSF 0A.3 |
4297 |
0B6D: BSF 0A.3 |
1786 |
.................... lcd_putc("www.mlab.cz"); |
4298 |
.................... lcd_putc("www.mlab.cz"); |
1787 |
0AC7: MOVLW 2A |
4299 |
0B6E: MOVLW 2A |
1788 |
0AC8: BSF 03.6 |
4300 |
0B6F: BSF 03.6 |
1789 |
0AC9: MOVWF 0D |
4301 |
0B70: MOVWF 0D |
1790 |
0ACA: MOVLW 00 |
4302 |
0B71: MOVLW 00 |
1791 |
0ACB: MOVWF 0F |
4303 |
0B72: MOVWF 0F |
1792 |
0ACC: BCF 0A.3 |
4304 |
0B73: BCF 0A.3 |
1793 |
0ACD: BCF 03.6 |
4305 |
0B74: BCF 03.6 |
1794 |
0ACE: CALL 1BC |
4306 |
0B75: CALL 23F |
1795 |
0ACF: BSF 0A.3 |
4307 |
0B76: BSF 0A.3 |
1796 |
.................... Delay_ms(2000); |
4308 |
.................... Delay_ms(2000); |
1797 |
0AD0: MOVLW 08 |
4309 |
0B77: MOVLW 08 |
1798 |
0AD1: MOVWF 2F |
4310 |
0B78: MOVWF 35 |
1799 |
0AD2: MOVLW FA |
4311 |
0B79: MOVLW FA |
1800 |
0AD3: MOVWF 3D |
4312 |
0B7A: MOVWF 43 |
1801 |
0AD4: BCF 0A.3 |
4313 |
0B7B: BCF 0A.3 |
1802 |
0AD5: CALL 078 |
4314 |
0B7C: CALL 0FB |
1803 |
0AD6: BSF 0A.3 |
4315 |
0B7D: BSF 0A.3 |
1804 |
0AD7: DECFSZ 2F,F |
4316 |
0B7E: DECFSZ 35,F |
1805 |
0AD8: GOTO 2D2 |
4317 |
0B7F: GOTO 379 |
1806 |
.................... lcd_init(); |
4318 |
.................... lcd_init(); |
1807 |
0AD9: BCF 0A.3 |
4319 |
0B80: BCF 0A.3 |
1808 |
0ADA: CALL 145 |
4320 |
0B81: CALL 1C8 |
1809 |
0ADB: BSF 0A.3 |
4321 |
0B82: BSF 0A.3 |
1810 |
.................... |
4322 |
.................... |
1811 |
.................... while (TRUE) |
4323 |
.................... while (TRUE) |
1812 |
.................... { |
4324 |
.................... { |
1813 |
.................... lcd_gotoxy(1,1); |
4325 |
.................... lcd_gotoxy(1,1); |
1814 |
0ADC: MOVLW 01 |
4326 |
0B83: MOVLW 01 |
1815 |
0ADD: MOVWF 3D |
4327 |
0B84: MOVWF 43 |
1816 |
0ADE: MOVWF 3E |
4328 |
0B85: MOVWF 44 |
1817 |
0ADF: BCF 0A.3 |
4329 |
0B86: BCF 0A.3 |
1818 |
0AE0: CALL 17D |
4330 |
0B87: CALL 200 |
1819 |
0AE1: BSF 0A.3 |
4331 |
0B88: BSF 0A.3 |
1820 |
.................... temp1 = SHT25_get_temp(); |
4332 |
.................... temp1 = SHT25_get_temp(); |
1821 |
0AE2: BCF 0A.3 |
4333 |
0B89: BCF 0A.3 |
1822 |
0AE3: GOTO 52E |
4334 |
0B8A: GOTO 567 |
1823 |
0AE4: BSF 0A.3 |
4335 |
0B8B: BSF 0A.3 |
1824 |
0AE5: MOVF 7A,W |
4336 |
0B8C: MOVF 7A,W |
1825 |
0AE6: MOVWF 24 |
4337 |
0B8D: MOVWF 2A |
1826 |
0AE7: MOVF 79,W |
4338 |
0B8E: MOVF 79,W |
1827 |
0AE8: MOVWF 23 |
4339 |
0B8F: MOVWF 29 |
1828 |
0AE9: MOVF 78,W |
4340 |
0B90: MOVF 78,W |
1829 |
0AEA: MOVWF 22 |
4341 |
0B91: MOVWF 28 |
1830 |
0AEB: MOVF 77,W |
4342 |
0B92: MOVF 77,W |
1831 |
0AEC: MOVWF 21 |
4343 |
0B93: MOVWF 27 |
1832 |
.................... humidity = SHT25_get_hum(); |
4344 |
.................... humidity = SHT25_get_hum(); |
1833 |
0AED: BCF 0A.3 |
4345 |
0B94: BCF 0A.3 |
1834 |
0AEE: GOTO 5FD |
- |
|
1835 |
0AEF: BSF 0A.3 |
- |
|
1836 |
0AF0: MOVF 7A,W |
- |
|
1837 |
0AF1: MOVWF 2C |
- |
|
1838 |
0AF2: MOVF 79,W |
- |
|
1839 |
0AF3: MOVWF 2B |
- |
|
1840 |
0AF4: MOVF 78,W |
- |
|
1841 |
0AF5: MOVWF 2A |
- |
|
1842 |
0AF6: MOVF 77,W |
- |
|
1843 |
0AF7: MOVWF 29 |
- |
|
1844 |
.................... temp2= LTS01_get_temp(); |
- |
|
1845 |
0AF8: BCF 0A.3 |
- |
|
1846 |
0AF9: GOTO 6B3 |
4346 |
0B95: GOTO 636 |
1847 |
0AFA: BSF 0A.3 |
- |
|
1848 |
0AFB: MOVF 7A,W |
- |
|
1849 |
0AFC: MOVWF 28 |
- |
|
1850 |
0AFD: MOVF 79,W |
- |
|
1851 |
0AFE: MOVWF 27 |
- |
|
1852 |
0AFF: MOVF 78,W |
- |
|
1853 |
0B00: MOVWF 26 |
- |
|
1854 |
0B01: MOVF 77,W |
- |
|
1855 |
0B02: MOVWF 25 |
- |
|
1856 |
.................... |
- |
|
1857 |
.................... printf(lcd_putc,"%f C %f \%% \r\n",temp1, humidity); |
- |
|
1858 |
0B03: MOVLW 89 |
- |
|
1859 |
0B04: MOVWF 04 |
- |
|
1860 |
0B05: MOVF 24,W |
- |
|
1861 |
0B06: MOVWF 32 |
- |
|
1862 |
0B07: MOVF 23,W |
- |
|
1863 |
0B08: MOVWF 31 |
- |
|
1864 |
0B09: MOVF 22,W |
- |
|
1865 |
0B0A: MOVWF 30 |
- |
|
1866 |
0B0B: MOVF 21,W |
- |
|
1867 |
0B0C: MOVWF 2F |
- |
|
1868 |
0B0D: MOVLW 02 |
- |
|
1869 |
0B0E: MOVWF 33 |
- |
|
1870 |
0B0F: CALL 000 |
- |
|
1871 |
0B10: MOVLW 20 |
- |
|
1872 |
0B11: MOVWF 3C |
- |
|
1873 |
0B12: BCF 0A.3 |
- |
|
1874 |
0B13: CALL 18F |
- |
|
1875 |
0B14: BSF 0A.3 |
- |
|
1876 |
0B15: MOVLW 43 |
- |
|
1877 |
0B16: MOVWF 3C |
- |
|
1878 |
0B17: BCF 0A.3 |
- |
|
1879 |
0B18: CALL 18F |
- |
|
1880 |
0B19: BSF 0A.3 |
- |
|
1881 |
0B1A: MOVLW 20 |
- |
|
1882 |
0B1B: MOVWF 3C |
- |
|
1883 |
0B1C: BCF 0A.3 |
- |
|
1884 |
0B1D: CALL 18F |
- |
|
1885 |
0B1E: BSF 0A.3 |
4347 |
0B96: BSF 0A.3 |
1886 |
0B1F: MOVLW 89 |
- |
|
1887 |
0B20: MOVWF 04 |
- |
|
1888 |
0B21: MOVF 2C,W |
- |
|
1889 |
0B22: MOVWF 32 |
- |
|
1890 |
0B23: MOVF 2B,W |
- |
|
1891 |
0B24: MOVWF 31 |
- |
|
1892 |
0B25: MOVF 2A,W |
- |
|
1893 |
0B26: MOVWF 30 |
- |
|
1894 |
0B27: MOVF 29,W |
- |
|
1895 |
0B28: MOVWF 2F |
- |
|
1896 |
0B29: MOVLW 02 |
- |
|
1897 |
0B2A: MOVWF 33 |
- |
|
1898 |
0B2B: CALL 000 |
- |
|
1899 |
0B2C: MOVLW 20 |
- |
|
1900 |
0B2D: MOVWF 3C |
- |
|
1901 |
0B2E: BCF 0A.3 |
- |
|
1902 |
0B2F: CALL 18F |
- |
|
1903 |
0B30: BSF 0A.3 |
- |
|
1904 |
0B31: MOVLW 25 |
- |
|
1905 |
0B32: MOVWF 3C |
- |
|
1906 |
0B33: BCF 0A.3 |
- |
|
1907 |
0B34: CALL 18F |
- |
|
1908 |
0B35: BSF 0A.3 |
- |
|
1909 |
0B36: MOVLW 20 |
- |
|
1910 |
0B37: MOVWF 3C |
- |
|
1911 |
0B38: BCF 0A.3 |
- |
|
1912 |
0B39: CALL 18F |
- |
|
1913 |
0B3A: BSF 0A.3 |
- |
|
1914 |
0B3B: MOVLW 0D |
- |
|
1915 |
0B3C: MOVWF 3C |
- |
|
1916 |
0B3D: BCF 0A.3 |
- |
|
1917 |
0B3E: CALL 18F |
- |
|
1918 |
0B3F: BSF 0A.3 |
- |
|
1919 |
0B40: MOVLW 0A |
- |
|
1920 |
0B41: MOVWF 3C |
- |
|
1921 |
0B42: BCF 0A.3 |
- |
|
1922 |
0B43: CALL 18F |
- |
|
1923 |
0B44: BSF 0A.3 |
- |
|
1924 |
.................... lcd_gotoxy(1,2); |
- |
|
1925 |
0B45: MOVLW 01 |
- |
|
1926 |
0B46: MOVWF 3D |
- |
|
1927 |
0B47: MOVLW 02 |
- |
|
1928 |
0B48: MOVWF 3E |
- |
|
1929 |
0B49: BCF 0A.3 |
- |
|
1930 |
0B4A: CALL 17D |
- |
|
1931 |
0B4B: BSF 0A.3 |
- |
|
1932 |
.................... printf(lcd_putc," %f C",temp2); |
- |
|
1933 |
0B4C: MOVLW 20 |
- |
|
1934 |
0B4D: MOVWF 3C |
- |
|
1935 |
0B4E: BCF 0A.3 |
- |
|
1936 |
0B4F: CALL 18F |
- |
|
1937 |
0B50: BSF 0A.3 |
- |
|
1938 |
0B51: MOVLW 89 |
- |
|
1939 |
0B52: MOVWF 04 |
- |
|
1940 |
0B53: MOVF 28,W |
- |
|
1941 |
0B54: MOVWF 32 |
- |
|
1942 |
0B55: MOVF 27,W |
- |
|
1943 |
0B56: MOVWF 31 |
- |
|
1944 |
0B57: MOVF 26,W |
- |
|
1945 |
0B58: MOVWF 30 |
- |
|
1946 |
0B59: MOVF 25,W |
- |
|
1947 |
0B5A: MOVWF 2F |
- |
|
1948 |
0B5B: MOVLW 02 |
- |
|
1949 |
0B5C: MOVWF 33 |
- |
|
1950 |
0B5D: CALL 000 |
- |
|
1951 |
0B5E: MOVLW 20 |
- |
|
1952 |
0B5F: MOVWF 3C |
- |
|
1953 |
0B60: BCF 0A.3 |
- |
|
1954 |
0B61: CALL 18F |
- |
|
1955 |
0B62: BSF 0A.3 |
- |
|
1956 |
0B63: MOVLW 43 |
- |
|
1957 |
0B64: MOVWF 3C |
- |
|
1958 |
0B65: BCF 0A.3 |
- |
|
1959 |
0B66: CALL 18F |
- |
|
1960 |
0B67: BSF 0A.3 |
- |
|
1961 |
.................... printf("%ld %f %f %f \r\n",i, temp1, humidity, temp2); |
- |
|
1962 |
0B68: MOVLW 10 |
- |
|
1963 |
0B69: MOVWF 04 |
- |
|
1964 |
0B6A: MOVF 2E,W |
- |
|
1965 |
0B6B: MOVWF 30 |
- |
|
1966 |
0B6C: MOVF 2D,W |
- |
|
1967 |
0B6D: MOVWF 2F |
- |
|
1968 |
0B6E: GOTO 0DA |
- |
|
1969 |
0B6F: MOVLW 20 |
- |
|
1970 |
0B70: BTFSS 0C.4 |
- |
|
1971 |
0B71: GOTO 370 |
- |
|
1972 |
0B72: MOVWF 19 |
- |
|
1973 |
0B73: MOVLW 89 |
- |
|
1974 |
0B74: MOVWF 04 |
- |
|
1975 |
0B75: MOVF 24,W |
- |
|
1976 |
0B76: MOVWF 32 |
- |
|
1977 |
0B77: MOVF 23,W |
- |
|
1978 |
0B78: MOVWF 31 |
- |
|
1979 |
0B79: MOVF 22,W |
- |
|
1980 |
0B7A: MOVWF 30 |
- |
|
1981 |
0B7B: MOVF 21,W |
- |
|
1982 |
0B7C: MOVWF 2F |
- |
|
1983 |
0B7D: MOVLW 02 |
- |
|
1984 |
0B7E: MOVWF 33 |
- |
|
1985 |
0B7F: CALL 152 |
- |
|
1986 |
0B80: MOVLW 20 |
- |
|
1987 |
0B81: BTFSS 0C.4 |
- |
|
1988 |
0B82: GOTO 381 |
- |
|
1989 |
0B83: MOVWF 19 |
- |
|
1990 |
0B84: MOVLW 89 |
- |
|
1991 |
0B85: MOVWF 04 |
- |
|
1992 |
0B86: MOVF 2C,W |
- |
|
1993 |
0B87: MOVWF 32 |
- |
|
1994 |
0B88: MOVF 2B,W |
- |
|
1995 |
0B89: MOVWF 31 |
- |
|
1996 |
0B8A: MOVF 2A,W |
- |
|
1997 |
0B8B: MOVWF 30 |
- |
|
1998 |
0B8C: MOVF 29,W |
- |
|
1999 |
0B8D: MOVWF 2F |
- |
|
2000 |
0B8E: MOVLW 02 |
- |
|
2001 |
0B8F: MOVWF 33 |
- |
|
2002 |
0B90: CALL 152 |
- |
|
2003 |
0B91: MOVLW 20 |
- |
|
2004 |
0B92: BTFSS 0C.4 |
- |
|
2005 |
0B93: GOTO 392 |
- |
|
2006 |
0B94: MOVWF 19 |
- |
|
2007 |
0B95: MOVLW 89 |
- |
|
2008 |
0B96: MOVWF 04 |
- |
|
2009 |
0B97: MOVF 28,W |
4348 |
0B97: MOVF 7A,W |
2010 |
0B98: MOVWF 32 |
4349 |
0B98: MOVWF 32 |
2011 |
0B99: MOVF 27,W |
4350 |
0B99: MOVF 79,W |
2012 |
0B9A: MOVWF 31 |
4351 |
0B9A: MOVWF 31 |
2013 |
0B9B: MOVF 26,W |
4352 |
0B9B: MOVF 78,W |
2014 |
0B9C: MOVWF 30 |
4353 |
0B9C: MOVWF 30 |
2015 |
0B9D: MOVF 25,W |
4354 |
0B9D: MOVF 77,W |
2016 |
0B9E: MOVWF 2F |
4355 |
0B9E: MOVWF 2F |
- |
|
4356 |
.................... temp2= LTS01_get_temp(); |
- |
|
4357 |
0B9F: BCF 0A.3 |
- |
|
4358 |
0BA0: GOTO 6EC |
- |
|
4359 |
0BA1: BSF 0A.3 |
- |
|
4360 |
0BA2: MOVF 7A,W |
- |
|
4361 |
0BA3: MOVWF 2E |
- |
|
4362 |
0BA4: MOVF 79,W |
- |
|
4363 |
0BA5: MOVWF 2D |
- |
|
4364 |
0BA6: MOVF 78,W |
- |
|
4365 |
0BA7: MOVWF 2C |
- |
|
4366 |
0BA8: MOVF 77,W |
- |
|
4367 |
0BA9: MOVWF 2B |
- |
|
4368 |
.................... hmc5883l_read_data(); |
- |
|
4369 |
0BAA: GOTO 000 |
- |
|
4370 |
.................... |
- |
|
4371 |
.................... printf(lcd_putc,"%f C %f \%%",temp1, humidity); |
- |
|
4372 |
0BAB: MOVLW 89 |
- |
|
4373 |
0BAC: MOVWF 04 |
- |
|
4374 |
0BAD: MOVF 2A,W |
- |
|
4375 |
0BAE: MOVWF 38 |
- |
|
4376 |
0BAF: MOVF 29,W |
- |
|
4377 |
0BB0: MOVWF 37 |
- |
|
4378 |
0BB1: MOVF 28,W |
- |
|
4379 |
0BB2: MOVWF 36 |
- |
|
4380 |
0BB3: MOVF 27,W |
- |
|
4381 |
0BB4: MOVWF 35 |
2017 |
0B9F: MOVLW 02 |
4382 |
0BB5: MOVLW 02 |
- |
|
4383 |
0BB6: MOVWF 39 |
- |
|
4384 |
0BB7: CALL 091 |
- |
|
4385 |
0BB8: MOVLW 20 |
- |
|
4386 |
0BB9: MOVWF 42 |
- |
|
4387 |
0BBA: BCF 0A.3 |
- |
|
4388 |
0BBB: CALL 212 |
- |
|
4389 |
0BBC: BSF 0A.3 |
- |
|
4390 |
0BBD: MOVLW 43 |
- |
|
4391 |
0BBE: MOVWF 42 |
- |
|
4392 |
0BBF: BCF 0A.3 |
- |
|
4393 |
0BC0: CALL 212 |
- |
|
4394 |
0BC1: BSF 0A.3 |
- |
|
4395 |
0BC2: MOVLW 20 |
- |
|
4396 |
0BC3: MOVWF 42 |
- |
|
4397 |
0BC4: BCF 0A.3 |
- |
|
4398 |
0BC5: CALL 212 |
- |
|
4399 |
0BC6: BSF 0A.3 |
- |
|
4400 |
0BC7: MOVLW 89 |
- |
|
4401 |
0BC8: MOVWF 04 |
- |
|
4402 |
0BC9: MOVF 32,W |
- |
|
4403 |
0BCA: MOVWF 38 |
- |
|
4404 |
0BCB: MOVF 31,W |
- |
|
4405 |
0BCC: MOVWF 37 |
- |
|
4406 |
0BCD: MOVF 30,W |
- |
|
4407 |
0BCE: MOVWF 36 |
- |
|
4408 |
0BCF: MOVF 2F,W |
2018 |
0BA0: MOVWF 33 |
4409 |
0BD0: MOVWF 35 |
- |
|
4410 |
0BD1: MOVLW 02 |
- |
|
4411 |
0BD2: MOVWF 39 |
- |
|
4412 |
0BD3: CALL 091 |
- |
|
4413 |
0BD4: MOVLW 20 |
- |
|
4414 |
0BD5: MOVWF 42 |
- |
|
4415 |
0BD6: BCF 0A.3 |
- |
|
4416 |
0BD7: CALL 212 |
- |
|
4417 |
0BD8: BSF 0A.3 |
- |
|
4418 |
0BD9: MOVLW 25 |
- |
|
4419 |
0BDA: MOVWF 42 |
- |
|
4420 |
0BDB: BCF 0A.3 |
- |
|
4421 |
0BDC: CALL 212 |
- |
|
4422 |
0BDD: BSF 0A.3 |
- |
|
4423 |
.................... lcd_gotoxy(1,2); |
- |
|
4424 |
0BDE: MOVLW 01 |
- |
|
4425 |
0BDF: MOVWF 43 |
- |
|
4426 |
0BE0: MOVLW 02 |
- |
|
4427 |
0BE1: MOVWF 44 |
- |
|
4428 |
0BE2: BCF 0A.3 |
- |
|
4429 |
0BE3: CALL 200 |
- |
|
4430 |
0BE4: BSF 0A.3 |
- |
|
4431 |
.................... printf(lcd_putc," %f C",temp2); |
- |
|
4432 |
0BE5: MOVLW 20 |
- |
|
4433 |
0BE6: MOVWF 42 |
- |
|
4434 |
0BE7: BCF 0A.3 |
2019 |
0BA1: CALL 152 |
4435 |
0BE8: CALL 212 |
- |
|
4436 |
0BE9: BSF 0A.3 |
- |
|
4437 |
0BEA: MOVLW 89 |
- |
|
4438 |
0BEB: MOVWF 04 |
- |
|
4439 |
0BEC: MOVF 2E,W |
- |
|
4440 |
0BED: MOVWF 38 |
- |
|
4441 |
0BEE: MOVF 2D,W |
- |
|
4442 |
0BEF: MOVWF 37 |
- |
|
4443 |
0BF0: MOVF 2C,W |
- |
|
4444 |
0BF1: MOVWF 36 |
- |
|
4445 |
0BF2: MOVF 2B,W |
- |
|
4446 |
0BF3: MOVWF 35 |
- |
|
4447 |
0BF4: MOVLW 02 |
- |
|
4448 |
0BF5: MOVWF 39 |
- |
|
4449 |
0BF6: CALL 091 |
2020 |
0BA2: MOVLW 20 |
4450 |
0BF7: MOVLW 20 |
- |
|
4451 |
0BF8: MOVWF 42 |
- |
|
4452 |
0BF9: BCF 0A.3 |
- |
|
4453 |
0BFA: CALL 212 |
- |
|
4454 |
0BFB: BSF 0A.3 |
- |
|
4455 |
0BFC: MOVLW 43 |
- |
|
4456 |
0BFD: MOVWF 42 |
- |
|
4457 |
0BFE: BCF 0A.3 |
- |
|
4458 |
0BFF: CALL 212 |
- |
|
4459 |
0C00: BSF 0A.3 |
- |
|
4460 |
.................... printf("%ld %f %f %f ",i, temp1, humidity, temp2); |
- |
|
4461 |
0C01: MOVLW 10 |
- |
|
4462 |
0C02: MOVWF 04 |
- |
|
4463 |
0C03: MOVF 34,W |
- |
|
4464 |
0C04: MOVWF 36 |
- |
|
4465 |
0C05: MOVF 33,W |
- |
|
4466 |
0C06: MOVWF 35 |
- |
|
4467 |
0C07: CALL 16B |
- |
|
4468 |
0C08: MOVLW 20 |
2021 |
0BA3: BTFSS 0C.4 |
4469 |
0C09: BTFSS 0C.4 |
2022 |
0BA4: GOTO 3A3 |
4470 |
0C0A: GOTO 409 |
2023 |
0BA5: MOVWF 19 |
4471 |
0C0B: MOVWF 19 |
- |
|
4472 |
0C0C: MOVLW 89 |
- |
|
4473 |
0C0D: MOVWF 04 |
- |
|
4474 |
0C0E: MOVF 2A,W |
- |
|
4475 |
0C0F: MOVWF 38 |
- |
|
4476 |
0C10: MOVF 29,W |
- |
|
4477 |
0C11: MOVWF 37 |
- |
|
4478 |
0C12: MOVF 28,W |
- |
|
4479 |
0C13: MOVWF 36 |
- |
|
4480 |
0C14: MOVF 27,W |
- |
|
4481 |
0C15: MOVWF 35 |
2024 |
0BA6: MOVLW 0D |
4482 |
0C16: MOVLW 02 |
- |
|
4483 |
0C17: MOVWF 39 |
- |
|
4484 |
0C18: CALL 1E1 |
- |
|
4485 |
0C19: MOVLW 20 |
- |
|
4486 |
0C1A: BTFSS 0C.4 |
- |
|
4487 |
0C1B: GOTO 41A |
- |
|
4488 |
0C1C: MOVWF 19 |
- |
|
4489 |
0C1D: MOVLW 89 |
- |
|
4490 |
0C1E: MOVWF 04 |
- |
|
4491 |
0C1F: MOVF 32,W |
- |
|
4492 |
0C20: MOVWF 38 |
- |
|
4493 |
0C21: MOVF 31,W |
- |
|
4494 |
0C22: MOVWF 37 |
- |
|
4495 |
0C23: MOVF 30,W |
- |
|
4496 |
0C24: MOVWF 36 |
- |
|
4497 |
0C25: MOVF 2F,W |
- |
|
4498 |
0C26: MOVWF 35 |
- |
|
4499 |
0C27: MOVLW 02 |
- |
|
4500 |
0C28: MOVWF 39 |
- |
|
4501 |
0C29: CALL 1E1 |
- |
|
4502 |
0C2A: MOVLW 20 |
- |
|
4503 |
0C2B: BTFSS 0C.4 |
- |
|
4504 |
0C2C: GOTO 42B |
- |
|
4505 |
0C2D: MOVWF 19 |
- |
|
4506 |
0C2E: MOVLW 89 |
- |
|
4507 |
0C2F: MOVWF 04 |
- |
|
4508 |
0C30: MOVF 2E,W |
- |
|
4509 |
0C31: MOVWF 38 |
- |
|
4510 |
0C32: MOVF 2D,W |
- |
|
4511 |
0C33: MOVWF 37 |
- |
|
4512 |
0C34: MOVF 2C,W |
- |
|
4513 |
0C35: MOVWF 36 |
- |
|
4514 |
0C36: MOVF 2B,W |
- |
|
4515 |
0C37: MOVWF 35 |
- |
|
4516 |
0C38: MOVLW 02 |
- |
|
4517 |
0C39: MOVWF 39 |
- |
|
4518 |
0C3A: CALL 1E1 |
- |
|
4519 |
0C3B: MOVLW 20 |
- |
|
4520 |
0C3C: BTFSS 0C.4 |
- |
|
4521 |
0C3D: GOTO 43C |
- |
|
4522 |
0C3E: MOVWF 19 |
- |
|
4523 |
.................... printf("%Ld %Ld %Ld \n\r", compass.x, compass.y, compass.z); |
- |
|
4524 |
0C3F: MOVLW 10 |
- |
|
4525 |
0C40: MOVWF 04 |
- |
|
4526 |
0C41: MOVF 22,W |
- |
|
4527 |
0C42: MOVWF 36 |
- |
|
4528 |
0C43: MOVF 21,W |
- |
|
4529 |
0C44: MOVWF 35 |
- |
|
4530 |
0C45: CALL 16B |
- |
|
4531 |
0C46: MOVLW 20 |
2025 |
0BA7: BTFSS 0C.4 |
4532 |
0C47: BTFSS 0C.4 |
2026 |
0BA8: GOTO 3A7 |
4533 |
0C48: GOTO 447 |
2027 |
0BA9: MOVWF 19 |
4534 |
0C49: MOVWF 19 |
- |
|
4535 |
0C4A: MOVLW 10 |
- |
|
4536 |
0C4B: MOVWF 04 |
- |
|
4537 |
0C4C: MOVF 24,W |
- |
|
4538 |
0C4D: MOVWF 36 |
- |
|
4539 |
0C4E: MOVF 23,W |
- |
|
4540 |
0C4F: MOVWF 35 |
- |
|
4541 |
0C50: CALL 16B |
- |
|
4542 |
0C51: MOVLW 20 |
- |
|
4543 |
0C52: BTFSS 0C.4 |
- |
|
4544 |
0C53: GOTO 452 |
- |
|
4545 |
0C54: MOVWF 19 |
- |
|
4546 |
0C55: MOVLW 10 |
- |
|
4547 |
0C56: MOVWF 04 |
- |
|
4548 |
0C57: MOVF 26,W |
- |
|
4549 |
0C58: MOVWF 36 |
- |
|
4550 |
0C59: MOVF 25,W |
- |
|
4551 |
0C5A: MOVWF 35 |
- |
|
4552 |
0C5B: CALL 16B |
- |
|
4553 |
0C5C: MOVLW 20 |
- |
|
4554 |
0C5D: BTFSS 0C.4 |
- |
|
4555 |
0C5E: GOTO 45D |
- |
|
4556 |
0C5F: MOVWF 19 |
2028 |
0BAA: MOVLW 0A |
4557 |
0C60: MOVLW 0A |
- |
|
4558 |
0C61: BTFSS 0C.4 |
- |
|
4559 |
0C62: GOTO 461 |
- |
|
4560 |
0C63: MOVWF 19 |
- |
|
4561 |
0C64: MOVLW 0D |
2029 |
0BAB: BTFSS 0C.4 |
4562 |
0C65: BTFSS 0C.4 |
2030 |
0BAC: GOTO 3AB |
4563 |
0C66: GOTO 465 |
2031 |
0BAD: MOVWF 19 |
4564 |
0C67: MOVWF 19 |
2032 |
.................... i++; |
4565 |
.................... i++; |
2033 |
0BAE: INCF 2D,F |
4566 |
0C68: INCF 33,F |
2034 |
0BAF: BTFSC 03.2 |
4567 |
0C69: BTFSC 03.2 |
2035 |
0BB0: INCF 2E,F |
4568 |
0C6A: INCF 34,F |
2036 |
.................... Delay_ms(100); |
4569 |
.................... Delay_ms(100); |
2037 |
0BB1: MOVLW 64 |
4570 |
0C6B: MOVLW 64 |
2038 |
0BB2: MOVWF 3D |
4571 |
0C6C: MOVWF 43 |
2039 |
0BB3: BCF 0A.3 |
4572 |
0C6D: BCF 0A.3 |
2040 |
0BB4: CALL 078 |
4573 |
0C6E: CALL 0FB |
2041 |
0BB5: BSF 0A.3 |
4574 |
0C6F: BSF 0A.3 |
2042 |
.................... } |
4575 |
.................... } |
2043 |
0BB6: GOTO 2DC |
4576 |
0C70: GOTO 383 |
2044 |
.................... |
4577 |
.................... |
2045 |
.................... } |
4578 |
.................... } |
2046 |
0BB7: SLEEP |
4579 |
0C71: SLEEP |
2047 |
|
4580 |
|
2048 |
Configuration Fuses: |
4581 |
Configuration Fuses: |
2049 |
Word 1: 2CF5 INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG |
4582 |
Word 1: 2CF5 INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG |
2050 |
Word 2: 3FFF NOWRT BORV40 |
4583 |
Word 2: 3FFF NOWRT BORV40 |