Change Slave sends '0' during convert prozess on all DS18B20
authorTobias <tm@tm3d.de>
Thu, 15 Oct 2015 06:38:33 +0000 (08:38 +0200)
committerTobias <tm@tm3d.de>
Thu, 15 Oct 2015 06:38:33 +0000 (08:38 +0200)
Auto find MAX44009
Config Bytes on DS18B20_TC

24 files changed:
DS18B20_BMP280/DS18B20_BMP280.c
DS18B20_BMP280/OWDS18B20.S
DS18B20_BMP280_DS2438_SHT/DS18B20_BMP280_DS2438_SHT.atsln [new file with mode: 0644]
DS18B20_BMP280_DS2438_SHT/DS18B20_BMP280_DS2438_SHT.cproj [new file with mode: 0644]
DS18B20_BMP280_DS2438_SHT/DS18B20_DS2438.c
DS18B20_BMP280_DS2438_SHT/OWDS18B20_DS2438.S
DS18B20_MAX44009/DS18B20_MAX44009.c
DS18B20_MAX44009/OWDS18B20.S
DS18B20_MAX44009_DS2438_SHT/DS18B20_DS2438.c
DS18B20_MAX44009_DS2438_SHT/OWDS18B20_DS2438.S
DS18B20_Thermocouble/DS18B20_TC.c
DS18B20_Thermocouble/DS18B20_TC.cproj
DS18B20_Thermocouble/OWDS18B20.S
DS2450/DS2450.atsln
DS2450/DS2450.c
DS2450/DS2450.cproj
DS2450/OWDS2450.S
common/I2C/MAX44009.c
common/I2C/MAX44009.h
common/I2C/SHT2x.c
common/OWPinInterrupt.s
common/OWRomFunctions.s
common/OWRomFunctionsDual.s
programmer/flash/flashp.bat

index 313a368..4a78bad 100644 (file)
@@ -43,6 +43,7 @@
 
 
 extern void OWINIT();
+extern void EXTERN_SLEEP();
 
 
 
@@ -102,12 +103,13 @@ 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);
@@ -123,7 +125,8 @@ int main(void){
                        //pack.temp++;
                        alarmflag=af;
                        sei();                  
-                       gcontrol=0;
+                       EXTERN_SLEEP();
+                       //PORTB&=~(1<<PINB1);
                }
 
                
index 27aa8d2..f0331cf 100644 (file)
@@ -33,7 +33,6 @@
 
 #define _CHANGEABLE_ID_
 #define _ZERO_POLLING_
-//#define _DB_
 
 #include "../common/OWConfig.s"
 #include "../common/OWCRC8.s"
@@ -61,6 +60,7 @@ Init_EEPROM_read:
 .macro COMMAND_TABLE
                rjmp h_readscratchpad
                rjmp h_writescratchpad
+               rjmp h_convert_run
 .endm
 
 #include "../common/OWRomFunctions.s"
@@ -71,6 +71,7 @@ Init_EEPROM_read:
 ; Ab hier Geraeteabhaenging
 #define OW_READ_SCRATCHPAD OW_FIRST_COMMAND+0
 #define OW_WRITE_SCRATCHPAD OW_FIRST_COMMAND+1
+#define OW_CONVERT_RUN  OW_FIRST_COMMAND+2
 
 
 ;---------------------------------------------------
@@ -139,8 +140,12 @@ hrc_set_convertT:
 ;      ldi r_rwbyte,1
 ;hrc_set_convertT_end:
 ;      sts alarmflag,r_rwbyte
-       rjmp handle_end_sleep
-
+       ldi r_mode,OW_CONVERT_RUN
+       ldi r_sendflag,3 ;set bit 0 and 1 for no zero polling
+h_convert_run:
+       ldi r_bcount,0
+       ldi r_rwbyte,0
+       rjmp handle_end_no_bcount       
 
 hrc_copy_scratchpad:
        ldi r_bytep,2
@@ -232,6 +237,5 @@ h_writescratchpad_all:
 
 
 
-
 #include "../common/OWPinInterrupt.s"
 .end
\ No newline at end of file
diff --git a/DS18B20_BMP280_DS2438_SHT/DS18B20_BMP280_DS2438_SHT.atsln b/DS18B20_BMP280_DS2438_SHT/DS18B20_BMP280_DS2438_SHT.atsln
new file mode 100644 (file)
index 0000000..0a5815e
--- /dev/null
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Atmel Studio Solution File, Format Version 11.00
+VisualStudioVersion = 14.0.23107.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "DS18B20_BMP280_DS2438_SHT", "DS18B20_BMP280_DS2438_SHT.cproj", "{7A5672FE-8226-4158-B931-E1F36B9A8858}"
+EndProject
+Global
+       GlobalSection(SolutionConfigurationPlatforms) = preSolution
+               Debug|AVR = Debug|AVR
+               Release|AVR = Release|AVR
+       EndGlobalSection
+       GlobalSection(ProjectConfigurationPlatforms) = postSolution
+               {7A5672FE-8226-4158-B931-E1F36B9A8858}.Debug|AVR.ActiveCfg = Debug|AVR
+               {7A5672FE-8226-4158-B931-E1F36B9A8858}.Debug|AVR.Build.0 = Debug|AVR
+               {7A5672FE-8226-4158-B931-E1F36B9A8858}.Release|AVR.ActiveCfg = Release|AVR
+               {7A5672FE-8226-4158-B931-E1F36B9A8858}.Release|AVR.Build.0 = Release|AVR
+       EndGlobalSection
+       GlobalSection(SolutionProperties) = preSolution
+               HideSolutionNode = FALSE
+       EndGlobalSection
+EndGlobal
diff --git a/DS18B20_BMP280_DS2438_SHT/DS18B20_BMP280_DS2438_SHT.cproj b/DS18B20_BMP280_DS2438_SHT/DS18B20_BMP280_DS2438_SHT.cproj
new file mode 100644 (file)
index 0000000..7124151
--- /dev/null
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectVersion>7.0</ProjectVersion>
+    <ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName>
+    <ProjectGuid>{7a5672fe-8226-4158-b931-e1f36b9a8858}</ProjectGuid>
+    <avrdevice>ATtiny84A</avrdevice>
+    <avrdeviceseries>none</avrdeviceseries>
+    <OutputType>Executable</OutputType>
+    <Language>C</Language>
+    <OutputFileName>$(MSBuildProjectName)</OutputFileName>
+    <OutputFileExtension>.elf</OutputFileExtension>
+    <OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
+    <AssemblyName>DS18B20_DS2438</AssemblyName>
+    <Name>DS18B20_BMP280_DS2438_SHT</Name>
+    <RootNamespace>DS18B20_DS2438</RootNamespace>
+    <ToolchainFlavour>Native</ToolchainFlavour>
+    <KeepTimersRunning>true</KeepTimersRunning>
+    <OverrideVtor>false</OverrideVtor>
+    <CacheFlash>true</CacheFlash>
+    <ProgFlashFromRam>true</ProgFlashFromRam>
+    <RamSnippetAddress>0x20000000</RamSnippetAddress>
+    <UncachedRange />
+    <preserveEEPROM>true</preserveEEPROM>
+    <OverrideVtorValue>exception_table</OverrideVtorValue>
+    <BootSegment>2</BootSegment>
+    <eraseonlaunchrule>1</eraseonlaunchrule>
+    <AsfFrameworkConfig>
+      <framework-data xmlns="">
+        <options />
+        <configurations />
+        <files />
+        <documentation help="" />
+        <offline-documentation help="" />
+        <dependencies>
+          <content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.19.0" />
+        </dependencies>
+      </framework-data>
+    </AsfFrameworkConfig>
+    <avrtool>com.atmel.avrdbg.tool.atmelice</avrtool>
+    <com_atmel_avrdbg_tool_atmelice>
+      <ToolOptions>
+        <InterfaceProperties>
+        </InterfaceProperties>
+        <InterfaceName>debugWIRE</InterfaceName>
+      </ToolOptions>
+      <ToolType>com.atmel.avrdbg.tool.atmelice</ToolType>
+      <ToolNumber>J41800000779</ToolNumber>
+      <ToolName>Atmel-ICE</ToolName>
+    </com_atmel_avrdbg_tool_atmelice>
+    <avrtoolinterface>debugWIRE</avrtoolinterface>
+    <com_atmel_avrdbg_tool_simulator>
+      <ToolOptions>
+        <InterfaceProperties>
+        </InterfaceProperties>
+        <InterfaceName>
+        </InterfaceName>
+      </ToolOptions>
+      <ToolType>com.atmel.avrdbg.tool.simulator</ToolType>
+      <ToolNumber>
+      </ToolNumber>
+      <ToolName>Simulator</ToolName>
+    </com_atmel_avrdbg_tool_simulator>
+    <ExternalProgrammingToolCommand />
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
+    <ToolchainSettings>
+      <AvrGcc>
+        <avrgcc.common.Device>-mmcu=attiny84a -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\gcc\dev\attiny84a"</avrgcc.common.Device>
+        <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
+        <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
+        <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
+        <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
+        <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
+        <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
+        <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
+        <avrgcc.compiler.symbols.DefSymbols>
+          <ListValues>
+            <Value>DEBUG</Value>
+          </ListValues>
+        </avrgcc.compiler.symbols.DefSymbols>
+        <avrgcc.compiler.directories.IncludePaths>
+          <ListValues>
+            <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\include</Value>
+          </ListValues>
+        </avrgcc.compiler.directories.IncludePaths>
+        <avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>
+        <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
+        <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
+        <avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
+        <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
+        <avrgcc.linker.libraries.Libraries>
+          <ListValues>
+            <Value>libm</Value>
+          </ListValues>
+        </avrgcc.linker.libraries.Libraries>
+        <avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
+      </AvrGcc>
+    </ToolchainSettings>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
+    <ToolchainSettings>
+      <AvrGcc>
+        <avrgcc.common.Device>-mmcu=attiny84a -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\gcc\dev\attiny84a"</avrgcc.common.Device>
+        <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
+        <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
+        <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
+        <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
+        <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
+        <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
+        <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
+        <avrgcc.compiler.symbols.DefSymbols>
+          <ListValues>
+            <Value>DEBUG</Value>
+          </ListValues>
+        </avrgcc.compiler.symbols.DefSymbols>
+        <avrgcc.compiler.directories.IncludePaths>
+          <ListValues>
+            <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\include</Value>
+          </ListValues>
+        </avrgcc.compiler.directories.IncludePaths>
+        <avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>
+        <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
+        <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
+        <avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
+        <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
+        <avrgcc.linker.libraries.Libraries>
+          <ListValues>
+            <Value>libm</Value>
+          </ListValues>
+        </avrgcc.linker.libraries.Libraries>
+        <avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
+      </AvrGcc>
+    </ToolchainSettings>
+  </PropertyGroup>
+  <ItemGroup>
+    <Compile Include="..\common\I2C\SHT2x.c">
+      <SubType>compile</SubType>
+      <Link>SHT2x.c</Link>
+    </Compile>
+    <Compile Include="D:\oc\dev\owSlave2\common\I2C\BMP280.c">
+      <SubType>compile</SubType>
+      <Link>BMP280.c</Link>
+    </Compile>
+    <Compile Include="D:\oc\dev\owSlave2\common\I2C\USI_TWI_Master.c">
+      <SubType>compile</SubType>
+      <Link>USI_TWI_Master.c</Link>
+    </Compile>
+    <Compile Include="DS18B20_DS2438.c">
+      <SubType>compile</SubType>
+    </Compile>
+    <Compile Include="OWDS18B20_DS2438.S">
+      <SubType>compile</SubType>
+    </Compile>
+  </ItemGroup>
+  <Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
+</Project>
\ No newline at end of file
index 4aec172..8d995eb 100644 (file)
@@ -44,7 +44,7 @@
 
 
 extern void OWINIT();
-
+extern void EXTERN_SLEEP();
 
 
 uint8_t owid1[8]={0x28, 0xA3, 0xD9, 0x84, 0x00, 0x16, 0x05, 0x18};/**/
@@ -207,7 +207,7 @@ int main(void){
                                //pack.temp++;
                                alarmflag=af;
                                sei();
-                               gcontrol=0;
+                               EXTERN_SLEEP(); 
                }
                if ((gcontrol==2)||(gcontrol==3)) {
                        gcontrol=0;
index bf7146e..e67690a 100644 (file)
@@ -69,6 +69,7 @@ Init_EEPROM_read:
 .macro COMMAND_TABLE
                rjmp h_readscratchpad1
                rjmp h_writescratchpad1
+               rjmp h_convert_run1
                rjmp h_readscratchpad_adr2
                rjmp h_readscratchpad2
                rjmp h_writescratchpad_adr2
@@ -83,10 +84,12 @@ Init_EEPROM_read:
 ; Ab hier Geraeteabhaenging
 #define OW_READ_SCRATCHPAD1 OW_FIRST_COMMAND+0
 #define OW_WRITE_SCRATCHPAD1 OW_FIRST_COMMAND+1
-#define OW_READ_SCRATCHPAD_ADR2 OW_FIRST_COMMAND+2
-#define OW_READ_SCRATCHPAD2 OW_FIRST_COMMAND+3
-#define OW_WRITE_SCRATCHPAD_ADR2 OW_FIRST_COMMAND+4
-#define OW_WRITE_SCRATCHPAD2 OW_FIRST_COMMAND+5
+#define OW_CONVERT_RUN1  OW_FIRST_COMMAND+2
+#define OW_READ_SCRATCHPAD_ADR2 OW_FIRST_COMMAND+3
+#define OW_READ_SCRATCHPAD2 OW_FIRST_COMMAND+4
+#define OW_WRITE_SCRATCHPAD_ADR2 OW_FIRST_COMMAND+5
+#define OW_WRITE_SCRATCHPAD2 OW_FIRST_COMMAND+6
+
 
 
 ;---------------------------------------------------
@@ -132,7 +135,12 @@ hrc_set_convertT1:
        ldi r_temp,1
        sts gcontrol,r_temp
 
-       rjmp handle_end_sleep
+       ldi r_mode,OW_CONVERT_RUN1
+       ldi r_sendflag,3 ;set bit 0 and 1 for no zero polling
+h_convert_run1:
+       ldi r_bcount,0
+       ldi r_rwbyte,0
+       rjmp handle_end_no_bcount       
 
 
 hrc_copy_scratchpad1:
index f4bd316..3447b6b 100644 (file)
@@ -44,7 +44,7 @@
 
 extern void OWINIT();
 
-
+extern void EXTERN_SLEEP();
 
 
 uint8_t owid[8]={0x28, 0xA2, 0xD9, 0x84, 0x00, 0x16, 0x77, 0x6B};/**/
@@ -60,7 +60,7 @@ extern uint8_t reset_indicator;
 extern uint8_t alarmflag;
 
 
-
+uint8_t max_adr=0;
 
 typedef union {
        volatile uint8_t bytes[8];
@@ -101,14 +101,16 @@ int main(void){
 
        MCUSR=0;
        USI_TWI_Master_Initialise();
-       
+       if (checkMAX44009(0)) max_adr=0; else max_adr=1 ;
        
        gcontrol=1;
+       //DDRB|=(1<<PINB1);
        sei();
     while(1)   {
        
                if (gcontrol) {
-                       volatile double l=MAX44009getlux(1);            
+                       //PORTB|=(1<<PINB1); //Dauer 2.3ms
+                       volatile double l=MAX44009getlux(max_adr);              
                        if (l<0.030) l=0.030; //Darf nicht 0 sein. minimum -35°C Sensor minimum 0.045
                        //double l=1000;
                        l=log(l)*10*16;
@@ -121,8 +123,9 @@ int main(void){
                        pack.temp=w;
                        //pack.temp++;
                        alarmflag=af;
-                       sei();                  
-                       gcontrol=0;
+                       sei();  
+                       EXTERN_SLEEP();         
+                       //PORTB&=~(1<<PINB1);
                }
 
                
index 0ad51b6..f0331cf 100644 (file)
@@ -60,6 +60,7 @@ Init_EEPROM_read:
 .macro COMMAND_TABLE
                rjmp h_readscratchpad
                rjmp h_writescratchpad
+               rjmp h_convert_run
 .endm
 
 #include "../common/OWRomFunctions.s"
@@ -70,6 +71,7 @@ Init_EEPROM_read:
 ; Ab hier Geraeteabhaenging
 #define OW_READ_SCRATCHPAD OW_FIRST_COMMAND+0
 #define OW_WRITE_SCRATCHPAD OW_FIRST_COMMAND+1
+#define OW_CONVERT_RUN  OW_FIRST_COMMAND+2
 
 
 ;---------------------------------------------------
@@ -138,8 +140,12 @@ hrc_set_convertT:
 ;      ldi r_rwbyte,1
 ;hrc_set_convertT_end:
 ;      sts alarmflag,r_rwbyte
-       rjmp handle_end_sleep
-
+       ldi r_mode,OW_CONVERT_RUN
+       ldi r_sendflag,3 ;set bit 0 and 1 for no zero polling
+h_convert_run:
+       ldi r_bcount,0
+       ldi r_rwbyte,0
+       rjmp handle_end_no_bcount       
 
 hrc_copy_scratchpad:
        ldi r_bytep,2
@@ -231,6 +237,5 @@ h_writescratchpad_all:
 
 
 
-
 #include "../common/OWPinInterrupt.s"
 .end
\ No newline at end of file
index d737c59..3cdc7ec 100644 (file)
@@ -44,7 +44,7 @@
 
 
 extern void OWINIT();
-
+extern void EXTERN_SLEEP();
 
 
 uint8_t owid1[8]={0x28, 0xA3, 0xD9, 0x84, 0x00, 0x16, 0x05, 0x18};/**/
@@ -139,6 +139,7 @@ int16_t sRH,sT;
 volatile double temperatureC,humidityRH;
 volatile double l;
 
+uint8_t max_adr=0;
 
 int main(void){
     PRR|=(1<<PRADC);  // adc for save Power
@@ -162,6 +163,7 @@ int main(void){
 
        MCUSR=0;
        USI_TWI_Master_Initialise();
+       if (checkMAX44009(0)) max_adr=0; else max_adr=1 ;
        SHT2x_SoftReset();
        SHT2x_ReadUserRegister(userRegister);
        //(userRegister & ~SHT2x_RES_MASK) | SHT2x_RES_10_13BIT;
@@ -176,8 +178,10 @@ int main(void){
        
        gcontrol=1;
        sei();
+       //DDRB|=(1<<PINB1);
     while(1)   {
                if (wdcounter>0) {
+                       //PORTB|=(1<<PINB1); //Dauer 440ms
                        SHT2x_MeasurePoll(HUMIDITY, &sRH);
                        // --- measure temperature with "Polling Mode" (no hold master) ---
                        SHT2x_MeasurePoll(TEMP, &sT);
@@ -187,11 +191,12 @@ int main(void){
                        double hhum=(1.0546-0.000216*temperatureC)*(humidityRH);
                        am2302_hum=0.318*hhum +76.0;
                        am2302_temp=temperatureC*25.6;
+                       //PORTB&=~(1<<PINB1);
                        wdcounter=0;
                }
        
                if (gcontrol==1) {
-                       l=MAX44009getlux(0);            
+                       l=MAX44009getlux(max_adr);              
                        if (l<0.030) l=0.030; //Darf nicht 0 sein. minimum -35°C Sensor minimum 0.045
                        //double l=1000;
                        l=log(l)*10*16;
@@ -205,7 +210,7 @@ int main(void){
                        //pack.temp++;
                        alarmflag=af;
                        sei();                  
-                       gcontrol=0;
+                       EXTERN_SLEEP();         
                }
                if ((gcontrol==2)||(gcontrol==3)) {
                        gcontrol=0;
@@ -227,7 +232,6 @@ int main(void){
                        MCUCR|=(1<<SE);
                        MCUCR&=~(1<<SM1);
                }
-               //MCUCR&=~(1<<ISC01);
                asm("SLEEP");
    }
 
index bf7146e..a653b5c 100644 (file)
@@ -33,7 +33,7 @@
 
 #define _CHANGEABLE_ID_
 #define _ZERO_POLLING_
-#define _DB_
+//#define _DB_
 
 #include "../common/OWConfig.s"
 #include "../common/OWCRC8.s"
@@ -69,6 +69,7 @@ Init_EEPROM_read:
 .macro COMMAND_TABLE
                rjmp h_readscratchpad1
                rjmp h_writescratchpad1
+               rjmp h_convert_run1
                rjmp h_readscratchpad_adr2
                rjmp h_readscratchpad2
                rjmp h_writescratchpad_adr2
@@ -83,10 +84,11 @@ Init_EEPROM_read:
 ; Ab hier Geraeteabhaenging
 #define OW_READ_SCRATCHPAD1 OW_FIRST_COMMAND+0
 #define OW_WRITE_SCRATCHPAD1 OW_FIRST_COMMAND+1
-#define OW_READ_SCRATCHPAD_ADR2 OW_FIRST_COMMAND+2
-#define OW_READ_SCRATCHPAD2 OW_FIRST_COMMAND+3
-#define OW_WRITE_SCRATCHPAD_ADR2 OW_FIRST_COMMAND+4
-#define OW_WRITE_SCRATCHPAD2 OW_FIRST_COMMAND+5
+#define OW_CONVERT_RUN1  OW_FIRST_COMMAND+2
+#define OW_READ_SCRATCHPAD_ADR2 OW_FIRST_COMMAND+3
+#define OW_READ_SCRATCHPAD2 OW_FIRST_COMMAND+4
+#define OW_WRITE_SCRATCHPAD_ADR2 OW_FIRST_COMMAND+5
+#define OW_WRITE_SCRATCHPAD2 OW_FIRST_COMMAND+6
 
 
 ;---------------------------------------------------
@@ -132,7 +134,12 @@ hrc_set_convertT1:
        ldi r_temp,1
        sts gcontrol,r_temp
 
-       rjmp handle_end_sleep
+       ldi r_mode,OW_CONVERT_RUN1
+       ldi r_sendflag,3 ;set bit 0 and 1 for no zero polling
+h_convert_run1:
+       ldi r_bcount,0
+       ldi r_rwbyte,0
+       rjmp handle_end_no_bcount       
 
 
 hrc_copy_scratchpad1:
index bd618b4..154b3e5 100644 (file)
 #include <avr/pgmspace.h>
 
 extern void OWINIT();
+extern void EXTERN_SLEEP();
 
-//const float k_rs[54] PROGMEM ={0.000000,24.125000,48.585366,72.731707,96.829268,121.097561,145.700000,170.600000,195.650000,220.625000,245.365854,269.853659,294.119048,318.195122,342.166667,366.000000,389.761905,413.428571,437.023810,460.558140,484.047619,507.511628,530.976190,554.418605,577.883721,601.395349,624.952381,648.571429,672.285714,696.073171,719.976190,744.000000,768.146341,792.439024,816.853659,841.414634,866.125000,890.975000,916.000000,941.179487,966.525000,992.025641,1017.717949,1043.589744,1069.657895,1095.945946,1122.432432,1149.184211,1176.189189,1203.472222,1231.083333,1259.000000,1287.285714,1315.941176};
-const float j_rs[70] PROGMEM ={0, 18.302913, 34.830476, 50.783019, 70.653704, 90.505455, 110.341818, 130.165455, 149.163636, 160.791071, 180.596364, 200.398214, 220.200000, 240.000000, 250.882883, 270.603636, 290.409091, 310.216364, 330.025455, 342.472727, 360.649091, 380.461818, 400.275000, 420.087273, 435.275676, 450.703636, 470.503636, 490.298214, 510.082456, 523.486726, 540.621053, 560.370175, 580.105172, 591.979487, 610.527119, 630.213559, 644.601653, 660.534426, 680.168852, 690.787097, 710.391935, 729.123810, 740.559375, 760.126562, 770.684615, 790.235385, 800.782812, 820.331250, 834.681250, 850.446032, 870.017460, 880.600000, 900.196774, 911.099187, 930.432787, 950.073333, 960.728333, 980.396667, 1000.078333, 1010.772881, 1030.475862, 1050.187931, 1065.717241, 1080.631034, 1100.358621, 1120.089655, 1131.840000,1150.556897, 1170.294737, 1190.035088};
+const float k_rs[54] PROGMEM ={0.000000,24.125000,48.585366,72.731707,96.829268,121.097561,145.700000,170.600000,195.650000,220.625000,245.365854,269.853659,294.119048,318.195122,342.166667,366.000000,389.761905,413.428571,437.023810,460.558140,484.047619,507.511628,530.976190,554.418605,577.883721,601.395349,624.952381,648.571429,672.285714,696.073171,719.976190,744.000000,768.146341,792.439024,816.853659,841.414634,866.125000,890.975000,916.000000,941.179487,966.525000,992.025641,1017.717949,1043.589744,1069.657895,1095.945946,1122.432432,1149.184211,1176.189189,1203.472222,1231.083333,1259.000000,1287.285714,1315.941176};
+//const float j_rs[70] PROGMEM ={0, 18.302913, 34.830476, 50.783019, 70.653704, 90.505455, 110.341818, 130.165455, 149.163636, 160.791071, 180.596364, 200.398214, 220.200000, 240.000000, 250.882883, 270.603636, 290.409091, 310.216364, 330.025455, 342.472727, 360.649091, 380.461818, 400.275000, 420.087273, 435.275676, 450.703636, 470.503636, 490.298214, 510.082456, 523.486726, 540.621053, 560.370175, 580.105172, 591.979487, 610.527119, 630.213559, 644.601653, 660.534426, 680.168852, 690.787097, 710.391935, 729.123810, 740.559375, 760.126562, 770.684615, 790.235385, 800.782812, 820.331250, 834.681250, 850.446032, 870.017460, 880.600000, 900.196774, 911.099187, 930.432787, 950.073333, 960.728333, 980.396667, 1000.078333, 1010.772881, 1030.475862, 1050.187931, 1065.717241, 1080.631034, 1100.358621, 1120.089655, 1131.840000,1150.556897, 1170.294737, 1190.035088};
        double gettemp_rs(double V) {
                uint8_t iv=(uint8_t)(V);
-               float t0=pgm_read_float(&(j_rs[iv]));
-               float t1=pgm_read_float(&(j_rs[iv+1]));
+               float t0=pgm_read_float(&(k_rs[iv]));
+               float t1=pgm_read_float(&(k_rs[iv+1]));
                return t0+(t1-t0)/1*(V-iv);
        }
 
 
 uint8_t owid[8]={0x28, 0xA2, 0xD9, 0x84, 0x00, 0x16, 0x02, 0xAC};/**/
-uint8_t config_info[16]={0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
+uint8_t config_info[16]={0x01,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
        
 #if (owid>128) 
 #error "Variable not correct"
@@ -259,7 +260,7 @@ int main(void){
                        for(uint8_t i=0;i<16;i++) {
                                sum+=ares[i];
                        }
-                       V=sum/20.0/1024.0*1.174*1000.0/16.0;
+                       V=sum/20.0/1024.0*1.12*1000.0/16.0;
                        //V=sum/20.0/1024.0*1.01*1000.0/16.0;
                        ktemp=gettemp_rs(V);
                        owm_reset();
@@ -287,7 +288,7 @@ int main(void){
                        pack.temp=htemp;
                        alarmflag=af;
                        sei();
-                       gcontrol=0;
+                       EXTERN_SLEEP();
                        PORTB&=~(1<<PORTB0);
                }
 
index 1a2f8e8..7163df4 100644 (file)
@@ -2,7 +2,7 @@
 <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
     <SchemaVersion>2.0</SchemaVersion>
-    <ProjectVersion>6.2</ProjectVersion>
+    <ProjectVersion>7.0</ProjectVersion>
     <ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName>
     <ProjectGuid>{7a5672fe-8226-4158-b931-e1f36b9a8858}</ProjectGuid>
     <avrdevice>ATtiny84A</avrdevice>
       <ToolName>Atmel-ICE</ToolName>
     </com_atmel_avrdbg_tool_atmelice>
     <avrtoolinterface>debugWIRE</avrtoolinterface>
+    <ExternalProgrammingToolCommand />
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
     <ToolchainSettings>
       <AvrGcc>
-        <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
-        <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
-        <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
-        <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
-        <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
-        <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
-        <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
-        <avrgcc.compiler.symbols.DefSymbols>
-          <ListValues>
-            <Value>NDEBUG</Value>
-          </ListValues>
-        </avrgcc.compiler.symbols.DefSymbols>
-        <avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
-        <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
-        <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
-        <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
-        <avrgcc.linker.libraries.Libraries>
-          <ListValues>
-            <Value>libm</Value>
-          </ListValues>
-        </avrgcc.linker.libraries.Libraries>
-      </AvrGcc>
+  <avrgcc.common.Device>-mmcu=attiny84a -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\gcc\dev\attiny84a"</avrgcc.common.Device>
+  <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
+  <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
+  <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
+  <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
+  <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
+  <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
+  <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
+  <avrgcc.compiler.symbols.DefSymbols>
+    <ListValues>
+      <Value>DEBUG</Value>
+    </ListValues>
+  </avrgcc.compiler.symbols.DefSymbols>
+  <avrgcc.compiler.directories.IncludePaths>
+    <ListValues>
+      <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\include</Value>
+    </ListValues>
+  </avrgcc.compiler.directories.IncludePaths>
+  <avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>
+  <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
+  <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
+  <avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
+  <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
+  <avrgcc.linker.libraries.Libraries>
+    <ListValues>
+      <Value>libm</Value>
+    </ListValues>
+  </avrgcc.linker.libraries.Libraries>
+  <avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
+</AvrGcc>
     </ToolchainSettings>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
     <ToolchainSettings>
       <AvrGcc>
-        <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
-        <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
-        <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
-        <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
-        <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
-        <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
-        <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
-        <avrgcc.compiler.symbols.DefSymbols>
-          <ListValues>
-            <Value>DEBUG</Value>
-          </ListValues>
-        </avrgcc.compiler.symbols.DefSymbols>
-        <avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>
-        <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
-        <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
-        <avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
-        <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
-        <avrgcc.linker.libraries.Libraries>
-          <ListValues>
-            <Value>libm</Value>
-          </ListValues>
-        </avrgcc.linker.libraries.Libraries>
-        <avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
-      </AvrGcc>
+  <avrgcc.common.Device>-mmcu=attiny84a -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\gcc\dev\attiny84a"</avrgcc.common.Device>
+  <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
+  <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
+  <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
+  <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
+  <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
+  <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
+  <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
+  <avrgcc.compiler.symbols.DefSymbols>
+    <ListValues>
+      <Value>DEBUG</Value>
+    </ListValues>
+  </avrgcc.compiler.symbols.DefSymbols>
+  <avrgcc.compiler.directories.IncludePaths>
+    <ListValues>
+      <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\include</Value>
+    </ListValues>
+  </avrgcc.compiler.directories.IncludePaths>
+  <avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>
+  <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
+  <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
+  <avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
+  <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
+  <avrgcc.linker.libraries.Libraries>
+    <ListValues>
+      <Value>libm</Value>
+    </ListValues>
+  </avrgcc.linker.libraries.Libraries>
+  <avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
+</AvrGcc>
     </ToolchainSettings>
   </PropertyGroup>
   <ItemGroup>
index 351b949..f9f2dc0 100644 (file)
@@ -32,6 +32,7 @@
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 
 #define _CHANGEABLE_ID_
+#define _ZERO_POLLING_
 
 #include "../common/OWConfig.s"
 #include "../common/OWCRC8.s"
@@ -59,6 +60,7 @@ Init_EEPROM_read:
 .macro COMMAND_TABLE
                rjmp h_readscratchpad
                rjmp h_writescratchpad
+               rjmp h_convert_run
 .endm
 
 #include "../common/OWRomFunctions.s"
@@ -69,6 +71,7 @@ Init_EEPROM_read:
 ; Ab hier Geraeteabhaenging
 #define OW_READ_SCRATCHPAD OW_FIRST_COMMAND+0
 #define OW_WRITE_SCRATCHPAD OW_FIRST_COMMAND+1
+#define OW_CONVERT_RUN  OW_FIRST_COMMAND+2
 
 
 ;---------------------------------------------------
@@ -137,7 +140,12 @@ hrc_set_convertT:
 ;      ldi r_rwbyte,1
 ;hrc_set_convertT_end:
 ;      sts alarmflag,r_rwbyte
-       rjmp handle_end_sleep
+       ldi r_mode,OW_CONVERT_RUN
+       ldi r_sendflag,3 ;set bit 0 and 1 for no zero polling
+h_convert_run:
+       ldi r_bcount,0
+       ldi r_rwbyte,0
+       rjmp handle_end_no_bcount       
 
 
 hrc_copy_scratchpad:
index 361cfa6..848bac3 100644 (file)
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
 # Atmel Studio Solution File, Format Version 11.00
 VisualStudioVersion = 14.0.23107.0
 MinimumVisualStudioVersion = 10.0.40219.1
-Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "DS2450", "DS2450.cproj", "{7A5672FE-8226-4158-B931-E1F36B9A8858}"
+Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "DS2450", "DS2450.cproj", "{DCE6C7E3-EE26-4D79-826B-08594B9AD897}"
 EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -11,10 +11,10 @@ Global
                Release|AVR = Release|AVR
        EndGlobalSection
        GlobalSection(ProjectConfigurationPlatforms) = postSolution
-               {7A5672FE-8226-4158-B931-E1F36B9A8858}.Debug|AVR.ActiveCfg = Debug|AVR
-               {7A5672FE-8226-4158-B931-E1F36B9A8858}.Debug|AVR.Build.0 = Debug|AVR
-               {7A5672FE-8226-4158-B931-E1F36B9A8858}.Release|AVR.ActiveCfg = Release|AVR
-               {7A5672FE-8226-4158-B931-E1F36B9A8858}.Release|AVR.Build.0 = Release|AVR
+               {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.ActiveCfg = Debug|AVR
+               {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.Build.0 = Debug|AVR
+               {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.ActiveCfg = Release|AVR
+               {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.Build.0 = Release|AVR
        EndGlobalSection
        GlobalSection(SolutionProperties) = preSolution
                HideSolutionNode = FALSE
index 4ca471f..3567ab2 100644 (file)
@@ -40,6 +40,7 @@
 #include <avr/pgmspace.h>
 
 extern void OWINIT();
+extern void EXTERN_SLEEP();
 
 uint8_t owid[8]={0x20, 0xA2, 0xD9, 0x84, 0x00, 0x16, 0x02, 0x5D};/**/
 uint8_t config_info[16]={0x06,0x09,0x06,0x09,0x06,0x09,0x06,0x09,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
@@ -129,18 +130,21 @@ int main(void){
        MCUCR &=~(1<<PUD); //All Pins Pullup...
        MCUCR |=(1<<BODS);
        PORTA&=~((1<<PINA0)|(1<<PINA1)|(1<<PINA2)|(1<<PINA3));
-       ADCSRA=(1<<ADEN)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0);
+       ADCSRA=(1<<ADEN)|(1<ADPS0)|(1<<ADPS2);
 
        
        
        gcontrol=1;
        ADCSRB|=(1<<ADLAR); 
        sei();
+       
+       //DDRB|=(1<<PINB1);
 
     while(1)   {
 
 
                if (gcontrol) {
+                       //PORTB|=(1<<PINB1);
                        uint8_t bb=1;
                        uint8_t bb1=1;
                        for(uint8_t i=0;i<4;i++){
@@ -155,7 +159,7 @@ int main(void){
                        //CHanel A
                        if (pack.convc1&1) {
                                if (pack.CSA2&0x01)     ADMUX=0; else ADMUX=0x80;
-                               _delay_ms(10);
+                               _delay_us(100);
                                ADCSRA|=(1<<ADSC);
                                while ((ADCSRA&(1<<ADSC)));
                                cli();pack.A=ADC;sei();
@@ -168,7 +172,7 @@ int main(void){
 
                        if (pack.convc1&2) {
                                if (pack.CSB2&0x01)     ADMUX=1; else ADMUX=0x81;
-                               _delay_ms(10);
+                               _delay_us(100);
                                ADCSRA|=(1<<ADSC);
                                while ((ADCSRA&(1<<ADSC)));
                                cli();pack.B=ADC;sei();
@@ -180,7 +184,7 @@ int main(void){
 
                        if (pack.convc1&4) {
                                if (pack.CSC2&0x01)     ADMUX=2; else ADMUX=0x82;
-                               _delay_ms(10);
+                               _delay_us(100);
                                ADCSRA|=(1<<ADSC);
                                while ((ADCSRA&(1<<ADSC)));
                                cli();pack.C=ADC;sei();
@@ -191,7 +195,7 @@ int main(void){
                        } 
                        if (pack.convc1&8) {
                                if (pack.CSD2&0x01)     ADMUX=3; else ADMUX=0x83;
-                               _delay_ms(10);
+                               _delay_us(100);
                                ADCSRA|=(1<<ADSC);
                                while ((ADCSRA&(1<<ADSC)));
                                cli();pack.D=ADC;sei();
@@ -201,7 +205,8 @@ int main(void){
                                        if (pack.bytes[1]<pack.LD) {alarmflag=1;pack.CSD2|=0x10;}
                        }
                        
-                       gcontrol=0;
+                       EXTERN_SLEEP();
+                       //PORTB&=~(1<<PINB1);
                }
 
                uint8_t bb=1;
index 9e51646..bdf657b 100644 (file)
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
   <PropertyGroup>
     <SchemaVersion>2.0</SchemaVersion>
     <ProjectVersion>7.0</ProjectVersion>
     <ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName>
-    <ProjectGuid>{7a5672fe-8226-4158-b931-e1f36b9a8858}</ProjectGuid>
+    <ProjectGuid>dce6c7e3-ee26-4d79-826b-08594b9ad897</ProjectGuid>
     <avrdevice>ATtiny84A</avrdevice>
     <avrdeviceseries>none</avrdeviceseries>
     <OutputType>Executable</OutputType>
     <OverrideVtorValue>exception_table</OverrideVtorValue>
     <BootSegment>2</BootSegment>
     <eraseonlaunchrule>1</eraseonlaunchrule>
+    <ExternalProgrammingToolCommand />
     <AsfFrameworkConfig>
       <framework-data xmlns="">
-        <options />
-        <configurations />
-        <files />
-        <documentation help="" />
-        <offline-documentation help="" />
-        <dependencies>
-          <content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.19.0" />
-        </dependencies>
-      </framework-data>
+  <options />
+  <configurations />
+  <files />
+  <documentation help="" />
+  <offline-documentation help="" />
+  <dependencies>
+    <content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.27.3" />
+  </dependencies>
+</framework-data>
     </AsfFrameworkConfig>
-    <avrtool>com.atmel.avrdbg.tool.avrdragon</avrtool>
+    <avrtool>com.atmel.avrdbg.tool.atmelice</avrtool>
+    <avrtoolserialnumber>J41800000779</avrtoolserialnumber>
+    <avrdeviceexpectedsignature>0x1E930C</avrdeviceexpectedsignature>
     <com_atmel_avrdbg_tool_atmelice>
       <ToolOptions>
         <InterfaceProperties>
       <ToolName>Atmel-ICE</ToolName>
     </com_atmel_avrdbg_tool_atmelice>
     <avrtoolinterface>debugWIRE</avrtoolinterface>
-    <ExternalProgrammingToolCommand />
-    <avrtoolserialnumber>00A20004766E</avrtoolserialnumber>
-    <avrdeviceexpectedsignature>0x1E930C</avrdeviceexpectedsignature>
-    <com_atmel_avrdbg_tool_avrdragon>
-      <ToolOptions>
-        <InterfaceProperties>
-        </InterfaceProperties>
-        <InterfaceName>debugWIRE</InterfaceName>
-      </ToolOptions>
-      <ToolType>com.atmel.avrdbg.tool.avrdragon</ToolType>
-      <ToolNumber>00A20004766E</ToolNumber>
-      <ToolName>AVR Dragon</ToolName>
-    </com_atmel_avrdbg_tool_avrdragon>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
     <ToolchainSettings>
@@ -77,7 +67,7 @@
   <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
   <avrgcc.compiler.symbols.DefSymbols>
     <ListValues>
-      <Value>DEBUG</Value>
+      <Value>NDEBUG</Value>
     </ListValues>
   </avrgcc.compiler.symbols.DefSymbols>
   <avrgcc.compiler.directories.IncludePaths>
       <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\include</Value>
     </ListValues>
   </avrgcc.compiler.directories.IncludePaths>
-  <avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>
+  <avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
   <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
   <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
-  <avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
   <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
   <avrgcc.linker.libraries.Libraries>
     <ListValues>
       <Value>libm</Value>
     </ListValues>
   </avrgcc.linker.libraries.Libraries>
-  <avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
 </AvrGcc>
     </ToolchainSettings>
   </PropertyGroup>
index 4fba4bc..aec56b7 100644 (file)
@@ -32,6 +32,7 @@
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 
 #define _CHANGEABLE_ID_
+#define _ZERO_POLLING_
 
 #include "../common/OWConfig.s"
 #include "../common/OWCRC16.s"
@@ -59,6 +60,7 @@
                rjmp h_convert
                rjmp h_convertcrc1
                rjmp h_convertcrc2
+               rjmp h_convert_conv
 .endm
 
 #include "../common/OWRomFunctions.s"
@@ -79,7 +81,7 @@
 #define OW_CONVERT OW_FIRST_COMMAND+9
 #define OW_CONVERT_CRC1 OW_FIRST_COMMAND+10
 #define OW_CONVERT_CRC2 OW_FIRST_COMMAND+11
-
+#define OW_CONVERT_CONV OW_FIRST_COMMAND+12
 
 ;---------------------------------------------------
 ;      READ COMMAND and start operation
@@ -230,9 +232,13 @@ h_convertcrc2:
        ldi r_temp,1
        sts gcontrol,r_temp
        ;ldi r_bcount,1
-       ldi r_mode,OW_SLEEP
-       clr r_sendflag
-       rjmp handle_end
+       ldi r_mode,OW_CONVERT_CONV
+       ;clr r_sendflag
+       ldi r_sendflag,3 ;set bit 0 and 1 for no zero polling
+h_convert_conv:
+       ldi r_bcount,0
+       ldi r_rwbyte,0
+       rjmp handle_end_no_bcount       
 
 
 
index 8ec682d..426098e 100644 (file)
 #include "USI_TWI_Master.h"
 #include "MAX44009.h"
 
+uint8_t checkMAX44009(uint8_t nr) {
+       volatile uint8_t b1;
+       nr=(nr<<1)&0x02f;
+       
+       I2c_StartCondition();
+       I2c_WriteByte(0b10010100|nr);
+       I2c_WriteByte(0x03);
+       I2c_StartCondition();
+       I2c_WriteByte (0b10010101|nr);
+       b1 =I2c_ReadByte(NO_ACK);
+       I2c_StopCondition();
+       return b1!=0xFF;
+       
+}
+
+
 double MAX44009getlux(uint8_t nr)  {
        volatile uint8_t b1,b2;
        nr=(nr<<1)&0x02f;
index 53e234c..366a236 100644 (file)
@@ -33,6 +33,6 @@
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 double MAX44009getlux(uint8_t nr);
-
+uint8_t checkMAX44009(uint8_t nr);
 
 #endif
\ No newline at end of file
index 157faca..effe916 100644 (file)
@@ -128,7 +128,7 @@ uint8_t SHT2x_MeasurePoll(etSHT2xMeasureType eSHT2xMeasureType, int16_t *pMeasur
        //-- poll every 10ms for measurement ready. Timeout after 20 retries (200ms)--
        do
        { I2c_StartCondition();
-               _delay_ms(1000); //delay 10ms
+               _delay_ms(200); //delay 10ms
                if(i++ >= 20) break;
        } while(I2c_WriteByte (I2C_ADR_R) == ACK_ERROR);
        if (i>=20) error |= TIME_OUT_ERROR;
index 00feec0..72aef80 100644 (file)
@@ -115,12 +115,15 @@ iend:
        rjmp zeropolling
        rjmp no_zerromaker
 zeropolling:
+       sbrc r_sendflag,1  ; sendflag bit 1 -> switch off zeropolling in software eg for asking convert is donne (DS2450, DS18B20 and others)
+       rjmp no_zerromaker
+zeropolling_h_loop:
        sbic OW_PIN,OW_PINN ;warten bis leitung wieder h 
        rjmp zeropolling_wait  ;leitung ist low ->Schleie
        in r_temp,TCNT_REG
        cpi r_temp,(~OWT_MIN_RESET)+OWT_ZP_WAIT_LOW_TO;aller zwei us zaehlt der timer
        brsh  zeropolling_timeout ;Timeout Reset?
-       rjmp zeropolling
+       rjmp zeropolling_h_loop
 zeropolling_wait:
        sbis OW_PIN,OW_PINN ;warten bis leitung wieder l
        rjmp zeropolling_low_imp ;Leitung ist low raus aus schleufe
index 0b1488d..9887940 100644 (file)
@@ -471,3 +471,18 @@ owinit_botest_end:
        sts alarmflag,r_temp
        RESETZEROMARKER
        ret
+
+
+.global EXTERN_SLEEP
+EXTERN_SLEEP:
+       cli
+       push r_temp
+       ldi r_temp,0
+       sts mode,r_temp ;SLEEP
+       sts gcontrol,r_temp
+       sts sendflag,r_temp
+       sts bcount,r_temp
+       RESETZEROMARKER
+       pop r_temp
+       sei
+       ret
\ No newline at end of file
index 59b3d40..adc571c 100644 (file)
@@ -641,3 +641,17 @@ owinit_cpconfig2:
        sts alarmflag,r_temp
        RESETZEROMARKER
        ret
+
+.global EXTERN_SLEEP
+EXTERN_SLEEP:
+       cli
+       push r_temp
+       ldi r_temp,0
+       sts mode,r_temp ;SLEEP
+       sts gcontrol,r_temp
+       sts sendflag,r_temp
+       sts bcount,r_temp
+       RESETZEROMARKER
+       pop r_temp
+       sei
+       ret
\ No newline at end of file
index bf1b335..a44d5aa 100644 (file)
@@ -1,2 +1,2 @@
 avrdude -c usbasp -p t84 -U lfuse:w:0xE2:m -U hfuse:w:0xDF:m -U efuse:w:0xFE:m
-avrdude -c usbasp -p t84 -e -U flash:w:"../programmer/Debug/programmer.hex"
+avrdude -c usbasp -p t84 -e -U flash:w:"../programmer/Release/programmer.hex"