1045 |
jacho |
1 |
CCS PCM C Compiler, Version 4.106, 47914 25-3-13 12:58 |
|
|
2 |
|
|
|
3 |
Filename: C:\Users\Honza\Documents\pic\serio_tlak\pic\main.lst |
|
|
4 |
|
|
|
5 |
ROM used: 516 words (6%) |
|
|
6 |
Largest free fragment is 2048 |
|
|
7 |
RAM used: 24 (7%) at main() level |
|
|
8 |
79 (21%) worst case |
|
|
9 |
Stack: 2 locations |
|
|
10 |
|
|
|
11 |
* |
|
|
12 |
0000: MOVLW 01 |
|
|
13 |
0001: MOVWF 0A |
|
|
14 |
0002: GOTO 18F |
|
|
15 |
0003: NOP |
|
|
16 |
.................... #include "C:\Users\Honza\Documents\pic\serio_tlak\pic\main.h" |
|
|
17 |
.................... #include <16F887.h> |
|
|
18 |
.................... //////// Standard Header file for the PIC16F887 device //////////////// |
|
|
19 |
.................... #device PIC16F887 |
|
|
20 |
.................... #list |
|
|
21 |
.................... |
|
|
22 |
.................... #device adc=8 |
|
|
23 |
.................... |
|
|
24 |
.................... #FUSES NOWDT //No Watch Dog Timer |
|
|
25 |
.................... #FUSES INTRC //Internal RC Osc |
|
|
26 |
.................... #FUSES NOPUT //No Power Up Timer |
|
|
27 |
.................... #FUSES MCLR //Master Clear pin enabled |
|
|
28 |
.................... #FUSES NOPROTECT //Code not protected from reading |
|
|
29 |
.................... #FUSES NOCPD //No EE protection |
|
|
30 |
.................... #FUSES NOBROWNOUT //No brownout reset |
|
|
31 |
.................... #FUSES IESO //Internal External Switch Over mode enabled |
|
|
32 |
.................... #FUSES FCMEN //Fail-safe clock monitor enabled |
|
|
33 |
.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O |
|
|
34 |
.................... #FUSES NODEBUG //No Debug mode for ICD |
|
|
35 |
.................... #FUSES NOWRT //Program memory not write protected |
|
|
36 |
.................... #FUSES BORV40 //Brownout reset at 4.0V |
|
|
37 |
.................... |
|
|
38 |
.................... #use delay(clock=8000000) |
|
|
39 |
.................... |
|
|
40 |
.................... |
|
|
41 |
.................... |
|
|
42 |
.................... |
|
|
43 |
.................... |
|
|
44 |
.................... /**** Automatic weather station 01A ****/ |
|
|
45 |
.................... #define VERSION "0.1" |
|
|
46 |
.................... |
|
|
47 |
.................... #define ID "$Id: main.c 2858 2013-03-22 16:04:13Z kaklik $" |
|
|
48 |
.................... #include <string.h> |
|
|
49 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
50 |
.................... //// (C) Copyright 1996,2008 Custom Computer Services //// |
|
|
51 |
.................... //// This source code may only be used by licensed users of the CCS C //// |
|
|
52 |
.................... //// compiler. This source code may only be distributed to other //// |
|
|
53 |
.................... //// licensed users of the CCS C compiler. No other use, reproduction //// |
|
|
54 |
.................... //// or distribution is permitted without written permission. //// |
|
|
55 |
.................... //// Derivative programs created using this software in object code //// |
|
|
56 |
.................... //// form are not restricted in any way. //// |
|
|
57 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
58 |
.................... |
|
|
59 |
.................... #ifndef _STRING |
|
|
60 |
.................... #define _STRING |
|
|
61 |
.................... #include <stddef.h> |
|
|
62 |
.................... /////////////////////////////////////////////////////////////////////////// |
|
|
63 |
.................... //// (C) Copyright 1996,2003 Custom Computer Services //// |
|
|
64 |
.................... //// This source code may only be used by licensed users of the CCS C //// |
|
|
65 |
.................... //// compiler. This source code may only be distributed to other //// |
|
|
66 |
.................... //// licensed users of the CCS C compiler. No other use, reproduction //// |
|
|
67 |
.................... //// or distribution is permitted without written permission. //// |
|
|
68 |
.................... //// Derivative programs created using this software in object code //// |
|
|
69 |
.................... //// form are not restricted in any way. //// |
|
|
70 |
.................... /////////////////////////////////////////////////////////////////////////// |
|
|
71 |
.................... |
|
|
72 |
.................... #ifndef _STDDEF |
|
|
73 |
.................... |
|
|
74 |
.................... #define _STDDEF |
|
|
75 |
.................... |
|
|
76 |
.................... #if sizeof(unsigned int8 *)==1 |
|
|
77 |
.................... #define ptrdiff_t unsigned int8 |
|
|
78 |
.................... #else |
|
|
79 |
.................... #define ptrdiff_t unsigned int16 |
|
|
80 |
.................... #endif |
|
|
81 |
.................... |
|
|
82 |
.................... #define size_t unsigned int8 |
|
|
83 |
.................... #define wchar_t char |
|
|
84 |
.................... #define NULL 0 |
|
|
85 |
.................... |
|
|
86 |
.................... #define offsetof(s,f) (offsetofbit(s,f)/8) |
|
|
87 |
.................... |
|
|
88 |
.................... #endif |
|
|
89 |
.................... |
|
|
90 |
.................... #include <ctype.h> |
|
|
91 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
92 |
.................... //// (C) Copyright 1996,2003 Custom Computer Services //// |
|
|
93 |
.................... //// This source code may only be used by licensed users of the CCS C //// |
|
|
94 |
.................... //// compiler. This source code may only be distributed to other //// |
|
|
95 |
.................... //// licensed users of the CCS C compiler. No other use, reproduction //// |
|
|
96 |
.................... //// or distribution is permitted without written permission. //// |
|
|
97 |
.................... //// Derivative programs created using this software in object code //// |
|
|
98 |
.................... //// form are not restricted in any way. //// |
|
|
99 |
.................... //////////////////////////////////////////////////////////////////////////// |
|
|
100 |
.................... |
|
|
101 |
.................... #ifndef _CTYPE |
|
|
102 |
.................... #define _CTYPE |
|
|
103 |
.................... |
|
|
104 |
.................... #define islower(x) isamong(x,"abcdefghijklmnopqrstuvwxyz") |
|
|
105 |
.................... #define isupper(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZ") |
|
|
106 |
.................... #define isalnum(x) isamong(x,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") |
|
|
107 |
.................... #define isalpha(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") |
|
|
108 |
.................... #define isdigit(x) isamong(x,"0123456789") |
|
|
109 |
.................... #define isspace(x) ((x)==' ') |
|
|
110 |
.................... #define isxdigit(x) isamong(x,"0123456789ABCDEFabcdef") |
|
|
111 |
.................... #define iscntrl(x) ((x)<' ') |
|
|
112 |
.................... #define isprint(x) ((x)>=' ') |
|
|
113 |
.................... #define isgraph(x) ((x)>' ') |
|
|
114 |
.................... #define ispunct(x) (((x)>' ')&&!isalnum(x)) |
|
|
115 |
.................... |
|
|
116 |
.................... #endif |
|
|
117 |
.................... |
|
|
118 |
.................... |
|
|
119 |
.................... |
|
|
120 |
.................... |
|
|
121 |
.................... |
|
|
122 |
.................... ////////////////////////////////////////////// |
|
|
123 |
.................... //// Uncomment the following define to //// |
|
|
124 |
.................... //// allow some functions to use a //// |
|
|
125 |
.................... //// quicker algorithm, but use more ROM //// |
|
|
126 |
.................... //// //// |
|
|
127 |
.................... //// #define FASTER_BUT_MORE_ROM //// |
|
|
128 |
.................... ////////////////////////////////////////////// |
|
|
129 |
.................... |
|
|
130 |
.................... |
|
|
131 |
.................... |
|
|
132 |
.................... /*Copying functions*/ |
|
|
133 |
.................... /* standard template: |
|
|
134 |
.................... void *memmove(void *s1, void *s2, size_t n). |
|
|
135 |
.................... Copies max of n characters safely (not following ending '\0') |
|
|
136 |
.................... from s2 in s1; if s2 has less than n characters, appends 0 */ |
|
|
137 |
.................... |
|
|
138 |
.................... char *memmove(void *s1,char *s2,size_t n) |
|
|
139 |
.................... { |
|
|
140 |
.................... char *sc1; |
|
|
141 |
.................... char *sc2; |
|
|
142 |
.................... sc1=s1; |
|
|
143 |
.................... sc2=s2; |
|
|
144 |
.................... if(sc2<sc1 && sc1 <sc2 +n) |
|
|
145 |
.................... for(sc1+=n,sc2+=n;0<n;--n) |
|
|
146 |
.................... *--sc1=*--sc2; |
|
|
147 |
.................... else |
|
|
148 |
.................... for(;0<n;--n) |
|
|
149 |
.................... *sc1++=*sc2++; |
|
|
150 |
.................... return s1; |
|
|
151 |
.................... } |
|
|
152 |
.................... |
|
|
153 |
.................... /* Standard template: char *strcpy(char *s1, const char *s2) |
|
|
154 |
.................... copies the string s2 including the null character to s1. |
|
|
155 |
.................... This is a compiler built in to handle the different address |
|
|
156 |
.................... spaces */ |
|
|
157 |
.................... |
|
|
158 |
.................... #define strcopy strcpy |
|
|
159 |
.................... |
|
|
160 |
.................... /* standard template: |
|
|
161 |
.................... char *strncpy(char *s1, const char *s2, size_t n). |
|
|
162 |
.................... Copies max of n characters (not following ending '\0') |
|
|
163 |
.................... from s2 in s1; if s2 has less than n characters, appends 0 */ |
|
|
164 |
.................... |
|
|
165 |
.................... char *strncpy(char *s1, char *s2, size_t n) |
|
|
166 |
.................... { |
|
|
167 |
.................... char *s; |
|
|
168 |
.................... |
|
|
169 |
.................... for (s = s1; n > 0 && *s2 != '\0'; n--) |
|
|
170 |
.................... *s++ = *s2++; |
|
|
171 |
.................... for (; n > 0; n--) |
|
|
172 |
.................... *s++ = '\0'; |
|
|
173 |
.................... |
|
|
174 |
.................... return(s1); |
|
|
175 |
.................... } |
|
|
176 |
.................... /***********************************************************/ |
|
|
177 |
.................... |
|
|
178 |
.................... /*concatenation functions*/ |
|
|
179 |
.................... /* standard template: char *strcat(char *s1, const char *s2) |
|
|
180 |
.................... appends s2 to s1*/ |
|
|
181 |
.................... |
|
|
182 |
.................... char *strcat(char *s1, char *s2) |
|
|
183 |
.................... { |
|
|
184 |
.................... char *s; |
|
|
185 |
.................... |
|
|
186 |
.................... for (s = s1; *s != '\0'; ++s); |
|
|
187 |
.................... while(*s2 != '\0') |
|
|
188 |
.................... { |
|
|
189 |
.................... *s = *s2; |
|
|
190 |
.................... ++s; |
|
|
191 |
.................... ++s2; |
|
|
192 |
.................... } |
|
|
193 |
.................... |
|
|
194 |
.................... *s = '\0'; |
|
|
195 |
.................... return(s1); |
|
|
196 |
.................... } |
|
|
197 |
.................... /* standard template: char *strncat(char *s1, char *s2,size_t n) |
|
|
198 |
.................... appends not more than n characters from s2 to s1*/ |
|
|
199 |
.................... |
|
|
200 |
.................... char *strncat(char *s1, char *s2, size_t n) |
|
|
201 |
.................... { |
|
|
202 |
.................... char *s; |
|
|
203 |
.................... |
|
|
204 |
.................... for (s = s1; *s != '\0'; ++s); |
|
|
205 |
.................... while(*s2 != '\0' && 0<n) |
|
|
206 |
.................... { |
|
|
207 |
.................... *s = *s2; |
|
|
208 |
.................... ++s; |
|
|
209 |
.................... ++s2; |
|
|
210 |
.................... --n; |
|
|
211 |
.................... } |
|
|
212 |
.................... |
|
|
213 |
.................... *s = '\0'; |
|
|
214 |
.................... return(s1); |
|
|
215 |
.................... } |
|
|
216 |
.................... |
|
|
217 |
.................... /***********************************************************/ |
|
|
218 |
.................... |
|
|
219 |
.................... |
|
|
220 |
.................... /*comparison functions*/ |
|
|
221 |
.................... /* standard template: signed int memcmp(void *s1, void *s2). |
|
|
222 |
.................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */ |
|
|
223 |
.................... |
|
|
224 |
.................... signed int8 memcmp(void * s1,char *s2,size_t n) |
|
|
225 |
.................... { |
|
|
226 |
.................... char *su1, *su2; |
|
|
227 |
.................... for(su1=s1, su2=s2; 0<n; ++su1, ++su2, --n) |
|
|
228 |
.................... { |
|
|
229 |
.................... if(*su1!=*su2) |
|
|
230 |
.................... return ((*su1<*su2)?-1:+1); |
|
|
231 |
.................... } |
|
|
232 |
.................... return 0; |
|
|
233 |
.................... } |
|
|
234 |
.................... |
|
|
235 |
.................... /* standard template: int strcmp(const char *s1, const char *s2). |
|
|
236 |
.................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */ |
|
|
237 |
.................... |
|
|
238 |
.................... signed int8 strcmp(char *s1, char *s2) |
|
|
239 |
.................... { |
|
|
240 |
.................... for (; *s1 == *s2; s1++, s2++) |
|
|
241 |
.................... if (*s1 == '\0') |
|
|
242 |
.................... return(0); |
|
|
243 |
.................... return((*s1 < *s2) ? -1: 1); |
|
|
244 |
.................... } |
|
|
245 |
.................... /* standard template: int strcoll(const char *s1, const char *s2). |
|
|
246 |
.................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */ |
|
|
247 |
.................... |
|
|
248 |
.................... signed int8 strcoll(char *s1, char *s2) |
|
|
249 |
.................... { |
|
|
250 |
.................... for (; *s1 == *s2; s1++, s2++) |
|
|
251 |
.................... if (*s1 == '\0') |
|
|
252 |
.................... return(0); |
|
|
253 |
.................... return((*s1 < *s2) ? -1: 1); |
|
|
254 |
.................... } |
|
|
255 |
.................... |
|
|
256 |
.................... /* standard template: |
|
|
257 |
.................... int strncmp(const char *s1, const char *s2, size_t n). |
|
|
258 |
.................... Compares max of n characters (not following 0) from s1 to s2; |
|
|
259 |
.................... returns same as strcmp */ |
|
|
260 |
.................... |
|
|
261 |
.................... signed int8 strncmp(char *s1, char *s2, size_t n) |
|
|
262 |
.................... { |
|
|
263 |
.................... for (; n > 0; s1++, s2++, n--) |
|
|
264 |
.................... if (*s1 != *s2) |
|
|
265 |
.................... return((*s1 <*s2) ? -1: 1); |
|
|
266 |
.................... else if (*s1 == '\0') |
|
|
267 |
.................... return(0); |
|
|
268 |
.................... return(0); |
|
|
269 |
.................... } |
|
|
270 |
.................... /* standard template: |
|
|
271 |
.................... int strxfrm(const char *s1, const char *s2, size_t n). |
|
|
272 |
.................... transforms maximum of n characters from s2 and places them into s1*/ |
|
|
273 |
.................... size_t strxfrm(char *s1, char *s2, size_t n) |
|
|
274 |
.................... { |
|
|
275 |
.................... char *s; |
|
|
276 |
.................... unsigned int8 n1; |
|
|
277 |
.................... n1=n; |
|
|
278 |
.................... for (s = s1; n > 0 && *s2 != '\0'; n--) |
|
|
279 |
.................... *s++ = *s2++; |
|
|
280 |
.................... for (; n > 0; n--) |
|
|
281 |
.................... *s++ = '\0'; |
|
|
282 |
.................... |
|
|
283 |
.................... return(n1); |
|
|
284 |
.................... } |
|
|
285 |
.................... |
|
|
286 |
.................... |
|
|
287 |
.................... |
|
|
288 |
.................... |
|
|
289 |
.................... |
|
|
290 |
.................... /***********************************************************/ |
|
|
291 |
.................... /*Search functions*/ |
|
|
292 |
.................... /* standard template: void *memchr(const char *s, int c). |
|
|
293 |
.................... Finds first occurrence of c in n characters of s */ |
|
|
294 |
.................... |
|
|
295 |
.................... char *memchr(void *s,unsigned int8 c,size_t n) |
|
|
296 |
.................... { |
|
|
297 |
.................... char uc; |
|
|
298 |
.................... char *su; |
|
|
299 |
.................... uc=c; |
|
|
300 |
.................... for(su=s;0<n;++su,--n) |
|
|
301 |
.................... if(*su==uc) |
|
|
302 |
.................... return su; |
|
|
303 |
.................... return NULL; |
|
|
304 |
.................... } |
|
|
305 |
.................... |
|
|
306 |
.................... /* standard template: char *strchr(const char *s, int c). |
|
|
307 |
.................... Finds first occurrence of c in s */ |
|
|
308 |
.................... |
|
|
309 |
.................... char *strchr(char *s, unsigned int8 c) |
|
|
310 |
.................... { |
|
|
311 |
.................... for (; *s != c; s++) |
|
|
312 |
.................... if (*s == '\0') |
|
|
313 |
.................... return(0); |
|
|
314 |
.................... return(s); |
|
|
315 |
.................... } |
|
|
316 |
.................... /* standard template: |
|
|
317 |
.................... size_t strcspn(const char *s1, const char *s2). |
|
|
318 |
.................... Computes length of max initial segment of s1 that |
|
|
319 |
.................... consists entirely of characters NOT from s2*/ |
|
|
320 |
.................... |
|
|
321 |
.................... unsigned int8 strcspn(char *s1, char *s2) |
|
|
322 |
.................... { |
|
|
323 |
.................... char *sc1, *sc2; |
|
|
324 |
.................... |
|
|
325 |
.................... for (sc1 = s1; *sc1 != 0; sc1++) |
|
|
326 |
.................... for (sc2 = s2; *sc2 != 0; sc2++) |
|
|
327 |
.................... if (*sc1 == *sc2) |
|
|
328 |
.................... return(sc1 - s1); |
|
|
329 |
.................... return(sc1 - s1); |
|
|
330 |
.................... } |
|
|
331 |
.................... /* standard template: |
|
|
332 |
.................... char *strpbrk(const char *s1, const char *s2). |
|
|
333 |
.................... Locates first occurence of any character from s2 in s1; |
|
|
334 |
.................... returns s1 if s2 is empty string */ |
|
|
335 |
.................... |
|
|
336 |
.................... char *strpbrk(char *s1, char *s2) |
|
|
337 |
.................... { |
|
|
338 |
.................... char *sc1, *sc2; |
|
|
339 |
.................... |
|
|
340 |
.................... for (sc1 = s1; *sc1 != 0; sc1++) |
|
|
341 |
.................... for (sc2 = s2; *sc2 != 0; sc2++) |
|
|
342 |
.................... if (*sc1 == *sc2) |
|
|
343 |
.................... return(sc1); |
|
|
344 |
.................... return(0); |
|
|
345 |
.................... } |
|
|
346 |
.................... |
|
|
347 |
.................... |
|
|
348 |
.................... /* standard template: char *strrchr(const char *s, int c). |
|
|
349 |
.................... Finds last occurrence of c in s */ |
|
|
350 |
.................... |
|
|
351 |
.................... char *strrchr(char *s, unsigned int8 c) |
|
|
352 |
.................... { |
|
|
353 |
.................... char *p; |
|
|
354 |
.................... |
|
|
355 |
.................... for (p = 0; ; s++) |
|
|
356 |
.................... { |
|
|
357 |
.................... if (*s == c) |
|
|
358 |
.................... p = s; |
|
|
359 |
.................... if (*s == '\0') |
|
|
360 |
.................... return(p); |
|
|
361 |
.................... } |
|
|
362 |
.................... } |
|
|
363 |
.................... /* computes length of max initial segment of s1 consisting |
|
|
364 |
.................... entirely of characters from s2 */ |
|
|
365 |
.................... |
|
|
366 |
.................... unsigned int8 strspn(char *s1, char *s2) |
|
|
367 |
.................... { |
|
|
368 |
.................... char *sc1, *sc2; |
|
|
369 |
.................... |
|
|
370 |
.................... for (sc1 = s1; *sc1 != 0; sc1++) |
|
|
371 |
.................... for (sc2 = s2; ; sc2++) |
|
|
372 |
.................... if (*sc2 == '\0') |
|
|
373 |
.................... return(sc1 - s1); |
|
|
374 |
.................... else if (*sc1 == *sc2) |
|
|
375 |
.................... break; |
|
|
376 |
.................... return(sc1 - s1); |
|
|
377 |
.................... } |
|
|
378 |
.................... /* standard template: |
|
|
379 |
.................... char *strstr(const char *s1, const char *s2); |
|
|
380 |
.................... Locates first occurence of character sequence s2 in s1; |
|
|
381 |
.................... returns 0 if s2 is empty string |
|
|
382 |
.................... |
|
|
383 |
.................... Uncomment #define FASTER_BUT_MORE_ROM at the top of the |
|
|
384 |
.................... file to use the faster algorithm */ |
|
|
385 |
.................... char *strstr(char *s1, char *s2) |
|
|
386 |
.................... { |
|
|
387 |
.................... char *s, *t; |
|
|
388 |
.................... |
|
|
389 |
.................... #ifdef FASTER_BUT_MORE_ROM |
|
|
390 |
.................... if (*s2 == '\0') |
|
|
391 |
.................... return(s1); |
|
|
392 |
.................... #endif |
|
|
393 |
.................... |
|
|
394 |
.................... while (*s1) |
|
|
395 |
.................... { |
|
|
396 |
.................... for(s = s1, t = s2; *t && (*s == *t); ++s, ++t); |
|
|
397 |
.................... |
|
|
398 |
.................... if (*t == '\0') |
|
|
399 |
.................... return s1; |
|
|
400 |
.................... ++s1; |
|
|
401 |
.................... #ifdef FASTER_BUT_MORE_ROM |
|
|
402 |
.................... while(*s1 != '\0' && *s1 != *s2) |
|
|
403 |
.................... ++s1; |
|
|
404 |
.................... #endif |
|
|
405 |
.................... } |
|
|
406 |
.................... return 0; |
|
|
407 |
.................... } |
|
|
408 |
.................... |
|
|
409 |
.................... /* standard template: char *strtok(char *s1, const char *s2). |
|
|
410 |
.................... |
|
|
411 |
.................... Finds next token in s1 delimited by a character from separator |
|
|
412 |
.................... string s2 (which can be different from call to call). First call |
|
|
413 |
.................... starts at beginning of s1 searching for first character NOT |
|
|
414 |
.................... contained in s2; returns 0 if none is found. |
|
|
415 |
.................... If one is found, it is the start of first token (return value). |
|
|
416 |
.................... Function then searches from there for a character contained in s2. |
|
|
417 |
.................... If none is found, current token extends to end of s1, and subsequent |
|
|
418 |
.................... searches for a token will return 0. If one is found, it is |
|
|
419 |
.................... overwritten by '\0', which terminates current token. Function saves |
|
|
420 |
.................... pointer to following character from which next search will start. |
|
|
421 |
.................... Each subsequent call, with 0 as first argument, starts searching |
|
|
422 |
.................... from saved pointer */ |
|
|
423 |
.................... |
|
|
424 |
.................... char *strtok(char *s1, char *s2) |
|
|
425 |
.................... { |
|
|
426 |
.................... char *beg, *end; |
|
|
427 |
.................... static char *save; |
|
|
428 |
* |
|
|
429 |
01A9: BCF 03.6 |
|
|
430 |
01AA: CLRF 20 |
|
|
431 |
01AB: CLRF 21 |
|
|
432 |
.................... |
|
|
433 |
.................... beg = (s1)? s1: save; |
|
|
434 |
.................... beg += strspn(beg, s2); |
|
|
435 |
.................... if (*beg == '\0') |
|
|
436 |
.................... { |
|
|
437 |
.................... *save = ' '; |
|
|
438 |
.................... return(0); |
|
|
439 |
.................... } |
|
|
440 |
.................... end = strpbrk(beg, s2); |
|
|
441 |
.................... if (*end != '\0') |
|
|
442 |
.................... { |
|
|
443 |
.................... *end = '\0'; |
|
|
444 |
.................... end++; |
|
|
445 |
.................... } |
|
|
446 |
.................... save = end; |
|
|
447 |
.................... return(beg); |
|
|
448 |
.................... } |
|
|
449 |
.................... |
|
|
450 |
.................... /*****************************************************************/ |
|
|
451 |
.................... /*Miscellaneous functions*/ |
|
|
452 |
.................... /* standard template |
|
|
453 |
.................... maps error number in errnum to an error message string |
|
|
454 |
.................... Returns: Pointer to string |
|
|
455 |
.................... */ |
|
|
456 |
.................... #ifdef _ERRNO |
|
|
457 |
.................... char * strerror(unsigned int8 errnum) |
|
|
458 |
.................... { |
|
|
459 |
.................... char s[15]; |
|
|
460 |
.................... switch( errnum) |
|
|
461 |
.................... { |
|
|
462 |
.................... case 0: |
|
|
463 |
.................... strcpy(s,"no errors"); |
|
|
464 |
.................... return s; |
|
|
465 |
.................... case EDOM : |
|
|
466 |
.................... strcpy(s,"domain error"); |
|
|
467 |
.................... return s; |
|
|
468 |
.................... case ERANGE: |
|
|
469 |
.................... strcpy(s,"range error"); |
|
|
470 |
.................... return s; |
|
|
471 |
.................... } |
|
|
472 |
.................... } |
|
|
473 |
.................... #ENDIF |
|
|
474 |
.................... /* standard template: size_t strlen(const char *s). |
|
|
475 |
.................... Computes length of s1 (preceding terminating 0) */ |
|
|
476 |
.................... |
|
|
477 |
.................... unsigned int8 strlen(char *s) |
|
|
478 |
.................... { |
|
|
479 |
.................... char *sc; |
|
|
480 |
.................... |
|
|
481 |
.................... for (sc = s; *sc != 0; sc++); |
|
|
482 |
* |
|
|
483 |
0032: MOVF 66,W |
|
|
484 |
0033: MOVWF 68 |
|
|
485 |
0034: MOVF 65,W |
|
|
486 |
0035: MOVWF 67 |
|
|
487 |
0036: MOVF 68,W |
|
|
488 |
0037: MOVWF 7A |
|
|
489 |
0038: MOVF 67,W |
|
|
490 |
0039: MOVWF 04 |
|
|
491 |
003A: BCF 03.7 |
|
|
492 |
003B: BTFSC 7A.0 |
|
|
493 |
003C: BSF 03.7 |
|
|
494 |
003D: MOVF 00,F |
|
|
495 |
003E: BTFSC 03.2 |
|
|
496 |
003F: GOTO 044 |
|
|
497 |
0040: INCF 67,F |
|
|
498 |
0041: BTFSC 03.2 |
|
|
499 |
0042: INCF 68,F |
|
|
500 |
0043: GOTO 036 |
|
|
501 |
.................... return(sc - s); |
|
|
502 |
0044: MOVF 65,W |
|
|
503 |
0045: SUBWF 67,W |
|
|
504 |
0046: MOVWF 77 |
|
|
505 |
0047: MOVF 68,W |
|
|
506 |
0048: MOVWF 7A |
|
|
507 |
0049: MOVF 66,W |
|
|
508 |
004A: BTFSS 03.0 |
|
|
509 |
004B: INCFSZ 66,W |
|
|
510 |
004C: SUBWF 7A,F |
|
|
511 |
004D: MOVF 77,W |
|
|
512 |
004E: MOVWF 78 |
|
|
513 |
.................... } |
|
|
514 |
004F: RETURN |
|
|
515 |
.................... |
|
|
516 |
.................... /* standard template: size_t stricmp(const char *s1, const char *s2). |
|
|
517 |
.................... Compares s1 to s2 ignoring case (upper vs. lower) */ |
|
|
518 |
.................... |
|
|
519 |
.................... signed int8 stricmp(char *s1, char *s2) |
|
|
520 |
.................... { |
|
|
521 |
.................... for(; *s1==*s2||(isalpha(*s1)&&isalpha(*s2)&&(*s1==*s2+32||*s2==*s1+32)); |
|
|
522 |
.................... s1++, s2++) |
|
|
523 |
.................... if (*s1 == '\0') |
|
|
524 |
.................... return(0); |
|
|
525 |
.................... return((*s1 < *s2) ? -1: 1); |
|
|
526 |
.................... } |
|
|
527 |
.................... |
|
|
528 |
.................... |
|
|
529 |
.................... /* standard template: char *strlwr(char *s). |
|
|
530 |
.................... Replaces uppercase letters by lowercase; |
|
|
531 |
.................... returns pointer to new string s */ |
|
|
532 |
.................... |
|
|
533 |
.................... char *strlwr(char *s) |
|
|
534 |
.................... { |
|
|
535 |
.................... char *p; |
|
|
536 |
.................... |
|
|
537 |
.................... for (p = s; *p != '\0'; p++) |
|
|
538 |
.................... if (*p >= 'A' && *p <='Z') |
|
|
539 |
.................... *p += 'a' - 'A'; |
|
|
540 |
.................... return(s); |
|
|
541 |
.................... } |
|
|
542 |
.................... |
|
|
543 |
.................... |
|
|
544 |
.................... /************************************************************/ |
|
|
545 |
.................... |
|
|
546 |
.................... |
|
|
547 |
.................... #endif |
|
|
548 |
.................... |
|
|
549 |
.................... #use rs232(baud=9600,parity=N,xmit=PIN_B7,rcv=PIN_B6,bits=8) //rcv TXD xmit RXD |
|
|
550 |
0050: BSF 03.5 |
|
|
551 |
0051: BCF 06.7 |
|
|
552 |
0052: BCF 03.5 |
|
|
553 |
0053: BCF 06.7 |
|
|
554 |
0054: MOVLW 08 |
|
|
555 |
0055: MOVWF 78 |
|
|
556 |
0056: GOTO 057 |
|
|
557 |
0057: NOP |
|
|
558 |
0058: BSF 78.7 |
|
|
559 |
0059: GOTO 068 |
|
|
560 |
005A: BCF 78.7 |
|
|
561 |
005B: RRF 69,F |
|
|
562 |
005C: BTFSC 03.0 |
|
|
563 |
005D: BSF 06.7 |
|
|
564 |
005E: BTFSS 03.0 |
|
|
565 |
005F: BCF 06.7 |
|
|
566 |
0060: BSF 78.6 |
|
|
567 |
0061: GOTO 068 |
|
|
568 |
0062: BCF 78.6 |
|
|
569 |
0063: DECFSZ 78,F |
|
|
570 |
0064: GOTO 05B |
|
|
571 |
0065: GOTO 066 |
|
|
572 |
0066: NOP |
|
|
573 |
0067: BSF 06.7 |
|
|
574 |
0068: MOVLW 3F |
|
|
575 |
0069: MOVWF 04 |
|
|
576 |
006A: DECFSZ 04,F |
|
|
577 |
006B: GOTO 06A |
|
|
578 |
006C: NOP |
|
|
579 |
006D: BTFSC 78.7 |
|
|
580 |
006E: GOTO 05A |
|
|
581 |
006F: BTFSC 78.6 |
|
|
582 |
0070: GOTO 062 |
|
|
583 |
0071: RETURN |
|
|
584 |
.................... |
|
|
585 |
.................... #CASE // Case sensitive compiler |
|
|
586 |
.................... |
|
|
587 |
.................... #define SEND_DELAY 50 // Time between two characters on RS232 |
|
|
588 |
.................... |
|
|
589 |
.................... #define CSN_SPI PIN_C2 // preassure sensor connection |
|
|
590 |
.................... #include "..\MPL115A1.c" |
|
|
591 |
.................... /* |
|
|
592 |
.................... MPL115A1 SDN - +3.3V (always power on) |
|
|
593 |
.................... MPL115A1 #CS - PIN_C2 |
|
|
594 |
.................... MPL115A1 DOUT - PIN_C4 |
|
|
595 |
.................... MPL115A1 DIN - PIN_C5 |
|
|
596 |
.................... MPL115A1 SCLK - PIN_C3 |
|
|
597 |
.................... MPL115A1 GND - GND |
|
|
598 |
.................... MPL115A1 VDD - +3.3V |
|
|
599 |
.................... */ |
|
|
600 |
.................... |
|
|
601 |
.................... |
|
|
602 |
.................... // SPI mode definitions. |
|
|
603 |
.................... #define SPI_MODE_0 (SPI_L_TO_H | SPI_XMIT_L_TO_H) |
|
|
604 |
.................... #define SPI_MODE_1 (SPI_L_TO_H) |
|
|
605 |
.................... #define SPI_MODE_2 (SPI_H_TO_L) |
|
|
606 |
.................... #define SPI_MODE_3 (SPI_H_TO_L | SPI_XMIT_L_TO_H) |
|
|
607 |
.................... |
|
|
608 |
.................... float a0; // correctiaon coefficients |
|
|
609 |
.................... float b1; |
|
|
610 |
.................... float b2; |
|
|
611 |
.................... float c12; |
|
|
612 |
.................... |
|
|
613 |
.................... |
|
|
614 |
.................... void MPL_init() |
|
|
615 |
.................... { |
|
|
616 |
.................... unsigned int8 a0_MSB, a0_LSB; |
|
|
617 |
.................... unsigned int8 b1_MSB, b1_LSB; |
|
|
618 |
.................... unsigned int8 b2_MSB, b2_LSB; |
|
|
619 |
.................... unsigned int8 c12_MSB, c12_LSB; |
|
|
620 |
.................... |
|
|
621 |
.................... output_low(CSN_SPI); |
|
|
622 |
.................... |
|
|
623 |
.................... spi_write(0x88); // get MSB for a0 |
|
|
624 |
.................... a0_MSB = spi_read(0x00); |
|
|
625 |
.................... spi_write(0x8A); // get LSB for a0 |
|
|
626 |
.................... a0_LSB = spi_read(0x00); |
|
|
627 |
.................... |
|
|
628 |
.................... spi_write(0x8C); // get MSB for b1 |
|
|
629 |
.................... b1_MSB = spi_read(0x00); |
|
|
630 |
.................... spi_write(0x8E); // get LSB for b1 |
|
|
631 |
.................... b1_LSB = spi_read(0x00); |
|
|
632 |
.................... |
|
|
633 |
.................... spi_write(0x90); // get MSB for b2 |
|
|
634 |
.................... b2_MSB = spi_read(0x00); |
|
|
635 |
.................... spi_write(0x92); // get LSB for b2 |
|
|
636 |
.................... b2_LSB = spi_read(0x00); |
|
|
637 |
.................... |
|
|
638 |
.................... spi_write(0x94); // get MSB for c12 |
|
|
639 |
.................... c12_MSB = spi_read(0x00); |
|
|
640 |
.................... spi_write(0x96); // get LSB for c12 |
|
|
641 |
.................... c12_LSB = spi_read(0x00); |
|
|
642 |
.................... |
|
|
643 |
.................... spi_read(0x00); |
|
|
644 |
.................... output_high(CSN_SPI); |
|
|
645 |
.................... |
|
|
646 |
.................... // translate to floating point number |
|
|
647 |
.................... |
|
|
648 |
.................... a0 = ((unsigned int16) a0_MSB << 5) + (a0_LSB >> 3) + (a0_LSB & 0x07)/8.0; |
|
|
649 |
.................... b1 = ((((b1_MSB & 0x1F) * 0x100) + b1_LSB) / 8192.0) - 3; |
|
|
650 |
.................... b2 = ((((unsigned int16) (b2_MSB - 0x80) << 8) + b2_LSB)/ 16384.0) - 2; |
|
|
651 |
.................... c12 =(((c12_MSB * 0x100) + c12_LSB)/16777216.0); |
|
|
652 |
.................... } |
|
|
653 |
.................... |
|
|
654 |
.................... float MPL_get_pressure() |
|
|
655 |
.................... { |
|
|
656 |
.................... unsigned int8 LSB_data, MSB_data; |
|
|
657 |
.................... unsigned int16 ADC_pressure, ADC_temperature; |
|
|
658 |
.................... float Pcomp; |
|
|
659 |
.................... |
|
|
660 |
.................... output_low(CSN_SPI); //Start temperature and pressure conversion |
|
|
661 |
.................... spi_write(0x24); |
|
|
662 |
.................... spi_write(0x00); |
|
|
663 |
.................... output_high(CSN_SPI); |
|
|
664 |
.................... |
|
|
665 |
.................... delay_ms(10); |
|
|
666 |
.................... |
|
|
667 |
.................... output_low(CSN_SPI); // get MSB for Pressure |
|
|
668 |
.................... spi_write(0x80); |
|
|
669 |
.................... MSB_data = spi_read(0x00); |
|
|
670 |
.................... spi_write(0x82); // get LSB for Pressure |
|
|
671 |
.................... LSB_data = spi_read(0x00); |
|
|
672 |
.................... output_high(CSN_SPI); |
|
|
673 |
.................... |
|
|
674 |
.................... ADC_pressure = (((unsigned int16) MSB_data << 8) + LSB_data ) >> 6; // conversion of 8bit registers to 16bit variable |
|
|
675 |
.................... |
|
|
676 |
.................... output_low(CSN_SPI); |
|
|
677 |
.................... spi_write(0x84); |
|
|
678 |
.................... MSB_data = spi_read(0x00); |
|
|
679 |
.................... spi_write(0x86); // get LSB for Temperature |
|
|
680 |
.................... LSB_data = spi_read(0x00); |
|
|
681 |
.................... spi_read(0x00); |
|
|
682 |
.................... output_high(CSN_SPI); |
|
|
683 |
.................... |
|
|
684 |
.................... ADC_temperature = (((unsigned int16) MSB_data << 8) + LSB_data ) >> 6; // conversion of 8bit registers to 16bit variable |
|
|
685 |
.................... |
|
|
686 |
.................... Pcomp = (a0 + (b1 + c12 * ADC_temperature) * ADC_pressure + b2 * ADC_temperature ); // compute relative compensated pressure |
|
|
687 |
.................... |
|
|
688 |
.................... return (Pcomp * ((115.0 - 50.0)/1023.0) + 50.0); // return absolute pressure |
|
|
689 |
.................... } |
|
|
690 |
.................... |
|
|
691 |
.................... float MPL_get_temperature() |
|
|
692 |
.................... { |
|
|
693 |
.................... unsigned int8 LSB_data, MSB_data; |
|
|
694 |
.................... unsigned int16 ADC_temperature; |
|
|
695 |
.................... |
|
|
696 |
.................... output_low(CSN_SPI); //Start temperature and pressure conversion |
|
|
697 |
.................... spi_write(0x22); |
|
|
698 |
.................... spi_write(0x00); |
|
|
699 |
.................... output_high(CSN_SPI); |
|
|
700 |
.................... |
|
|
701 |
.................... delay_ms(10); |
|
|
702 |
.................... |
|
|
703 |
.................... output_low(CSN_SPI); |
|
|
704 |
.................... spi_write(0x84); |
|
|
705 |
.................... MSB_data = spi_read(0x00); |
|
|
706 |
.................... spi_write(0x86); // get LSB for Temperature |
|
|
707 |
.................... LSB_data = spi_read(0x00); |
|
|
708 |
.................... spi_read(0x00); |
|
|
709 |
.................... output_high(CSN_SPI); |
|
|
710 |
.................... |
|
|
711 |
.................... ADC_temperature = (((unsigned int16) MSB_data << 8) + LSB_data ) >> 6; // conversion of 8bit registers to 16bit variable |
|
|
712 |
.................... |
|
|
713 |
.................... return ( ((float) ADC_temperature - 498.0)/-5.35) + 27.0; // return temperature in deg C |
|
|
714 |
.................... } |
|
|
715 |
.................... |
|
|
716 |
.................... |
|
|
717 |
.................... |
|
|
718 |
.................... void welcome(void) // Welcome message |
|
|
719 |
.................... { |
|
|
720 |
.................... char REV[50]=ID; // Buffer for concatenate of a version string |
|
|
721 |
0072: MOVLW 24 |
|
|
722 |
0073: MOVWF 33 |
|
|
723 |
0074: MOVLW 49 |
|
|
724 |
0075: MOVWF 34 |
|
|
725 |
0076: MOVLW 64 |
|
|
726 |
0077: MOVWF 35 |
|
|
727 |
0078: MOVLW 3A |
|
|
728 |
0079: MOVWF 36 |
|
|
729 |
007A: MOVLW 20 |
|
|
730 |
007B: MOVWF 37 |
|
|
731 |
007C: MOVLW 6D |
|
|
732 |
007D: MOVWF 38 |
|
|
733 |
007E: MOVLW 61 |
|
|
734 |
007F: MOVWF 39 |
|
|
735 |
0080: MOVLW 69 |
|
|
736 |
0081: MOVWF 3A |
|
|
737 |
0082: MOVLW 6E |
|
|
738 |
0083: MOVWF 3B |
|
|
739 |
0084: MOVLW 2E |
|
|
740 |
0085: MOVWF 3C |
|
|
741 |
0086: MOVLW 63 |
|
|
742 |
0087: MOVWF 3D |
|
|
743 |
0088: MOVLW 20 |
|
|
744 |
0089: MOVWF 3E |
|
|
745 |
008A: MOVLW 32 |
|
|
746 |
008B: MOVWF 3F |
|
|
747 |
008C: MOVLW 38 |
|
|
748 |
008D: MOVWF 40 |
|
|
749 |
008E: MOVLW 35 |
|
|
750 |
008F: MOVWF 41 |
|
|
751 |
0090: MOVLW 38 |
|
|
752 |
0091: MOVWF 42 |
|
|
753 |
0092: MOVLW 20 |
|
|
754 |
0093: MOVWF 43 |
|
|
755 |
0094: MOVLW 32 |
|
|
756 |
0095: MOVWF 44 |
|
|
757 |
0096: MOVLW 30 |
|
|
758 |
0097: MOVWF 45 |
|
|
759 |
0098: MOVLW 31 |
|
|
760 |
0099: MOVWF 46 |
|
|
761 |
009A: MOVLW 33 |
|
|
762 |
009B: MOVWF 47 |
|
|
763 |
009C: MOVLW 2D |
|
|
764 |
009D: MOVWF 48 |
|
|
765 |
009E: MOVLW 30 |
|
|
766 |
009F: MOVWF 49 |
|
|
767 |
00A0: MOVLW 33 |
|
|
768 |
00A1: MOVWF 4A |
|
|
769 |
00A2: MOVLW 2D |
|
|
770 |
00A3: MOVWF 4B |
|
|
771 |
00A4: MOVLW 32 |
|
|
772 |
00A5: MOVWF 4C |
|
|
773 |
00A6: MOVWF 4D |
|
|
774 |
00A7: MOVLW 20 |
|
|
775 |
00A8: MOVWF 4E |
|
|
776 |
00A9: MOVLW 31 |
|
|
777 |
00AA: MOVWF 4F |
|
|
778 |
00AB: MOVLW 36 |
|
|
779 |
00AC: MOVWF 50 |
|
|
780 |
00AD: MOVLW 3A |
|
|
781 |
00AE: MOVWF 51 |
|
|
782 |
00AF: MOVLW 30 |
|
|
783 |
00B0: MOVWF 52 |
|
|
784 |
00B1: MOVLW 34 |
|
|
785 |
00B2: MOVWF 53 |
|
|
786 |
00B3: MOVLW 3A |
|
|
787 |
00B4: MOVWF 54 |
|
|
788 |
00B5: MOVLW 31 |
|
|
789 |
00B6: MOVWF 55 |
|
|
790 |
00B7: MOVLW 33 |
|
|
791 |
00B8: MOVWF 56 |
|
|
792 |
00B9: MOVLW 5A |
|
|
793 |
00BA: MOVWF 57 |
|
|
794 |
00BB: MOVLW 20 |
|
|
795 |
00BC: MOVWF 58 |
|
|
796 |
00BD: MOVLW 6B |
|
|
797 |
00BE: MOVWF 59 |
|
|
798 |
00BF: MOVLW 61 |
|
|
799 |
00C0: MOVWF 5A |
|
|
800 |
00C1: MOVLW 6B |
|
|
801 |
00C2: MOVWF 5B |
|
|
802 |
00C3: MOVLW 6C |
|
|
803 |
00C4: MOVWF 5C |
|
|
804 |
00C5: MOVLW 69 |
|
|
805 |
00C6: MOVWF 5D |
|
|
806 |
00C7: MOVLW 6B |
|
|
807 |
00C8: MOVWF 5E |
|
|
808 |
00C9: MOVLW 20 |
|
|
809 |
00CA: MOVWF 5F |
|
|
810 |
00CB: MOVLW 24 |
|
|
811 |
00CC: MOVWF 60 |
|
|
812 |
00CD: CLRF 61 |
|
|
813 |
.................... |
|
|
814 |
.................... if (REV[strlen(REV)-1]=='$') REV[strlen(REV)-1]=0; |
|
|
815 |
00CE: CLRF 66 |
|
|
816 |
00CF: MOVLW 33 |
|
|
817 |
00D0: MOVWF 65 |
|
|
818 |
00D1: CALL 032 |
|
|
819 |
00D2: MOVLW 01 |
|
|
820 |
00D3: SUBWF 78,W |
|
|
821 |
00D4: ADDLW 33 |
|
|
822 |
00D5: MOVWF 04 |
|
|
823 |
00D6: BCF 03.7 |
|
|
824 |
00D7: MOVF 00,W |
|
|
825 |
00D8: SUBLW 24 |
|
|
826 |
00D9: BTFSS 03.2 |
|
|
827 |
00DA: GOTO 0E5 |
|
|
828 |
00DB: CLRF 66 |
|
|
829 |
00DC: MOVLW 33 |
|
|
830 |
00DD: MOVWF 65 |
|
|
831 |
00DE: CALL 032 |
|
|
832 |
00DF: MOVLW 01 |
|
|
833 |
00E0: SUBWF 78,W |
|
|
834 |
00E1: ADDLW 33 |
|
|
835 |
00E2: MOVWF 04 |
|
|
836 |
00E3: BCF 03.7 |
|
|
837 |
00E4: CLRF 00 |
|
|
838 |
.................... |
|
|
839 |
.................... printf("# ver seq temp[mK] hum_temp[mK] hum[%%] "); |
|
|
840 |
00E5: MOVLW 04 |
|
|
841 |
00E6: BSF 03.6 |
|
|
842 |
00E7: MOVWF 0D |
|
|
843 |
00E8: MOVLW 00 |
|
|
844 |
00E9: MOVWF 0F |
|
|
845 |
00EA: BCF 03.0 |
|
|
846 |
00EB: MOVLW 25 |
|
|
847 |
00EC: BCF 03.6 |
|
|
848 |
00ED: MOVWF 65 |
|
|
849 |
* |
|
|
850 |
013C: MOVLW 25 |
|
|
851 |
013D: MOVWF 69 |
|
|
852 |
013E: CALL 050 |
|
|
853 |
013F: MOVLW 5D |
|
|
854 |
0140: MOVWF 69 |
|
|
855 |
0141: CALL 050 |
|
|
856 |
0142: MOVLW 20 |
|
|
857 |
0143: MOVWF 69 |
|
|
858 |
0144: CALL 050 |
|
|
859 |
.................... printf("bar_temp[mK] pressure[hPa] Anemo[pls/s]check\r\n\r\n"); |
|
|
860 |
0145: MOVLW 19 |
|
|
861 |
0146: BSF 03.6 |
|
|
862 |
0147: MOVWF 0D |
|
|
863 |
0148: MOVLW 00 |
|
|
864 |
0149: MOVWF 0F |
|
|
865 |
.................... } |
|
|
866 |
* |
|
|
867 |
018B: BCF 03.6 |
|
|
868 |
018C: BCF 0A.3 |
|
|
869 |
018D: BCF 0A.4 |
|
|
870 |
018E: GOTO 203 (RETURN) |
|
|
871 |
.................... |
|
|
872 |
.................... void main() |
|
|
873 |
.................... { |
|
|
874 |
018F: CLRF 04 |
|
|
875 |
0190: BCF 03.7 |
|
|
876 |
0191: MOVLW 1F |
|
|
877 |
0192: ANDWF 03,F |
|
|
878 |
0193: MOVLW 71 |
|
|
879 |
0194: BSF 03.5 |
|
|
880 |
0195: MOVWF 0F |
|
|
881 |
0196: MOVF 0F,W |
|
|
882 |
0197: BCF 06.7 |
|
|
883 |
0198: BCF 03.5 |
|
|
884 |
0199: BSF 06.7 |
|
|
885 |
019A: BSF 03.5 |
|
|
886 |
019B: BSF 03.6 |
|
|
887 |
019C: MOVF 09,W |
|
|
888 |
019D: ANDLW C0 |
|
|
889 |
019E: MOVWF 09 |
|
|
890 |
019F: BCF 03.6 |
|
|
891 |
01A0: BCF 1F.4 |
|
|
892 |
01A1: BCF 1F.5 |
|
|
893 |
01A2: MOVLW 00 |
|
|
894 |
01A3: BSF 03.6 |
|
|
895 |
01A4: MOVWF 08 |
|
|
896 |
01A5: BCF 03.5 |
|
|
897 |
01A6: CLRF 07 |
|
|
898 |
01A7: CLRF 08 |
|
|
899 |
01A8: CLRF 09 |
|
|
900 |
.................... |
|
|
901 |
.................... |
|
|
902 |
.................... setup_oscillator(OSC_8MHZ); // pri prouziti bootloaderu neni treba nastavovat |
|
|
903 |
* |
|
|
904 |
01AE: MOVLW 71 |
|
|
905 |
01AF: BSF 03.5 |
|
|
906 |
01B0: MOVWF 0F |
|
|
907 |
01B1: MOVF 0F,W |
|
|
908 |
.................... setup_wdt(WDT_2304MS); |
|
|
909 |
01B2: MOVLW 09 |
|
|
910 |
01B3: BCF 03.5 |
|
|
911 |
01B4: BSF 03.6 |
|
|
912 |
01B5: MOVWF 05 |
|
|
913 |
01B6: MOVLW 0F |
|
|
914 |
01B7: MOVWF 77 |
|
|
915 |
01B8: BCF 03.6 |
|
|
916 |
01B9: CLRF 01 |
|
|
917 |
01BA: MOVLW 81 |
|
|
918 |
01BB: MOVWF 04 |
|
|
919 |
01BC: BCF 03.7 |
|
|
920 |
01BD: MOVF 00,W |
|
|
921 |
01BE: ANDLW F0 |
|
|
922 |
01BF: IORLW 07 |
|
|
923 |
01C0: MOVWF 00 |
|
|
924 |
01C1: CLRWDT |
|
|
925 |
01C2: MOVF 00,W |
|
|
926 |
01C3: ANDLW F7 |
|
|
927 |
01C4: BTFSC 77.3 |
|
|
928 |
01C5: ANDLW F0 |
|
|
929 |
01C6: IORWF 77,W |
|
|
930 |
01C7: MOVWF 00 |
|
|
931 |
.................... restart_wdt(); //---WDT |
|
|
932 |
01C8: CLRWDT |
|
|
933 |
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD); |
|
|
934 |
01C9: BSF 03.5 |
|
|
935 |
01CA: BSF 03.6 |
|
|
936 |
01CB: MOVF 09,W |
|
|
937 |
01CC: ANDLW C0 |
|
|
938 |
01CD: MOVWF 09 |
|
|
939 |
01CE: BCF 03.6 |
|
|
940 |
01CF: BCF 1F.4 |
|
|
941 |
01D0: BCF 1F.5 |
|
|
942 |
01D1: MOVLW 00 |
|
|
943 |
01D2: BSF 03.6 |
|
|
944 |
01D3: MOVWF 08 |
|
|
945 |
.................... setup_adc(ADC_CLOCK_DIV_2); |
|
|
946 |
01D4: BCF 03.5 |
|
|
947 |
01D5: BCF 03.6 |
|
|
948 |
01D6: BCF 1F.6 |
|
|
949 |
01D7: BCF 1F.7 |
|
|
950 |
01D8: BSF 03.5 |
|
|
951 |
01D9: BCF 1F.7 |
|
|
952 |
01DA: BCF 03.5 |
|
|
953 |
01DB: BSF 1F.0 |
|
|
954 |
.................... setup_timer_0(RTCC_EXT_L_TO_H|RTCC_DIV_1); |
|
|
955 |
01DC: BSF 03.5 |
|
|
956 |
01DD: MOVF 01,W |
|
|
957 |
01DE: ANDLW C7 |
|
|
958 |
01DF: IORLW 28 |
|
|
959 |
01E0: MOVWF 01 |
|
|
960 |
.................... // setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1);//|T1_CLK_OUT); |
|
|
961 |
.................... setup_timer_1(T1_INTERNAL|T1_DIV_BY_8); |
|
|
962 |
01E1: MOVLW 35 |
|
|
963 |
01E2: BCF 03.5 |
|
|
964 |
01E3: MOVWF 10 |
|
|
965 |
.................... setup_timer_2(T2_DISABLED,0,1); |
|
|
966 |
01E4: MOVLW 00 |
|
|
967 |
01E5: MOVWF 78 |
|
|
968 |
01E6: MOVWF 12 |
|
|
969 |
01E7: MOVLW 00 |
|
|
970 |
01E8: BSF 03.5 |
|
|
971 |
01E9: MOVWF 12 |
|
|
972 |
.................... setup_ccp1(CCP_OFF); |
|
|
973 |
01EA: BCF 03.5 |
|
|
974 |
01EB: BSF 32.2 |
|
|
975 |
01EC: MOVF 32,W |
|
|
976 |
01ED: BSF 03.5 |
|
|
977 |
01EE: MOVWF 07 |
|
|
978 |
01EF: BCF 03.5 |
|
|
979 |
01F0: CLRF 17 |
|
|
980 |
01F1: BSF 03.5 |
|
|
981 |
01F2: CLRF 1B |
|
|
982 |
01F3: CLRF 1C |
|
|
983 |
01F4: MOVLW 01 |
|
|
984 |
01F5: MOVWF 1D |
|
|
985 |
.................... setup_comparator(NC_NC_NC_NC); // This device COMP currently not supported by the PICWizard |
|
|
986 |
01F6: BCF 03.5 |
|
|
987 |
01F7: BSF 03.6 |
|
|
988 |
01F8: CLRF 07 |
|
|
989 |
01F9: CLRF 08 |
|
|
990 |
01FA: CLRF 09 |
|
|
991 |
.................... //setup_spi(SPI_MASTER | SPI_MODE_0 | SPI_CLK_DIV_64); |
|
|
992 |
.................... output_high(CSN_SPI); |
|
|
993 |
01FB: BCF 03.6 |
|
|
994 |
01FC: BCF 32.2 |
|
|
995 |
01FD: MOVF 32,W |
|
|
996 |
01FE: BSF 03.5 |
|
|
997 |
01FF: MOVWF 07 |
|
|
998 |
0200: BCF 03.5 |
|
|
999 |
0201: BSF 07.2 |
|
|
1000 |
.................... |
|
|
1001 |
.................... welcome(); // welcome print and device indentification |
|
|
1002 |
0202: GOTO 072 |
|
|
1003 |
.................... |
|
|
1004 |
.................... |
|
|
1005 |
.................... } |
|
|
1006 |
.................... |
|
|
1007 |
0203: SLEEP |
|
|
1008 |
|
|
|
1009 |
Configuration Fuses: |
|
|
1010 |
Word 1: 2CF5 INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG |
|
|
1011 |
Word 2: 3FFF NOWRT BORV40 |