From: Tobias <tm@tm3d.de> Date: Wed, 7 Oct 2015 14:41:49 +0000 (+0200) Subject: New Dual with BMP280 and SHT X-Git-Url: https://git.smho.de/?a=commitdiff_plain;h=28c2911a7459ae2977c0cb0228c0ca2af1c345bf;p=owSlave2.git New Dual with BMP280 and SHT Some renames Chance flasher adress in dual code!!!! --- diff --git a/DS18B20_BMP280_DS2438_SHT/DS18B20_DS2438.c b/DS18B20_BMP280_DS2438_SHT/DS18B20_DS2438.c new file mode 100644 index 0000000..4aec172 --- /dev/null +++ b/DS18B20_BMP280_DS2438_SHT/DS18B20_DS2438.c @@ -0,0 +1,237 @@ + +// 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/SHT2x.h" +#include "../common/I2C/BMP280.h" + + +extern void OWINIT(); + + + +uint8_t owid1[8]={0x28, 0xA3, 0xD9, 0x84, 0x00, 0x16, 0x05, 0x18};/**/ +uint8_t owid2[8]={0x26, 0xA3, 0xD9, 0x84, 0x00, 0x16, 0x05, 0x67};/**/ +uint8_t config_info1[16]={0x02,0x03, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; +uint8_t config_info2[16]={0x01,0x06, 0x05,0x08, 0x04,0x07, 0x00,0x00, 0x01,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; + + +#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 + +} + + +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 + }; +} pack1_t; +volatile pack1_t pack1; + + + +typedef union { + #if defined(__AVR_ATtiny25__) + volatile uint8_t bytes[16]; + #else + volatile uint8_t bytes[64]; + #endif + struct { + uint8_t status; //1 + int16_t temp; //2 + uint16_t voltage; //4 + uint16_t current; //6 + uint8_t threshold; //8 + + uint8_t page1[8]; //9 + #if defined(__AVR_ATtiny25__) + #else + uint8_t page2[8]; //17 + uint8_t page3[8]; //25 + uint8_t page4[8]; //33 + uint8_t page5[8]; //41 + uint8_t page6[8]; //49 + uint8_t page7[8]; //57 + //uint8_t crc; //65 + #endif + }; +} pack2_t; +volatile pack2_t pack2; + + + + +volatile int16_t am2302_temp; +volatile uint16_t am2302_hum; + + +uint8_t userRegister[1]; +int16_t sRH,sT; +volatile double temperatureC,humidityRH; +volatile double l; + uint32_t P; + int32_t t; + +int main(void){ + PRR|=(1<<PRADC); // adc for save Power + pack1.temp=0x0550; + pack1.config=0x7F; + pack1.TH=75; + pack1.TL=70; + pack1.rrFF=0xFF; + pack1.rr00=0; + pack1.rr10=0x10; + PORTA=0xFF; + 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; + USI_TWI_Master_Initialise(); + bmp280Init(); + SHT2x_SoftReset(); + SHT2x_ReadUserRegister(userRegister); + //(userRegister & ~SHT2x_RES_MASK) | SHT2x_RES_10_13BIT; + SHT2x_WriteUserRegister(userRegister); //write changed user reg + // --- measure humidity with "Hold Master Mode (HM)" --- + SHT2x_MeasurePoll(HUMIDITY, &sRH); + // --- measure temperature with "Polling Mode" (no hold master) --- + SHT2x_MeasurePoll(TEMP, &sT); + //-- calculate humidity and temperature -- + temperatureC = SHT2x_CalcTemperatureC(sT); + humidityRH = SHT2x_CalcRH(sRH); + + gcontrol=1; + sei(); + while(1) { + if (wdcounter>0) { + SHT2x_MeasurePoll(HUMIDITY, &sRH); + // --- measure temperature with "Polling Mode" (no hold master) --- + SHT2x_MeasurePoll(TEMP, &sT); + //-- calculate humidity and temperature -- + temperatureC = SHT2x_CalcTemperatureC(sT)*10.0; + humidityRH = SHT2x_CalcRH(sRH)*10.0; + double hhum=(1.0546-0.000216*temperatureC)*(humidityRH); + am2302_hum=0.318*hhum +76.0; + am2302_temp=temperatureC*25.6; + wdcounter=0; + } + + if (gcontrol==1) { + + bmp280ConvertInt(&t,&P,1); + P=P-70000; + P=P/20; + uint16_t w=P; + uint8_t t8=w>>4; + uint8_t af=0; + if (t8>pack1.TH) af=1; + if (t8<=pack1.TL) af=1; + cli(); + pack1.temp=w; + //pack.temp++; + alarmflag=af; + sei(); + gcontrol=0; + } + if ((gcontrol==2)||(gcontrol==3)) { + 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_DS2438_SHT/DS18B20_DS2438_6_2.atsln b/DS18B20_BMP280_DS2438_SHT/DS18B20_DS2438_6_2.atsln new file mode 100644 index 0000000..adaf496 --- /dev/null +++ b/DS18B20_BMP280_DS2438_SHT/DS18B20_DS2438_6_2.atsln @@ -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_DS2438", "DS18B20_DS2438_6_2.cproj", "{7A5672FE-8226-4158-B931-E1F36B9A8858}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|AVR = Debug|AVR + Release|AVR = Release|AVR + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7A5672FE-8226-4158-B931-E1F36B9A8858}.Debug|AVR.ActiveCfg = Debug|AVR + {7A5672FE-8226-4158-B931-E1F36B9A8858}.Debug|AVR.Build.0 = Debug|AVR + {7A5672FE-8226-4158-B931-E1F36B9A8858}.Release|AVR.ActiveCfg = Release|AVR + {7A5672FE-8226-4158-B931-E1F36B9A8858}.Release|AVR.Build.0 = Release|AVR + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/DS18B20_BMP280_DS2438_SHT/DS18B20_DS2438_6_2.cproj b/DS18B20_BMP280_DS2438_SHT/DS18B20_DS2438_6_2.cproj new file mode 100644 index 0000000..dec1c59 --- /dev/null +++ b/DS18B20_BMP280_DS2438_SHT/DS18B20_DS2438_6_2.cproj @@ -0,0 +1,143 @@ +<?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_DS2438</AssemblyName> + <Name>DS18B20_DS2438</Name> + <RootNamespace>DS18B20_DS2438</RootNamespace> + <ToolchainFlavour>Native</ToolchainFlavour> + <KeepTimersRunning>true</KeepTimersRunning> + <OverrideVtor>false</OverrideVtor> + <CacheFlash>true</CacheFlash> + <ProgFlashFromRam>true</ProgFlashFromRam> + <RamSnippetAddress>0x20000000</RamSnippetAddress> + <UncachedRange /> + <preserveEEPROM>true</preserveEEPROM> + <OverrideVtorValue>exception_table</OverrideVtorValue> + <BootSegment>2</BootSegment> + <eraseonlaunchrule>1</eraseonlaunchrule> + <AsfFrameworkConfig> + <framework-data xmlns=""> + <options /> + <configurations /> + <files /> + <documentation help="" /> + <offline-documentation help="" /> + <dependencies> + <content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.19.0" /> + </dependencies> + </framework-data> + </AsfFrameworkConfig> + <avrtool>com.atmel.avrdbg.tool.atmelice</avrtool> + <com_atmel_avrdbg_tool_atmelice> + <ToolOptions> + <InterfaceProperties> + </InterfaceProperties> + <InterfaceName>debugWIRE</InterfaceName> + </ToolOptions> + <ToolType>com.atmel.avrdbg.tool.atmelice</ToolType> + <ToolNumber>J41800000779</ToolNumber> + <ToolName>Atmel-ICE</ToolName> + </com_atmel_avrdbg_tool_atmelice> + <avrtoolinterface>debugWIRE</avrtoolinterface> + <com_atmel_avrdbg_tool_simulator> + <ToolOptions> + <InterfaceProperties> + </InterfaceProperties> + <InterfaceName> + </InterfaceName> + </ToolOptions> + <ToolType>com.atmel.avrdbg.tool.simulator</ToolType> + <ToolNumber> + </ToolNumber> + <ToolName>Simulator</ToolName> + </com_atmel_avrdbg_tool_simulator> + </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\SHT2x.c"> + <SubType>compile</SubType> + <Link>SHT2x.c</Link> + </Compile> + <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_DS2438.c"> + <SubType>compile</SubType> + </Compile> + <Compile Include="OWDS18B20_DS2438.S"> + <SubType>compile</SubType> + </Compile> + </ItemGroup> + <Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" /> +</Project> \ No newline at end of file diff --git a/DS18B20_BMP280_DS2438_SHT/OWDS18B20_DS2438.S b/DS18B20_BMP280_DS2438_SHT/OWDS18B20_DS2438.S new file mode 100644 index 0000000..bf7146e --- /dev/null +++ b/DS18B20_BMP280_DS2438_SHT/OWDS18B20_DS2438.S @@ -0,0 +1,347 @@ + +// 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_ +#define _DB_ + +#include "../common/OWConfig.s" +#include "../common/OWCRC8.s" + +.extern pack1,8 + +//.extern am2302_temp,2 + +#if defined(__AVR_ATtiny25__) +.extern pack2,16 +#else +.extern pack2,64 +#endif +.extern am2302_temp,2 +.extern am2302_hum,2 +.comm block,1 ; Block der augegeben, geschrieben wird (Parameter von READ/WRITE Scratchpad) + + +.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_func1 +.endm + +.macro COMMAND_TABLE + rjmp h_readscratchpad1 + rjmp h_writescratchpad1 + rjmp h_readscratchpad_adr2 + rjmp h_readscratchpad2 + rjmp h_writescratchpad_adr2 + rjmp h_writescratchpad2 +.endm + +#include "../common/OWRomFunctionsDual.s" +#include "../common/OWTimerInterrupt.s" + + + +; Ab hier Geraeteabhaenging +#define OW_READ_SCRATCHPAD1 OW_FIRST_COMMAND+0 +#define OW_WRITE_SCRATCHPAD1 OW_FIRST_COMMAND+1 +#define OW_READ_SCRATCHPAD_ADR2 OW_FIRST_COMMAND+2 +#define OW_READ_SCRATCHPAD2 OW_FIRST_COMMAND+3 +#define OW_WRITE_SCRATCHPAD_ADR2 OW_FIRST_COMMAND+4 +#define OW_WRITE_SCRATCHPAD2 OW_FIRST_COMMAND+5 + + +;--------------------------------------------------- +; READ COMMAND and start operation +;--------------------------------------------------- + + +h_readcommand1: + clr r_bytep +#ifndef _DIS_FLASH_ + FLASH_COMMANDS ; muss zu erst sein.... +#endif + cjmp 0xBE,hrc_set_readscratchpad1 + cjmp 0x4E,hrc_set_writescratchpad1 + 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 + ldi r_mode,OW_SLEEP + rjmp handle_end + +hrc_set_readscratchpad1: + ldi r_mode,OW_READ_SCRATCHPAD1 + ldi r_sendflag,1 + CRCInit2 + rjmp h_readscratchpad1 + +hrc_set_writescratchpad1: + ldi r_mode,OW_WRITE_SCRATCHPAD1 + ldi r_bytep,2 ;start to write in 2 + rjmp handle_end + +hrc_recall_eeprom1: + rcall hrc_recall_eeprom_func1 + rjmp handle_end + + + +hrc_set_convertT1: + ldi r_temp,1 + sts gcontrol,r_temp + + rjmp handle_end_sleep + + +hrc_copy_scratchpad1: + ldi r_bytep,2 + configZ pack1,r_bytep + clr r_bytep +hrc_copy_scratchpad_EEPROM_write1: + sbic _SFR_IO_ADDR(EECR), EEPE + rjmp hrc_copy_scratchpad_EEPROM_write1 + 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_write1 + rjmp handle_end + + +hrc_recall_eeprom_func1: + ldi r_bytep,2 + configZ pack1,r_bytep + clr r_bytep + clr r_temp +hrc_recall_eeprom_EEPROM_read1: + sbic _SFR_IO_ADDR(EECR), EEPE + rjmp hrc_recall_eeprom_EEPROM_read1 + 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_read1 + ret + + + + + + +;--------------------------------------------------- +; READ SCRATCHPAD +;--------------------------------------------------- + +h_readscratchpad1: + cpi r_bytep,8 + breq h_readscratchpad_crc1 + cpi r_bytep,9 + breq h_readscratchpad_all1 + configZ pack1,r_bytep + ld r_rwbyte,Z + rjmp h_readscratchpad_endc1 +h_readscratchpad_crc1: + lds r_rwbyte,crc +h_readscratchpad_endc1: + inc r_bytep + ldi r_bcount,1 + rjmp handle_end +h_readscratchpad_all1: + rjmp handle_end_sleep + + + + + +;--------------------------------------------------- +; WRITE SCRATCHPAD +;--------------------------------------------------- + +h_writescratchpad1: + configZ pack1,r_bytep + inc r_bytep + cpi r_bytep,5 + breq h_writescratchpad_all1 + st Z,r_rwbyte + rjmp handle_end +h_writescratchpad_all1: + ori r_rwbyte,0x1F ; Alle unteren Bits sind immer 1 + st Z,r_rwbyte + rjmp handle_end_sleep + +;***************************************************************************************************************************************************************************************** +;***************************************************************************************************************************************************************************************** +;***************************************************************************************************************************************************************************************** +;***************************************************************************************************************************************************************************************** +;***************************************************************************************************************************************************************************************** + + + + + +h_readcommand2: + clr r_bytep +#ifndef _DIS_FLASH_ + FLASH_COMMANDS ; muss zu erst sein.... +#endif + cset 0xBE,OW_READ_SCRATCHPAD_ADR2 + 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 + rjmp handle_end_sleep + + +hrc_set_convertT2: + ldi r_temp,2 + sts gcontrol,r_temp + lds r_temp,am2302_temp + sts pack2+1,r_temp + lds r_temp,am2302_temp+1 + sts pack2+2,r_temp + rjmp handle_end_sleep +hrc_set_convertV2: + lds r_temp,pack2 + sbrs r_temp,3 + rjmp hrc_set_convertVV2 + ldi r_temp,0xF4 + sts pack2+3,r_temp + ldi r_temp,0x01 + sts pack2+4,r_temp + rjmp hrc_set_convertend2 +hrc_set_convertVV2: + ldi r_temp,3 + sts gcontrol,r_temp + lds r_temp,am2302_hum + sts pack2+3,r_temp + lds r_temp,am2302_hum+1 + sts pack2+4,r_temp +hrc_set_convertend2: + rjmp handle_end_sleep + + + +;--------------------------------------------------- +; READ SCRATCHPAD +;--------------------------------------------------- + +h_readscratchpad_adr2: + lsl r_rwbyte + lsl r_rwbyte + lsl r_rwbyte +#if defined(__AVR_ATtiny25__) + andi r_rwbyte,0x01 ;nur Page 0 und 1 und das immer wiederholen +#endif + sts block,r_rwbyte + ldi r_sendflag,1 + ldi r_mode,OW_READ_SCRATCHPAD2 + CRCInit2 +h_readscratchpad2: + cpi r_bytep,8 + breq h_readscratchpad_crc2 + cpi r_bytep,9 + breq h_readscratchpad_all2 + lds r_temp,block + add r_temp,r_bytep + configZ pack2,r_temp + ld r_rwbyte,Z + rjmp handle_end_inc +h_readscratchpad_crc2: + lds r_rwbyte,crc + rjmp handle_end_inc +h_readscratchpad_all2: + rjmp handle_end_sleep + + + + +;--------------------------------------------------- +; WRITE SCRATCHPAD +;--------------------------------------------------- +h_writescratchpad_adr2: + lsl r_rwbyte + lsl r_rwbyte + lsl r_rwbyte +#if defined(__AVR_ATtiny25__) + andi r_rwbyte,0x01 ;nur Page 0 und 1 und das immer wiederholen +#endif + sts block,r_rwbyte + ldi r_mode,OW_WRITE_SCRATCHPAD2 + ldi r_bcount,1 + rjmp handle_end +h_writescratchpad2: + cpi r_bytep,8 + breq h_writescratchpad_all2 + lds r_temp,block + add r_temp,r_bytep + configZ pack2,r_temp + st Z,r_rwbyte + rjmp handle_end_inc +h_writescratchpad_all2: + rjmp handle_end_sleep + + + + + + + + + +#include "../common/OWPinInterrupt.s" +.end \ No newline at end of file diff --git a/DS18B20_DS2438/DS18B20.pdf b/DS18B20_DS2438/DS18B20.pdf deleted file mode 100644 index a942d79..0000000 Binary files a/DS18B20_DS2438/DS18B20.pdf and /dev/null differ diff --git a/DS18B20_DS2438/DS18B20_DS2438.atsln b/DS18B20_DS2438/DS18B20_DS2438.atsln deleted file mode 100644 index 6e68474..0000000 --- a/DS18B20_DS2438/DS18B20_DS2438.atsln +++ /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_DS2438", "DS18B20_DS2438.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_DS2438/DS18B20_DS2438.c b/DS18B20_DS2438/DS18B20_DS2438.c deleted file mode 100644 index e995108..0000000 --- a/DS18B20_DS2438/DS18B20_DS2438.c +++ /dev/null @@ -1,235 +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" -#include "../common/I2C/SHT2x.h" - - -extern void OWINIT(); - - - -uint8_t owid1[8]={0x28, 0xA3, 0xD9, 0x84, 0x00, 0x16, 0x05, 0x18};/**/ -uint8_t owid2[8]={0x26, 0xA3, 0xD9, 0x84, 0x00, 0x16, 0x05, 0x67};/**/ -uint8_t config_info1[16]={0x03,0x04, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; -uint8_t config_info2[16]={0x01,0x06, 0x05,0x00, 0x04,0x07, 0x00,0x00, 0x01,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; - - -#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 - -} - - -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 - }; -} pack1_t; -volatile pack1_t pack1; - - - -typedef union { - #if defined(__AVR_ATtiny25__) - volatile uint8_t bytes[16]; - #else - volatile uint8_t bytes[64]; - #endif - struct { - uint8_t status; //1 - int16_t temp; //2 - uint16_t voltage; //4 - uint16_t current; //6 - uint8_t threshold; //8 - - uint8_t page1[8]; //9 - #if defined(__AVR_ATtiny25__) - #else - uint8_t page2[8]; //17 - uint8_t page3[8]; //25 - uint8_t page4[8]; //33 - uint8_t page5[8]; //41 - uint8_t page6[8]; //49 - uint8_t page7[8]; //57 - //uint8_t crc; //65 - #endif - }; -} pack2_t; -volatile pack2_t pack2; - - - - -volatile int16_t am2302_temp; -volatile uint16_t am2302_hum; - - -uint8_t userRegister[1]; -int16_t sRH,sT; -volatile double temperatureC,humidityRH; -volatile double l; - - -int main(void){ - PRR|=(1<<PRADC); // adc for save Power - pack1.temp=0x0550; - pack1.config=0x7F; - pack1.TH=75; - pack1.TL=70; - pack1.rrFF=0xFF; - pack1.rr00=0; - pack1.rr10=0x10; - PORTA=0xFF; - 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; - USI_TWI_Master_Initialise(); - SHT2x_SoftReset(); - SHT2x_ReadUserRegister(userRegister); - //(userRegister & ~SHT2x_RES_MASK) | SHT2x_RES_10_13BIT; - SHT2x_WriteUserRegister(userRegister); //write changed user reg - // --- measure humidity with "Hold Master Mode (HM)" --- - SHT2x_MeasurePoll(HUMIDITY, &sRH); - // --- measure temperature with "Polling Mode" (no hold master) --- - SHT2x_MeasurePoll(TEMP, &sT); - //-- calculate humidity and temperature -- - temperatureC = SHT2x_CalcTemperatureC(sT); - humidityRH = SHT2x_CalcRH(sRH); - - gcontrol=1; - sei(); - while(1) { - if (wdcounter>0) { - SHT2x_MeasurePoll(HUMIDITY, &sRH); - // --- measure temperature with "Polling Mode" (no hold master) --- - SHT2x_MeasurePoll(TEMP, &sT); - //-- calculate humidity and temperature -- - temperatureC = SHT2x_CalcTemperatureC(sT)*10.0; - humidityRH = SHT2x_CalcRH(sRH)*10.0; - double hhum=(1.0546-0.000216*temperatureC)*(humidityRH); - am2302_hum=0.318*hhum +76.0; - am2302_temp=temperatureC*25.6; - wdcounter=0; - } - - if (gcontrol==1) { - 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>pack1.TH) af=1; - if (t8<=pack1.TL) af=1; - cli(); - pack1.temp=w; - //pack.temp++; - alarmflag=af; - sei(); - gcontrol=0; - } - if ((gcontrol==2)||(gcontrol==3)) { - 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_DS2438/DS18B20_DS2438.cproj b/DS18B20_DS2438/DS18B20_DS2438.cproj deleted file mode 100644 index dec1c59..0000000 --- a/DS18B20_DS2438/DS18B20_DS2438.cproj +++ /dev/null @@ -1,143 +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_DS2438</AssemblyName> - <Name>DS18B20_DS2438</Name> - <RootNamespace>DS18B20_DS2438</RootNamespace> - <ToolchainFlavour>Native</ToolchainFlavour> - <KeepTimersRunning>true</KeepTimersRunning> - <OverrideVtor>false</OverrideVtor> - <CacheFlash>true</CacheFlash> - <ProgFlashFromRam>true</ProgFlashFromRam> - <RamSnippetAddress>0x20000000</RamSnippetAddress> - <UncachedRange /> - <preserveEEPROM>true</preserveEEPROM> - <OverrideVtorValue>exception_table</OverrideVtorValue> - <BootSegment>2</BootSegment> - <eraseonlaunchrule>1</eraseonlaunchrule> - <AsfFrameworkConfig> - <framework-data xmlns=""> - <options /> - <configurations /> - <files /> - <documentation help="" /> - <offline-documentation help="" /> - <dependencies> - <content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.19.0" /> - </dependencies> - </framework-data> - </AsfFrameworkConfig> - <avrtool>com.atmel.avrdbg.tool.atmelice</avrtool> - <com_atmel_avrdbg_tool_atmelice> - <ToolOptions> - <InterfaceProperties> - </InterfaceProperties> - <InterfaceName>debugWIRE</InterfaceName> - </ToolOptions> - <ToolType>com.atmel.avrdbg.tool.atmelice</ToolType> - <ToolNumber>J41800000779</ToolNumber> - <ToolName>Atmel-ICE</ToolName> - </com_atmel_avrdbg_tool_atmelice> - <avrtoolinterface>debugWIRE</avrtoolinterface> - <com_atmel_avrdbg_tool_simulator> - <ToolOptions> - <InterfaceProperties> - </InterfaceProperties> - <InterfaceName> - </InterfaceName> - </ToolOptions> - <ToolType>com.atmel.avrdbg.tool.simulator</ToolType> - <ToolNumber> - </ToolNumber> - <ToolName>Simulator</ToolName> - </com_atmel_avrdbg_tool_simulator> - </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\SHT2x.c"> - <SubType>compile</SubType> - <Link>SHT2x.c</Link> - </Compile> - <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_DS2438.c"> - <SubType>compile</SubType> - </Compile> - <Compile Include="OWDS18B20_DS2438.S"> - <SubType>compile</SubType> - </Compile> - </ItemGroup> - <Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" /> -</Project> \ No newline at end of file diff --git a/DS18B20_DS2438/OWDS18B20_DS2438.S b/DS18B20_DS2438/OWDS18B20_DS2438.S deleted file mode 100644 index bf7146e..0000000 --- a/DS18B20_DS2438/OWDS18B20_DS2438.S +++ /dev/null @@ -1,347 +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 _CHANGEABLE_ID_ -#define _ZERO_POLLING_ -#define _DB_ - -#include "../common/OWConfig.s" -#include "../common/OWCRC8.s" - -.extern pack1,8 - -//.extern am2302_temp,2 - -#if defined(__AVR_ATtiny25__) -.extern pack2,16 -#else -.extern pack2,64 -#endif -.extern am2302_temp,2 -.extern am2302_hum,2 -.comm block,1 ; Block der augegeben, geschrieben wird (Parameter von READ/WRITE Scratchpad) - - -.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_func1 -.endm - -.macro COMMAND_TABLE - rjmp h_readscratchpad1 - rjmp h_writescratchpad1 - rjmp h_readscratchpad_adr2 - rjmp h_readscratchpad2 - rjmp h_writescratchpad_adr2 - rjmp h_writescratchpad2 -.endm - -#include "../common/OWRomFunctionsDual.s" -#include "../common/OWTimerInterrupt.s" - - - -; Ab hier Geraeteabhaenging -#define OW_READ_SCRATCHPAD1 OW_FIRST_COMMAND+0 -#define OW_WRITE_SCRATCHPAD1 OW_FIRST_COMMAND+1 -#define OW_READ_SCRATCHPAD_ADR2 OW_FIRST_COMMAND+2 -#define OW_READ_SCRATCHPAD2 OW_FIRST_COMMAND+3 -#define OW_WRITE_SCRATCHPAD_ADR2 OW_FIRST_COMMAND+4 -#define OW_WRITE_SCRATCHPAD2 OW_FIRST_COMMAND+5 - - -;--------------------------------------------------- -; READ COMMAND and start operation -;--------------------------------------------------- - - -h_readcommand1: - clr r_bytep -#ifndef _DIS_FLASH_ - FLASH_COMMANDS ; muss zu erst sein.... -#endif - cjmp 0xBE,hrc_set_readscratchpad1 - cjmp 0x4E,hrc_set_writescratchpad1 - 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 - ldi r_mode,OW_SLEEP - rjmp handle_end - -hrc_set_readscratchpad1: - ldi r_mode,OW_READ_SCRATCHPAD1 - ldi r_sendflag,1 - CRCInit2 - rjmp h_readscratchpad1 - -hrc_set_writescratchpad1: - ldi r_mode,OW_WRITE_SCRATCHPAD1 - ldi r_bytep,2 ;start to write in 2 - rjmp handle_end - -hrc_recall_eeprom1: - rcall hrc_recall_eeprom_func1 - rjmp handle_end - - - -hrc_set_convertT1: - ldi r_temp,1 - sts gcontrol,r_temp - - rjmp handle_end_sleep - - -hrc_copy_scratchpad1: - ldi r_bytep,2 - configZ pack1,r_bytep - clr r_bytep -hrc_copy_scratchpad_EEPROM_write1: - sbic _SFR_IO_ADDR(EECR), EEPE - rjmp hrc_copy_scratchpad_EEPROM_write1 - 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_write1 - rjmp handle_end - - -hrc_recall_eeprom_func1: - ldi r_bytep,2 - configZ pack1,r_bytep - clr r_bytep - clr r_temp -hrc_recall_eeprom_EEPROM_read1: - sbic _SFR_IO_ADDR(EECR), EEPE - rjmp hrc_recall_eeprom_EEPROM_read1 - 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_read1 - ret - - - - - - -;--------------------------------------------------- -; READ SCRATCHPAD -;--------------------------------------------------- - -h_readscratchpad1: - cpi r_bytep,8 - breq h_readscratchpad_crc1 - cpi r_bytep,9 - breq h_readscratchpad_all1 - configZ pack1,r_bytep - ld r_rwbyte,Z - rjmp h_readscratchpad_endc1 -h_readscratchpad_crc1: - lds r_rwbyte,crc -h_readscratchpad_endc1: - inc r_bytep - ldi r_bcount,1 - rjmp handle_end -h_readscratchpad_all1: - rjmp handle_end_sleep - - - - - -;--------------------------------------------------- -; WRITE SCRATCHPAD -;--------------------------------------------------- - -h_writescratchpad1: - configZ pack1,r_bytep - inc r_bytep - cpi r_bytep,5 - breq h_writescratchpad_all1 - st Z,r_rwbyte - rjmp handle_end -h_writescratchpad_all1: - ori r_rwbyte,0x1F ; Alle unteren Bits sind immer 1 - st Z,r_rwbyte - rjmp handle_end_sleep - -;***************************************************************************************************************************************************************************************** -;***************************************************************************************************************************************************************************************** -;***************************************************************************************************************************************************************************************** -;***************************************************************************************************************************************************************************************** -;***************************************************************************************************************************************************************************************** - - - - - -h_readcommand2: - clr r_bytep -#ifndef _DIS_FLASH_ - FLASH_COMMANDS ; muss zu erst sein.... -#endif - cset 0xBE,OW_READ_SCRATCHPAD_ADR2 - 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 - rjmp handle_end_sleep - - -hrc_set_convertT2: - ldi r_temp,2 - sts gcontrol,r_temp - lds r_temp,am2302_temp - sts pack2+1,r_temp - lds r_temp,am2302_temp+1 - sts pack2+2,r_temp - rjmp handle_end_sleep -hrc_set_convertV2: - lds r_temp,pack2 - sbrs r_temp,3 - rjmp hrc_set_convertVV2 - ldi r_temp,0xF4 - sts pack2+3,r_temp - ldi r_temp,0x01 - sts pack2+4,r_temp - rjmp hrc_set_convertend2 -hrc_set_convertVV2: - ldi r_temp,3 - sts gcontrol,r_temp - lds r_temp,am2302_hum - sts pack2+3,r_temp - lds r_temp,am2302_hum+1 - sts pack2+4,r_temp -hrc_set_convertend2: - rjmp handle_end_sleep - - - -;--------------------------------------------------- -; READ SCRATCHPAD -;--------------------------------------------------- - -h_readscratchpad_adr2: - lsl r_rwbyte - lsl r_rwbyte - lsl r_rwbyte -#if defined(__AVR_ATtiny25__) - andi r_rwbyte,0x01 ;nur Page 0 und 1 und das immer wiederholen -#endif - sts block,r_rwbyte - ldi r_sendflag,1 - ldi r_mode,OW_READ_SCRATCHPAD2 - CRCInit2 -h_readscratchpad2: - cpi r_bytep,8 - breq h_readscratchpad_crc2 - cpi r_bytep,9 - breq h_readscratchpad_all2 - lds r_temp,block - add r_temp,r_bytep - configZ pack2,r_temp - ld r_rwbyte,Z - rjmp handle_end_inc -h_readscratchpad_crc2: - lds r_rwbyte,crc - rjmp handle_end_inc -h_readscratchpad_all2: - rjmp handle_end_sleep - - - - -;--------------------------------------------------- -; WRITE SCRATCHPAD -;--------------------------------------------------- -h_writescratchpad_adr2: - lsl r_rwbyte - lsl r_rwbyte - lsl r_rwbyte -#if defined(__AVR_ATtiny25__) - andi r_rwbyte,0x01 ;nur Page 0 und 1 und das immer wiederholen -#endif - sts block,r_rwbyte - ldi r_mode,OW_WRITE_SCRATCHPAD2 - ldi r_bcount,1 - rjmp handle_end -h_writescratchpad2: - cpi r_bytep,8 - breq h_writescratchpad_all2 - lds r_temp,block - add r_temp,r_bytep - configZ pack2,r_temp - st Z,r_rwbyte - rjmp handle_end_inc -h_writescratchpad_all2: - rjmp handle_end_sleep - - - - - - - - - -#include "../common/OWPinInterrupt.s" -.end \ No newline at end of file diff --git a/DS18B20_MAX44009_DS2438_SHT/DS18B20_DS2438.c b/DS18B20_MAX44009_DS2438_SHT/DS18B20_DS2438.c new file mode 100644 index 0000000..d737c59 --- /dev/null +++ b/DS18B20_MAX44009_DS2438_SHT/DS18B20_DS2438.c @@ -0,0 +1,235 @@ + +// 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" +#include "../common/I2C/SHT2x.h" + + +extern void OWINIT(); + + + +uint8_t owid1[8]={0x28, 0xA3, 0xD9, 0x84, 0x00, 0x16, 0x05, 0x18};/**/ +uint8_t owid2[8]={0x26, 0xA3, 0xD9, 0x84, 0x00, 0x16, 0x05, 0x67};/**/ +uint8_t config_info1[16]={0x03,0x04, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; +uint8_t config_info2[16]={0x01,0x06, 0x05,0x08, 0x04,0x07, 0x00,0x00, 0x01,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; + + +#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 + +} + + +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 + }; +} pack1_t; +volatile pack1_t pack1; + + + +typedef union { + #if defined(__AVR_ATtiny25__) + volatile uint8_t bytes[16]; + #else + volatile uint8_t bytes[64]; + #endif + struct { + uint8_t status; //1 + int16_t temp; //2 + uint16_t voltage; //4 + uint16_t current; //6 + uint8_t threshold; //8 + + uint8_t page1[8]; //9 + #if defined(__AVR_ATtiny25__) + #else + uint8_t page2[8]; //17 + uint8_t page3[8]; //25 + uint8_t page4[8]; //33 + uint8_t page5[8]; //41 + uint8_t page6[8]; //49 + uint8_t page7[8]; //57 + //uint8_t crc; //65 + #endif + }; +} pack2_t; +volatile pack2_t pack2; + + + + +volatile int16_t am2302_temp; +volatile uint16_t am2302_hum; + + +uint8_t userRegister[1]; +int16_t sRH,sT; +volatile double temperatureC,humidityRH; +volatile double l; + + +int main(void){ + PRR|=(1<<PRADC); // adc for save Power + pack1.temp=0x0550; + pack1.config=0x7F; + pack1.TH=75; + pack1.TL=70; + pack1.rrFF=0xFF; + pack1.rr00=0; + pack1.rr10=0x10; + PORTA=0xFF; + 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; + USI_TWI_Master_Initialise(); + SHT2x_SoftReset(); + SHT2x_ReadUserRegister(userRegister); + //(userRegister & ~SHT2x_RES_MASK) | SHT2x_RES_10_13BIT; + SHT2x_WriteUserRegister(userRegister); //write changed user reg + // --- measure humidity with "Hold Master Mode (HM)" --- + SHT2x_MeasurePoll(HUMIDITY, &sRH); + // --- measure temperature with "Polling Mode" (no hold master) --- + SHT2x_MeasurePoll(TEMP, &sT); + //-- calculate humidity and temperature -- + temperatureC = SHT2x_CalcTemperatureC(sT); + humidityRH = SHT2x_CalcRH(sRH); + + gcontrol=1; + sei(); + while(1) { + if (wdcounter>0) { + SHT2x_MeasurePoll(HUMIDITY, &sRH); + // --- measure temperature with "Polling Mode" (no hold master) --- + SHT2x_MeasurePoll(TEMP, &sT); + //-- calculate humidity and temperature -- + temperatureC = SHT2x_CalcTemperatureC(sT)*10.0; + humidityRH = SHT2x_CalcRH(sRH)*10.0; + double hhum=(1.0546-0.000216*temperatureC)*(humidityRH); + am2302_hum=0.318*hhum +76.0; + am2302_temp=temperatureC*25.6; + wdcounter=0; + } + + if (gcontrol==1) { + l=MAX44009getlux(0); + 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>pack1.TH) af=1; + if (t8<=pack1.TL) af=1; + cli(); + pack1.temp=w; + //pack.temp++; + alarmflag=af; + sei(); + gcontrol=0; + } + if ((gcontrol==2)||(gcontrol==3)) { + 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_DS2438_SHT/DS18B20_DS2438_6_2.atsln b/DS18B20_MAX44009_DS2438_SHT/DS18B20_DS2438_6_2.atsln new file mode 100644 index 0000000..adaf496 --- /dev/null +++ b/DS18B20_MAX44009_DS2438_SHT/DS18B20_DS2438_6_2.atsln @@ -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_DS2438", "DS18B20_DS2438_6_2.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_DS2438_SHT/DS18B20_DS2438_6_2.cproj b/DS18B20_MAX44009_DS2438_SHT/DS18B20_DS2438_6_2.cproj new file mode 100644 index 0000000..dec1c59 --- /dev/null +++ b/DS18B20_MAX44009_DS2438_SHT/DS18B20_DS2438_6_2.cproj @@ -0,0 +1,143 @@ +<?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_DS2438</AssemblyName> + <Name>DS18B20_DS2438</Name> + <RootNamespace>DS18B20_DS2438</RootNamespace> + <ToolchainFlavour>Native</ToolchainFlavour> + <KeepTimersRunning>true</KeepTimersRunning> + <OverrideVtor>false</OverrideVtor> + <CacheFlash>true</CacheFlash> + <ProgFlashFromRam>true</ProgFlashFromRam> + <RamSnippetAddress>0x20000000</RamSnippetAddress> + <UncachedRange /> + <preserveEEPROM>true</preserveEEPROM> + <OverrideVtorValue>exception_table</OverrideVtorValue> + <BootSegment>2</BootSegment> + <eraseonlaunchrule>1</eraseonlaunchrule> + <AsfFrameworkConfig> + <framework-data xmlns=""> + <options /> + <configurations /> + <files /> + <documentation help="" /> + <offline-documentation help="" /> + <dependencies> + <content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.19.0" /> + </dependencies> + </framework-data> + </AsfFrameworkConfig> + <avrtool>com.atmel.avrdbg.tool.atmelice</avrtool> + <com_atmel_avrdbg_tool_atmelice> + <ToolOptions> + <InterfaceProperties> + </InterfaceProperties> + <InterfaceName>debugWIRE</InterfaceName> + </ToolOptions> + <ToolType>com.atmel.avrdbg.tool.atmelice</ToolType> + <ToolNumber>J41800000779</ToolNumber> + <ToolName>Atmel-ICE</ToolName> + </com_atmel_avrdbg_tool_atmelice> + <avrtoolinterface>debugWIRE</avrtoolinterface> + <com_atmel_avrdbg_tool_simulator> + <ToolOptions> + <InterfaceProperties> + </InterfaceProperties> + <InterfaceName> + </InterfaceName> + </ToolOptions> + <ToolType>com.atmel.avrdbg.tool.simulator</ToolType> + <ToolNumber> + </ToolNumber> + <ToolName>Simulator</ToolName> + </com_atmel_avrdbg_tool_simulator> + </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\SHT2x.c"> + <SubType>compile</SubType> + <Link>SHT2x.c</Link> + </Compile> + <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_DS2438.c"> + <SubType>compile</SubType> + </Compile> + <Compile Include="OWDS18B20_DS2438.S"> + <SubType>compile</SubType> + </Compile> + </ItemGroup> + <Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" /> +</Project> \ No newline at end of file diff --git a/DS18B20_MAX44009_DS2438_SHT/DS18B20_MAX44009_DS2438_SHT.atsln b/DS18B20_MAX44009_DS2438_SHT/DS18B20_MAX44009_DS2438_SHT.atsln new file mode 100644 index 0000000..634f63e --- /dev/null +++ b/DS18B20_MAX44009_DS2438_SHT/DS18B20_MAX44009_DS2438_SHT.atsln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Atmel Studio Solution File, Format Version 11.00 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "DS18B20_MAX44009_DS2438_SHT", "DS18B20_MAX44009_DS2438_SHT.cproj", "{7A5672FE-8226-4158-B931-E1F36B9A8858}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|AVR = Debug|AVR + Release|AVR = Release|AVR + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7A5672FE-8226-4158-B931-E1F36B9A8858}.Debug|AVR.ActiveCfg = Debug|AVR + {7A5672FE-8226-4158-B931-E1F36B9A8858}.Debug|AVR.Build.0 = Debug|AVR + {7A5672FE-8226-4158-B931-E1F36B9A8858}.Release|AVR.ActiveCfg = Release|AVR + {7A5672FE-8226-4158-B931-E1F36B9A8858}.Release|AVR.Build.0 = Release|AVR + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/DS18B20_MAX44009_DS2438_SHT/DS18B20_MAX44009_DS2438_SHT.cproj b/DS18B20_MAX44009_DS2438_SHT/DS18B20_MAX44009_DS2438_SHT.cproj new file mode 100644 index 0000000..1f7848f --- /dev/null +++ b/DS18B20_MAX44009_DS2438_SHT/DS18B20_MAX44009_DS2438_SHT.cproj @@ -0,0 +1,158 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <SchemaVersion>2.0</SchemaVersion> + <ProjectVersion>7.0</ProjectVersion> + <ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName> + <ProjectGuid>{7a5672fe-8226-4158-b931-e1f36b9a8858}</ProjectGuid> + <avrdevice>ATtiny84A</avrdevice> + <avrdeviceseries>none</avrdeviceseries> + <OutputType>Executable</OutputType> + <Language>C</Language> + <OutputFileName>$(MSBuildProjectName)</OutputFileName> + <OutputFileExtension>.elf</OutputFileExtension> + <OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory> + <AssemblyName>DS18B20_DS2438</AssemblyName> + <Name>DS18B20_MAX44009_DS2438_SHT</Name> + <RootNamespace>DS18B20_DS2438</RootNamespace> + <ToolchainFlavour>Native</ToolchainFlavour> + <KeepTimersRunning>true</KeepTimersRunning> + <OverrideVtor>false</OverrideVtor> + <CacheFlash>true</CacheFlash> + <ProgFlashFromRam>true</ProgFlashFromRam> + <RamSnippetAddress>0x20000000</RamSnippetAddress> + <UncachedRange /> + <preserveEEPROM>true</preserveEEPROM> + <OverrideVtorValue>exception_table</OverrideVtorValue> + <BootSegment>2</BootSegment> + <eraseonlaunchrule>1</eraseonlaunchrule> + <AsfFrameworkConfig> + <framework-data xmlns=""> + <options /> + <configurations /> + <files /> + <documentation help="" /> + <offline-documentation help="" /> + <dependencies> + <content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.19.0" /> + </dependencies> + </framework-data> + </AsfFrameworkConfig> + <avrtool>com.atmel.avrdbg.tool.atmelice</avrtool> + <com_atmel_avrdbg_tool_atmelice> + <ToolOptions> + <InterfaceProperties> + </InterfaceProperties> + <InterfaceName>debugWIRE</InterfaceName> + </ToolOptions> + <ToolType>com.atmel.avrdbg.tool.atmelice</ToolType> + <ToolNumber>J41800000779</ToolNumber> + <ToolName>Atmel-ICE</ToolName> + </com_atmel_avrdbg_tool_atmelice> + <avrtoolinterface>debugWIRE</avrtoolinterface> + <com_atmel_avrdbg_tool_simulator> + <ToolOptions> + <InterfaceProperties> + </InterfaceProperties> + <InterfaceName> + </InterfaceName> + </ToolOptions> + <ToolType>com.atmel.avrdbg.tool.simulator</ToolType> + <ToolNumber> + </ToolNumber> + <ToolName>Simulator</ToolName> + </com_atmel_avrdbg_tool_simulator> + <ExternalProgrammingToolCommand /> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> + <ToolchainSettings> + <AvrGcc> + <avrgcc.common.Device>-mmcu=attiny84a -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\gcc\dev\attiny84a"</avrgcc.common.Device> + <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex> + <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss> + <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep> + <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec> + <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures> + <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned> + <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned> + <avrgcc.compiler.symbols.DefSymbols> + <ListValues> + <Value>DEBUG</Value> + </ListValues> + </avrgcc.compiler.symbols.DefSymbols> + <avrgcc.compiler.directories.IncludePaths> + <ListValues> + <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\include</Value> + </ListValues> + </avrgcc.compiler.directories.IncludePaths> + <avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level> + <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers> + <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum> + <avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel> + <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings> + <avrgcc.linker.libraries.Libraries> + <ListValues> + <Value>libm</Value> + </ListValues> + </avrgcc.linker.libraries.Libraries> + <avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel> + </AvrGcc> + </ToolchainSettings> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> + <ToolchainSettings> + <AvrGcc> + <avrgcc.common.Device>-mmcu=attiny84a -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\gcc\dev\attiny84a"</avrgcc.common.Device> + <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex> + <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss> + <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep> + <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec> + <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures> + <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned> + <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned> + <avrgcc.compiler.symbols.DefSymbols> + <ListValues> + <Value>DEBUG</Value> + </ListValues> + </avrgcc.compiler.symbols.DefSymbols> + <avrgcc.compiler.directories.IncludePaths> + <ListValues> + <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\include</Value> + </ListValues> + </avrgcc.compiler.directories.IncludePaths> + <avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level> + <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers> + <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum> + <avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel> + <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings> + <avrgcc.linker.libraries.Libraries> + <ListValues> + <Value>libm</Value> + </ListValues> + </avrgcc.linker.libraries.Libraries> + <avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel> + </AvrGcc> + </ToolchainSettings> + </PropertyGroup> + <ItemGroup> + <Compile Include="..\common\I2C\SHT2x.c"> + <SubType>compile</SubType> + <Link>SHT2x.c</Link> + </Compile> + <Compile Include="D:\oc\dev\owSlave2\common\I2C\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_DS2438.c"> + <SubType>compile</SubType> + </Compile> + <Compile Include="OWDS18B20_DS2438.S"> + <SubType>compile</SubType> + </Compile> + </ItemGroup> + <Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" /> +</Project> \ No newline at end of file diff --git a/DS18B20_MAX44009_DS2438_SHT/OWDS18B20_DS2438.S b/DS18B20_MAX44009_DS2438_SHT/OWDS18B20_DS2438.S new file mode 100644 index 0000000..bf7146e --- /dev/null +++ b/DS18B20_MAX44009_DS2438_SHT/OWDS18B20_DS2438.S @@ -0,0 +1,347 @@ + +// 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_ +#define _DB_ + +#include "../common/OWConfig.s" +#include "../common/OWCRC8.s" + +.extern pack1,8 + +//.extern am2302_temp,2 + +#if defined(__AVR_ATtiny25__) +.extern pack2,16 +#else +.extern pack2,64 +#endif +.extern am2302_temp,2 +.extern am2302_hum,2 +.comm block,1 ; Block der augegeben, geschrieben wird (Parameter von READ/WRITE Scratchpad) + + +.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_func1 +.endm + +.macro COMMAND_TABLE + rjmp h_readscratchpad1 + rjmp h_writescratchpad1 + rjmp h_readscratchpad_adr2 + rjmp h_readscratchpad2 + rjmp h_writescratchpad_adr2 + rjmp h_writescratchpad2 +.endm + +#include "../common/OWRomFunctionsDual.s" +#include "../common/OWTimerInterrupt.s" + + + +; Ab hier Geraeteabhaenging +#define OW_READ_SCRATCHPAD1 OW_FIRST_COMMAND+0 +#define OW_WRITE_SCRATCHPAD1 OW_FIRST_COMMAND+1 +#define OW_READ_SCRATCHPAD_ADR2 OW_FIRST_COMMAND+2 +#define OW_READ_SCRATCHPAD2 OW_FIRST_COMMAND+3 +#define OW_WRITE_SCRATCHPAD_ADR2 OW_FIRST_COMMAND+4 +#define OW_WRITE_SCRATCHPAD2 OW_FIRST_COMMAND+5 + + +;--------------------------------------------------- +; READ COMMAND and start operation +;--------------------------------------------------- + + +h_readcommand1: + clr r_bytep +#ifndef _DIS_FLASH_ + FLASH_COMMANDS ; muss zu erst sein.... +#endif + cjmp 0xBE,hrc_set_readscratchpad1 + cjmp 0x4E,hrc_set_writescratchpad1 + 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 + ldi r_mode,OW_SLEEP + rjmp handle_end + +hrc_set_readscratchpad1: + ldi r_mode,OW_READ_SCRATCHPAD1 + ldi r_sendflag,1 + CRCInit2 + rjmp h_readscratchpad1 + +hrc_set_writescratchpad1: + ldi r_mode,OW_WRITE_SCRATCHPAD1 + ldi r_bytep,2 ;start to write in 2 + rjmp handle_end + +hrc_recall_eeprom1: + rcall hrc_recall_eeprom_func1 + rjmp handle_end + + + +hrc_set_convertT1: + ldi r_temp,1 + sts gcontrol,r_temp + + rjmp handle_end_sleep + + +hrc_copy_scratchpad1: + ldi r_bytep,2 + configZ pack1,r_bytep + clr r_bytep +hrc_copy_scratchpad_EEPROM_write1: + sbic _SFR_IO_ADDR(EECR), EEPE + rjmp hrc_copy_scratchpad_EEPROM_write1 + 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_write1 + rjmp handle_end + + +hrc_recall_eeprom_func1: + ldi r_bytep,2 + configZ pack1,r_bytep + clr r_bytep + clr r_temp +hrc_recall_eeprom_EEPROM_read1: + sbic _SFR_IO_ADDR(EECR), EEPE + rjmp hrc_recall_eeprom_EEPROM_read1 + 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_read1 + ret + + + + + + +;--------------------------------------------------- +; READ SCRATCHPAD +;--------------------------------------------------- + +h_readscratchpad1: + cpi r_bytep,8 + breq h_readscratchpad_crc1 + cpi r_bytep,9 + breq h_readscratchpad_all1 + configZ pack1,r_bytep + ld r_rwbyte,Z + rjmp h_readscratchpad_endc1 +h_readscratchpad_crc1: + lds r_rwbyte,crc +h_readscratchpad_endc1: + inc r_bytep + ldi r_bcount,1 + rjmp handle_end +h_readscratchpad_all1: + rjmp handle_end_sleep + + + + + +;--------------------------------------------------- +; WRITE SCRATCHPAD +;--------------------------------------------------- + +h_writescratchpad1: + configZ pack1,r_bytep + inc r_bytep + cpi r_bytep,5 + breq h_writescratchpad_all1 + st Z,r_rwbyte + rjmp handle_end +h_writescratchpad_all1: + ori r_rwbyte,0x1F ; Alle unteren Bits sind immer 1 + st Z,r_rwbyte + rjmp handle_end_sleep + +;***************************************************************************************************************************************************************************************** +;***************************************************************************************************************************************************************************************** +;***************************************************************************************************************************************************************************************** +;***************************************************************************************************************************************************************************************** +;***************************************************************************************************************************************************************************************** + + + + + +h_readcommand2: + clr r_bytep +#ifndef _DIS_FLASH_ + FLASH_COMMANDS ; muss zu erst sein.... +#endif + cset 0xBE,OW_READ_SCRATCHPAD_ADR2 + 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 + rjmp handle_end_sleep + + +hrc_set_convertT2: + ldi r_temp,2 + sts gcontrol,r_temp + lds r_temp,am2302_temp + sts pack2+1,r_temp + lds r_temp,am2302_temp+1 + sts pack2+2,r_temp + rjmp handle_end_sleep +hrc_set_convertV2: + lds r_temp,pack2 + sbrs r_temp,3 + rjmp hrc_set_convertVV2 + ldi r_temp,0xF4 + sts pack2+3,r_temp + ldi r_temp,0x01 + sts pack2+4,r_temp + rjmp hrc_set_convertend2 +hrc_set_convertVV2: + ldi r_temp,3 + sts gcontrol,r_temp + lds r_temp,am2302_hum + sts pack2+3,r_temp + lds r_temp,am2302_hum+1 + sts pack2+4,r_temp +hrc_set_convertend2: + rjmp handle_end_sleep + + + +;--------------------------------------------------- +; READ SCRATCHPAD +;--------------------------------------------------- + +h_readscratchpad_adr2: + lsl r_rwbyte + lsl r_rwbyte + lsl r_rwbyte +#if defined(__AVR_ATtiny25__) + andi r_rwbyte,0x01 ;nur Page 0 und 1 und das immer wiederholen +#endif + sts block,r_rwbyte + ldi r_sendflag,1 + ldi r_mode,OW_READ_SCRATCHPAD2 + CRCInit2 +h_readscratchpad2: + cpi r_bytep,8 + breq h_readscratchpad_crc2 + cpi r_bytep,9 + breq h_readscratchpad_all2 + lds r_temp,block + add r_temp,r_bytep + configZ pack2,r_temp + ld r_rwbyte,Z + rjmp handle_end_inc +h_readscratchpad_crc2: + lds r_rwbyte,crc + rjmp handle_end_inc +h_readscratchpad_all2: + rjmp handle_end_sleep + + + + +;--------------------------------------------------- +; WRITE SCRATCHPAD +;--------------------------------------------------- +h_writescratchpad_adr2: + lsl r_rwbyte + lsl r_rwbyte + lsl r_rwbyte +#if defined(__AVR_ATtiny25__) + andi r_rwbyte,0x01 ;nur Page 0 und 1 und das immer wiederholen +#endif + sts block,r_rwbyte + ldi r_mode,OW_WRITE_SCRATCHPAD2 + ldi r_bcount,1 + rjmp handle_end +h_writescratchpad2: + cpi r_bytep,8 + breq h_writescratchpad_all2 + lds r_temp,block + add r_temp,r_bytep + configZ pack2,r_temp + st Z,r_rwbyte + rjmp handle_end_inc +h_writescratchpad_all2: + rjmp handle_end_sleep + + + + + + + + + +#include "../common/OWPinInterrupt.s" +.end \ No newline at end of file diff --git a/DS2438_DHT22/DS2438_DHT22.c b/DS2438_DHT22/DS2438_DHT22.c index c5981c0..6d4a5a0 100644 --- a/DS2438_DHT22/DS2438_DHT22.c +++ b/DS2438_DHT22/DS2438_DHT22.c @@ -43,7 +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}; +uint8_t config_info[16]={0x01,0x06, 0x05,0x08, 0x04,0x07, 0x00,0x00, 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; extern uint8_t mode; diff --git a/DS2438_DHT22/DS2438_DHT22.cproj b/DS2438_DHT22/DS2438_DHT22.cproj index fc976a9..cc45178 100644 --- a/DS2438_DHT22/DS2438_DHT22.cproj +++ b/DS2438_DHT22/DS2438_DHT22.cproj @@ -2,7 +2,7 @@ <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <SchemaVersion>2.0</SchemaVersion> - <ProjectVersion>6.2</ProjectVersion> + <ProjectVersion>7.0</ProjectVersion> <ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName> <ProjectGuid>{91468d4f-8ae2-4c59-8a35-549c49e00934}</ProjectGuid> <avrdevice>ATtiny84A</avrdevice> @@ -50,61 +50,76 @@ <ToolName>Atmel-ICE</ToolName> </com_atmel_avrdbg_tool_atmelice> <avrtoolinterface>debugWIRE</avrtoolinterface> + <ExternalProgrammingToolCommand /> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> <ToolchainSettings> <AvrGcc> - <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex> - <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss> - <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep> - <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec> - <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures> - <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned> - <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned> - <avrgcc.compiler.symbols.DefSymbols> - <ListValues> - <Value>NDEBUG</Value> - </ListValues> - </avrgcc.compiler.symbols.DefSymbols> - <avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level> - <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers> - <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum> - <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings> - <avrgcc.linker.libraries.Libraries> - <ListValues> - <Value>libm</Value> - </ListValues> - </avrgcc.linker.libraries.Libraries> - </AvrGcc> + <avrgcc.common.Device>-mmcu=attiny84a -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\gcc\dev\attiny84a"</avrgcc.common.Device> + <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex> + <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss> + <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep> + <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec> + <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures> + <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned> + <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned> + <avrgcc.compiler.symbols.DefSymbols> + <ListValues> + <Value>DEBUG</Value> + </ListValues> + </avrgcc.compiler.symbols.DefSymbols> + <avrgcc.compiler.directories.IncludePaths> + <ListValues> + <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\include</Value> + </ListValues> + </avrgcc.compiler.directories.IncludePaths> + <avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level> + <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers> + <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum> + <avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel> + <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings> + <avrgcc.linker.libraries.Libraries> + <ListValues> + <Value>libm</Value> + </ListValues> + </avrgcc.linker.libraries.Libraries> + <avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel> +</AvrGcc> </ToolchainSettings> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> <ToolchainSettings> <AvrGcc> - <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex> - <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss> - <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep> - <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec> - <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures> - <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned> - <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned> - <avrgcc.compiler.symbols.DefSymbols> - <ListValues> - <Value>DEBUG</Value> - </ListValues> - </avrgcc.compiler.symbols.DefSymbols> - <avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level> - <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers> - <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum> - <avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel> - <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings> - <avrgcc.linker.libraries.Libraries> - <ListValues> - <Value>libm</Value> - </ListValues> - </avrgcc.linker.libraries.Libraries> - <avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel> - </AvrGcc> + <avrgcc.common.Device>-mmcu=attiny84a -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\gcc\dev\attiny84a"</avrgcc.common.Device> + <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex> + <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss> + <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep> + <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec> + <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures> + <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned> + <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned> + <avrgcc.compiler.symbols.DefSymbols> + <ListValues> + <Value>DEBUG</Value> + </ListValues> + </avrgcc.compiler.symbols.DefSymbols> + <avrgcc.compiler.directories.IncludePaths> + <ListValues> + <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\include</Value> + </ListValues> + </avrgcc.compiler.directories.IncludePaths> + <avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level> + <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers> + <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum> + <avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel> + <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings> + <avrgcc.linker.libraries.Libraries> + <ListValues> + <Value>libm</Value> + </ListValues> + </avrgcc.linker.libraries.Libraries> + <avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel> +</AvrGcc> </ToolchainSettings> </PropertyGroup> <ItemGroup> diff --git a/DS2450/DS2450.atsln b/DS2450/DS2450.atsln index e8c4ea1..361cfa6 100644 --- a/DS2450/DS2450.atsln +++ b/DS2450/DS2450.atsln @@ -1,6 +1,8 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 +Microsoft Visual Studio Solution File, Format Version 12.00 # Atmel Studio Solution File, Format Version 11.00 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "DS2450", "DS2450.cproj", "{7A5672FE-8226-4158-B931-E1F36B9A8858}" EndProject Global diff --git a/DS2450/DS2450.c b/DS2450/DS2450.c index 74d24dd..4ca471f 100644 --- a/DS2450/DS2450.c +++ b/DS2450/DS2450.c @@ -42,7 +42,7 @@ 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}; +uint8_t config_info[16]={0x06,0x09,0x06,0x09,0x06,0x09,0x06,0x09,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; #if (owid>128) #error "Variable not correct" diff --git a/DS2450/DS2450.cproj b/DS2450/DS2450.cproj index 95a82ba..9e51646 100644 --- a/DS2450/DS2450.cproj +++ b/DS2450/DS2450.cproj @@ -2,7 +2,7 @@ <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <SchemaVersion>2.0</SchemaVersion> - <ProjectVersion>6.2</ProjectVersion> + <ProjectVersion>7.0</ProjectVersion> <ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName> <ProjectGuid>{7a5672fe-8226-4158-b931-e1f36b9a8858}</ProjectGuid> <avrdevice>ATtiny84A</avrdevice> @@ -38,7 +38,7 @@ </dependencies> </framework-data> </AsfFrameworkConfig> - <avrtool>com.atmel.avrdbg.tool.atmelice</avrtool> + <avrtool>com.atmel.avrdbg.tool.avrdragon</avrtool> <com_atmel_avrdbg_tool_atmelice> <ToolOptions> <InterfaceProperties> @@ -50,61 +50,88 @@ <ToolName>Atmel-ICE</ToolName> </com_atmel_avrdbg_tool_atmelice> <avrtoolinterface>debugWIRE</avrtoolinterface> + <ExternalProgrammingToolCommand /> + <avrtoolserialnumber>00A20004766E</avrtoolserialnumber> + <avrdeviceexpectedsignature>0x1E930C</avrdeviceexpectedsignature> + <com_atmel_avrdbg_tool_avrdragon> + <ToolOptions> + <InterfaceProperties> + </InterfaceProperties> + <InterfaceName>debugWIRE</InterfaceName> + </ToolOptions> + <ToolType>com.atmel.avrdbg.tool.avrdragon</ToolType> + <ToolNumber>00A20004766E</ToolNumber> + <ToolName>AVR Dragon</ToolName> + </com_atmel_avrdbg_tool_avrdragon> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> <ToolchainSettings> <AvrGcc> - <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex> - <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss> - <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep> - <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec> - <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures> - <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned> - <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned> - <avrgcc.compiler.symbols.DefSymbols> - <ListValues> - <Value>NDEBUG</Value> - </ListValues> - </avrgcc.compiler.symbols.DefSymbols> - <avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level> - <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers> - <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum> - <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings> - <avrgcc.linker.libraries.Libraries> - <ListValues> - <Value>libm</Value> - </ListValues> - </avrgcc.linker.libraries.Libraries> - </AvrGcc> + <avrgcc.common.Device>-mmcu=attiny84a -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\gcc\dev\attiny84a"</avrgcc.common.Device> + <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex> + <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss> + <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep> + <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec> + <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures> + <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned> + <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned> + <avrgcc.compiler.symbols.DefSymbols> + <ListValues> + <Value>DEBUG</Value> + </ListValues> + </avrgcc.compiler.symbols.DefSymbols> + <avrgcc.compiler.directories.IncludePaths> + <ListValues> + <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\include</Value> + </ListValues> + </avrgcc.compiler.directories.IncludePaths> + <avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level> + <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers> + <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum> + <avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel> + <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings> + <avrgcc.linker.libraries.Libraries> + <ListValues> + <Value>libm</Value> + </ListValues> + </avrgcc.linker.libraries.Libraries> + <avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel> +</AvrGcc> </ToolchainSettings> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> <ToolchainSettings> <AvrGcc> - <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex> - <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss> - <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep> - <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec> - <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures> - <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned> - <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned> - <avrgcc.compiler.symbols.DefSymbols> - <ListValues> - <Value>DEBUG</Value> - </ListValues> - </avrgcc.compiler.symbols.DefSymbols> - <avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level> - <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers> - <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum> - <avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel> - <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings> - <avrgcc.linker.libraries.Libraries> - <ListValues> - <Value>libm</Value> - </ListValues> - </avrgcc.linker.libraries.Libraries> - <avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel> - </AvrGcc> + <avrgcc.common.Device>-mmcu=attiny84a -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\gcc\dev\attiny84a"</avrgcc.common.Device> + <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex> + <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss> + <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep> + <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec> + <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures> + <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned> + <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned> + <avrgcc.compiler.symbols.DefSymbols> + <ListValues> + <Value>DEBUG</Value> + </ListValues> + </avrgcc.compiler.symbols.DefSymbols> + <avrgcc.compiler.directories.IncludePaths> + <ListValues> + <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\include</Value> + </ListValues> + </avrgcc.compiler.directories.IncludePaths> + <avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level> + <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers> + <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum> + <avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel> + <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings> + <avrgcc.linker.libraries.Libraries> + <ListValues> + <Value>libm</Value> + </ListValues> + </avrgcc.linker.libraries.Libraries> + <avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel> +</AvrGcc> </ToolchainSettings> </PropertyGroup> <ItemGroup> diff --git a/common/OWRomFunctionsDual.s b/common/OWRomFunctionsDual.s index 09ed5be..59b3d40 100644 --- a/common/OWRomFunctionsDual.s +++ b/common/OWRomFunctionsDual.s @@ -178,7 +178,7 @@ hrc_jmp_flasher: lds r_temp,flashmarker cpi r_temp,2 brne hrc_jmp_flasher_inc - ldi r_temp,0xE0 + ldi r_temp,0xC0 push r_temp ldi r_temp,0x0E push r_temp @@ -559,7 +559,7 @@ OWINIT: sbic _SFR_IO_ADDR(PINA),PINA5 rjmp owinit_botest_end ;PINA5 nicht 0.... nicht verbunden cbi _SFR_IO_ADDR(DDRA),PINA4 - ldi r_temp,0xE0 + ldi r_temp,0xC0 push r_temp ldi r_temp,0x0E push r_temp diff --git a/programmer/flash/flashp.bat b/programmer/flash/flashp.bat index 02aef01..bf1b335 100644 --- a/programmer/flash/flashp.bat +++ b/programmer/flash/flashp.bat @@ -1,2 +1,2 @@ -avrdude -c usbasp -p t84 -U lfuse:w:0xE2:m -U hfuse:w:0xDF:m +avrdude -c usbasp -p t84 -U lfuse:w:0xE2:m -U hfuse:w:0xDF:m -U efuse:w:0xFE:m avrdude -c usbasp -p t84 -e -U flash:w:"../programmer/Debug/programmer.hex" diff --git a/programmer/programmer/programmer.asmproj b/programmer/programmer/programmer.asmproj index 509f82c..8a2ba95 100644 --- a/programmer/programmer/programmer.asmproj +++ b/programmer/programmer/programmer.asmproj @@ -57,29 +57,29 @@ <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> <ToolchainSettings> <AvrAssembler> - <avrasm.assembler.general.AdditionalIncludeDirectories> - <ListValues> - <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\avrasm\inc</Value> - <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\avrasm\inc</Value> - </ListValues> - </avrasm.assembler.general.AdditionalIncludeDirectories> - <avrasm.assembler.general.IncludeFile>tn84adef.inc</avrasm.assembler.general.IncludeFile> -</AvrAssembler> + <avrasm.assembler.general.AdditionalIncludeDirectories> + <ListValues> + <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\avrasm\inc</Value> + <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\avrasm\inc</Value> + </ListValues> + </avrasm.assembler.general.AdditionalIncludeDirectories> + <avrasm.assembler.general.IncludeFile>tn84adef.inc</avrasm.assembler.general.IncludeFile> + </AvrAssembler> </ToolchainSettings> <OutputType>Executable</OutputType> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> <ToolchainSettings> <AvrAssembler> - <avrasm.assembler.general.AdditionalIncludeDirectories> - <ListValues> - <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\avrasm\inc</Value> - <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\avrasm\inc</Value> - <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\avrasm\inc</Value> - </ListValues> - </avrasm.assembler.general.AdditionalIncludeDirectories> - <avrasm.assembler.general.IncludeFile>tn84adef.inc</avrasm.assembler.general.IncludeFile> -</AvrAssembler> + <avrasm.assembler.general.AdditionalIncludeDirectories> + <ListValues> + <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\avrasm\inc</Value> + <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\avrasm\inc</Value> + <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\avrasm\inc</Value> + </ListValues> + </avrasm.assembler.general.AdditionalIncludeDirectories> + <avrasm.assembler.general.IncludeFile>tn84adef.inc</avrasm.assembler.general.IncludeFile> + </AvrAssembler> </ToolchainSettings> </PropertyGroup> <ItemGroup>