CCS PCM C Compiler, Version 4.106, 47914 25-3-13 12:58
Filename: C:\Users\Honza\Documents\pic\serio_tlak\pic\main.lst
ROM used: 516 words (6%)
Largest free fragment is 2048
RAM used: 24 (7%) at main() level
79 (21%) worst case
Stack: 2 locations
*
0000: MOVLW 01
0001: MOVWF 0A
0002: GOTO 18F
0003: NOP
.................... #include "C:\Users\Honza\Documents\pic\serio_tlak\pic\main.h"
.................... #include <16F887.h>
.................... //////// Standard Header file for the PIC16F887 device ////////////////
.................... #device PIC16F887
.................... #list
....................
.................... #device adc=8
....................
.................... #FUSES NOWDT //No Watch Dog Timer
.................... #FUSES INTRC //Internal RC Osc
.................... #FUSES NOPUT //No Power Up Timer
.................... #FUSES MCLR //Master Clear pin enabled
.................... #FUSES NOPROTECT //Code not protected from reading
.................... #FUSES NOCPD //No EE protection
.................... #FUSES NOBROWNOUT //No brownout reset
.................... #FUSES IESO //Internal External Switch Over mode enabled
.................... #FUSES FCMEN //Fail-safe clock monitor enabled
.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
.................... #FUSES NODEBUG //No Debug mode for ICD
.................... #FUSES NOWRT //Program memory not write protected
.................... #FUSES BORV40 //Brownout reset at 4.0V
....................
.................... #use delay(clock=8000000)
....................
....................
....................
....................
....................
.................... /**** Automatic weather station 01A ****/
.................... #define VERSION "0.1"
....................
.................... #define ID "$Id: main.c 2858 2013-03-22 16:04:13Z kaklik $"
.................... #include <string.h>
.................... ////////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2008 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ////////////////////////////////////////////////////////////////////////////
....................
.................... #ifndef _STRING
.................... #define _STRING
.................... #include <stddef.h>
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2003 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ///////////////////////////////////////////////////////////////////////////
....................
.................... #ifndef _STDDEF
....................
.................... #define _STDDEF
....................
.................... #if sizeof(unsigned int8 *)==1
.................... #define ptrdiff_t unsigned int8
.................... #else
.................... #define ptrdiff_t unsigned int16
.................... #endif
....................
.................... #define size_t unsigned int8
.................... #define wchar_t char
.................... #define NULL 0
....................
.................... #define offsetof(s,f) (offsetofbit(s,f)/8)
....................
.................... #endif
....................
.................... #include <ctype.h>
.................... ////////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2003 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ////////////////////////////////////////////////////////////////////////////
....................
.................... #ifndef _CTYPE
.................... #define _CTYPE
....................
.................... #define islower(x) isamong(x,"abcdefghijklmnopqrstuvwxyz")
.................... #define isupper(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZ")
.................... #define isalnum(x) isamong(x,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
.................... #define isalpha(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
.................... #define isdigit(x) isamong(x,"0123456789")
.................... #define isspace(x) ((x)==' ')
.................... #define isxdigit(x) isamong(x,"0123456789ABCDEFabcdef")
.................... #define iscntrl(x) ((x)<' ')
.................... #define isprint(x) ((x)>=' ')
.................... #define isgraph(x) ((x)>' ')
.................... #define ispunct(x) (((x)>' ')&&!isalnum(x))
....................
.................... #endif
....................
....................
....................
....................
....................
.................... //////////////////////////////////////////////
.................... //// Uncomment the following define to ////
.................... //// allow some functions to use a ////
.................... //// quicker algorithm, but use more ROM ////
.................... //// ////
.................... //// #define FASTER_BUT_MORE_ROM ////
.................... //////////////////////////////////////////////
....................
....................
....................
.................... /*Copying functions*/
.................... /* standard template:
.................... void *memmove(void *s1, void *s2, size_t n).
.................... Copies max of n characters safely (not following ending '\0')
.................... from s2 in s1; if s2 has less than n characters, appends 0 */
....................
.................... char *memmove(void *s1,char *s2,size_t n)
.................... {
.................... char *sc1;
.................... char *sc2;
.................... sc1=s1;
.................... sc2=s2;
.................... if(sc2<sc1 && sc1 <sc2 +n)
.................... for(sc1+=n,sc2+=n;0<n;--n)
.................... *--sc1=*--sc2;
.................... else
.................... for(;0<n;--n)
.................... *sc1++=*sc2++;
.................... return s1;
.................... }
....................
.................... /* Standard template: char *strcpy(char *s1, const char *s2)
.................... copies the string s2 including the null character to s1.
.................... This is a compiler built in to handle the different address
.................... spaces */
....................
.................... #define strcopy strcpy
....................
.................... /* standard template:
.................... char *strncpy(char *s1, const char *s2, size_t n).
.................... Copies max of n characters (not following ending '\0')
.................... from s2 in s1; if s2 has less than n characters, appends 0 */
....................
.................... char *strncpy(char *s1, char *s2, size_t n)
.................... {
.................... char *s;
....................
.................... for (s = s1; n > 0 && *s2 != '\0'; n--)
.................... *s++ = *s2++;
.................... for (; n > 0; n--)
.................... *s++ = '\0';
....................
.................... return(s1);
.................... }
.................... /***********************************************************/
....................
.................... /*concatenation functions*/
.................... /* standard template: char *strcat(char *s1, const char *s2)
.................... appends s2 to s1*/
....................
.................... char *strcat(char *s1, char *s2)
.................... {
.................... char *s;
....................
.................... for (s = s1; *s != '\0'; ++s);
.................... while(*s2 != '\0')
.................... {
.................... *s = *s2;
.................... ++s;
.................... ++s2;
.................... }
....................
.................... *s = '\0';
.................... return(s1);
.................... }
.................... /* standard template: char *strncat(char *s1, char *s2,size_t n)
.................... appends not more than n characters from s2 to s1*/
....................
.................... char *strncat(char *s1, char *s2, size_t n)
.................... {
.................... char *s;
....................
.................... for (s = s1; *s != '\0'; ++s);
.................... while(*s2 != '\0' && 0<n)
.................... {
.................... *s = *s2;
.................... ++s;
.................... ++s2;
.................... --n;
.................... }
....................
.................... *s = '\0';
.................... return(s1);
.................... }
....................
.................... /***********************************************************/
....................
....................
.................... /*comparison functions*/
.................... /* standard template: signed int memcmp(void *s1, void *s2).
.................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */
....................
.................... signed int8 memcmp(void * s1,char *s2,size_t n)
.................... {
.................... char *su1, *su2;
.................... for(su1=s1, su2=s2; 0<n; ++su1, ++su2, --n)
.................... {
.................... if(*su1!=*su2)
.................... return ((*su1<*su2)?-1:+1);
.................... }
.................... return 0;
.................... }
....................
.................... /* standard template: int strcmp(const char *s1, const char *s2).
.................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */
....................
.................... signed int8 strcmp(char *s1, char *s2)
.................... {
.................... for (; *s1 == *s2; s1++, s2++)
.................... if (*s1 == '\0')
.................... return(0);
.................... return((*s1 < *s2) ? -1: 1);
.................... }
.................... /* standard template: int strcoll(const char *s1, const char *s2).
.................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */
....................
.................... signed int8 strcoll(char *s1, char *s2)
.................... {
.................... for (; *s1 == *s2; s1++, s2++)
.................... if (*s1 == '\0')
.................... return(0);
.................... return((*s1 < *s2) ? -1: 1);
.................... }
....................
.................... /* standard template:
.................... int strncmp(const char *s1, const char *s2, size_t n).
.................... Compares max of n characters (not following 0) from s1 to s2;
.................... returns same as strcmp */
....................
.................... signed int8 strncmp(char *s1, char *s2, size_t n)
.................... {
.................... for (; n > 0; s1++, s2++, n--)
.................... if (*s1 != *s2)
.................... return((*s1 <*s2) ? -1: 1);
.................... else if (*s1 == '\0')
.................... return(0);
.................... return(0);
.................... }
.................... /* standard template:
.................... int strxfrm(const char *s1, const char *s2, size_t n).
.................... transforms maximum of n characters from s2 and places them into s1*/
.................... size_t strxfrm(char *s1, char *s2, size_t n)
.................... {
.................... char *s;
.................... unsigned int8 n1;
.................... n1=n;
.................... for (s = s1; n > 0 && *s2 != '\0'; n--)
.................... *s++ = *s2++;
.................... for (; n > 0; n--)
.................... *s++ = '\0';
....................
.................... return(n1);
.................... }
....................
....................
....................
....................
....................
.................... /***********************************************************/
.................... /*Search functions*/
.................... /* standard template: void *memchr(const char *s, int c).
.................... Finds first occurrence of c in n characters of s */
....................
.................... char *memchr(void *s,unsigned int8 c,size_t n)
.................... {
.................... char uc;
.................... char *su;
.................... uc=c;
.................... for(su=s;0<n;++su,--n)
.................... if(*su==uc)
.................... return su;
.................... return NULL;
.................... }
....................
.................... /* standard template: char *strchr(const char *s, int c).
.................... Finds first occurrence of c in s */
....................
.................... char *strchr(char *s, unsigned int8 c)
.................... {
.................... for (; *s != c; s++)
.................... if (*s == '\0')
.................... return(0);
.................... return(s);
.................... }
.................... /* standard template:
.................... size_t strcspn(const char *s1, const char *s2).
.................... Computes length of max initial segment of s1 that
.................... consists entirely of characters NOT from s2*/
....................
.................... unsigned int8 strcspn(char *s1, char *s2)
.................... {
.................... char *sc1, *sc2;
....................
.................... for (sc1 = s1; *sc1 != 0; sc1++)
.................... for (sc2 = s2; *sc2 != 0; sc2++)
.................... if (*sc1 == *sc2)
.................... return(sc1 - s1);
.................... return(sc1 - s1);
.................... }
.................... /* standard template:
.................... char *strpbrk(const char *s1, const char *s2).
.................... Locates first occurence of any character from s2 in s1;
.................... returns s1 if s2 is empty string */
....................
.................... char *strpbrk(char *s1, char *s2)
.................... {
.................... char *sc1, *sc2;
....................
.................... for (sc1 = s1; *sc1 != 0; sc1++)
.................... for (sc2 = s2; *sc2 != 0; sc2++)
.................... if (*sc1 == *sc2)
.................... return(sc1);
.................... return(0);
.................... }
....................
....................
.................... /* standard template: char *strrchr(const char *s, int c).
.................... Finds last occurrence of c in s */
....................
.................... char *strrchr(char *s, unsigned int8 c)
.................... {
.................... char *p;
....................
.................... for (p = 0; ; s++)
.................... {
.................... if (*s == c)
.................... p = s;
.................... if (*s == '\0')
.................... return(p);
.................... }
.................... }
.................... /* computes length of max initial segment of s1 consisting
.................... entirely of characters from s2 */
....................
.................... unsigned int8 strspn(char *s1, char *s2)
.................... {
.................... char *sc1, *sc2;
....................
.................... for (sc1 = s1; *sc1 != 0; sc1++)
.................... for (sc2 = s2; ; sc2++)
.................... if (*sc2 == '\0')
.................... return(sc1 - s1);
.................... else if (*sc1 == *sc2)
.................... break;
.................... return(sc1 - s1);
.................... }
.................... /* standard template:
.................... char *strstr(const char *s1, const char *s2);
.................... Locates first occurence of character sequence s2 in s1;
.................... returns 0 if s2 is empty string
....................
.................... Uncomment #define FASTER_BUT_MORE_ROM at the top of the
.................... file to use the faster algorithm */
.................... char *strstr(char *s1, char *s2)
.................... {
.................... char *s, *t;
....................
.................... #ifdef FASTER_BUT_MORE_ROM
.................... if (*s2 == '\0')
.................... return(s1);
.................... #endif
....................
.................... while (*s1)
.................... {
.................... for(s = s1, t = s2; *t && (*s == *t); ++s, ++t);
....................
.................... if (*t == '\0')
.................... return s1;
.................... ++s1;
.................... #ifdef FASTER_BUT_MORE_ROM
.................... while(*s1 != '\0' && *s1 != *s2)
.................... ++s1;
.................... #endif
.................... }
.................... return 0;
.................... }
....................
.................... /* standard template: char *strtok(char *s1, const char *s2).
....................
.................... Finds next token in s1 delimited by a character from separator
.................... string s2 (which can be different from call to call). First call
.................... starts at beginning of s1 searching for first character NOT
.................... contained in s2; returns 0 if none is found.
.................... If one is found, it is the start of first token (return value).
.................... Function then searches from there for a character contained in s2.
.................... If none is found, current token extends to end of s1, and subsequent
.................... searches for a token will return 0. If one is found, it is
.................... overwritten by '\0', which terminates current token. Function saves
.................... pointer to following character from which next search will start.
.................... Each subsequent call, with 0 as first argument, starts searching
.................... from saved pointer */
....................
.................... char *strtok(char *s1, char *s2)
.................... {
.................... char *beg, *end;
.................... static char *save;
*
01A9: BCF 03.6
01AA: CLRF 20
01AB: CLRF 21
....................
.................... beg = (s1)? s1: save;
.................... beg += strspn(beg, s2);
.................... if (*beg == '\0')
.................... {
.................... *save = ' ';
.................... return(0);
.................... }
.................... end = strpbrk(beg, s2);
.................... if (*end != '\0')
.................... {
.................... *end = '\0';
.................... end++;
.................... }
.................... save = end;
.................... return(beg);
.................... }
....................
.................... /*****************************************************************/
.................... /*Miscellaneous functions*/
.................... /* standard template
.................... maps error number in errnum to an error message string
.................... Returns: Pointer to string
.................... */
.................... #ifdef _ERRNO
.................... char * strerror(unsigned int8 errnum)
.................... {
.................... char s[15];
.................... switch( errnum)
.................... {
.................... case 0:
.................... strcpy(s,"no errors");
.................... return s;
.................... case EDOM :
.................... strcpy(s,"domain error");
.................... return s;
.................... case ERANGE:
.................... strcpy(s,"range error");
.................... return s;
.................... }
.................... }
.................... #ENDIF
.................... /* standard template: size_t strlen(const char *s).
.................... Computes length of s1 (preceding terminating 0) */
....................
.................... unsigned int8 strlen(char *s)
.................... {
.................... char *sc;
....................
.................... for (sc = s; *sc != 0; sc++);
*
0032: MOVF 66,W
0033: MOVWF 68
0034: MOVF 65,W
0035: MOVWF 67
0036: MOVF 68,W
0037: MOVWF 7A
0038: MOVF 67,W
0039: MOVWF 04
003A: BCF 03.7
003B: BTFSC 7A.0
003C: BSF 03.7
003D: MOVF 00,F
003E: BTFSC 03.2
003F: GOTO 044
0040: INCF 67,F
0041: BTFSC 03.2
0042: INCF 68,F
0043: GOTO 036
.................... return(sc - s);
0044: MOVF 65,W
0045: SUBWF 67,W
0046: MOVWF 77
0047: MOVF 68,W
0048: MOVWF 7A
0049: MOVF 66,W
004A: BTFSS 03.0
004B: INCFSZ 66,W
004C: SUBWF 7A,F
004D: MOVF 77,W
004E: MOVWF 78
.................... }
004F: RETURN
....................
.................... /* standard template: size_t stricmp(const char *s1, const char *s2).
.................... Compares s1 to s2 ignoring case (upper vs. lower) */
....................
.................... signed int8 stricmp(char *s1, char *s2)
.................... {
.................... for(; *s1==*s2||(isalpha(*s1)&&isalpha(*s2)&&(*s1==*s2+32||*s2==*s1+32));
.................... s1++, s2++)
.................... if (*s1 == '\0')
.................... return(0);
.................... return((*s1 < *s2) ? -1: 1);
.................... }
....................
....................
.................... /* standard template: char *strlwr(char *s).
.................... Replaces uppercase letters by lowercase;
.................... returns pointer to new string s */
....................
.................... char *strlwr(char *s)
.................... {
.................... char *p;
....................
.................... for (p = s; *p != '\0'; p++)
.................... if (*p >= 'A' && *p <='Z')
.................... *p += 'a' - 'A';
.................... return(s);
.................... }
....................
....................
.................... /************************************************************/
....................
....................
.................... #endif
....................
.................... #use rs232(baud=9600,parity=N,xmit=PIN_B7,rcv=PIN_B6,bits=8) //rcv TXD xmit RXD
0050: BSF 03.5
0051: BCF 06.7
0052: BCF 03.5
0053: BCF 06.7
0054: MOVLW 08
0055: MOVWF 78
0056: GOTO 057
0057: NOP
0058: BSF 78.7
0059: GOTO 068
005A: BCF 78.7
005B: RRF 69,F
005C: BTFSC 03.0
005D: BSF 06.7
005E: BTFSS 03.0
005F: BCF 06.7
0060: BSF 78.6
0061: GOTO 068
0062: BCF 78.6
0063: DECFSZ 78,F
0064: GOTO 05B
0065: GOTO 066
0066: NOP
0067: BSF 06.7
0068: MOVLW 3F
0069: MOVWF 04
006A: DECFSZ 04,F
006B: GOTO 06A
006C: NOP
006D: BTFSC 78.7
006E: GOTO 05A
006F: BTFSC 78.6
0070: GOTO 062
0071: RETURN
....................
.................... #CASE // Case sensitive compiler
....................
.................... #define SEND_DELAY 50 // Time between two characters on RS232
....................
.................... #define CSN_SPI PIN_C2 // preassure sensor connection
.................... #include "..\MPL115A1.c"
.................... /*
.................... MPL115A1 SDN - +3.3V (always power on)
.................... MPL115A1 #CS - PIN_C2
.................... MPL115A1 DOUT - PIN_C4
.................... MPL115A1 DIN - PIN_C5
.................... MPL115A1 SCLK - PIN_C3
.................... MPL115A1 GND - GND
.................... MPL115A1 VDD - +3.3V
.................... */
....................
....................
.................... // SPI mode definitions.
.................... #define SPI_MODE_0 (SPI_L_TO_H | SPI_XMIT_L_TO_H)
.................... #define SPI_MODE_1 (SPI_L_TO_H)
.................... #define SPI_MODE_2 (SPI_H_TO_L)
.................... #define SPI_MODE_3 (SPI_H_TO_L | SPI_XMIT_L_TO_H)
....................
.................... float a0; // correctiaon coefficients
.................... float b1;
.................... float b2;
.................... float c12;
....................
....................
.................... void MPL_init()
.................... {
.................... unsigned int8 a0_MSB, a0_LSB;
.................... unsigned int8 b1_MSB, b1_LSB;
.................... unsigned int8 b2_MSB, b2_LSB;
.................... unsigned int8 c12_MSB, c12_LSB;
....................
.................... output_low(CSN_SPI);
....................
.................... spi_write(0x88); // get MSB for a0
.................... a0_MSB = spi_read(0x00);
.................... spi_write(0x8A); // get LSB for a0
.................... a0_LSB = spi_read(0x00);
....................
.................... spi_write(0x8C); // get MSB for b1
.................... b1_MSB = spi_read(0x00);
.................... spi_write(0x8E); // get LSB for b1
.................... b1_LSB = spi_read(0x00);
....................
.................... spi_write(0x90); // get MSB for b2
.................... b2_MSB = spi_read(0x00);
.................... spi_write(0x92); // get LSB for b2
.................... b2_LSB = spi_read(0x00);
....................
.................... spi_write(0x94); // get MSB for c12
.................... c12_MSB = spi_read(0x00);
.................... spi_write(0x96); // get LSB for c12
.................... c12_LSB = spi_read(0x00);
....................
.................... spi_read(0x00);
.................... output_high(CSN_SPI);
....................
.................... // translate to floating point number
....................
.................... a0 = ((unsigned int16) a0_MSB << 5) + (a0_LSB >> 3) + (a0_LSB & 0x07)/8.0;
.................... b1 = ((((b1_MSB & 0x1F) * 0x100) + b1_LSB) / 8192.0) - 3;
.................... b2 = ((((unsigned int16) (b2_MSB - 0x80) << 8) + b2_LSB)/ 16384.0) - 2;
.................... c12 =(((c12_MSB * 0x100) + c12_LSB)/16777216.0);
.................... }
....................
.................... float MPL_get_pressure()
.................... {
.................... unsigned int8 LSB_data, MSB_data;
.................... unsigned int16 ADC_pressure, ADC_temperature;
.................... float Pcomp;
....................
.................... output_low(CSN_SPI); //Start temperature and pressure conversion
.................... spi_write(0x24);
.................... spi_write(0x00);
.................... output_high(CSN_SPI);
....................
.................... delay_ms(10);
....................
.................... output_low(CSN_SPI); // get MSB for Pressure
.................... spi_write(0x80);
.................... MSB_data = spi_read(0x00);
.................... spi_write(0x82); // get LSB for Pressure
.................... LSB_data = spi_read(0x00);
.................... output_high(CSN_SPI);
....................
.................... ADC_pressure = (((unsigned int16) MSB_data << 8) + LSB_data ) >> 6; // conversion of 8bit registers to 16bit variable
....................
.................... output_low(CSN_SPI);
.................... spi_write(0x84);
.................... MSB_data = spi_read(0x00);
.................... spi_write(0x86); // get LSB for Temperature
.................... LSB_data = spi_read(0x00);
.................... spi_read(0x00);
.................... output_high(CSN_SPI);
....................
.................... ADC_temperature = (((unsigned int16) MSB_data << 8) + LSB_data ) >> 6; // conversion of 8bit registers to 16bit variable
....................
.................... Pcomp = (a0 + (b1 + c12 * ADC_temperature) * ADC_pressure + b2 * ADC_temperature ); // compute relative compensated pressure
....................
.................... return (Pcomp * ((115.0 - 50.0)/1023.0) + 50.0); // return absolute pressure
.................... }
....................
.................... float MPL_get_temperature()
.................... {
.................... unsigned int8 LSB_data, MSB_data;
.................... unsigned int16 ADC_temperature;
....................
.................... output_low(CSN_SPI); //Start temperature and pressure conversion
.................... spi_write(0x22);
.................... spi_write(0x00);
.................... output_high(CSN_SPI);
....................
.................... delay_ms(10);
....................
.................... output_low(CSN_SPI);
.................... spi_write(0x84);
.................... MSB_data = spi_read(0x00);
.................... spi_write(0x86); // get LSB for Temperature
.................... LSB_data = spi_read(0x00);
.................... spi_read(0x00);
.................... output_high(CSN_SPI);
....................
.................... ADC_temperature = (((unsigned int16) MSB_data << 8) + LSB_data ) >> 6; // conversion of 8bit registers to 16bit variable
....................
.................... return ( ((float) ADC_temperature - 498.0)/-5.35) + 27.0; // return temperature in deg C
.................... }
....................
....................
....................
.................... void welcome(void) // Welcome message
.................... {
.................... char REV[50]=ID; // Buffer for concatenate of a version string
0072: MOVLW 24
0073: MOVWF 33
0074: MOVLW 49
0075: MOVWF 34
0076: MOVLW 64
0077: MOVWF 35
0078: MOVLW 3A
0079: MOVWF 36
007A: MOVLW 20
007B: MOVWF 37
007C: MOVLW 6D
007D: MOVWF 38
007E: MOVLW 61
007F: MOVWF 39
0080: MOVLW 69
0081: MOVWF 3A
0082: MOVLW 6E
0083: MOVWF 3B
0084: MOVLW 2E
0085: MOVWF 3C
0086: MOVLW 63
0087: MOVWF 3D
0088: MOVLW 20
0089: MOVWF 3E
008A: MOVLW 32
008B: MOVWF 3F
008C: MOVLW 38
008D: MOVWF 40
008E: MOVLW 35
008F: MOVWF 41
0090: MOVLW 38
0091: MOVWF 42
0092: MOVLW 20
0093: MOVWF 43
0094: MOVLW 32
0095: MOVWF 44
0096: MOVLW 30
0097: MOVWF 45
0098: MOVLW 31
0099: MOVWF 46
009A: MOVLW 33
009B: MOVWF 47
009C: MOVLW 2D
009D: MOVWF 48
009E: MOVLW 30
009F: MOVWF 49
00A0: MOVLW 33
00A1: MOVWF 4A
00A2: MOVLW 2D
00A3: MOVWF 4B
00A4: MOVLW 32
00A5: MOVWF 4C
00A6: MOVWF 4D
00A7: MOVLW 20
00A8: MOVWF 4E
00A9: MOVLW 31
00AA: MOVWF 4F
00AB: MOVLW 36
00AC: MOVWF 50
00AD: MOVLW 3A
00AE: MOVWF 51
00AF: MOVLW 30
00B0: MOVWF 52
00B1: MOVLW 34
00B2: MOVWF 53
00B3: MOVLW 3A
00B4: MOVWF 54
00B5: MOVLW 31
00B6: MOVWF 55
00B7: MOVLW 33
00B8: MOVWF 56
00B9: MOVLW 5A
00BA: MOVWF 57
00BB: MOVLW 20
00BC: MOVWF 58
00BD: MOVLW 6B
00BE: MOVWF 59
00BF: MOVLW 61
00C0: MOVWF 5A
00C1: MOVLW 6B
00C2: MOVWF 5B
00C3: MOVLW 6C
00C4: MOVWF 5C
00C5: MOVLW 69
00C6: MOVWF 5D
00C7: MOVLW 6B
00C8: MOVWF 5E
00C9: MOVLW 20
00CA: MOVWF 5F
00CB: MOVLW 24
00CC: MOVWF 60
00CD: CLRF 61
....................
.................... if (REV[strlen(REV)-1]=='$') REV[strlen(REV)-1]=0;
00CE: CLRF 66
00CF: MOVLW 33
00D0: MOVWF 65
00D1: CALL 032
00D2: MOVLW 01
00D3: SUBWF 78,W
00D4: ADDLW 33
00D5: MOVWF 04
00D6: BCF 03.7
00D7: MOVF 00,W
00D8: SUBLW 24
00D9: BTFSS 03.2
00DA: GOTO 0E5
00DB: CLRF 66
00DC: MOVLW 33
00DD: MOVWF 65
00DE: CALL 032
00DF: MOVLW 01
00E0: SUBWF 78,W
00E1: ADDLW 33
00E2: MOVWF 04
00E3: BCF 03.7
00E4: CLRF 00
....................
.................... printf("# ver seq temp[mK] hum_temp[mK] hum[%%] ");
00E5: MOVLW 04
00E6: BSF 03.6
00E7: MOVWF 0D
00E8: MOVLW 00
00E9: MOVWF 0F
00EA: BCF 03.0
00EB: MOVLW 25
00EC: BCF 03.6
00ED: MOVWF 65
*
013C: MOVLW 25
013D: MOVWF 69
013E: CALL 050
013F: MOVLW 5D
0140: MOVWF 69
0141: CALL 050
0142: MOVLW 20
0143: MOVWF 69
0144: CALL 050
.................... printf("bar_temp[mK] pressure[hPa] Anemo[pls/s]check\r\n\r\n");
0145: MOVLW 19
0146: BSF 03.6
0147: MOVWF 0D
0148: MOVLW 00
0149: MOVWF 0F
.................... }
*
018B: BCF 03.6
018C: BCF 0A.3
018D: BCF 0A.4
018E: GOTO 203 (RETURN)
....................
.................... void main()
.................... {
018F: CLRF 04
0190: BCF 03.7
0191: MOVLW 1F
0192: ANDWF 03,F
0193: MOVLW 71
0194: BSF 03.5
0195: MOVWF 0F
0196: MOVF 0F,W
0197: BCF 06.7
0198: BCF 03.5
0199: BSF 06.7
019A: BSF 03.5
019B: BSF 03.6
019C: MOVF 09,W
019D: ANDLW C0
019E: MOVWF 09
019F: BCF 03.6
01A0: BCF 1F.4
01A1: BCF 1F.5
01A2: MOVLW 00
01A3: BSF 03.6
01A4: MOVWF 08
01A5: BCF 03.5
01A6: CLRF 07
01A7: CLRF 08
01A8: CLRF 09
....................
....................
.................... setup_oscillator(OSC_8MHZ); // pri prouziti bootloaderu neni treba nastavovat
*
01AE: MOVLW 71
01AF: BSF 03.5
01B0: MOVWF 0F
01B1: MOVF 0F,W
.................... setup_wdt(WDT_2304MS);
01B2: MOVLW 09
01B3: BCF 03.5
01B4: BSF 03.6
01B5: MOVWF 05
01B6: MOVLW 0F
01B7: MOVWF 77
01B8: BCF 03.6
01B9: CLRF 01
01BA: MOVLW 81
01BB: MOVWF 04
01BC: BCF 03.7
01BD: MOVF 00,W
01BE: ANDLW F0
01BF: IORLW 07
01C0: MOVWF 00
01C1: CLRWDT
01C2: MOVF 00,W
01C3: ANDLW F7
01C4: BTFSC 77.3
01C5: ANDLW F0
01C6: IORWF 77,W
01C7: MOVWF 00
.................... restart_wdt(); //---WDT
01C8: CLRWDT
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD);
01C9: BSF 03.5
01CA: BSF 03.6
01CB: MOVF 09,W
01CC: ANDLW C0
01CD: MOVWF 09
01CE: BCF 03.6
01CF: BCF 1F.4
01D0: BCF 1F.5
01D1: MOVLW 00
01D2: BSF 03.6
01D3: MOVWF 08
.................... setup_adc(ADC_CLOCK_DIV_2);
01D4: BCF 03.5
01D5: BCF 03.6
01D6: BCF 1F.6
01D7: BCF 1F.7
01D8: BSF 03.5
01D9: BCF 1F.7
01DA: BCF 03.5
01DB: BSF 1F.0
.................... setup_timer_0(RTCC_EXT_L_TO_H|RTCC_DIV_1);
01DC: BSF 03.5
01DD: MOVF 01,W
01DE: ANDLW C7
01DF: IORLW 28
01E0: MOVWF 01
.................... // setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1);//|T1_CLK_OUT);
.................... setup_timer_1(T1_INTERNAL|T1_DIV_BY_8);
01E1: MOVLW 35
01E2: BCF 03.5
01E3: MOVWF 10
.................... setup_timer_2(T2_DISABLED,0,1);
01E4: MOVLW 00
01E5: MOVWF 78
01E6: MOVWF 12
01E7: MOVLW 00
01E8: BSF 03.5
01E9: MOVWF 12
.................... setup_ccp1(CCP_OFF);
01EA: BCF 03.5
01EB: BSF 32.2
01EC: MOVF 32,W
01ED: BSF 03.5
01EE: MOVWF 07
01EF: BCF 03.5
01F0: CLRF 17
01F1: BSF 03.5
01F2: CLRF 1B
01F3: CLRF 1C
01F4: MOVLW 01
01F5: MOVWF 1D
.................... setup_comparator(NC_NC_NC_NC); // This device COMP currently not supported by the PICWizard
01F6: BCF 03.5
01F7: BSF 03.6
01F8: CLRF 07
01F9: CLRF 08
01FA: CLRF 09
.................... //setup_spi(SPI_MASTER | SPI_MODE_0 | SPI_CLK_DIV_64);
.................... output_high(CSN_SPI);
01FB: BCF 03.6
01FC: BCF 32.2
01FD: MOVF 32,W
01FE: BSF 03.5
01FF: MOVWF 07
0200: BCF 03.5
0201: BSF 07.2
....................
.................... welcome(); // welcome print and device indentification
0202: GOTO 072
....................
....................
.................... }
....................
0203: SLEEP
Configuration Fuses:
Word 1: 2CF5 INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG
Word 2: 3FFF NOWRT BORV40