X-Git-Url: http://git.smho.de/gw/?a=blobdiff_plain;f=DS18B20_BMP280_DS2438_SHT%2FOWDS18B20_DS2438.S;fp=DS18B20_BMP280_DS2438_SHT%2FOWDS18B20_DS2438.S;h=bf7146e5a7188125a35eac3fd757101e73d32b38;hb=28c2911a7459ae2977c0cb0228c0ca2af1c345bf;hp=0000000000000000000000000000000000000000;hpb=6aa7a2df05f4f65bf6c7260487a470798a5ed1b1;p=owSlave2.git 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<