Change Slave sends '0' during convert prozess on all DS18B20
[owSlave2.git] / DS18B20_BMP280 / DS18B20_BMP280.c
index ca6333b..4a78bad 100644 (file)
 
 
 extern void OWINIT();
+extern void EXTERN_SLEEP();
 
 
 
 
-uint8_t owid[8]={0x28, 0xA2, 0xD9, 0x84, 0x00, 0x16, 0x77, 0x6B};/**/
-uint8_t config_info[16]={0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x10,0x11,0x12,0x13,0x14,0x15,0x16};
+uint8_t owid[8]={0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40};/**/
+uint8_t config_info[16]={0x02,0x03, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
        
 #if (owid>128) 
 #error "Variable not correct"
@@ -102,17 +103,18 @@ int main(void){
        MCUSR=0;
        USI_TWI_Master_Initialise();
        bmp280Init();
-       
+       //DDRB|=(1<<PINB1);
        gcontrol=1;
        sei();
     while(1)   {
        
                if (gcontrol) {
+                       //PORTB|=(1<<PINB1); //Dauer 5.4ms
                        uint32_t P;
                        int32_t t;
                        bmp280ConvertInt(&t,&P,1);
-                       P=P*16;
-                       P=P/1000;
+                       P=P-70000;
+                       P=P/20;
                        uint16_t w=P;
                        uint8_t t8=w>>4;
                        uint8_t af=0;
@@ -123,7 +125,8 @@ int main(void){
                        //pack.temp++;
                        alarmflag=af;
                        sei();                  
-                       gcontrol=0;
+                       EXTERN_SLEEP();
+                       //PORTB&=~(1<<PINB1);
                }