From 4df4c7ba2c95a48e95873b1f3a93d62ed9727eba Mon Sep 17 00:00:00 2001 From: Tobias Date: Thu, 15 Oct 2015 08:38:33 +0200 Subject: [PATCH] Change Slave sends '0' during convert prozess on all DS18B20 Auto find MAX44009 Config Bytes on DS18B20_TC --- DS18B20_BMP280/DS18B20_BMP280.c | 7 +- DS18B20_BMP280/OWDS18B20.S | 12 +- .../DS18B20_BMP280_DS2438_SHT.atsln | 22 +++ .../DS18B20_BMP280_DS2438_SHT.cproj | 158 ++++++++++++++++++ DS18B20_BMP280_DS2438_SHT/DS18B20_DS2438.c | 4 +- DS18B20_BMP280_DS2438_SHT/OWDS18B20_DS2438.S | 18 +- DS18B20_MAX44009/DS18B20_MAX44009.c | 15 +- DS18B20_MAX44009/OWDS18B20.S | 11 +- DS18B20_MAX44009_DS2438_SHT/DS18B20_DS2438.c | 12 +- .../OWDS18B20_DS2438.S | 19 ++- DS18B20_Thermocouble/DS18B20_TC.c | 15 +- DS18B20_Thermocouble/DS18B20_TC.cproj | 109 ++++++------ DS18B20_Thermocouble/OWDS18B20.S | 10 +- DS2450/DS2450.atsln | 10 +- DS2450/DS2450.c | 17 +- DS2450/DS2450.cproj | 46 ++--- DS2450/OWDS2450.S | 14 +- common/I2C/MAX44009.c | 16 ++ common/I2C/MAX44009.h | 2 +- common/I2C/SHT2x.c | 2 +- common/OWPinInterrupt.s | 5 +- common/OWRomFunctions.s | 15 ++ common/OWRomFunctionsDual.s | 14 ++ programmer/flash/flashp.bat | 2 +- 24 files changed, 420 insertions(+), 135 deletions(-) create mode 100644 DS18B20_BMP280_DS2438_SHT/DS18B20_BMP280_DS2438_SHT.atsln create mode 100644 DS18B20_BMP280_DS2438_SHT/DS18B20_BMP280_DS2438_SHT.cproj diff --git a/DS18B20_BMP280/DS18B20_BMP280.c b/DS18B20_BMP280/DS18B20_BMP280.c index 313a368..4a78bad 100644 --- a/DS18B20_BMP280/DS18B20_BMP280.c +++ b/DS18B20_BMP280/DS18B20_BMP280.c @@ -43,6 +43,7 @@ extern void OWINIT(); +extern void EXTERN_SLEEP(); @@ -102,12 +103,13 @@ int main(void){ MCUSR=0; USI_TWI_Master_Initialise(); bmp280Init(); - + //DDRB|=(1< + + + 2.0 + 7.0 + com.Atmel.AVRGCC8.C + {7a5672fe-8226-4158-b931-e1f36b9a8858} + ATtiny84A + none + Executable + C + $(MSBuildProjectName) + .elf + $(MSBuildProjectDirectory)\$(Configuration) + DS18B20_DS2438 + DS18B20_BMP280_DS2438_SHT + DS18B20_DS2438 + Native + true + false + true + true + 0x20000000 + + true + exception_table + 2 + 1 + + + + + + + + + + + + + com.atmel.avrdbg.tool.atmelice + + + + + debugWIRE + + com.atmel.avrdbg.tool.atmelice + J41800000779 + Atmel-ICE + + debugWIRE + + + + + + + + com.atmel.avrdbg.tool.simulator + + + Simulator + + + + + + + -mmcu=attiny84a -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\gcc\dev\attiny84a" + True + True + True + True + False + True + True + + + DEBUG + + + + + %24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\include + + + Optimize (-O1) + True + True + Default (-g2) + True + + + libm + + + Default (-Wa,-g) + + + + + + + -mmcu=attiny84a -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\gcc\dev\attiny84a" + True + True + True + True + False + True + True + + + DEBUG + + + + + %24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\include + + + Optimize (-O1) + True + True + Default (-g2) + True + + + libm + + + Default (-Wa,-g) + + + + + + compile + SHT2x.c + + + compile + BMP280.c + + + compile + USI_TWI_Master.c + + + compile + + + compile + + + + \ No newline at end of file diff --git a/DS18B20_BMP280_DS2438_SHT/DS18B20_DS2438.c b/DS18B20_BMP280_DS2438_SHT/DS18B20_DS2438.c index 4aec172..8d995eb 100644 --- a/DS18B20_BMP280_DS2438_SHT/DS18B20_DS2438.c +++ b/DS18B20_BMP280_DS2438_SHT/DS18B20_DS2438.c @@ -44,7 +44,7 @@ extern void OWINIT(); - +extern void EXTERN_SLEEP(); uint8_t owid1[8]={0x28, 0xA3, 0xD9, 0x84, 0x00, 0x16, 0x05, 0x18};/**/ @@ -207,7 +207,7 @@ int main(void){ //pack.temp++; alarmflag=af; sei(); - gcontrol=0; + EXTERN_SLEEP(); } if ((gcontrol==2)||(gcontrol==3)) { gcontrol=0; diff --git a/DS18B20_BMP280_DS2438_SHT/OWDS18B20_DS2438.S b/DS18B20_BMP280_DS2438_SHT/OWDS18B20_DS2438.S index bf7146e..e67690a 100644 --- a/DS18B20_BMP280_DS2438_SHT/OWDS18B20_DS2438.S +++ b/DS18B20_BMP280_DS2438_SHT/OWDS18B20_DS2438.S @@ -69,6 +69,7 @@ Init_EEPROM_read: .macro COMMAND_TABLE rjmp h_readscratchpad1 rjmp h_writescratchpad1 + rjmp h_convert_run1 rjmp h_readscratchpad_adr2 rjmp h_readscratchpad2 rjmp h_writescratchpad_adr2 @@ -83,10 +84,12 @@ Init_EEPROM_read: ; Ab hier Geraeteabhaenging #define OW_READ_SCRATCHPAD1 OW_FIRST_COMMAND+0 #define OW_WRITE_SCRATCHPAD1 OW_FIRST_COMMAND+1 -#define OW_READ_SCRATCHPAD_ADR2 OW_FIRST_COMMAND+2 -#define OW_READ_SCRATCHPAD2 OW_FIRST_COMMAND+3 -#define OW_WRITE_SCRATCHPAD_ADR2 OW_FIRST_COMMAND+4 -#define OW_WRITE_SCRATCHPAD2 OW_FIRST_COMMAND+5 +#define OW_CONVERT_RUN1 OW_FIRST_COMMAND+2 +#define OW_READ_SCRATCHPAD_ADR2 OW_FIRST_COMMAND+3 +#define OW_READ_SCRATCHPAD2 OW_FIRST_COMMAND+4 +#define OW_WRITE_SCRATCHPAD_ADR2 OW_FIRST_COMMAND+5 +#define OW_WRITE_SCRATCHPAD2 OW_FIRST_COMMAND+6 + ;--------------------------------------------------- @@ -132,7 +135,12 @@ hrc_set_convertT1: ldi r_temp,1 sts gcontrol,r_temp - rjmp handle_end_sleep + ldi r_mode,OW_CONVERT_RUN1 + ldi r_sendflag,3 ;set bit 0 and 1 for no zero polling +h_convert_run1: + ldi r_bcount,0 + ldi r_rwbyte,0 + rjmp handle_end_no_bcount hrc_copy_scratchpad1: diff --git a/DS18B20_MAX44009/DS18B20_MAX44009.c b/DS18B20_MAX44009/DS18B20_MAX44009.c index f4bd316..3447b6b 100644 --- a/DS18B20_MAX44009/DS18B20_MAX44009.c +++ b/DS18B20_MAX44009/DS18B20_MAX44009.c @@ -44,7 +44,7 @@ extern void OWINIT(); - +extern void EXTERN_SLEEP(); uint8_t owid[8]={0x28, 0xA2, 0xD9, 0x84, 0x00, 0x16, 0x77, 0x6B};/**/ @@ -60,7 +60,7 @@ extern uint8_t reset_indicator; extern uint8_t alarmflag; - +uint8_t max_adr=0; typedef union { volatile uint8_t bytes[8]; @@ -101,14 +101,16 @@ int main(void){ MCUSR=0; USI_TWI_Master_Initialise(); - + if (checkMAX44009(0)) max_adr=0; else max_adr=1 ; gcontrol=1; + //DDRB|=(1<0) { + //PORTB|=(1< extern void OWINIT(); +extern void EXTERN_SLEEP(); -//const float k_rs[54] PROGMEM ={0.000000,24.125000,48.585366,72.731707,96.829268,121.097561,145.700000,170.600000,195.650000,220.625000,245.365854,269.853659,294.119048,318.195122,342.166667,366.000000,389.761905,413.428571,437.023810,460.558140,484.047619,507.511628,530.976190,554.418605,577.883721,601.395349,624.952381,648.571429,672.285714,696.073171,719.976190,744.000000,768.146341,792.439024,816.853659,841.414634,866.125000,890.975000,916.000000,941.179487,966.525000,992.025641,1017.717949,1043.589744,1069.657895,1095.945946,1122.432432,1149.184211,1176.189189,1203.472222,1231.083333,1259.000000,1287.285714,1315.941176}; -const float j_rs[70] PROGMEM ={0, 18.302913, 34.830476, 50.783019, 70.653704, 90.505455, 110.341818, 130.165455, 149.163636, 160.791071, 180.596364, 200.398214, 220.200000, 240.000000, 250.882883, 270.603636, 290.409091, 310.216364, 330.025455, 342.472727, 360.649091, 380.461818, 400.275000, 420.087273, 435.275676, 450.703636, 470.503636, 490.298214, 510.082456, 523.486726, 540.621053, 560.370175, 580.105172, 591.979487, 610.527119, 630.213559, 644.601653, 660.534426, 680.168852, 690.787097, 710.391935, 729.123810, 740.559375, 760.126562, 770.684615, 790.235385, 800.782812, 820.331250, 834.681250, 850.446032, 870.017460, 880.600000, 900.196774, 911.099187, 930.432787, 950.073333, 960.728333, 980.396667, 1000.078333, 1010.772881, 1030.475862, 1050.187931, 1065.717241, 1080.631034, 1100.358621, 1120.089655, 1131.840000,1150.556897, 1170.294737, 1190.035088}; +const float k_rs[54] PROGMEM ={0.000000,24.125000,48.585366,72.731707,96.829268,121.097561,145.700000,170.600000,195.650000,220.625000,245.365854,269.853659,294.119048,318.195122,342.166667,366.000000,389.761905,413.428571,437.023810,460.558140,484.047619,507.511628,530.976190,554.418605,577.883721,601.395349,624.952381,648.571429,672.285714,696.073171,719.976190,744.000000,768.146341,792.439024,816.853659,841.414634,866.125000,890.975000,916.000000,941.179487,966.525000,992.025641,1017.717949,1043.589744,1069.657895,1095.945946,1122.432432,1149.184211,1176.189189,1203.472222,1231.083333,1259.000000,1287.285714,1315.941176}; +//const float j_rs[70] PROGMEM ={0, 18.302913, 34.830476, 50.783019, 70.653704, 90.505455, 110.341818, 130.165455, 149.163636, 160.791071, 180.596364, 200.398214, 220.200000, 240.000000, 250.882883, 270.603636, 290.409091, 310.216364, 330.025455, 342.472727, 360.649091, 380.461818, 400.275000, 420.087273, 435.275676, 450.703636, 470.503636, 490.298214, 510.082456, 523.486726, 540.621053, 560.370175, 580.105172, 591.979487, 610.527119, 630.213559, 644.601653, 660.534426, 680.168852, 690.787097, 710.391935, 729.123810, 740.559375, 760.126562, 770.684615, 790.235385, 800.782812, 820.331250, 834.681250, 850.446032, 870.017460, 880.600000, 900.196774, 911.099187, 930.432787, 950.073333, 960.728333, 980.396667, 1000.078333, 1010.772881, 1030.475862, 1050.187931, 1065.717241, 1080.631034, 1100.358621, 1120.089655, 1131.840000,1150.556897, 1170.294737, 1190.035088}; double gettemp_rs(double V) { uint8_t iv=(uint8_t)(V); - float t0=pgm_read_float(&(j_rs[iv])); - float t1=pgm_read_float(&(j_rs[iv+1])); + float t0=pgm_read_float(&(k_rs[iv])); + float t1=pgm_read_float(&(k_rs[iv+1])); return t0+(t1-t0)/1*(V-iv); } uint8_t owid[8]={0x28, 0xA2, 0xD9, 0x84, 0x00, 0x16, 0x02, 0xAC};/**/ -uint8_t config_info[16]={0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; +uint8_t config_info[16]={0x01,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; #if (owid>128) #error "Variable not correct" @@ -259,7 +260,7 @@ int main(void){ for(uint8_t i=0;i<16;i++) { sum+=ares[i]; } - V=sum/20.0/1024.0*1.174*1000.0/16.0; + V=sum/20.0/1024.0*1.12*1000.0/16.0; //V=sum/20.0/1024.0*1.01*1000.0/16.0; ktemp=gettemp_rs(V); owm_reset(); @@ -287,7 +288,7 @@ int main(void){ pack.temp=htemp; alarmflag=af; sei(); - gcontrol=0; + EXTERN_SLEEP(); PORTB&=~(1< 2.0 - 6.2 + 7.0 com.Atmel.AVRGCC8.C {7a5672fe-8226-4158-b931-e1f36b9a8858} ATtiny84A @@ -50,61 +50,76 @@ Atmel-ICE debugWIRE + - True - True - True - True - False - True - True - - - NDEBUG - - - Optimize for size (-Os) - True - True - True - - - libm - - - + -mmcu=attiny84a -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\gcc\dev\attiny84a" + True + True + True + True + False + True + True + + + DEBUG + + + + + %24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\include + + + Optimize (-O1) + True + True + Default (-g2) + True + + + libm + + + Default (-Wa,-g) + - True - True - True - True - False - True - True - - - DEBUG - - - Optimize (-O1) - True - True - Default (-g2) - True - - - libm - - - Default (-Wa,-g) - + -mmcu=attiny84a -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\gcc\dev\attiny84a" + True + True + True + True + False + True + True + + + DEBUG + + + + + %24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\include + + + Optimize (-O1) + True + True + Default (-g2) + True + + + libm + + + Default (-Wa,-g) + diff --git a/DS18B20_Thermocouble/OWDS18B20.S b/DS18B20_Thermocouble/OWDS18B20.S index 351b949..f9f2dc0 100644 --- a/DS18B20_Thermocouble/OWDS18B20.S +++ b/DS18B20_Thermocouble/OWDS18B20.S @@ -32,6 +32,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define _CHANGEABLE_ID_ +#define _ZERO_POLLING_ #include "../common/OWConfig.s" #include "../common/OWCRC8.s" @@ -59,6 +60,7 @@ Init_EEPROM_read: .macro COMMAND_TABLE rjmp h_readscratchpad rjmp h_writescratchpad + rjmp h_convert_run .endm #include "../common/OWRomFunctions.s" @@ -69,6 +71,7 @@ Init_EEPROM_read: ; Ab hier Geraeteabhaenging #define OW_READ_SCRATCHPAD OW_FIRST_COMMAND+0 #define OW_WRITE_SCRATCHPAD OW_FIRST_COMMAND+1 +#define OW_CONVERT_RUN OW_FIRST_COMMAND+2 ;--------------------------------------------------- @@ -137,7 +140,12 @@ hrc_set_convertT: ; ldi r_rwbyte,1 ;hrc_set_convertT_end: ; sts alarmflag,r_rwbyte - rjmp handle_end_sleep + ldi r_mode,OW_CONVERT_RUN + ldi r_sendflag,3 ;set bit 0 and 1 for no zero polling +h_convert_run: + ldi r_bcount,0 + ldi r_rwbyte,0 + rjmp handle_end_no_bcount hrc_copy_scratchpad: diff --git a/DS2450/DS2450.atsln b/DS2450/DS2450.atsln index 361cfa6..848bac3 100644 --- a/DS2450/DS2450.atsln +++ b/DS2450/DS2450.atsln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Atmel Studio Solution File, Format Version 11.00 VisualStudioVersion = 14.0.23107.0 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "DS2450", "DS2450.cproj", "{7A5672FE-8226-4158-B931-E1F36B9A8858}" +Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "DS2450", "DS2450.cproj", "{DCE6C7E3-EE26-4D79-826B-08594B9AD897}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,10 +11,10 @@ Global Release|AVR = Release|AVR EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7A5672FE-8226-4158-B931-E1F36B9A8858}.Debug|AVR.ActiveCfg = Debug|AVR - {7A5672FE-8226-4158-B931-E1F36B9A8858}.Debug|AVR.Build.0 = Debug|AVR - {7A5672FE-8226-4158-B931-E1F36B9A8858}.Release|AVR.ActiveCfg = Release|AVR - {7A5672FE-8226-4158-B931-E1F36B9A8858}.Release|AVR.Build.0 = Release|AVR + {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.ActiveCfg = Debug|AVR + {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.Build.0 = Debug|AVR + {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.ActiveCfg = Release|AVR + {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.Build.0 = Release|AVR EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/DS2450/DS2450.c b/DS2450/DS2450.c index 4ca471f..3567ab2 100644 --- a/DS2450/DS2450.c +++ b/DS2450/DS2450.c @@ -40,6 +40,7 @@ #include extern void OWINIT(); +extern void EXTERN_SLEEP(); uint8_t owid[8]={0x20, 0xA2, 0xD9, 0x84, 0x00, 0x16, 0x02, 0x5D};/**/ uint8_t config_info[16]={0x06,0x09,0x06,0x09,0x06,0x09,0x06,0x09,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; @@ -129,18 +130,21 @@ int main(void){ MCUCR &=~(1< - + 2.0 7.0 com.Atmel.AVRGCC8.C - {7a5672fe-8226-4158-b931-e1f36b9a8858} + dce6c7e3-ee26-4d79-826b-08594b9ad897 ATtiny84A none Executable @@ -26,19 +26,22 @@ exception_table 2 1 + - - - - - - - - - + + + + + + + + + - com.atmel.avrdbg.tool.avrdragon + com.atmel.avrdbg.tool.atmelice + J41800000779 + 0x1E930C @@ -50,19 +53,6 @@ Atmel-ICE debugWIRE - - 00A20004766E - 0x1E930C - - - - - debugWIRE - - com.atmel.avrdbg.tool.avrdragon - 00A20004766E - AVR Dragon - @@ -77,7 +67,7 @@ True - DEBUG + NDEBUG @@ -85,17 +75,15 @@ %24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\include - Optimize (-O1) + Optimize for size (-Os) True True - Default (-g2) True libm - Default (-Wa,-g) diff --git a/DS2450/OWDS2450.S b/DS2450/OWDS2450.S index 4fba4bc..aec56b7 100644 --- a/DS2450/OWDS2450.S +++ b/DS2450/OWDS2450.S @@ -32,6 +32,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define _CHANGEABLE_ID_ +#define _ZERO_POLLING_ #include "../common/OWConfig.s" #include "../common/OWCRC16.s" @@ -59,6 +60,7 @@ rjmp h_convert rjmp h_convertcrc1 rjmp h_convertcrc2 + rjmp h_convert_conv .endm #include "../common/OWRomFunctions.s" @@ -79,7 +81,7 @@ #define OW_CONVERT OW_FIRST_COMMAND+9 #define OW_CONVERT_CRC1 OW_FIRST_COMMAND+10 #define OW_CONVERT_CRC2 OW_FIRST_COMMAND+11 - +#define OW_CONVERT_CONV OW_FIRST_COMMAND+12 ;--------------------------------------------------- ; READ COMMAND and start operation @@ -230,9 +232,13 @@ h_convertcrc2: ldi r_temp,1 sts gcontrol,r_temp ;ldi r_bcount,1 - ldi r_mode,OW_SLEEP - clr r_sendflag - rjmp handle_end + ldi r_mode,OW_CONVERT_CONV + ;clr r_sendflag + ldi r_sendflag,3 ;set bit 0 and 1 for no zero polling +h_convert_conv: + ldi r_bcount,0 + ldi r_rwbyte,0 + rjmp handle_end_no_bcount diff --git a/common/I2C/MAX44009.c b/common/I2C/MAX44009.c index 8ec682d..426098e 100644 --- a/common/I2C/MAX44009.c +++ b/common/I2C/MAX44009.c @@ -38,6 +38,22 @@ #include "USI_TWI_Master.h" #include "MAX44009.h" +uint8_t checkMAX44009(uint8_t nr) { + volatile uint8_t b1; + nr=(nr<<1)&0x02f; + + I2c_StartCondition(); + I2c_WriteByte(0b10010100|nr); + I2c_WriteByte(0x03); + I2c_StartCondition(); + I2c_WriteByte (0b10010101|nr); + b1 =I2c_ReadByte(NO_ACK); + I2c_StopCondition(); + return b1!=0xFF; + +} + + double MAX44009getlux(uint8_t nr) { volatile uint8_t b1,b2; nr=(nr<<1)&0x02f; diff --git a/common/I2C/MAX44009.h b/common/I2C/MAX44009.h index 53e234c..366a236 100644 --- a/common/I2C/MAX44009.h +++ b/common/I2C/MAX44009.h @@ -33,6 +33,6 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. double MAX44009getlux(uint8_t nr); - +uint8_t checkMAX44009(uint8_t nr); #endif \ No newline at end of file diff --git a/common/I2C/SHT2x.c b/common/I2C/SHT2x.c index 157faca..effe916 100644 --- a/common/I2C/SHT2x.c +++ b/common/I2C/SHT2x.c @@ -128,7 +128,7 @@ uint8_t SHT2x_MeasurePoll(etSHT2xMeasureType eSHT2xMeasureType, int16_t *pMeasur //-- poll every 10ms for measurement ready. Timeout after 20 retries (200ms)-- do { I2c_StartCondition(); - _delay_ms(1000); //delay 10ms + _delay_ms(200); //delay 10ms if(i++ >= 20) break; } while(I2c_WriteByte (I2C_ADR_R) == ACK_ERROR); if (i>=20) error |= TIME_OUT_ERROR; diff --git a/common/OWPinInterrupt.s b/common/OWPinInterrupt.s index 00feec0..72aef80 100644 --- a/common/OWPinInterrupt.s +++ b/common/OWPinInterrupt.s @@ -115,12 +115,15 @@ iend: rjmp zeropolling rjmp no_zerromaker zeropolling: + sbrc r_sendflag,1 ; sendflag bit 1 -> switch off zeropolling in software eg for asking convert is donne (DS2450, DS18B20 and others) + rjmp no_zerromaker +zeropolling_h_loop: sbic OW_PIN,OW_PINN ;warten bis leitung wieder h rjmp zeropolling_wait ;leitung ist low ->Schleie in r_temp,TCNT_REG cpi r_temp,(~OWT_MIN_RESET)+OWT_ZP_WAIT_LOW_TO;aller zwei us zaehlt der timer brsh zeropolling_timeout ;Timeout Reset? - rjmp zeropolling + rjmp zeropolling_h_loop zeropolling_wait: sbis OW_PIN,OW_PINN ;warten bis leitung wieder l rjmp zeropolling_low_imp ;Leitung ist low raus aus schleufe diff --git a/common/OWRomFunctions.s b/common/OWRomFunctions.s index 0b1488d..9887940 100644 --- a/common/OWRomFunctions.s +++ b/common/OWRomFunctions.s @@ -471,3 +471,18 @@ owinit_botest_end: sts alarmflag,r_temp RESETZEROMARKER ret + + +.global EXTERN_SLEEP +EXTERN_SLEEP: + cli + push r_temp + ldi r_temp,0 + sts mode,r_temp ;SLEEP + sts gcontrol,r_temp + sts sendflag,r_temp + sts bcount,r_temp + RESETZEROMARKER + pop r_temp + sei + ret \ No newline at end of file diff --git a/common/OWRomFunctionsDual.s b/common/OWRomFunctionsDual.s index 59b3d40..adc571c 100644 --- a/common/OWRomFunctionsDual.s +++ b/common/OWRomFunctionsDual.s @@ -641,3 +641,17 @@ owinit_cpconfig2: sts alarmflag,r_temp RESETZEROMARKER ret + +.global EXTERN_SLEEP +EXTERN_SLEEP: + cli + push r_temp + ldi r_temp,0 + sts mode,r_temp ;SLEEP + sts gcontrol,r_temp + sts sendflag,r_temp + sts bcount,r_temp + RESETZEROMARKER + pop r_temp + sei + ret \ No newline at end of file diff --git a/programmer/flash/flashp.bat b/programmer/flash/flashp.bat index bf1b335..a44d5aa 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 -U efuse:w:0xFE:m -avrdude -c usbasp -p t84 -e -U flash:w:"../programmer/Debug/programmer.hex" +avrdude -c usbasp -p t84 -e -U flash:w:"../programmer/Release/programmer.hex" -- 2.34.1