DS2423 FHEM LEDs
authorTobias <tm@tm3d.de>
Thu, 18 May 2017 07:38:22 +0000 (09:38 +0200)
committerTobias <tm@tm3d.de>
Thu, 18 May 2017 07:38:22 +0000 (09:38 +0200)
4MHz Timing

DS2423_DS2413/DS2423_DS2413.c
DS2423_DS2423/DS2423_DS2423.c
DS2423_DS2423/DS2423_DS2423.cproj
DS2450/DS2450.cproj
common/I2C/CDM7160.h
common/OWDS2450.S
common/OWSet_ATTINYX4.s
programmer/programmer/programmer.asmproj

index 29800f8..a44b62b 100644 (file)
@@ -117,8 +117,8 @@ volatile uint8_t changefromeeprom;
 \r
 \r
 ISR(PCINT0_vect) {\r
-       if (((PIN_REG&PIN_CH2)==0)&&((istat&PIN_CH2)==PIN_CH2)) {       counters1.c32[2]++;     }\r
-       if (((PIN_REG&PIN_CH3)==0)&&((istat&PIN_CH3)==PIN_CH3)) {       counters1.c32[3]++;     }\r
+       if (((PIN_REG&PIN_CH2)==0)&&((istat&PIN_CH2)==PIN_CH2)) {       counters1.c32[2]++;     LED2_ON}\r
+       if (((PIN_REG&PIN_CH3)==0)&&((istat&PIN_CH3)==PIN_CH3)) {       counters1.c32[3]++;LED2_ON      }\r
        if ((PIN_REG&PIN_PIOA)==0)      pin_state&=~0x1; else pin_state|=0x01;\r
        if ((PIN_REG&PIN_PIOB)==0)      pin_state&=~0x4; else pin_state|=0x04;\r
        //Reset Switch on the FHEM_BOARD\r
@@ -152,6 +152,9 @@ ISR(ANA_COMP_vect) {
                        PORTB&=~(1<<PINB1);\r
                        CLKPR=0x80;\r
                        CLKPR=0;\r
+#ifdef FHEM_PLATINE\r
+                       LPORT_CH1|=LPIN_CH1;\r
+#endif\r
                        GIFR|=(1<<INTF0);\r
                }\r
        }\r
@@ -260,6 +263,7 @@ int main(void){
 \r
 #ifdef FHEM_PLATINE\r
                if (LPORT_CH2&LPIN_CH2) {\r                      _delay_ms(50);\r                 LPORT_CH2&=~LPIN_CH2;\r          }\r
+               if (LPORT_CH1&LPIN_CH1) {\r                      _delay_ms(50);\r                 LPORT_CH1&=~LPIN_CH1;\r          }\r
 #endif\r
 #ifndef FHEM_PLATINE\r
                if ((PINB&(1<<PORTB0))==0) {  //Jumper gesetzt ->Ruecksetzen\r
index 68fb010..1dbd395 100644 (file)
@@ -47,7 +47,7 @@ extern void EXTERN_SLEEP(void);
 \r
 volatile uint8_t owid1[8]={0x1D, 0x40, 0xDA, 0x84, 0x00, 0x00, 0x05, 0xBD};/**/\r
 volatile uint8_t owid2[8]={0x1D, 0x41, 0xDA, 0x84, 0x00, 0x00, 0x05, 0x8A};/**/\r
-#if RAMEND>260 //defined(__AVR_ATtiny84__)   ||defined(__AVR_ATtiny84A__)  \r
+#if RAMEND>260 //defined(__AVR_ATtiny84__)   ||defined(__AVR_ATtiny84A__)\r
 uint8_t config_info1[26]={9,13,9,13,9,13,9,13,0x02,19,19,19,19,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; //+2 for CRC\r
 uint8_t config_info2[26]={9,13,9,13,9,13,9,13,0x02,19,19,19,19,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; //+2 for CRC\r
 #endif\r
@@ -75,7 +75,7 @@ typedef union {
 counterpack_t pack1;\r
 \r
 //The Memory of both  Chips is the same, beause of the small memory of ATTiny44\r
-#define pack2 pack1 \r
+#define pack2 pack1\r
 \r
 volatile uint8_t lastcps;\r
 typedef union {\r
@@ -162,6 +162,9 @@ ISR(ANA_COMP_vect) {
                        PORTB&=~(1<<PINB1);\r
                        CLKPR=0x80;\r
                        CLKPR=0;\r
+#ifdef FHEM_PLATINE\r
+                       LPORT_CH1|=LPIN_CH1;\r
+#endif\r
                        GIFR|=(1<<INTF0);\r
                }\r
        }\r
@@ -246,16 +249,16 @@ int main(void){
        //ACSR|=(1<<ACD);  //Disable Comparator\r
        ADCSRB|=(1<<ACME); //Disable Analog multiplexer\r
        MCUCR &=~(1<<PUD); //All Pins Pullup...\r
-#ifdef FHEM_PLATINE\r
+       #ifdef FHEM_PLATINE\r
        DIDR0|=(1<<ADC0D);\r
        PORTA&=~(1<<PINA0);//Disable Pullup\r
-#else\r
+       #else\r
        DIDR0|=(1<<ADC2D)|(1<<ADC1D); // Disable Digital input on Analog AIN0/AIN1  (PINA1 / PINA2)\r
        PORTA&=~(1<<PINA2); //AIN1\r
-#endif\r
+       #endif\r
        ACSR&=~(1<<ACD);\r
        ACSR|=(1<<ACIE)|(1<<ACIS1)|(1<<ACIS0)|(1<<ACBG); //Enabble comperator interrupt Rising edge....(1<<ACIS0) -> minus of Comperator falls down -> output of Comperator rises\r
-#ifdef FHEM_PLATINE\r
+       #ifdef FHEM_PLATINE\r
        //Switch std AIN1 to A0\r
        ADCSRA&=~(1<<ADEN);\r
        ADCSRB=(1<<ACME);\r
@@ -265,13 +268,14 @@ int main(void){
 \r
 \r
        LPORT_CH0|=LPIN_CH0;\r   _delay_ms(500);\r        LPORT_CH0&=~LPIN_CH0;\r
-#endif\r
+       #endif\r
        sei();\r
        while(1)   {\r
                #ifdef FHEM_PLATINE\r
                if (LPORT_CH2&LPIN_CH2) {\r                      _delay_ms(50);\r                 LPORT_CH2&=~LPIN_CH2;\r          }\r
-#endif\r
-#ifndef FHEM_PLATINE\r
+               if (LPORT_CH1&LPIN_CH1) {\r                      _delay_ms(50);\r                 LPORT_CH1&=~LPIN_CH1;\r          }\r
+               #endif\r
+               #ifndef FHEM_PLATINE\r
                if ((PINB&(1<<PORTB0))==0) {  //Jumper gesetzt ->Ruecksetzen\r
                        if ((counters1.c32[2]!=0)||(counters1.c32[3]!=0)||(counters2.c32[2]!=0)||(counters2.c32[3]!=0)) {\r
                                counters1.c32[0]++;\r                            counters2.c32[0]++;\r                            for (uint8_t i=2;i<4;i++) {\r
@@ -281,7 +285,7 @@ int main(void){
                                //count Resets\r                         changefromeeprom=1;\r
                        }\r
                }\r
-#endif\r
+               #endif\r
                MCUCR|=(1<<SE);\r
                MCUCR&=~(1<<SM1);\r
                asm("SLEEP");\r
index 607908d..c822d8f 100644 (file)
@@ -5,7 +5,7 @@
     <ProjectVersion>7.0</ProjectVersion>\r
     <ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName>\r
     <ProjectGuid>{7a5672fe-8226-4158-b931-e1f36b9a8858}</ProjectGuid>\r
-    <avrdevice>ATtiny44A</avrdevice>\r
+    <avrdevice>ATtiny84A</avrdevice>\r
     <avrdeviceseries>none</avrdeviceseries>\r
     <OutputType>Executable</OutputType>\r
     <Language>C</Language>\r
         </dependencies>\r
       </framework-data>\r
     </AsfFrameworkConfig>\r
-    <avrtool>\r
-    </avrtool>\r
+    <avrtool>com.atmel.avrdbg.tool.atmelice</avrtool>\r
     <com_atmel_avrdbg_tool_atmelice>\r
       <ToolOptions>\r
         <InterfaceProperties>\r
         </InterfaceProperties>\r
-        <InterfaceName>\r
-        </InterfaceName>\r
+        <InterfaceName>debugWIRE</InterfaceName>\r
       </ToolOptions>\r
       <ToolType>com.atmel.avrdbg.tool.atmelice</ToolType>\r
       <ToolNumber>J41800000789</ToolNumber>\r
       <ToolName>Atmel-ICE</ToolName>\r
     </com_atmel_avrdbg_tool_atmelice>\r
-    <avrtoolinterface>\r
-    </avrtoolinterface>\r
+    <avrtoolinterface>debugWIRE</avrtoolinterface>\r
     <com_atmel_avrdbg_tool_simulator>\r
       <ToolOptions>\r
         <InterfaceProperties>\r
@@ -67,7 +64,7 @@
     </com_atmel_avrdbg_tool_simulator>\r
     <ExternalProgrammingToolCommand />\r
     <avrtoolserialnumber>J41800000789</avrtoolserialnumber>\r
-    <avrdeviceexpectedsignature>0x1E930D</avrdeviceexpectedsignature>\r
+    <avrdeviceexpectedsignature>0x1E930C</avrdeviceexpectedsignature>\r
   </PropertyGroup>\r
   <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">\r
     <ToolchainSettings>\r
index 856184d..f29fdfd 100644 (file)
     <eraseonlaunchrule>1</eraseonlaunchrule>\r
     <ExternalProgrammingToolCommand />\r
     <AsfFrameworkConfig>\r
-      <framework-data xmlns="">\r
-        <options />\r
-        <configurations />\r
-        <files />\r
-        <documentation help="" />\r
-        <offline-documentation help="" />\r
-        <dependencies>\r
-          <content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.27.3" />\r
-        </dependencies>\r
-      </framework-data>\r
+      <framework-data>\r
+  <options />\r
+  <configurations />\r
+  <files />\r
+  <documentation help="" />\r
+  <offline-documentation help="" />\r
+  <dependencies>\r
+    <content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.28.1" />\r
+  </dependencies>\r
+</framework-data>\r
     </AsfFrameworkConfig>\r
     <avrtool />\r
   </PropertyGroup>\r
   <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">\r
     <ToolchainSettings>\r
       <AvrGcc>\r
-  <avrgcc.common.Device>-mmcu=attiny84a -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.79\gcc\dev\attiny84a"</avrgcc.common.Device>\r
-  <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>\r
-  <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>\r
-  <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>\r
-  <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>\r
-  <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>\r
-  <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>\r
-  <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>\r
-  <avrgcc.compiler.symbols.DefSymbols>\r
-    <ListValues>\r
-      <Value>NDEBUG</Value>\r
-    </ListValues>\r
-  </avrgcc.compiler.symbols.DefSymbols>\r
-  <avrgcc.compiler.directories.IncludePaths>\r
-    <ListValues>\r
-      <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.79\include</Value>\r
-    </ListValues>\r
-  </avrgcc.compiler.directories.IncludePaths>\r
-  <avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>\r
-  <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>\r
-  <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>\r
-  <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>\r
-  <avrgcc.linker.libraries.Libraries>\r
-    <ListValues>\r
-      <Value>libm</Value>\r
-    </ListValues>\r
-  </avrgcc.linker.libraries.Libraries>\r
-  <avrgcc.assembler.general.IncludePaths>\r
-    <ListValues>\r
-      <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.79\include</Value>\r
-    </ListValues>\r
-  </avrgcc.assembler.general.IncludePaths>\r
-</AvrGcc>\r
+        <avrgcc.common.Device>-mmcu=attiny84a -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.79\gcc\dev\attiny84a"</avrgcc.common.Device>\r
+        <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>\r
+        <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>\r
+        <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>\r
+        <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>\r
+        <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>\r
+        <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>\r
+        <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>\r
+        <avrgcc.compiler.symbols.DefSymbols>\r
+          <ListValues>\r
+            <Value>NDEBUG</Value>\r
+          </ListValues>\r
+        </avrgcc.compiler.symbols.DefSymbols>\r
+        <avrgcc.compiler.directories.IncludePaths>\r
+          <ListValues>\r
+            <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.79\include</Value>\r
+          </ListValues>\r
+        </avrgcc.compiler.directories.IncludePaths>\r
+        <avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>\r
+        <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>\r
+        <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>\r
+        <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>\r
+        <avrgcc.linker.libraries.Libraries>\r
+          <ListValues>\r
+            <Value>libm</Value>\r
+          </ListValues>\r
+        </avrgcc.linker.libraries.Libraries>\r
+        <avrgcc.assembler.general.IncludePaths>\r
+          <ListValues>\r
+            <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.79\include</Value>\r
+          </ListValues>\r
+        </avrgcc.assembler.general.IncludePaths>\r
+      </AvrGcc>\r
     </ToolchainSettings>\r
   </PropertyGroup>\r
   <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">\r
     <ToolchainSettings>\r
       <AvrGcc>\r
-  <avrgcc.common.Device>-mmcu=attiny84a -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.79\gcc\dev\attiny84a"</avrgcc.common.Device>\r
-  <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>\r
-  <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>\r
-  <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>\r
-  <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>\r
-  <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>\r
-  <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>\r
-  <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>\r
-  <avrgcc.compiler.symbols.DefSymbols>\r
-    <ListValues>\r
-      <Value>DEBUG</Value>\r
-    </ListValues>\r
-  </avrgcc.compiler.symbols.DefSymbols>\r
-  <avrgcc.compiler.directories.IncludePaths>\r
-    <ListValues>\r
-      <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.79\include</Value>\r
-    </ListValues>\r
-  </avrgcc.compiler.directories.IncludePaths>\r
-  <avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>\r
-  <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>\r
-  <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>\r
-  <avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>\r
-  <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>\r
-  <avrgcc.linker.libraries.Libraries>\r
-    <ListValues>\r
-      <Value>libm</Value>\r
-    </ListValues>\r
-  </avrgcc.linker.libraries.Libraries>\r
-  <avrgcc.assembler.general.IncludePaths>\r
-    <ListValues>\r
-      <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.79\include</Value>\r
-    </ListValues>\r
-  </avrgcc.assembler.general.IncludePaths>\r
-  <avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>\r
-</AvrGcc>\r
+        <avrgcc.common.Device>-mmcu=attiny84a -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.79\gcc\dev\attiny84a"</avrgcc.common.Device>\r
+        <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>\r
+        <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>\r
+        <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>\r
+        <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>\r
+        <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>\r
+        <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>\r
+        <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>\r
+        <avrgcc.compiler.symbols.DefSymbols>\r
+          <ListValues>\r
+            <Value>DEBUG</Value>\r
+          </ListValues>\r
+        </avrgcc.compiler.symbols.DefSymbols>\r
+        <avrgcc.compiler.directories.IncludePaths>\r
+          <ListValues>\r
+            <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.79\include</Value>\r
+          </ListValues>\r
+        </avrgcc.compiler.directories.IncludePaths>\r
+        <avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>\r
+        <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>\r
+        <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>\r
+        <avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>\r
+        <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>\r
+        <avrgcc.linker.libraries.Libraries>\r
+          <ListValues>\r
+            <Value>libm</Value>\r
+          </ListValues>\r
+        </avrgcc.linker.libraries.Libraries>\r
+        <avrgcc.assembler.general.IncludePaths>\r
+          <ListValues>\r
+            <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.79\include</Value>\r
+          </ListValues>\r
+        </avrgcc.assembler.general.IncludePaths>\r
+        <avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>\r
+      </AvrGcc>\r
     </ToolchainSettings>\r
   </PropertyGroup>\r
   <ItemGroup>\r
index a3bf902..e057b3f 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef MAX44009_H\r
-#define MAX44009_H\r
+#ifndef CDM7160_H\r
+#define CDM7160_H\r
 // Copyright (c) 2015, Tobias Mueller tm(at)tm3d.de\r
 // All rights reserved.\r
 //\r
index c6a43ec..40e3907 100644 (file)
@@ -1,5 +1,5 @@
 \r
-// Copyright (c) 2015, Tobias Mueller tm(at)tm3d.de\r
+// Copyright (c) 2017, Tobias Mueller tm(at)tm3d.de\r
 // All rights reserved. \r
 // \r
 // Redistribution and use in source and binary forms, with or without \r
index 48282c4..1810047 100644 (file)
@@ -69,7 +69,7 @@
 #define OWT_MIN_RESET 80\r
 #define OWT_RESET2 17\r
 #define OWT_RESET_PRESENT 15\r
-#define OWT_PRESENT 10\r
+#define OWT_PRESENT 60\r
 #define OWT_WRITE 16\r
 #define OWT_READ 5\r
 #define OWT_ZP_WAIT_LOW_TO 36  ; Zeit fuer die Maximale Lowzeit bei der Zerro Polling pruefung. Ist die Leitung laenger low, ist es vieleicht ein Reset \r
index a077c58..cffffb4 100644 (file)
     <eraseonlaunchrule>1</eraseonlaunchrule>\r
     <AsfFrameworkConfig>\r
       <framework-data>\r
-  <options />\r
-  <configurations />\r
-  <files />\r
-  <documentation help="" />\r
-  <offline-documentation help="" />\r
-  <dependencies>\r
-    <content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.28.1" />\r
-  </dependencies>\r
-</framework-data>\r
+        <options />\r
+        <configurations />\r
+        <files />\r
+        <documentation help="" />\r
+        <offline-documentation help="" />\r
+        <dependencies>\r
+          <content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.28.1" />\r
+        </dependencies>\r
+      </framework-data>\r
     </AsfFrameworkConfig>\r
     <avrtool>com.atmel.avrdbg.tool.atmelice</avrtool>\r
     <com_atmel_avrdbg_tool_atmelice>\r