Rename Files of different Devices
authorTobias <tm@tm3d.de>
Thu, 24 Sep 2015 16:34:43 +0000 (18:34 +0200)
committerTobias <tm@tm3d.de>
Thu, 24 Sep 2015 16:34:43 +0000 (18:34 +0200)
Include Config Bytes with ow command 0x85 to get more information of an device (not finished, part 1)

36 files changed:
DS18B20_BMP280/DS18B20_BMP280.atsln [new file with mode: 0644]
DS18B20_BMP280/DS18B20_BMP280.c [new file with mode: 0644]
DS18B20_BMP280/DS18B20_BMP280.cproj [new file with mode: 0644]
DS18B20_BMP280/OWDS18B20.S [new file with mode: 0644]
DS18B20_DS2438/DS18B20_DS2438.c
DS18B20_DS2438/OWDS18B20_DS2438.S
DS18B20_MAX44009/DS18B20.atsln [deleted file]
DS18B20_MAX44009/DS18B20.c [deleted file]
DS18B20_MAX44009/DS18B20.cproj [deleted file]
DS18B20_MAX44009/DS18B20_MAX44009.atsln [new file with mode: 0644]
DS18B20_MAX44009/DS18B20_MAX44009.c [new file with mode: 0644]
DS18B20_MAX44009/DS18B20_MAX44009.cproj [new file with mode: 0644]
DS18B20_MAX44009/OWDS18B20.S
DS18B20_Thermocouble/DS18B20.atsln [deleted file]
DS18B20_Thermocouble/DS18B20.c [deleted file]
DS18B20_Thermocouble/DS18B20.cproj [deleted file]
DS18B20_Thermocouble/DS18B20_TC.atsln [new file with mode: 0644]
DS18B20_Thermocouble/DS18B20_TC.c [new file with mode: 0644]
DS18B20_Thermocouble/DS18B20_TC.cproj [new file with mode: 0644]
DS18B20_Thermocouble/OWDS18B20.S
DS2423/DS2423.c
DS2423/OWDS2423.S
DS2438_DHT22/DS2438_DHT22.atsln
DS2438_DHT22/DS2438_DHT22.c
DS2438_DHT22/DS2438_DHT22.cproj
DS2438_DHT22/OWDS2438.S
DS2450/DS2450.c
DS2450/OWDS2450.S
common/OWCRC16.s
common/OWCRC8.s
common/OWConfig.s
common/OWPinInterrupt.s
common/OWRomFunctions.s
common/OWRomFunctionsDual.s
common/OWSet_ATTINYX5.s
vergleiche liste.xlsx [new file with mode: 0644]

diff --git a/DS18B20_BMP280/DS18B20_BMP280.atsln b/DS18B20_BMP280/DS18B20_BMP280.atsln
new file mode 100644 (file)
index 0000000..764eb5c
--- /dev/null
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Atmel Studio Solution File, Format Version 11.00
+Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "DS18B20_BMP280", "DS18B20_BMP280.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/DS18B20_BMP280.c b/DS18B20_BMP280/DS18B20_BMP280.c
new file mode 100644 (file)
index 0000000..ca6333b
--- /dev/null
@@ -0,0 +1,149 @@
+
+// Copyright (c) 2015, Tobias Mueller tm(at)tm3d.de
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the
+//    distribution.
+//  * All advertising materials mentioning features or use of this
+//    software must display the following acknowledgement: This product
+//    includes software developed by tm3d.de and its contributors.
+//  * Neither the name of tm3d.de nor the names of its contributors may
+//    be used to endorse or promote products derived from this software
+//    without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#define F_CPU 8000000UL
+#include <avr/io.h>
+#include <avr/interrupt.h>
+#include <util/delay.h>
+#include <avr/wdt.h>
+#include <avr/sleep.h>
+#include <avr/pgmspace.h>
+#include "../common/I2C/USI_TWI_Master.h"
+#include "../common/I2C/BMP280.h"
+
+
+extern void OWINIT();
+
+
+
+
+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};
+       
+#if (owid>128) 
+#error "Variable not correct"
+#endif
+
+extern uint8_t mode;
+extern uint8_t gcontrol;
+extern uint8_t reset_indicator;
+extern uint8_t alarmflag;
+
+
+
+
+typedef union {
+       volatile uint8_t bytes[8];
+       struct {
+               uint16_t temp;  //0
+               uint8_t TH;  //2
+               uint8_t TL;  //3
+               uint8_t config;  //4
+               uint8_t rrFF; //5
+               uint8_t rr00; //6
+               uint8_t rr10; //7
+       };
+} pack_t;
+volatile pack_t pack;
+
+
+
+
+
+
+
+
+int main(void){
+    PRR|=(1<<PRADC);  // adc for save Power
+       pack.temp=0x0550;
+       pack.config=0x7F;
+       pack.TH=75;
+       pack.TL=70;
+       pack.rrFF=0xFF;
+       pack.rr00=0;
+       pack.rr10=0x10;
+       PORTA=0xFF;
+       PORTB=0xFF;
+       OWINIT();
+
+       MCUCR &=~(1<<PUD); //All Pins Pullup...
+       MCUCR |=(1<<BODS);
+
+       MCUSR=0;
+       USI_TWI_Master_Initialise();
+       bmp280Init();
+       
+       gcontrol=1;
+       sei();
+    while(1)   {
+       
+               if (gcontrol) {
+                       uint32_t P;
+                       int32_t t;
+                       bmp280ConvertInt(&t,&P,1);
+                       P=P*16;
+                       P=P/1000;
+                       uint16_t w=P;
+                       uint8_t t8=w>>4;
+                       uint8_t af=0;
+                       if (t8>pack.TH) af=1;
+                       if (t8<=pack.TL) af=1; 
+                       cli();
+                       pack.temp=w;
+                       //pack.temp++;
+                       alarmflag=af;
+                       sei();                  
+                       gcontrol=0;
+               }
+
+               
+#if  defined(__AVR_ATtiny25__)||defined(__AVR_ATtiny45__)  || defined(__AVR_ATtiny85__)
+                       if (((TIMSK & (1<<TOIE0))==0)&& (mode==0))
+#endif                 
+#if  defined(__AVR_ATtiny24__)||defined(__AVR_ATtiny44__)  || defined(__AVR_ATtiny84__) ||defined(__AVR_ATtiny24A__)||defined(__AVR_ATtiny44A__)  || defined(__AVR_ATtiny84A__)
+                       if (((TIMSK0 & (1<<TOIE0))==0)&& (mode==0))
+#endif
+                         {
+
+                       MCUCR|=(1<<SE)|(1<<SM1);
+                       MCUCR&=~(1<<ISC01);
+               } else {
+                       MCUCR|=(1<<SE);
+                       MCUCR&=~(1<<SM1);
+               }
+               //MCUCR&=~(1<<ISC01);
+               asm("SLEEP");
+   }
+
+
+}
\ No newline at end of file
diff --git a/DS18B20_BMP280/DS18B20_BMP280.cproj b/DS18B20_BMP280/DS18B20_BMP280.cproj
new file mode 100644 (file)
index 0000000..d5732dc
--- /dev/null
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectVersion>6.2</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_BMP280</AssemblyName>
+    <Name>DS18B20_BMP280</Name>
+    <RootNamespace>DS18B20_BMP280</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>
+  </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>
+    </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>
+    </ToolchainSettings>
+  </PropertyGroup>
+  <ItemGroup>
+    <Compile Include="..\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_BMP280.c">
+      <SubType>compile</SubType>
+    </Compile>
+    <Compile Include="OWDS18B20.S">
+      <SubType>compile</SubType>
+    </Compile>
+  </ItemGroup>
+  <Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
+</Project>
\ No newline at end of file
diff --git a/DS18B20_BMP280/OWDS18B20.S b/DS18B20_BMP280/OWDS18B20.S
new file mode 100644 (file)
index 0000000..0ad51b6
--- /dev/null
@@ -0,0 +1,236 @@
+
+// Copyright (c) 2015, Tobias Mueller tm(at)tm3d.de
+// All rights reserved. 
+// 
+// Redistribution and use in source and binary forms, with or without 
+// modification, are permitted provided that the following conditions are 
+// met: 
+// 
+//  * Redistributions of source code must retain the above copyright 
+//    notice, this list of conditions and the following disclaimer. 
+//  * Redistributions in binary form must reproduce the above copyright 
+//    notice, this list of conditions and the following disclaimer in the 
+//    documentation and/or other materials provided with the 
+//    distribution. 
+//  * All advertising materials mentioning features or use of this 
+//    software must display the following acknowledgement: This product 
+//    includes software developed by tm3d.de and its contributors. 
+//  * Neither the name of tm3d.de nor the names of its contributors may 
+//    be used to endorse or promote products derived from this software 
+//    without specific prior written permission. 
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
+// 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"
+
+.extern pack,8
+
+//.extern  am2302_temp,2
+
+
+
+.macro CHIP_INIT       
+Init_EEPROM_read:
+       sbic _SFR_IO_ADDR(EECR), EEPE
+       rjmp Init_EEPROM_read
+       ldi r_temp,0
+       out _SFR_IO_ADDR(EEARH), r_temp
+       ldi r_temp,2
+       out _SFR_IO_ADDR(EEARL), r_temp
+       sbi _SFR_IO_ADDR(EECR), EERE
+       in r_temp,_SFR_IO_ADDR(EEDR)
+       sbrs r_temp,7
+       rcall hrc_recall_eeprom_func
+.endm
+
+.macro COMMAND_TABLE
+               rjmp h_readscratchpad
+               rjmp h_writescratchpad
+.endm
+
+#include "../common/OWRomFunctions.s"
+#include "../common/OWTimerInterrupt.s"
+
+
+
+; Ab hier Geraeteabhaenging
+#define OW_READ_SCRATCHPAD OW_FIRST_COMMAND+0
+#define OW_WRITE_SCRATCHPAD OW_FIRST_COMMAND+1
+
+
+;---------------------------------------------------
+;      READ COMMAND and start operation
+;---------------------------------------------------
+
+
+h_readcommand:
+       clr r_bytep
+#ifndef _DIS_FLASH_
+       FLASH_COMMANDS ; muss zu erst sein....
+#endif
+       cjmp 0xBE,hrc_set_readscratchpad
+       cjmp 0x4E,hrc_set_writescratchpad
+       cjmp 0x44,hrc_set_convertT
+       cjmp 0x48,hrc_copy_scratchpad
+       cjmp 0xB8,hrc_recall_eeprom
+       FW_CONFIG_INFO
+#ifdef _CHANGEABLE_ID_
+       CHANGE_ID_COMMANDS
+#endif
+       //ldi r_mode,OW_SLEEP
+       rjmp handle_end_sleep
+
+hrc_set_readscratchpad:
+       ldi r_mode,OW_READ_SCRATCHPAD
+       ldi r_sendflag,1
+       CRCInit2
+       rjmp h_readscratchpad
+
+hrc_set_writescratchpad:
+       ldi r_mode,OW_WRITE_SCRATCHPAD
+       ldi r_bytep,2 ;start to write in 2
+       rjmp handle_end
+
+hrc_recall_eeprom:
+       rcall hrc_recall_eeprom_func
+       rjmp handle_end
+
+
+
+hrc_set_convertT:
+       ldi r_temp,1
+       sts gcontrol,r_temp
+       ;lds temp,am2302_temp
+       //sts pack+1,temp
+       ;lds temp,am2302_temp+1
+       //sts pack+2,temp
+;      ldi r_rwbyte,0
+;      lds r_temp,pack
+;      swap r_temp
+;      andi r_temp,0x0F
+;      lds r_temp2,pack+1
+;      swap r_temp2
+;      andi r_temp2,0xF0
+;      or r_temp,r_temp2
+;      lds r_temp2,pack+2
+;      cp r_temp,r_temp2  ;higher than or equal to TH
+;      brge hrc_set_convertT_set_arlarm
+;      lds r_temp2,pack+3 
+;      cp r_temp,r_temp2 ;lower than or equal to TL
+;      brlt hrc_set_convertT_set_arlarm
+;      breq hrc_set_convertT_set_arlarm
+;      rjmp hrc_set_convertT_end
+;hrc_set_convertT_set_arlarm:
+;      ldi r_rwbyte,1
+;hrc_set_convertT_end:
+;      sts alarmflag,r_rwbyte
+       rjmp handle_end_sleep
+
+
+hrc_copy_scratchpad:
+       ldi r_bytep,2
+       configZ pack,r_bytep
+       clr r_bytep
+hrc_copy_scratchpad_EEPROM_write:
+       sbic _SFR_IO_ADDR(EECR), EEPE   
+       rjmp hrc_copy_scratchpad_EEPROM_write
+       ldi r_temp, (0<<EEPM1)|(0<<EEPM0)
+       out _SFR_IO_ADDR(EECR), r_temp
+       ldi r_temp,0
+       out _SFR_IO_ADDR(EEARH),r_temp
+       out _SFR_IO_ADDR(EEARL), r_bytep
+       ld  r_rwbyte,Z+
+       out _SFR_IO_ADDR(EEDR), r_rwbyte
+       sbi _SFR_IO_ADDR(EECR), EEMPE
+       sbi _SFR_IO_ADDR(EECR), EEPE
+       inc r_bytep
+       cpi r_bytep,3
+       brne hrc_copy_scratchpad_EEPROM_write
+       rjmp handle_end
+
+
+hrc_recall_eeprom_func:
+       ldi r_bytep,2
+       configZ pack,r_bytep
+       clr r_bytep
+       clr r_temp
+hrc_recall_eeprom_EEPROM_read:
+       sbic _SFR_IO_ADDR(EECR), EEPE
+       rjmp hrc_recall_eeprom_EEPROM_read
+       out _SFR_IO_ADDR(EEARH), r_temp
+       out _SFR_IO_ADDR(EEARL), r_bytep
+       sbi _SFR_IO_ADDR(EECR), EERE
+       in r_rwbyte,_SFR_IO_ADDR(EEDR)
+       st Z+,r_rwbyte
+       inc r_bytep
+       cpi r_bytep,3
+       brne hrc_recall_eeprom_EEPROM_read
+       ret
+
+
+
+
+
+
+;---------------------------------------------------
+;   READ SCRATCHPAD
+;---------------------------------------------------
+
+h_readscratchpad:
+       cpi  r_bytep,8
+       breq h_readscratchpad_crc
+       cpi  r_bytep,9
+       breq h_readscratchpad_all
+       configZ pack,r_bytep
+       ld   r_rwbyte,Z
+       rjmp h_readscratchpad_endc
+h_readscratchpad_crc:
+       lds  r_rwbyte,crc
+h_readscratchpad_endc:
+       inc  r_bytep
+       ldi  r_bcount,1 
+       rjmp handle_end
+h_readscratchpad_all:
+       rjmp handle_end_sleep
+
+
+
+
+
+;---------------------------------------------------
+;   WRITE SCRATCHPAD
+;---------------------------------------------------
+
+h_writescratchpad:
+       configZ pack,r_bytep
+       inc  r_bytep
+       cpi  r_bytep,5
+       breq h_writescratchpad_all
+       st   Z,r_rwbyte
+       rjmp handle_end
+h_writescratchpad_all:
+       ori r_rwbyte,0x1F ; Alle unteren Bits sind immer 1
+       st   Z,r_rwbyte
+       rjmp handle_end_sleep
+
+
+
+
+
+
+#include "../common/OWPinInterrupt.s"
+.end
\ No newline at end of file
index e668064..4bef0d2 100644 (file)
@@ -49,6 +49,8 @@ extern void OWINIT();
 
 uint8_t owid1[8]={0x28, 0xA3, 0xD9, 0x84, 0x00, 0x16, 0x05, 0x18};/**/
 uint8_t owid2[8]={0x26, 0xA2, 0xD9, 0x84, 0x00, 0x00, 0x01, 0x77};/**/
+uint8_t config_info1[16]={0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00};    
+uint8_t config_info2[16]={0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00};    
        
 #if (owid>128) 
 #error "Variable not correct"
index d0503b7..bf7146e 100644 (file)
@@ -104,6 +104,7 @@ h_readcommand1:
        cjmp 0x44,hrc_set_convertT1
        cjmp 0x48,hrc_copy_scratchpad1
        cjmp 0xB8,hrc_recall_eeprom1
+       FW_CONFIG_INFO1
 #ifdef _CHANGEABLE_ID_
        CHANGE_ID_COMMANDS
 #endif
@@ -239,6 +240,7 @@ h_readcommand2:
        cset 0x4E,OW_WRITE_SCRATCHPAD_ADR2
        cjmp 0x44,hrc_set_convertT2
        cjmp 0xB4,hrc_set_convertV2
+       FW_CONFIG_INFO2
 #ifdef _CHANGEABLE_ID_
        CHANGE_ID_COMMANDS
 #endif
diff --git a/DS18B20_MAX44009/DS18B20.atsln b/DS18B20_MAX44009/DS18B20.atsln
deleted file mode 100644 (file)
index 558a11d..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Atmel Studio Solution File, Format Version 11.00
-Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "DS18B20", "DS18B20.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_MAX44009/DS18B20.c b/DS18B20_MAX44009/DS18B20.c
deleted file mode 100644 (file)
index 12e682b..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-
-// Copyright (c) 2015, Tobias Mueller tm(at)tm3d.de
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the
-//    distribution.
-//  * All advertising materials mentioning features or use of this
-//    software must display the following acknowledgement: This product
-//    includes software developed by tm3d.de and its contributors.
-//  * Neither the name of tm3d.de nor the names of its contributors may
-//    be used to endorse or promote products derived from this software
-//    without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#define F_CPU 8000000UL
-#include <avr/io.h>
-#include <avr/interrupt.h>
-#include <util/delay.h>
-#include <avr/wdt.h>
-#include <avr/sleep.h>
-#include <avr/pgmspace.h>
-#include "../common/I2C/USI_TWI_Master.h"
-#include "../common/I2C/MAX44009.h"
-
-
-extern void OWINIT();
-
-
-
-
-uint8_t owid[8]={0x28, 0xA2, 0xD9, 0x84, 0x00, 0x16, 0x77, 0x6B};/**/
-       
-#if (owid>128) 
-#error "Variable not correct"
-#endif
-
-extern uint8_t mode;
-extern uint8_t gcontrol;
-extern uint8_t reset_indicator;
-extern uint8_t alarmflag;
-
-
-
-
-typedef union {
-       volatile uint8_t bytes[8];
-       struct {
-               uint16_t temp;  //0
-               uint8_t TH;  //2
-               uint8_t TL;  //3
-               uint8_t config;  //4
-               uint8_t rrFF; //5
-               uint8_t rr00; //6
-               uint8_t rr10; //7
-       };
-} pack_t;
-volatile pack_t pack;
-
-
-
-
-
-
-
-
-int main(void){
-    PRR|=(1<<PRADC);  // adc for save Power
-       pack.temp=0x0550;
-       pack.config=0x7F;
-       pack.TH=75;
-       pack.TL=70;
-       pack.rrFF=0xFF;
-       pack.rr00=0;
-       pack.rr10=0x10;
-       PORTA=0xFF;
-       PORTB=0xFF;
-       OWINIT();
-
-       MCUCR &=~(1<<PUD); //All Pins Pullup...
-       MCUCR |=(1<<BODS);
-
-       MCUSR=0;
-       USI_TWI_Master_Initialise();
-       
-       
-       gcontrol=1;
-       sei();
-    while(1)   {
-       
-               if (gcontrol) {
-                       volatile double l=MAX44009getlux();             
-                       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;
-                       uint16_t w=l;
-                       uint8_t t8=w>>4;
-                       uint8_t af=0;
-                       if (t8>pack.TH) af=1;
-                       if (t8<=pack.TL) af=1; 
-                       cli();
-                       pack.temp=w;
-                       //pack.temp++;
-                       alarmflag=af;
-                       sei();                  
-                       gcontrol=0;
-               }
-
-               
-#if  defined(__AVR_ATtiny25__)||defined(__AVR_ATtiny45__)  || defined(__AVR_ATtiny85__)
-                       if (((TIMSK & (1<<TOIE0))==0)&& (mode==0))
-#endif                 
-#if  defined(__AVR_ATtiny24__)||defined(__AVR_ATtiny44__)  || defined(__AVR_ATtiny84__) ||defined(__AVR_ATtiny24A__)||defined(__AVR_ATtiny44A__)  || defined(__AVR_ATtiny84A__)
-                       if (((TIMSK0 & (1<<TOIE0))==0)&& (mode==0))
-#endif
-                         {
-
-                       MCUCR|=(1<<SE)|(1<<SM1);
-                       MCUCR&=~(1<<ISC01);
-               } else {
-                       MCUCR|=(1<<SE);
-                       MCUCR&=~(1<<SM1);
-               }
-               //MCUCR&=~(1<<ISC01);
-               asm("SLEEP");
-   }
-
-
-}
\ No newline at end of file
diff --git a/DS18B20_MAX44009/DS18B20.cproj b/DS18B20_MAX44009/DS18B20.cproj
deleted file mode 100644 (file)
index 2220867..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectVersion>6.2</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</AssemblyName>
-    <Name>DS18B20</Name>
-    <RootNamespace>DS18B20</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>
-  </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>
-    </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>
-    </ToolchainSettings>
-  </PropertyGroup>
-  <ItemGroup>
-    <Compile Include="D:\oc\dev\owSlave2\common\I2C\MAX44009.c">
-      <SubType>compile</SubType>
-      <Link>MAX44009.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.c">
-      <SubType>compile</SubType>
-    </Compile>
-    <Compile Include="OWDS18B20.S">
-      <SubType>compile</SubType>
-    </Compile>
-  </ItemGroup>
-  <Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
-</Project>
\ No newline at end of file
diff --git a/DS18B20_MAX44009/DS18B20_MAX44009.atsln b/DS18B20_MAX44009/DS18B20_MAX44009.atsln
new file mode 100644 (file)
index 0000000..bce8cd3
--- /dev/null
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Atmel Studio Solution File, Format Version 11.00
+Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "DS18B20_MAX44009", "DS18B20_MAX44009.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_MAX44009/DS18B20_MAX44009.c b/DS18B20_MAX44009/DS18B20_MAX44009.c
new file mode 100644 (file)
index 0000000..359d95e
--- /dev/null
@@ -0,0 +1,148 @@
+
+// Copyright (c) 2015, Tobias Mueller tm(at)tm3d.de
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the
+//    distribution.
+//  * All advertising materials mentioning features or use of this
+//    software must display the following acknowledgement: This product
+//    includes software developed by tm3d.de and its contributors.
+//  * Neither the name of tm3d.de nor the names of its contributors may
+//    be used to endorse or promote products derived from this software
+//    without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#define F_CPU 8000000UL
+#include <avr/io.h>
+#include <avr/interrupt.h>
+#include <util/delay.h>
+#include <avr/wdt.h>
+#include <avr/sleep.h>
+#include <avr/pgmspace.h>
+#include "../common/I2C/USI_TWI_Master.h"
+#include "../common/I2C/MAX44009.h"
+
+
+extern void OWINIT();
+
+
+
+
+uint8_t owid[8]={0x28, 0xA2, 0xD9, 0x84, 0x00, 0x16, 0x77, 0x6B};/**/
+uint8_t config_info[16]={0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
+       
+#if (owid>128) 
+#error "Variable not correct"
+#endif
+
+extern uint8_t mode;
+extern uint8_t gcontrol;
+extern uint8_t reset_indicator;
+extern uint8_t alarmflag;
+
+
+
+
+typedef union {
+       volatile uint8_t bytes[8];
+       struct {
+               uint16_t temp;  //0
+               uint8_t TH;  //2
+               uint8_t TL;  //3
+               uint8_t config;  //4
+               uint8_t rrFF; //5
+               uint8_t rr00; //6
+               uint8_t rr10; //7
+       };
+} pack_t;
+volatile pack_t pack;
+
+
+
+
+
+
+
+
+int main(void){
+    PRR|=(1<<PRADC);  // adc for save Power
+       pack.temp=0x0550;
+       pack.config=0x7F;
+       pack.TH=75;
+       pack.TL=70;
+       pack.rrFF=0xFF;
+       pack.rr00=0;
+       pack.rr10=0x10;
+       PORTA=0xFF;
+       PORTB=0xFF;
+       OWINIT();
+
+       MCUCR &=~(1<<PUD); //All Pins Pullup...
+       MCUCR |=(1<<BODS);
+
+       MCUSR=0;
+       USI_TWI_Master_Initialise();
+       
+       
+       gcontrol=1;
+       sei();
+    while(1)   {
+       
+               if (gcontrol) {
+                       volatile double l=MAX44009getlux();             
+                       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;
+                       uint16_t w=l;
+                       uint8_t t8=w>>4;
+                       uint8_t af=0;
+                       if (t8>pack.TH) af=1;
+                       if (t8<=pack.TL) af=1; 
+                       cli();
+                       pack.temp=w;
+                       //pack.temp++;
+                       alarmflag=af;
+                       sei();                  
+                       gcontrol=0;
+               }
+
+               
+#if  defined(__AVR_ATtiny25__)||defined(__AVR_ATtiny45__)  || defined(__AVR_ATtiny85__)
+                       if (((TIMSK & (1<<TOIE0))==0)&& (mode==0))
+#endif                 
+#if  defined(__AVR_ATtiny24__)||defined(__AVR_ATtiny44__)  || defined(__AVR_ATtiny84__) ||defined(__AVR_ATtiny24A__)||defined(__AVR_ATtiny44A__)  || defined(__AVR_ATtiny84A__)
+                       if (((TIMSK0 & (1<<TOIE0))==0)&& (mode==0))
+#endif
+                         {
+
+                       MCUCR|=(1<<SE)|(1<<SM1);
+                       MCUCR&=~(1<<ISC01);
+               } else {
+                       MCUCR|=(1<<SE);
+                       MCUCR&=~(1<<SM1);
+               }
+               //MCUCR&=~(1<<ISC01);
+               asm("SLEEP");
+   }
+
+
+}
\ No newline at end of file
diff --git a/DS18B20_MAX44009/DS18B20_MAX44009.cproj b/DS18B20_MAX44009/DS18B20_MAX44009.cproj
new file mode 100644 (file)
index 0000000..a5cba43
--- /dev/null
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectVersion>6.2</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_MAX44009</AssemblyName>
+    <Name>DS18B20_MAX44009</Name>
+    <RootNamespace>DS18B20_MAX44009</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>
+  </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>
+    </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>
+    </ToolchainSettings>
+  </PropertyGroup>
+  <ItemGroup>
+    <Compile Include="D:\oc\dev\owSlave2\common\I2C\MAX44009.c">
+      <SubType>compile</SubType>
+      <Link>MAX44009.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_MAX44009.c">
+      <SubType>compile</SubType>
+    </Compile>
+    <Compile Include="OWDS18B20.S">
+      <SubType>compile</SubType>
+    </Compile>
+  </ItemGroup>
+  <Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
+</Project>
\ No newline at end of file
index 27d7b8f..0ad51b6 100644 (file)
@@ -87,6 +87,7 @@ h_readcommand:
        cjmp 0x44,hrc_set_convertT
        cjmp 0x48,hrc_copy_scratchpad
        cjmp 0xB8,hrc_recall_eeprom
+       FW_CONFIG_INFO
 #ifdef _CHANGEABLE_ID_
        CHANGE_ID_COMMANDS
 #endif
diff --git a/DS18B20_Thermocouble/DS18B20.atsln b/DS18B20_Thermocouble/DS18B20.atsln
deleted file mode 100644 (file)
index 558a11d..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Atmel Studio Solution File, Format Version 11.00
-Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "DS18B20", "DS18B20.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_Thermocouble/DS18B20.c b/DS18B20_Thermocouble/DS18B20.c
deleted file mode 100644 (file)
index 2ac3b11..0000000
+++ /dev/null
@@ -1,314 +0,0 @@
-
-// Copyright (c) 2015, Tobias Mueller tm(at)tm3d.de
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//  * Redistributions of source code must retain the above copyright
-//    notice, this list of conditions and the following disclaimer.
-//  * Redistributions in binary form must reproduce the above copyright
-//    notice, this list of conditions and the following disclaimer in the
-//    documentation and/or other materials provided with the
-//    distribution.
-//  * All advertising materials mentioning features or use of this
-//    software must display the following acknowledgement: This product
-//    includes software developed by tm3d.de and its contributors.
-//  * Neither the name of tm3d.de nor the names of its contributors may
-//    be used to endorse or promote products derived from this software
-//    without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#define F_CPU 8000000UL
-#include <avr/io.h>
-#include <avr/interrupt.h>
-#include <util/delay.h>
-#include <avr/wdt.h>
-#include <avr/sleep.h>
-#include <avr/pgmspace.h>
-
-extern void OWINIT();
-
-//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]));
-               return t0+(t1-t0)/1*(V-iv);
-       }
-
-
-uint8_t owid[8]={0x28, 0xA2, 0xD9, 0x84, 0x00, 0x16, 0x02, 0xAC};/**/
-       
-#if (owid>128) 
-#error "Variable not correct"
-#endif
-
-extern uint8_t mode;
-extern uint8_t gcontrol;
-extern uint8_t reset_indicator;
-extern uint8_t alarmflag;
-
-
-volatile uint8_t wdcounter;
-
-
-typedef union {
-       volatile uint8_t bytes[8];
-       struct {
-               uint16_t temp;  //0
-               uint8_t TH;  //2
-               uint8_t TL;  //3
-               uint8_t config;  //4
-               uint8_t rrFF; //5
-               uint8_t rr00; //6
-               uint8_t rr10; //7
-       };
-} pack_t;
-volatile pack_t pack;
-
-
-
-
-#if  defined(__AVR_ATtiny24__)||defined(__AVR_ATtiny44__)  || defined(__AVR_ATtiny84__) || defined(__AVR_ATtiny24A__)||defined(__AVR_ATtiny44A__)  || defined(__AVR_ATtiny84A__)
-ISR(WATCHDOG_vect) {
-#else
-ISR(WDT_vect) {
-#endif 
-       //sleep_disable();          // Disable Sleep on Wakeup
-       wdcounter++;
-       if (reset_indicator==1) reset_indicator++;
-       else if (reset_indicator==2) mode=0;
-/*     if (timeout==2) {
-               DIS_TIMER;
-               EN_OWINT;
-               mode=OWM_SLEEP;
-       }
-       timeout++;*/
-       //sleep_enable();           // Enable Sleep Mode
-
-}
-
-
-#define OWM_PORT PORTA
-#define OWM_PIN PINA
-#define OWM_PINN PINA0
-#define OWM_DD DDRA
-
-#define OWM_SET_LOW OWM_PORT&=~(1<<OWM_PINN);OWM_DD|=(1<<OWM_PINN)
-#define OWM_SET_HIGH OWM_DD&=~(1<<OWM_PINN);OWM_PORT|=(1<<OWM_PINN)
-
-#define OWM_IS_LOW ((OWM_PIN & (1<<OWM_PINN))==0)
-
-
-void owm_init() {
-       OWM_PORT|=(1<<OWM_PINN); //PULL UP
-       OWM_DD&=~(1<<OWM_PINN);
-}
-
-#define owm_delay(us1)  _delay_us(us1)
-
-uint8_t owm_reset() {
-       OWM_SET_LOW;
-       owm_delay(480);
-       OWM_SET_HIGH;
-       owm_delay(60);
-       if (OWM_IS_LOW) {owm_delay(420); return 1;} else {owm_delay(420); return 0;}
-       
-       
-}
-
-void owm_rw(uint8_t *b) {
-       uint8_t i;
-       uint8_t pp=1;
-       for(i=0;i<8;i++) {
-               if (pp&b[0]) {
-                       OWM_SET_LOW;
-                       owm_delay(6);
-                       OWM_SET_HIGH;
-                       owm_delay(9);
-                       if (OWM_IS_LOW) {
-                               b[0]&=~pp;
-                       }
-                       owm_delay(80-6-9);
-                       
-                       } else {
-                       OWM_SET_LOW;
-                       owm_delay(60);
-                       OWM_SET_HIGH;
-                       owm_delay(20);
-               }
-               pp=(pp<<1);
-       }
-}
-
-void owm_block(uint8_t count, uint8_t *buf){
-       uint8_t i;
-       for(i=0;i<count;i++) {
-               owm_rw(buf+i);
-       }
-}
-
-inline int16_t ow_fconvert(uint8_t b1, uint8_t b2) {
-       int16_t tsht;
-       tsht=b1  |((int)b2<<8);
-       if (b2 & 0x080)
-       tsht |= 0xFFFFF0000;
-       return tsht;
-}
-volatile double V,ktemp;
-
-uint16_t ADmess() {
-        ADMUX=0b10001101;
-        ADCSRA|=(1<<ADSC);
-        while ((ADCSRA&(1<<ADSC)));
-       return ADC;
-}
-
-int main(void){
-    //PRR|=(1<<PRUSI)|(1<<PRADC);  //Switch off usi and adc for save Power
-       pack.temp=0x0550;
-       pack.config=0x7F;
-       pack.TH=75;
-       pack.TL=70;
-       pack.rrFF=0xFF;
-       pack.rr00=0;
-       pack.rr10=0x10;
-       PORTA=0xFF-(1<<PINA1)-(1<<PINA2);
-       PORTB=0xFF;
-       OWINIT();
-
-       MCUCR &=~(1<<PUD); //All Pins Pullup...
-       MCUCR |=(1<<BODS);
-
-       WDTCSR |= ((1<<WDCE) );   // Enable the WD Change Bit//| (1<<WDE)
-       WDTCSR |=   (1<<WDIE) |              // Enable WDT Interrupt
-       (1<<WDP2) | (1<<WDP1);   // Set Timeout to ~1 seconds
-       MCUSR=0;
-       uint8_t block[13];
-       sei();
-       ADCSRA=(1<<ADEN)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0);
-       owm_init();
-       owm_reset();
-       block[0]=0xCC;
-       block[1]=0x4E;
-       block[2]=0;
-       block[3]=0;
-       block[4]=0x1F;
-       owm_block(5,block);
-       owm_reset();
-       block[0]=0x33;
-       for(uint8_t i=1;i<9;i++) {
-               block[i]=0xFF;
-       }
-       owm_block(9,block);
-       
-       if (block[1]==0x28) {  //DS18B20 angeschlossen
-               for(uint8_t i=0;i<8;i++) {
-                       owid[i]=block[i+1];
-               }
-               while(EECR & (1<<EEPE));
-               EEAR=E2END-7;
-               EECR|=(1<EERE);
-               if (EEDR!=0x28) { //Wenn keine ID im Eeprom uebernimm es
-                       for(uint8_t a=0;a<8;a++) {
-                               while(EECR & (1<<EEPE));
-                               EECR = (0<<EEPM1)|(0<<EEPM0);
-                               EEAR = E2END-7+a;
-                               EEDR = block[a+1];
-                               EECR |= (1<<EEMPE);
-                               EECR |= (1<<EEPE);
-                       }
-               }
-       }
-       
-       uint16_t ares[16],sum;
-       uint8_t par=0;
-       ares[0]=0;//ADmess();
-       for (par=1;par<16;par++) {
-               ares[par]=ares[0];
-       }
-       par=0;
-       wdcounter=0;
-       gcontrol=1;
-
-    while(1)   {
-               if (wdcounter>0) {
-                       ares[par]=ADmess();
-                       par++;
-                       if (par>15) par=0;
-                       wdcounter=0;
-               }
-               if (gcontrol) {
-                       PORTB|=(1<<PORTB0);
-                       sum=0;
-                       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.01*1000.0/16.0;
-                       ktemp=gettemp_rs(V);
-                       owm_reset();
-                       block[0]=0xCC;
-                       block[1]=0x44;
-                       owm_block(2,block);
-                       _delay_ms(100);
-                       owm_reset();
-                       block[0]=0xCC;
-                       block[1]=0xBE;
-                       for(uint8_t i=0;i<9;i++) block[i+2]=0xFF;
-                       owm_block(11,block);
-                       uint16_t htemp;
-                       if (PINB&(1<<PINB0)) {
-                               htemp=(ktemp*16+(block[2]|(block[3]<<8)))/10;
-                       } else {
-                               
-                               htemp=ktemp*16+(block[2]|(block[3]<<8));
-                       }
-                       uint8_t t8=pack.temp>>4;
-                       uint8_t af=0;
-                       if (t8>pack.TH) af=1;
-                       if (t8<=pack.TL) af=1;
-                       cli();
-                       pack.temp=htemp;
-                       alarmflag=af;
-                       sei();
-                       gcontrol=0;
-                       PORTB&=~(1<<PORTB0);
-               }
-
-               
-#if  defined(__AVR_ATtiny25__)||defined(__AVR_ATtiny45__)  || defined(__AVR_ATtiny85__)
-                       if (((TIMSK & (1<<TOIE0))==0)&& (mode==0))
-#endif                 
-#if  defined(__AVR_ATtiny24__)||defined(__AVR_ATtiny44__)  || defined(__AVR_ATtiny84__) ||defined(__AVR_ATtiny24A__)||defined(__AVR_ATtiny44A__)  || defined(__AVR_ATtiny84A__)
-                       if (((TIMSK0 & (1<<TOIE0))==0)&& (mode==0))
-#endif
-                         {
-//                     CLKPR=(1<<CLKPCE);
-       //              CLKPR=(1<<CLKPS2); /*0.5Mhz*/
-//                     PORTB&=~(1<<PINB1);
-                       MCUCR|=(1<<SE)|(1<<SM1);
-                       MCUCR&=~(1<<ISC01);
-               } else {
-                       MCUCR|=(1<<SE);
-                       MCUCR&=~(1<<SM1);
-               }
-               asm("SLEEP");
-   }
-
-
-}
\ No newline at end of file
diff --git a/DS18B20_Thermocouble/DS18B20.cproj b/DS18B20_Thermocouble/DS18B20.cproj
deleted file mode 100644 (file)
index b5a8073..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectVersion>6.2</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</AssemblyName>
-    <Name>DS18B20</Name>
-    <RootNamespace>DS18B20</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>
-  </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>
-    </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>
-    </ToolchainSettings>
-  </PropertyGroup>
-  <ItemGroup>
-    <Compile Include="DS18B20.c">
-      <SubType>compile</SubType>
-    </Compile>
-    <Compile Include="OWDS18B20.S">
-      <SubType>compile</SubType>
-    </Compile>
-  </ItemGroup>
-  <Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
-</Project>
\ No newline at end of file
diff --git a/DS18B20_Thermocouble/DS18B20_TC.atsln b/DS18B20_Thermocouble/DS18B20_TC.atsln
new file mode 100644 (file)
index 0000000..6bb479f
--- /dev/null
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Atmel Studio Solution File, Format Version 11.00
+Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "DS18B20_TC", "DS18B20_TC.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_Thermocouble/DS18B20_TC.c b/DS18B20_Thermocouble/DS18B20_TC.c
new file mode 100644 (file)
index 0000000..bd618b4
--- /dev/null
@@ -0,0 +1,315 @@
+
+// Copyright (c) 2015, Tobias Mueller tm(at)tm3d.de
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//  * Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//  * Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the
+//    distribution.
+//  * All advertising materials mentioning features or use of this
+//    software must display the following acknowledgement: This product
+//    includes software developed by tm3d.de and its contributors.
+//  * Neither the name of tm3d.de nor the names of its contributors may
+//    be used to endorse or promote products derived from this software
+//    without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#define F_CPU 8000000UL
+#include <avr/io.h>
+#include <avr/interrupt.h>
+#include <util/delay.h>
+#include <avr/wdt.h>
+#include <avr/sleep.h>
+#include <avr/pgmspace.h>
+
+extern void OWINIT();
+
+//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]));
+               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};
+       
+#if (owid>128) 
+#error "Variable not correct"
+#endif
+
+extern uint8_t mode;
+extern uint8_t gcontrol;
+extern uint8_t reset_indicator;
+extern uint8_t alarmflag;
+
+
+volatile uint8_t wdcounter;
+
+
+typedef union {
+       volatile uint8_t bytes[8];
+       struct {
+               uint16_t temp;  //0
+               uint8_t TH;  //2
+               uint8_t TL;  //3
+               uint8_t config;  //4
+               uint8_t rrFF; //5
+               uint8_t rr00; //6
+               uint8_t rr10; //7
+       };
+} pack_t;
+volatile pack_t pack;
+
+
+
+
+#if  defined(__AVR_ATtiny24__)||defined(__AVR_ATtiny44__)  || defined(__AVR_ATtiny84__) || defined(__AVR_ATtiny24A__)||defined(__AVR_ATtiny44A__)  || defined(__AVR_ATtiny84A__)
+ISR(WATCHDOG_vect) {
+#else
+ISR(WDT_vect) {
+#endif 
+       //sleep_disable();          // Disable Sleep on Wakeup
+       wdcounter++;
+       if (reset_indicator==1) reset_indicator++;
+       else if (reset_indicator==2) mode=0;
+/*     if (timeout==2) {
+               DIS_TIMER;
+               EN_OWINT;
+               mode=OWM_SLEEP;
+       }
+       timeout++;*/
+       //sleep_enable();           // Enable Sleep Mode
+
+}
+
+
+#define OWM_PORT PORTA
+#define OWM_PIN PINA
+#define OWM_PINN PINA0
+#define OWM_DD DDRA
+
+#define OWM_SET_LOW OWM_PORT&=~(1<<OWM_PINN);OWM_DD|=(1<<OWM_PINN)
+#define OWM_SET_HIGH OWM_DD&=~(1<<OWM_PINN);OWM_PORT|=(1<<OWM_PINN)
+
+#define OWM_IS_LOW ((OWM_PIN & (1<<OWM_PINN))==0)
+
+
+void owm_init() {
+       OWM_PORT|=(1<<OWM_PINN); //PULL UP
+       OWM_DD&=~(1<<OWM_PINN);
+}
+
+#define owm_delay(us1)  _delay_us(us1)
+
+uint8_t owm_reset() {
+       OWM_SET_LOW;
+       owm_delay(480);
+       OWM_SET_HIGH;
+       owm_delay(60);
+       if (OWM_IS_LOW) {owm_delay(420); return 1;} else {owm_delay(420); return 0;}
+       
+       
+}
+
+void owm_rw(uint8_t *b) {
+       uint8_t i;
+       uint8_t pp=1;
+       for(i=0;i<8;i++) {
+               if (pp&b[0]) {
+                       OWM_SET_LOW;
+                       owm_delay(6);
+                       OWM_SET_HIGH;
+                       owm_delay(9);
+                       if (OWM_IS_LOW) {
+                               b[0]&=~pp;
+                       }
+                       owm_delay(80-6-9);
+                       
+                       } else {
+                       OWM_SET_LOW;
+                       owm_delay(60);
+                       OWM_SET_HIGH;
+                       owm_delay(20);
+               }
+               pp=(pp<<1);
+       }
+}
+
+void owm_block(uint8_t count, uint8_t *buf){
+       uint8_t i;
+       for(i=0;i<count;i++) {
+               owm_rw(buf+i);
+       }
+}
+
+inline int16_t ow_fconvert(uint8_t b1, uint8_t b2) {
+       int16_t tsht;
+       tsht=b1  |((int)b2<<8);
+       if (b2 & 0x080)
+       tsht |= 0xFFFFF0000;
+       return tsht;
+}
+volatile double V,ktemp;
+
+uint16_t ADmess() {
+        ADMUX=0b10001101;
+        ADCSRA|=(1<<ADSC);
+        while ((ADCSRA&(1<<ADSC)));
+       return ADC;
+}
+
+int main(void){
+    //PRR|=(1<<PRUSI)|(1<<PRADC);  //Switch off usi and adc for save Power
+       pack.temp=0x0550;
+       pack.config=0x7F;
+       pack.TH=75;
+       pack.TL=70;
+       pack.rrFF=0xFF;
+       pack.rr00=0;
+       pack.rr10=0x10;
+       PORTA=0xFF-(1<<PINA1)-(1<<PINA2);
+       PORTB=0xFF;
+       OWINIT();
+
+       MCUCR &=~(1<<PUD); //All Pins Pullup...
+       MCUCR |=(1<<BODS);
+
+       WDTCSR |= ((1<<WDCE) );   // Enable the WD Change Bit//| (1<<WDE)
+       WDTCSR |=   (1<<WDIE) |              // Enable WDT Interrupt
+       (1<<WDP2) | (1<<WDP1);   // Set Timeout to ~1 seconds
+       MCUSR=0;
+       uint8_t block[13];
+       sei();
+       ADCSRA=(1<<ADEN)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0);
+       owm_init();
+       owm_reset();
+       block[0]=0xCC;
+       block[1]=0x4E;
+       block[2]=0;
+       block[3]=0;
+       block[4]=0x1F;
+       owm_block(5,block);
+       owm_reset();
+       block[0]=0x33;
+       for(uint8_t i=1;i<9;i++) {
+               block[i]=0xFF;
+       }
+       owm_block(9,block);
+       
+       if (block[1]==0x28) {  //DS18B20 angeschlossen
+               for(uint8_t i=0;i<8;i++) {
+                       owid[i]=block[i+1];
+               }
+               while(EECR & (1<<EEPE));
+               EEAR=E2END-7;
+               EECR|=(1<EERE);
+               if (EEDR!=0x28) { //Wenn keine ID im Eeprom uebernimm es
+                       for(uint8_t a=0;a<8;a++) {
+                               while(EECR & (1<<EEPE));
+                               EECR = (0<<EEPM1)|(0<<EEPM0);
+                               EEAR = E2END-7+a;
+                               EEDR = block[a+1];
+                               EECR |= (1<<EEMPE);
+                               EECR |= (1<<EEPE);
+                       }
+               }
+       }
+       
+       uint16_t ares[16],sum;
+       uint8_t par=0;
+       ares[0]=0;//ADmess();
+       for (par=1;par<16;par++) {
+               ares[par]=ares[0];
+       }
+       par=0;
+       wdcounter=0;
+       gcontrol=1;
+
+    while(1)   {
+               if (wdcounter>0) {
+                       ares[par]=ADmess();
+                       par++;
+                       if (par>15) par=0;
+                       wdcounter=0;
+               }
+               if (gcontrol) {
+                       PORTB|=(1<<PORTB0);
+                       sum=0;
+                       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.01*1000.0/16.0;
+                       ktemp=gettemp_rs(V);
+                       owm_reset();
+                       block[0]=0xCC;
+                       block[1]=0x44;
+                       owm_block(2,block);
+                       _delay_ms(100);
+                       owm_reset();
+                       block[0]=0xCC;
+                       block[1]=0xBE;
+                       for(uint8_t i=0;i<9;i++) block[i+2]=0xFF;
+                       owm_block(11,block);
+                       uint16_t htemp;
+                       if (PINB&(1<<PINB0)) {
+                               htemp=(ktemp*16+(block[2]|(block[3]<<8)))/10;
+                       } else {
+                               
+                               htemp=ktemp*16+(block[2]|(block[3]<<8));
+                       }
+                       uint8_t t8=pack.temp>>4;
+                       uint8_t af=0;
+                       if (t8>pack.TH) af=1;
+                       if (t8<=pack.TL) af=1;
+                       cli();
+                       pack.temp=htemp;
+                       alarmflag=af;
+                       sei();
+                       gcontrol=0;
+                       PORTB&=~(1<<PORTB0);
+               }
+
+               
+#if  defined(__AVR_ATtiny25__)||defined(__AVR_ATtiny45__)  || defined(__AVR_ATtiny85__)
+                       if (((TIMSK & (1<<TOIE0))==0)&& (mode==0))
+#endif                 
+#if  defined(__AVR_ATtiny24__)||defined(__AVR_ATtiny44__)  || defined(__AVR_ATtiny84__) ||defined(__AVR_ATtiny24A__)||defined(__AVR_ATtiny44A__)  || defined(__AVR_ATtiny84A__)
+                       if (((TIMSK0 & (1<<TOIE0))==0)&& (mode==0))
+#endif
+                         {
+//                     CLKPR=(1<<CLKPCE);
+       //              CLKPR=(1<<CLKPS2); /*0.5Mhz*/
+//                     PORTB&=~(1<<PINB1);
+                       MCUCR|=(1<<SE)|(1<<SM1);
+                       MCUCR&=~(1<<ISC01);
+               } else {
+                       MCUCR|=(1<<SE);
+                       MCUCR&=~(1<<SM1);
+               }
+               asm("SLEEP");
+   }
+
+
+}
\ No newline at end of file
diff --git a/DS18B20_Thermocouble/DS18B20_TC.cproj b/DS18B20_Thermocouble/DS18B20_TC.cproj
new file mode 100644 (file)
index 0000000..1a2f8e8
--- /dev/null
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectVersion>6.2</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_TC</AssemblyName>
+    <Name>DS18B20_TC</Name>
+    <RootNamespace>DS18B20_TC</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>
+  </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>
+    </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>
+    </ToolchainSettings>
+  </PropertyGroup>
+  <ItemGroup>
+    <Compile Include="DS18B20_TC.c">
+      <SubType>compile</SubType>
+    </Compile>
+    <Compile Include="OWDS18B20.S">
+      <SubType>compile</SubType>
+    </Compile>
+  </ItemGroup>
+  <Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
+</Project>
\ No newline at end of file
index 322f70f..351b949 100644 (file)
@@ -86,6 +86,7 @@ h_readcommand:
        cjmp 0x44,hrc_set_convertT
        cjmp 0x48,hrc_copy_scratchpad
        cjmp 0xB8,hrc_recall_eeprom
+       FW_CONFIG_INFO
 #ifdef _CHANGEABLE_ID_
        CHANGE_ID_COMMANDS
 #endif
index d4d376c..73cb3b6 100644 (file)
@@ -54,6 +54,7 @@
 extern void OWINIT();
 
 uint8_t owid[8]={0x1D, 0xA2, 0xD9, 0x84, 0x00, 0x26, 0x02, 0x5C};/**/
+uint8_t config_info[16]={0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
 
        
 
index e0a97fd..47737ca 100644 (file)
@@ -84,6 +84,7 @@ h_readcommand:
        cset 0x5A,OW_COPY_SCRATCHPAD
        cset 0xF0,OW_READ_MEMORY_ADDR
        cset 0xA5,OW_READ_MEMORYCOUNTER_ADDR
+       FW_CONFIG_INFO
 #ifdef _CHANGEABLE_ID_
        CHANGE_ID_COMMANDS
 #endif
index cde51c4..77e7763 100644 (file)
@@ -1,7 +1,7 @@
 
 Microsoft Visual Studio Solution File, Format Version 11.00
 # Atmel Studio Solution File, Format Version 11.00
-Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "DS2438_DHT22", "DS2438_DHT22.cproj", "{D8C974E2-4579-49ED-A4E2-6C54B37778FA}"
+Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "DS2438_DHT22", "DS2438_DHT22.cproj", "{91468D4F-8AE2-4C59-8A35-549C49E00934}"
 EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -9,10 +9,10 @@ Global
                Release|AVR = Release|AVR
        EndGlobalSection
        GlobalSection(ProjectConfigurationPlatforms) = postSolution
-               {D8C974E2-4579-49ED-A4E2-6C54B37778FA}.Debug|AVR.ActiveCfg = Debug|AVR
-               {D8C974E2-4579-49ED-A4E2-6C54B37778FA}.Debug|AVR.Build.0 = Debug|AVR
-               {D8C974E2-4579-49ED-A4E2-6C54B37778FA}.Release|AVR.ActiveCfg = Release|AVR
-               {D8C974E2-4579-49ED-A4E2-6C54B37778FA}.Release|AVR.Build.0 = Release|AVR
+               {91468D4F-8AE2-4C59-8A35-549C49E00934}.Debug|AVR.ActiveCfg = Debug|AVR
+               {91468D4F-8AE2-4C59-8A35-549C49E00934}.Debug|AVR.Build.0 = Debug|AVR
+               {91468D4F-8AE2-4C59-8A35-549C49E00934}.Release|AVR.ActiveCfg = Release|AVR
+               {91468D4F-8AE2-4C59-8A35-549C49E00934}.Release|AVR.Build.0 = Release|AVR
        EndGlobalSection
        GlobalSection(SolutionProperties) = preSolution
                HideSolutionNode = FALSE
index ed96a55..c5981c0 100644 (file)
@@ -32,7 +32,7 @@
 
 
 #define F_CPU 8000000UL
-#define FP_CALC
+//#define FP_CALC
 #include <avr/io.h>
 #include <avr/interrupt.h>
 #include <util/delay.h>
@@ -43,6 +43,7 @@ extern void OWINIT();
 
 
 uint8_t owid[8]={0x26, 0xA2, 0xD9, 0x84, 0x00, 0x00, 0x05, 0x16};/**/
+uint8_t config_info[16]={0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
        
 
 extern uint8_t mode;
@@ -347,9 +348,9 @@ int main(void){
 #define SENSOFF PORTA&=~(1<<PINA1);
 
        // Set up Watch Dog Timer for Inactivity
-       WDTCSR |= (1<<WDCE) ;   // Enable the WD Change Bit
-       WDTCSR =   (1<<WDIE) |              // Enable WDT Interrupt
-       (1<<WDP2) | (1<<WDP1);   // Set Timeout to ~2 seconds
+//     WDTCSR |= (1<<WDCE) ;   // Enable the WD Change Bit
+//     WDTCSR =   (1<<WDIE) |              // Enable WDT Interrupt
+//     (1<<WDP2) | (1<<WDP1);   // Set Timeout to ~2 seconds
 #endif
 
        
index 6269c1c..fc976a9 100644 (file)
@@ -4,7 +4,7 @@
     <SchemaVersion>2.0</SchemaVersion>
     <ProjectVersion>6.2</ProjectVersion>
     <ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName>
-    <ProjectGuid>{d8c974e2-4579-49ed-a4e2-6c54b37778fa}</ProjectGuid>
+    <ProjectGuid>{91468d4f-8ae2-4c59-8a35-549c49e00934}</ProjectGuid>
     <avrdevice>ATtiny84A</avrdevice>
     <avrdeviceseries>none</avrdeviceseries>
     <OutputType>Executable</OutputType>
@@ -34,7 +34,7 @@
         <documentation help="" />
         <offline-documentation help="" />
         <dependencies>
-          <content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.19.0" />
+          <content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.26.0" />
         </dependencies>
       </framework-data>
     </AsfFrameworkConfig>
@@ -46,7 +46,7 @@
         <InterfaceName>debugWIRE</InterfaceName>
       </ToolOptions>
       <ToolType>com.atmel.avrdbg.tool.atmelice</ToolType>
-      <ToolNumber>J41800000789</ToolNumber>
+      <ToolNumber>J41800000779</ToolNumber>
       <ToolName>Atmel-ICE</ToolName>
     </com_atmel_avrdbg_tool_atmelice>
     <avrtoolinterface>debugWIRE</avrtoolinterface>
index f545bed..35bc463 100644 (file)
@@ -32,6 +32,8 @@
 
 #define _CHANGEABLE_ID_
 //#define _DIS_FLASH_
+#define _ZERO_POLLING_
+//#define _DB_
 
 #include "../common/OWConfig.s"
 #include "../common/OWCRC8.s"
@@ -82,6 +84,7 @@ h_readcommand:
        cset 0x4E,OW_WRITE_SCRATCHPAD_ADR
        cjmp 0x44,hrc_set_convertT
        cjmp 0xB4,hrc_set_convertV
+       FW_CONFIG_INFO
 #ifdef _CHANGEABLE_ID_
        CHANGE_ID_COMMANDS
 #endif
index abf083c..74d24dd 100644 (file)
@@ -42,7 +42,8 @@
 extern void OWINIT();
 
 uint8_t owid[8]={0x20, 0xA2, 0xD9, 0x84, 0x00, 0x16, 0x02, 0x5D};/**/
-       
+uint8_t config_info[16]={0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
+
 #if (owid>128) 
 #error "Variable not correct"
 #endif
index 2614786..4fba4bc 100644 (file)
@@ -94,6 +94,7 @@ h_readcommand:
        cset 0xAA,OW_READ_MEMORY_ADDR
        cset 0x55,OW_WRITE_MEMORY_ADDR
        cset 0x3C,OW_CONVERT
+       FW_CONFIG_INFO
 #ifdef _CHANGEABLE_ID_
        CHANGE_ID_COMMANDS
 #endif
index 4d6920e..a26690a 100644 (file)
@@ -32,7 +32,7 @@
 
 
 .comm crc,2
-
+#define _CRC16_
 
 CRC16_alg:
        ;crc
index 90d2cd7..dad7480 100644 (file)
@@ -33,7 +33,7 @@
 
 .comm crc,1
 
-
+#define _CRC8_
 
 .macro CRCS ; CRC beim Senden
        ;crc
index 21a5351..8d82561 100644 (file)
@@ -57,7 +57,7 @@
 #define zh 31
 
 .extern owid,8
-
+.extern config_info,16
 
 .comm mode,1  ; Aktueller Zustand nach dem die Unterprogramme aufgerufen werden
 .comm srbyte,1 ; aktuelles Byte fuer Searchrom
index 5cf444b..00feec0 100644 (file)
@@ -126,8 +126,10 @@ zeropolling_wait:
        rjmp zeropolling_low_imp ;Leitung ist low raus aus schleufe
        in r_temp,TCNT_REG
        cpi r_temp,(~OWT_MIN_RESET)+OWT_ZP_WAIT_HIGH_TO ;aller zwei us zaehlt der timer
-       brsh  zeropolling_timeout ;Timeout
-       rjmp zeropolling_wait
+       sbis OW_PIN,OW_PINN ;noch eine Abfrage, da sonst schleife zu lang (sbis aendert keine flags)
+       rjmp zeropolling_low_imp ;Leitung ist low raus aus schleufe
+       brlo zeropolling_wait
+       rjmp zeropolling_timeout 
 zeropolling_low_imp:
        sbi OW_DDR,OW_PINN 
        RESETZEROMARKER 
index fdcc919..41a952f 100644 (file)
 #define OW_SEARCHROMR 4  ; next resive master answer
 #define OW_READROM 5
 #define OW_READ_COMMAND 6
+#define OW_FWCONFIGINFO 7
 
 
 #ifdef _CHANGEABLE_ID_
-#define OW_WRITE_NEWID 7
-#define OW_READ_NEWID 8
-#define OW_SET_NEWID 9
-#define OW_FIRST_COMMAND 10
+#define OW_WRITE_NEWID 8
+#define OW_READ_NEWID 9
+#define OW_SET_NEWID 10
+#define OW_FIRST_COMMAND 11
 .comm newid,8
 
        
@@ -79,7 +80,7 @@
 
 
 #else
-#define OW_FIRST_COMMAND 7
+#define OW_FIRST_COMMAND 8
 #endif
 
 #ifndef _DIS_FLASH_
@@ -93,6 +94,9 @@
 .endm
 #endif
 
+.macro FW_CONFIG_INFO
+       cljmp 0x85,hrc_fw_configinfo
+.endm
 
 
 #ifdef _CHANGEABLE_ID_
@@ -135,6 +139,7 @@ handle_stable:
                rjmp h_searchromr
                rjmp h_readrom
                rjmp h_readcommand 
+               rjmp h_fwconfiginfo
 #ifdef _CHANGEABLE_ID_
                rjmp h_writeid
                rjmp h_readid
@@ -193,6 +198,13 @@ hrc_set_alarm_search:
        ; sonst tue nichts
        rjmp handle_end_sleep
 
+
+hrc_fw_configinfo:
+       ldi r_mode,OW_FWCONFIGINFO
+       ldi r_sendflag,1
+       rjmp h_fwconfiginfo
+
+
 ;---------------------------------------------------
 ;   MATCH ROM
 ;---------------------------------------------------
@@ -290,6 +302,39 @@ h_readrom_all:
        rjmp handle_end_sleep
 
 
+;---------------------------------------------------
+;   FW_CONFIG_INFO
+;---------------------------------------------------
+
+h_fwconfiginfo:
+       cpi  r_bytep,16
+       breq h_fwconfiginfo_crc
+#ifdef _CRC8_
+       cpi  r_bytep,17
+       breq h_fwconfiginfo_all
+#elif defined _CRC16_
+       cpi  r_bytep,17
+       breq h_fwconfiginfo_crc2
+       cpi  r_bytep,18
+       breq h_fwconfiginfo_all
+#else
+       cpi  r_bytep,16
+       breq h_fwconfiginfo_all
+#warning No CRC known code implemented
+#endif
+       configZ config_info,r_bytep
+       ld   r_rwbyte,Z
+       rjmp handle_end_inc
+h_fwconfiginfo_crc:
+       lds r_rwbyte,crc
+       rjmp handle_end_inc
+h_fwconfiginfo_crc2:
+       lds r_rwbyte,crc+1
+       rjmp handle_end_inc
+h_fwconfiginfo_all:
+       rjmp handle_end_sleep
+
+
 ;---------------------------------------------------
 ;   CHANGE ROM FUNCTIONS
 ;---------------------------------------------------
index c28d855..f9ffb2f 100644 (file)
 #define OW_SEARCHROMR 4  ; next resive master answer
 #define OW_READ_COMMAND1 5
 #define OW_READ_COMMAND2 6
+#define OW_FWCONFIGINFO1 7
+#define OW_FWCONFIGINFO2 8
 
 
 #ifdef _CHANGEABLE_ID_
-#define OW_WRITE_NEWID 7
-#define OW_READ_NEWID 8
-#define OW_SET_NEWID 9
-#define OW_FIRST_COMMAND 10
+#define OW_WRITE_NEWID 9
+#define OW_READ_NEWID 10
+#define OW_SET_NEWID 11
+#define OW_FIRST_COMMAND 12
 .comm newid,8
 .comm idtable,64
        
@@ -79,7 +81,7 @@
 
 
 #else
-#define OW_FIRST_COMMAND 7
+#define OW_FIRST_COMMAND 9
 #endif
 
 #ifndef _DIS_FLASH_
 #endif
 
 
+.macro FW_CONFIG_INFO1
+       cljmp 0x85,hrc_fw_configinfo1
+.endm
+.macro FW_CONFIG_INFO2
+       cljmp 0x85,hrc_fw_configinfo2
+.endm
 
 #ifdef _CHANGEABLE_ID_
 ; lesen der ID aus dem EEPROM beim Start
@@ -145,6 +153,8 @@ handle_stable:
                rjmp h_searchromr
                rjmp h_readcommand1 
                rjmp h_readcommand2
+               rjmp h_fwconfiginfo1
+               rjmp h_fwconfiginfo2
 #ifdef _CHANGEABLE_ID_
                rjmp h_writeid
                rjmp h_readid
@@ -216,6 +226,17 @@ hrc_set_alarm_search:
        ; sonst tue nichts
        rjmp handle_end_sleep
 
+hrc_fw_configinfo1:
+       ldi r_mode,OW_FWCONFIGINFO1
+       ldi r_sendflag,1
+       rjmp h_fwconfiginfo1
+
+hrc_fw_configinfo2:
+       ldi r_mode,OW_FWCONFIGINFO2
+       ldi r_sendflag,1
+       rjmp h_fwconfiginfo2
+
+
 ;---------------------------------------------------
 ;   MATCH ROM
 ;---------------------------------------------------
@@ -353,6 +374,43 @@ h_searchromr:  ; stelle um auf empfangen
        rjmp handle_end_no_bcount
 
 
+;---------------------------------------------------
+;   FW_CONFIG_INFO
+;---------------------------------------------------
+
+h_fwconfiginfo1:
+       configZ config_info1,r_bytep
+       rjmp h_fwconfiginfo_go
+h_fwconfiginfo2:
+       configZ config_info2,r_bytep
+
+h_fwconfiginfo_go:
+       cpi  r_bytep,16
+       breq h_fwconfiginfo_crc
+#ifdef _CRC8_
+       cpi  r_bytep,17
+       breq h_fwconfiginfo_all
+#elif defined _CRC16_
+       cpi  r_bytep,17
+       breq h_fwconfiginfo_crc2
+       cpi  r_bytep,18
+       breq h_fwconfiginfo_all
+#else
+       cpi  r_bytep,16
+       breq h_fwconfiginfo_all
+#warning No CRC known code implemented
+#endif
+       ld   r_rwbyte,Z
+       rjmp handle_end_inc
+h_fwconfiginfo_crc:
+       lds r_rwbyte,crc
+       rjmp handle_end
+h_fwconfiginfo_crc2:
+       lds r_rwbyte,crc+1
+       rjmp handle_end
+h_fwconfiginfo_all:
+       rjmp handle_end_sleep
+
 
 ;---------------------------------------------------
 ;   CHANGE ROM FUNCTIONS
index 4c4528f..159d151 100644 (file)
 
 #else
 
-#define OWT_MIN_RESET 120 
-#define OWT_RESET2 60
+#define OWT_MIN_RESET 140
+#define OWT_RESET2 80
 #define OWT_RESET_PRESENT 30
 #define OWT_PRESENT 130
-//#define OWT_WRITE 35
-//#define OWT_READ 12
 #define OWT_WRITE 35
 #define OWT_READ 12
 
 #endif
 
 
+.macro CLEAR_TOV_FLAG
+       ldi r_temp,(1<<TOV0)
+       out _SFR_IO_ADDR(TIFR),r_temp
+.endm
+
+.macro JMP_NO_TOV
+       in r_temp, _SFR_IO_ADDR(TIFR)
+       sbrc r_temp,TOV0 ; wenn ueberlauf gleiich weiter
+.endm
 
 .macro CLEAR_INTERRUPT_FLAG 
        ldi r_temp,(1<<INTF0);inerrupt flags durch 1 loeschen..... 0 macht nix
 .endm
 
 
+.macro SET_FALLING_RESET_SLEEP
+       in r_temp,_SFR_IO_ADDR(MCUCR)
+       ori r_temp,(1<<ISC01)
+       andi r_temp,~(1<<SM1)
+       out     _SFR_IO_ADDR(MCUCR),r_temp
+.endm
 
 
 .macro HW_INIT
diff --git a/vergleiche liste.xlsx b/vergleiche liste.xlsx
new file mode 100644 (file)
index 0000000..a0eedd9
Binary files /dev/null and b/vergleiche liste.xlsx differ