Funk wetterstations Analyse Programm

Aus Ethersex_Wiki
Version vom 30. April 2010, 09:46 Uhr von Kiwi (Diskussion | Beiträge) (überarbeitung, verbessrung,....)
Wechseln zu: Navigation, Suche










// ################################################################################
// #                                                                              #
// # Daten Analyse und Programm Erstellung:                                       #
// #   Copyright (c) 2009-2010 - Michael Schultz <ethersex@keyb.de>               #
// #      Mit viel unterstuetzung/Geduld von: stesie, veyron und DanielW          #
// #                                                                              #
// # This program is free software; you can redistribute it and/or modify it      #
// # under the terms of the GNU General Public License (either version 2 or       #
// # version 3) as published by the Free Software Foundation.                     #
// #                                                                              #
// # This program is distributed in the hope that it will be useful,              #
// # but WITHOUT ANY WARRANTY; without even the implied warranty of               #
// # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                #
// # GNU General Public License for more details.                                 #
// #                                                                              #
// # You should have received a copy of the GNU General Public License            #
// # along with this program; if not, write to the Free Software                  #
// # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                    #
// #                                                                              #
// # For more information on the GPL, please go to:                               #
// # http://www.gnu.org/copyleft/gpl.html                                         #
// #                                                                              #
// #                                                                              #
// # Wetter-Funk-Daten Analyse Programm für Wetter Station der Firma              #
// #     Krippl Watches GmbH   --   http://www.produktservice.info                #
// # Protokoll analyse siehe:                                                     #
// #     http://www.ethersex.de/index.php/Funk-wetterstations-protokoll           #
// #                                                                              #
// ################################################################################

// Logging Destination Host: 10.0.0.77 on Port 95

#define PRESCALER 1024
#define NS_PER_TICK     (PRESCALER * 1000000UL / F_CPU * 1000)
#define US_TO_TICKS(n)  ((n) * 1000UL / NS_PER_TICK)

// debug ausgabe 0 = keine debug meldungen, 1 = ein bischen merh, und 2 für komplette bit analyse
#define WEATHERVERBOSE 0

uint8_t data[310];
uint16_t counter;
                                        // Timing          @16mhz: Timer Count     Timer C. Hex    Decode
uint8_t Time0 = US_TO_TICKS(1920);      // L       space 1920 bis 1999us            30-31,2         0x1E    0x1F    0
uint8_t Time1 = US_TO_TICKS(3990);      // H       space 3990 bis 4049us            62,3-63,2       0x3E    0x3F    1
uint8_t Time2 = US_TO_TICKS(2060);      // End-l   space 2060 bis 2089us            32,1-32,6       0x20    0x21    2
uint8_t Time3 = US_TO_TICKS(4130);      // End-h   space 4130 bis 4169us            64,5-65,1       0x40    0x41    3
uint8_t Time4 = US_TO_TICKS(8890);      // Start   space 8890 bis 8939us            138,9-139,6     0x8A    0x8B    4
uint8_t Time5 = US_TO_TICKS(360);       // End-    pulse  360 bis 369us             5,6-5,7         0x05            5
uint8_t Time6 = US_TO_TICKS(440);       // _       pulse  440 bis 519us             6,8-8,1         0x06    0x08    6
                                        // Pause
                                        //
uint8_t BitPos = 0;                     // Bit Position innerhalb eines 36 bit worts (1 bis 37)
uint8_t WordCound = 0;                  // Daten Wort Count (1 bis 9)
uint8_t WordData[45];                   // 1 Data Word = 5 Byte    /       Max 8 Data Words
uint8_t WordPos = 0;                    // Byte Pos in WordData
uint8_t MatchPos = 0;                   // meist vorkommene datenwort position im telegram
uint8_t MatchCount = 0;                 // wie viel treffer hatte dieses meist vorkommende telegram
                                        //
uint16_t Temp = 0;                      // Temperatur Wert (-)76,8 bis (+)127,9 °C, Vorzeichen wird erst bei der ausgabe gesetzt.
uint16_t Feuchte = 0;                   // Luftfeuchte Wert 20-99 %
uint8_t timer_0 = 0;                    // Timer Wert für zeitbestimming zwichen 2 Pegel änderungen (Interrupts)
uint8_t Temp1 = 0;                      // Temperatur wert, einer stelle --> 0,n °C
uint8_t Temp10 = 0;                     // Temperatur wert, zener stelle --> n,0 °C
                                        //
uint8_t Analysis[10] ;                  // Daten Analyse array
                                        // Analysis[0 bis 7]               Treffer der Daten Packets Übereinstimmung.
                                        // Analysis[8] - bit(0) = 1        Daten Liegen an und können vearbeitete werden
                                        // Analysis[8] - bit(1) = 1        Datenanalyse erfolgreich, Mindestens 3 Übereinstimmungen
                                        // Analysis[8] - bit(2) = 1        Daten sind Verarbeitet und können gesendet werden
                                        // Analysis[9]                     Array Positions Counter fuer analyse

CONTROL_START
        ON STARTUP DO
                Analysis[8]     |= (1 << 2);            //      nach start einmal ausgabe, um zu schauen wann das ding gebootet ist...
                _TCCR0_PRESCALE |=  _BV(CS02);          //      TCCR0B(CS02)=1
                _TCCR0_PRESCALE &= ~_BV(CS01);          //      TCCR0B(CS01)=0
                _TCCR0_PRESCALE |=  _BV(CS00);          //      TCCR0B(CS00)=1
                _EIMSK          |=  _BV(INT0);          //      EIMSK(INT0) = 1         Interrupt, Input Data on INT0 / PD2
                _EICRA          &= ~_BV(ISC01);         //      EICRA(ISC01) = 0        interrupt on any edge, asyncronously
                _EICRA          |=  _BV(ISC00);         //      EICRA(ISC00) = 1        interrupt on any edge, asyncronously
                _TIMSK_TIMER0   |=  _BV(TOIE0);         //      TIMSK0(TOIE0) = 1       Interrupt on Timer Overflow aktivieren
                TCP_CONNECT(10.0.0.77, 95, message_handler);
        END

        TCP_HANDLER_PERSIST(message_handler)
        for (;;)
        {

                // Analysis[8] - bit(2) = 1        Daten sind Verarbeitet und können gesendet werden
                if ( Analysis[8] & ( 1 << 2 ) )
                {
                        // Lösche ale Analysis Counter
                        for (int Count1 = 0; Count1 < 8; Count1 ++) Analysis[ (Count1) ] = 0 ;

                        // wie oft matcht welsches telegram mit allen anderen 8 telegrammen
                        for (int Count1 = 0; Count1 < 8; Count1 ++)
                                for (int Count2 = 0; Count2 < 8; Count2 ++)
                                        if (memcmp(&WordData[ (Count1) * 5 ], &WordData[ ( Count2 + 1 ) * 5], 5) == 0)
                                                { Analysis[ (Count1) ] ++ ; }

                        // nim nur das telegram mit der größten anzahl an treffer
                        for (int Count1 = 8; Count1 > 1; Count1 --)
                                for (int Count2 = 0; Count2 < 8; Count2 ++)
                                        if ( Analysis[ (Count2) ] == Count1 )
                                        {
                                                MatchPos = Count2 ;
                                                MatchCount = Count1 ;
                                                WordData[40] = WordData[ ( MatchPos * 5 )     ] ;
                                                WordData[41] = WordData[ ( MatchPos * 5 ) + 1 ] ;
                                                WordData[42] = WordData[ ( MatchPos * 5 ) + 2 ] ;
                                                WordData[43] = WordData[ ( MatchPos * 5 ) + 3 ] ;
                                                WordData[44] = WordData[ ( MatchPos * 5 ) + 4 ] ;
                                        }

                        // binär analyse der temperatur
                        Temp = 0 ;
                        if ( WordData[41] & ( 1 << 3 ) ) { Temp = Temp + 1    ; }
                        if ( WordData[41] & ( 1 << 2 ) ) { Temp = Temp + 2    ; }
                        if ( WordData[41] & ( 1 << 1 ) ) { Temp = Temp + 4    ; }
                        if ( WordData[41] & ( 1 << 0 ) ) { Temp = Temp + 8    ; }
                        if ( WordData[42] & ( 1 << 7 ) ) { Temp = Temp + 16   ; }
                        if ( WordData[42] & ( 1 << 6 ) ) { Temp = Temp + 32   ; }
                        if ( WordData[42] & ( 1 << 5 ) ) { Temp = Temp + 64   ; }
                        if ( WordData[42] & ( 1 << 4 ) ) { Temp = Temp + 128  ; }
                        if ( WordData[42] & ( 1 << 3 ) ) { Temp = Temp + 256  ; }
                        if ( WordData[42] & ( 1 << 2 ) ) { Temp = Temp + 512  ; }
                        if ( WordData[42] & ( 1 << 1 ) ) { Temp = Temp + 1024 ; }
                        Temp10=( Temp / 10 );
                        Temp1=( Temp - ( ( Temp / 10 ) * 10 ) );

                        // binär analyse der luftfeuchtigkeit
                        Feuchte = 0 ;
                        if ( WordData[43] & ( 1 << 7 ) ) { Feuchte = Feuchte + 1  ; }
                        if ( WordData[43] & ( 1 << 6 ) ) { Feuchte = Feuchte + 2  ; }
                        if ( WordData[43] & ( 1 << 5 ) ) { Feuchte = Feuchte + 4  ; }
                        if ( WordData[43] & ( 1 << 4 ) ) { Feuchte = Feuchte + 8  ; }
                        if ( WordData[43] & ( 1 << 3 ) ) { Feuchte = Feuchte + 10 ; }
                        if ( WordData[43] & ( 1 << 2 ) ) { Feuchte = Feuchte + 20 ; }
                        if ( WordData[43] & ( 1 << 1 ) ) { Feuchte = Feuchte + 40 ; }
                        if ( WordData[43] & ( 1 << 0 ) ) { Feuchte = Feuchte + 80 ; }

                        // syslog format, initial priority / facility
                        TCP_SEND("<27>");

                        // na welschen monat haben wir den, syslog benötigt diesen ausgeschrieben
                        if ( CLOCK_MONTH() == 1 )  { TCP_SEND("Jan "); }
                        if ( CLOCK_MONTH() == 2 )  { TCP_SEND("Feb "); }
                        if ( CLOCK_MONTH() == 3 )  { TCP_SEND("Mar "); }
                        if ( CLOCK_MONTH() == 4 )  { TCP_SEND("Apr "); }
                        if ( CLOCK_MONTH() == 5 )  { TCP_SEND("May "); }
                        if ( CLOCK_MONTH() == 6 )  { TCP_SEND("Jun "); }
                        if ( CLOCK_MONTH() == 7 )  { TCP_SEND("Jul "); }
                        if ( CLOCK_MONTH() == 8 )  { TCP_SEND("Aug "); }
                        if ( CLOCK_MONTH() == 9 )  { TCP_SEND("Sep "); }
                        if ( CLOCK_MONTH() == 10 ) { TCP_SEND("Oct "); }
                        if ( CLOCK_MONTH() == 11 ) { TCP_SEND("Nov "); }
                        if ( CLOCK_MONTH() == 12 ) { TCP_SEND("Dec "); }
                        TCP_SEND("%02d %02d:%02d:%02d %s wheather: code:", CLOCK_DAY(), CLOCK_HOUR(), CLOCK_MIN(), CLOCK_SEC(), CONF_HOSTNAME);
                        if ( WordData[40] & ( 1 << 3 ) ) { TCP_SEND("1");  } else { TCP_SEND("0");  }
                        if ( WordData[40] & ( 1 << 2 ) ) { TCP_SEND("1-"); } else { TCP_SEND("0-"); }
                        if ( WordData[40] & ( 1 << 7 ) ) { TCP_SEND("1");  } else { TCP_SEND("0");  }
                        if ( WordData[40] & ( 1 << 6 ) ) { TCP_SEND("1");  } else { TCP_SEND("0");  }
                        if ( WordData[40] & ( 1 << 5 ) ) { TCP_SEND("1");  } else { TCP_SEND("0");  }
                        if ( WordData[40] & ( 1 << 4 ) ) { TCP_SEND("1-"); } else { TCP_SEND("0-"); }
                        if ( WordData[40] & ( 1 << 1 ) ) { TCP_SEND("1");  } else { TCP_SEND("0");  }
                        if ( WordData[40] & ( 1 << 0 ) ) { TCP_SEND("1-"); } else { TCP_SEND("0-"); }
                        if ( WordData[41] & ( 1 << 7 ) ) { TCP_SEND("1");  } else { TCP_SEND("0");  }
                        if ( WordData[41] & ( 1 << 6 ) ) { TCP_SEND("1");  } else { TCP_SEND("0");  }
                        if ( WordData[41] & ( 1 << 5 ) ) { TCP_SEND("1");  } else { TCP_SEND("0");  }
                        TCP_SEND(" temp:");
                        if ( WordData[42] & ( 1 << 0 ) ) { TCP_SEND("-");  } else { TCP_SEND("+");  }
                        TCP_SEND("%d.%d hum:%d%% manu:", Temp10, Temp1, Feuchte);
                        if ( WordData[41] & ( 1 << 4 ) ) { TCP_SEND("1");  } else { TCP_SEND("0");  }
                        TCP_SEND(" Match:%d/%d", MatchPos, MatchCount);
                        TCP_SEND(" data:%02x%02x%02x%02x%02x\n", WordData[40],  WordData[41],  WordData[42],  WordData[43],  WordData[44]);
                        #if WEATHERVERBOSE == 1
                                TCP_SEND("00  --> %02x%02x%02x%02x%02x  Match:%d\n", WordData[0],   WordData[1],   WordData[2],   WordData[3],   WordData[4],  Analysis[0]);
                                TCP_SEND("01  --> %02x%02x%02x%02x%02x  Match:%d\n", WordData[5],   WordData[6],   WordData[7],   WordData[8],   WordData[9],  Analysis[1]);
                                TCP_SEND("02  --> %02x%02x%02x%02x%02x  Match:%d\n", WordData[10],  WordData[11],  WordData[12],  WordData[13],  WordData[14], Analysis[2]);
                                TCP_SEND("03  --> %02x%02x%02x%02x%02x  Match:%d\n", WordData[15],  WordData[16],  WordData[17],  WordData[18],  WordData[19], Analysis[3]);
                                TCP_SEND("04  --> %02x%02x%02x%02x%02x  Match:%d\n", WordData[20],  WordData[21],  WordData[22],  WordData[23],  WordData[24], Analysis[4]);
                                TCP_SEND("05  --> %02x%02x%02x%02x%02x  Match:%d\n", WordData[25],  WordData[26],  WordData[27],  WordData[28],  WordData[29], Analysis[5]);
                                TCP_SEND("06  --> %02x%02x%02x%02x%02x  Match:%d\n", WordData[30],  WordData[31],  WordData[32],  WordData[33],  WordData[34], Analysis[6]);
                                TCP_SEND("07  --> %02x%02x%02x%02x%02x  Match:%d\n", WordData[35],  WordData[36],  WordData[37],  WordData[38],  WordData[39], Analysis[7]);
                                TCP_SEND("Out --> %02x%02x%02x%02x%02x\n", WordData[40],  WordData[41],  WordData[42],  WordData[43],  WordData[44]);
                                TCP_SEND(" \n");
                                TCP_SEND(" \n");
                        #endif
                        #if WEATHERVERBOSE > 1
                                TCP_SEND("%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n", data[0],   data[1],   data[2],   data[3],   data[4],   data[5],   data[6],   data[7],   data[8],   data[9], data[10],  data[11],  data[12],  data[13],  data[14],  data[15],  data[16],  data[17],  data[18],  data[19],  data[20],  data[21],  data[22],  data[23],  data[24],  data[25],  data[26],  data[27],  data[28],  data[29],  data[30], data[31],  data[32],  data[33],  data[34],  data[35],  data[36],  data[37],  data[38],  data[39]);
                                TCP_SEND("%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n", data[40],  data[41],  data[42],  data[43],  data[44],  data[45],  data[46],  data[47],  data[48],  data[49], data[50],  data[51],  data[52],  data[53],  data[54],  data[55],  data[56],  data[57],  data[58],  data[59],  data[60],  data[61],  data[62],  data[63],  data[64],  data[65],  data[66],  data[67],  data[68],  data[69],  data[70], data[71],  data[72],  data[73],  data[74],  data[75],  data[76],  data[77],  data[78],  data[79]);
                                TCP_SEND("%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n", data[80],  data[81],  data[82],  data[83],  data[84],  data[85],  data[86],  data[87],  data[88],  data[89], data[100], data[101], data[102], data[103], data[104], data[105], data[106], data[107], data[108], data[109], data[110], data[111], data[112], data[113], data[114], data[115], data[116], data[117], data[118], data[119], data[120], data[121], data[122], data[123], data[124], data[125], data[126], data[127], data[128], data[129]);
                                TCP_SEND("%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n", data[130], data[131], data[132], data[133], data[134], data[135], data[136], data[137], data[138], data[139], data[140], data[141], data[142], data[143], data[144], data[145], data[146], data[147], data[148], data[149], data[150], data[151], data[152], data[153], data[154], data[155], data[156], data[157], data[158], data[159], data[160], data[161], data[162], data[163], data[164], data[165], data[166], data[167], data[168], data[169]);
                                TCP_SEND("%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n", data[170], data[171], data[172], data[173], data[174], data[175], data[176], data[177], data[178], data[179], data[180], data[181], data[182], data[183], data[184], data[185], data[186], data[187], data[188], data[189], data[190], data[191], data[192], data[193], data[194], data[195], data[196], data[197], data[198], data[199], data[200], data[201], data[202], data[203], data[204], data[205], data[206], data[207], data[208], data[209]);
                                TCP_SEND("%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n", data[210], data[211], data[212], data[213], data[214], data[215], data[216], data[217], data[218], data[219], data[220], data[221], data[222], data[223], data[224], data[225], data[226], data[227], data[228], data[229], data[230], data[231], data[232], data[233], data[234], data[235], data[236], data[237], data[238], data[239], data[240], data[241], data[242], data[243], data[244], data[245], data[246], data[247], data[248], data[249]);
                                TCP_SEND("%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n", data[250], data[251], data[252], data[253], data[254], data[255], data[256], data[257], data[258], data[259], data[260], data[261], data[262], data[263], data[264], data[265], data[266], data[267], data[268], data[269], data[270], data[271], data[272], data[273], data[274], data[275], data[276], data[277], data[278], data[279], data[280], data[281], data[282], data[283], data[284], data[285], data[286], data[287], data[288], data[289]);
                                TCP_SEND("%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n", data[290], data[291], data[292], data[293], data[294], data[295], data[296], data[297], data[298], data[299], data[300], data[301], data[302], data[303], data[304], data[305], data[306], data[307], data[308], data[309], data[290], data[291], data[292], data[293], data[294], data[295], data[296], data[297], data[298], data[299], data[300], data[301], data[302], data[303], data[304], data[305], data[306], data[307], data[308], data[309]);
                                TCP_SEND(" \n");
                                TCP_SEND(" \n");
                        #endif
                        Analysis[8] &= ~(1 << 2);       //     deaktivieren der Daten sendung
                }
                Analysis[9] = 0;
                PT_YIELD(pt);

//   Analysis[0 bis 7]               Treffer der Daten Packets Übereinstimmung.
//   Analysis[8] - bit(0) = 1        Daten Liegen an und können vearbeitete werden
//   Analysis[8] - bit(1) = 1        Datenanalyse erfolgreich, Mindestens 3 Übereinstimmungen
//   Analysis[8] - bit(2) = 1        Daten sind Verarbeitet und können gesendet werden
        }
        TCP_HANDLER_END();

CONTROL_END
// ###############################################################################################################################
ISR(INT0_vect)
{
        timer_0 = TCNT0;
        counter ++;
        if ( counter >= 310 )
        {
                counter = 1 ;
        }
        WordPos=(( BitPos / 8 ) + ( WordCound * 5 ));

        if ( WordPos >= 40 )
        {
                BitPos = 0 ;
                WordCound = 0 ;
        }

        if ( timer_0 >= Time6 && timer_0 <= ( Time6 + 2 ) )
        {
                counter -- ;
        } else if ( timer_0 == Time0 || timer_0 == ( Time0 + 1 ) )
        {                                                               // L       0       (L - Bit - Normal)
                data[counter] = 0;
                WordData[WordPos] &= ~(1 << ( 7 - (BitPos % 8)));         // WordData[n] = 0;
                BitPos ++ ;
        } else if ( timer_0 == Time1 || timer_0 == ( Time1 + 1 ) )
        {                                                               // H       1       (H - Bit - Normal)
                data[counter] = 1;
                WordData[WordPos] |= 1 << ( 7 - (BitPos % 8));          // WordData[n] = 1;
                BitPos ++ ;
        } else if ( timer_0 == Time2 || timer_0 == ( Time2 + 1 ) )
        {                                                               // End-l   2       (Ende Datenwort L)
                data[counter] = 2;
                WordData[WordPos] &= ~(1 << ( 7 - (BitPos % 8)));       // WordData[n] = 0;
                BitPos ++ ;
        } else if ( timer_0 == Time3 || timer_0 == ( Time3 + 1 ) )
        {                                                               // End-h   3       (Ende Datenwort H)
                data[counter] = 3;
                WordData[WordPos] |= 1 << ( 7 - (BitPos % 8));          // WordData[n] = 1;
                BitPos ++ ;
        } else if ( timer_0 >= ( Time4 -2 ) && timer_0 <= ( Time4 + 3 ) )
        {                                                               // Start   4      (Start Datenwort)
                data[counter] = 4;
                if ( BitPos != 1 )
                {
                        WordCound ++ ;
                        WordData[ WordPos ] = 0 ;
                        WordData[ WordPos + 1 ] = 0 ;
                        WordData[ WordPos + 2 ] = 0 ;
                        WordData[ WordPos + 3 ] = 0 ;
                        WordData[ WordPos + 4 ] = 0 ;
                }
                BitPos = 0;
        } else if ( timer_0 == Time5 || timer_0 == ( Time5 + 1 ) )
        {                                                               // End-    5       (Daten Sendung Ende)
                data[counter] = 5;
        } else
        {                                                               // ?       8       (Nicht Erkanntes Timing)
                data[counter] = 8;
                BitPos ++ ;
        }
        TCNT0 = 0;

//
//     L       0       (L - Bit)                       30
//     H       1       (H - Bit)                       62
//     End-l   2       (Ende Datenwort L)              32
//     End-h   3       (Ende Datenwort H)              64
//     Start   4       (Start Datenwort)               138
//     End-    5       (Daten Sendung Ende)            5
//     _       6       (puls)                          6
//     Pause   7       (Timer Overflow)
//     ?       8       (Nicht Erkanntes Timing)
//
//     uint8_t BitPos = 0;             //     Bit Position innerhalb eines 36 bit worts (0 bis 36)
//     uint8_t WordCound = 0;          //     Daten Wort Count (0 bis 7)
//     uint8_t WordData[40];           //     1 Data Word = 5 Byte    /       Max 8 Data Words
//

//     WordData[0]     WordData[1]     WordData[2]     WordData[3]     WordData[4]
//
//     0    0          1    1          2    2          3    3          4    4
//     5    D          0    0          4    8          E    4          7    0
//     0101 1101       0000 0000       0100 1000       1110 0100       0111 0000
//     RRRR CCBB       ???S TTTT       TTTT TTTT       LLLL LLLL       cccc ----
//

}
// ###############################################################################################################################
ISR(TIMER0_OVF_vect)
{
        if ( WordCound >= 3 )
        {
                Analysis[8] |= (1 << 2);
        }
        counter = 0;
        data[counter] = 7;
        TIFR0  &= ~_BV(TOV0);           //     TIFR0(TOV0) = 0
        BitPos = 0;
        WordCound = 0;
}
// ###############################################################################################################################


//     gummi:~#
//     gummi:~# while true ; do socat stdio tcp4-listen:95 ; echo "##########" ; sleep 1 ; done
//
//     gummi:/usr/src/ethersex/090730_wichtel_ac:de:48:d3:99:5f/ethersex/control6#
//             cd .. ; make clean ; make ; scp ethersex.bin 10.33.0.10:/srv/tftp/ACDE48D3995F ; cd control6/ ;
//             echo "bootloader" | socat stdio tcp4:10.0.0.40:2701
//
//     gummi:/usr/src/ethersex/090730_wichtel_ac:de:48:d3:99:5f/ethersex/control6#
//             cat funk_temp_und_feuchte_daten.src | sed 's///[\ \t]*.*//g' | sed 's/^\t\+$//'  | grep -v '^$'
//
//     gummi:~#
//             while true ; do socat stdio tcp4-listen:4444 | while read Line ; do
//             if [ "$(echo $Line | grep -c '^--')" = "1" ] ; then echo ; echo ; else
//             echo -en "$Line" | sed 's/^_//' ; fi ; done | sed 's/\(8[bc]0[78]\)/\n\1/g' ;
//             echo "##########" ; sleep 1 ; done
//
//                     Timing          Timer Count     Timer C. Hex    Decode
//     L       space 1920 bis 1999us   30-31,2         0x1E    0x1F    0
//     H       space 3990 bis 4049us   62,3-63,2       0x3E    0x3F    1
//     End-l   space 2060 bis 2089us   32,1-32,6       0x20    0x21    2
//     End-h   space 4130 bis 4169us   64,5-65,1       0x40    0x41    3
//     Start   space 8890 bis 8939us   138,9-139,6     0x8A    0x8B    4
//     End-    pulse  360 bis 369us    5,6-5,7         0x05            5
//     _       pulse  440 bis 519us    6,8-8,1         0x06    0x08    6
//     Pause                                                           7
//





Emfangen der "Wetter" Daten Mittels Syslog-NG

Sample "/etc/syslog-ng/syslog-ng.conf" File

################################################################################
# Speicherung der "Wetter" Daten (Temp und Feuchte)
################################################################################
source src_net_t95 {    tcp(    ip(10.0.0.77)   port(95)        max_connections(1000)   );      };
destination dst_file_t95 {      file("/mnt/log/current/$YEAR/$MONTH/$DAY/$HOUR/$HOST/$PROGRAM/$FACILITY.$PRIORITY.log"); };
log {   source(src_net_t95);    destination(dst_file_t95);      };
################################################################################



So sehen die daten dann gespeichert aus:
(/mnt/log/current/2009/08/03/08/wichtel/ethersex/daemon.err.log

Apr 30 09:42:39 wichtel wheather: code:01-1110-11-001 temp:+26.4 humidity:24% manu:0 Match:7/7 data: e721082400
Apr 30 09:43:09 wichtel wheather: code:01-1110-11-001 temp:+26.4 humidity:25% manu:0 Match:7/7 data: e72108a400
Apr 30 09:43:39 wichtel wheather: code:01-1110-11-001 temp:+26.4 humidity:24% manu:0 Match:7/7 data: e721082400