From: Tobias Müller Date: Wed, 13 Jul 2016 20:58:25 +0000 (+0200) Subject: Some small changes, X-Git-Url: https://git.smho.de/?a=commitdiff_plain;h=1624c8ce9acb762d2cdc0b2f6b064448561ff752;p=owSlave2.git Some small changes, new BMP280 functions --- diff --git a/Attiny84A nur Feuchte.pdf b/Attiny84A nur Feuchte.pdf deleted file mode 100644 index c783249..0000000 Binary files a/Attiny84A nur Feuchte.pdf and /dev/null differ diff --git a/DS18B20_BMP280_DS2438_SHT/DS18B20.pdf b/DS18B20_BMP280_DS2438_SHT/DS18B20.pdf deleted file mode 100644 index a942d79..0000000 Binary files a/DS18B20_BMP280_DS2438_SHT/DS18B20.pdf and /dev/null differ diff --git a/DS18B20_MAX44009/DS18B20.pdf b/DS18B20_MAX44009/DS18B20.pdf deleted file mode 100644 index a942d79..0000000 Binary files a/DS18B20_MAX44009/DS18B20.pdf and /dev/null differ diff --git a/DS18B20_MAX44009_DS2438_SHT/DS18B20.pdf b/DS18B20_MAX44009_DS2438_SHT/DS18B20.pdf deleted file mode 100644 index a942d79..0000000 Binary files a/DS18B20_MAX44009_DS2438_SHT/DS18B20.pdf and /dev/null differ diff --git a/DS18B20_MAX44009_DS2438_SHT/DS18B20_DS2438.c b/DS18B20_MAX44009_DS2438_SHT/DS18B20_DS2438.c index f1d01be..e717ac4 100644 --- a/DS18B20_MAX44009_DS2438_SHT/DS18B20_DS2438.c +++ b/DS18B20_MAX44009_DS2438_SHT/DS18B20_DS2438.c @@ -216,7 +216,7 @@ int main(void){ // --- measure temperature with "Polling Mode" (no hold master) --- SHT2x_MeasurePoll(TEMP, &sT); //-- calculate humidity and temperature -- - temperatureC = SHT2x_CalcTemperatureC(sT)*10.0-4; + temperatureC = SHT2x_CalcTemperatureC(sT)*10.0-2; humidityRH = SHT2x_CalcRH(sRH)*10.0+5; if (humidityRH>1000) humidityRH=1000; if (testSW()) { diff --git a/DS18B20_MAX44009_DS2438_SHT/DS18B20_MAX44009_DS2438_SHT.cproj b/DS18B20_MAX44009_DS2438_SHT/DS18B20_MAX44009_DS2438_SHT.cproj index 2bbe71c..03def20 100644 --- a/DS18B20_MAX44009_DS2438_SHT/DS18B20_MAX44009_DS2438_SHT.cproj +++ b/DS18B20_MAX44009_DS2438_SHT/DS18B20_MAX44009_DS2438_SHT.cproj @@ -27,16 +27,16 @@ 2 1 - - - - - - - - - - + + + + + + + + + + com.atmel.avrdbg.tool.atmelice diff --git a/DS18B20_Thermocouble/DS18B20.pdf b/DS18B20_Thermocouble/DS18B20.pdf deleted file mode 100644 index a942d79..0000000 Binary files a/DS18B20_Thermocouble/DS18B20.pdf and /dev/null differ diff --git a/DS18B20_VOC/DS18B20.pdf b/DS18B20_VOC/DS18B20.pdf deleted file mode 100644 index a942d79..0000000 Binary files a/DS18B20_VOC/DS18B20.pdf and /dev/null differ diff --git a/DS18B20_VOC_DS2438_SHT/DS18B20.pdf b/DS18B20_VOC_DS2438_SHT/DS18B20.pdf deleted file mode 100644 index a942d79..0000000 Binary files a/DS18B20_VOC_DS2438_SHT/DS18B20.pdf and /dev/null differ diff --git a/DS18B20_VOC_DS2438_SHT/DS18B20_DS2438.c b/DS18B20_VOC_DS2438_SHT/DS18B20_DS2438.c index 3e1aafc..8e04299 100644 --- a/DS18B20_VOC_DS2438_SHT/DS18B20_DS2438.c +++ b/DS18B20_VOC_DS2438_SHT/DS18B20_DS2438.c @@ -31,6 +31,8 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//!!!!!Max Program size 7551 Byte + #define F_CPU 8000000UL #include #include @@ -132,7 +134,7 @@ typedef union { uint8_t page5[8]; //41 uint8_t page6[8]; //49 uint8_t page7[8]; //57 - //uint8_t crc; //65 + #endif }; } pack2_t; @@ -158,6 +160,7 @@ uint8_t max_adr=0; uint16_t weekmaxarr[8]; +//Kompensieren der Abhänigkeit von RS/RO von Temperatur und Luftfeuchte inline double interp(double t, double h) { double h2; double t2; @@ -171,6 +174,27 @@ uint16_t mr; uint8_t startup=10; double ip; + +int testSW(void) { + uint8_t r; + DDRB&=~(1<pack2.r_week_max) pack2.r_week_max=weekmaxarr[i]; } if (pack2.tol_d>7) { @@ -297,7 +325,8 @@ int main(void){ } else { pack2.R0=pack2.r_day_max; } - R0=pack2.R0/100.0-0.5*(pack2.R0/100-R0); + //R0=//R0-0.5*(pack2.R0/100-R0); + R0=R0-(R0-pack2.R0/100.0)*0.5 ; pack2.R0=R0*100; writeEEPROM(EEPROM_R0,pack2.R0); writeEEPROM(EEPROM_R0d,pack2.r_day_max); //Maximum des Tages @@ -314,21 +343,31 @@ int main(void){ humidityRH = SHT2x_CalcRH(sRH); ip=interp(temperatureC,humidityRH); pack2.ip=ip*1000; - humidityRH=calibr_hum(temperatureC,-0.45,humidityRH)*10.0; + humidityRH=calibr_hum(temperatureC,-0.2,humidityRH)*10.0; //humidityRH=humidityRH*10.0; - temperatureC =temperatureC *10.0-4.5; - hhum=(1.0546-0.000216*temperatureC)*(humidityRH); - am2302_hum=0.318*hhum +76.0; - am2302_temp=temperatureC*25.6; + temperatureC =temperatureC *10.0-2; + + + if (testSW()) { + am2302_hum= humidityRH*10.0; + am2302_temp=temperatureC*25.6; + //am2302_temp=am2302_temp-45; + config_info2[5]=8; + }else{ + hhum=(1.0546-0.000216*temperatureC)*(humidityRH); + //am2302_hum=0.318*hhum +76.0; + am2302_hum=0.31*hhum +80; + am2302_temp=temperatureC*25.6; + config_info2[5]=7; + } //PORTB&=~(1<pack2.r_day_max) { pack2.r_day_max=l*100; } - } - l=l/R0; - l=log(1/l); + } else if (l500) { - // l=100; - // } wdcounter=0; } diff --git a/DS18B20_VOC_DS2438_SHT/DS18B20_VOC_DS2438_SHT.hex b/DS18B20_VOC_DS2438_SHT/DS18B20_VOC_DS2438_SHT.hex deleted file mode 100644 index 9ac443e..0000000 --- a/DS18B20_VOC_DS2438_SHT/DS18B20_VOC_DS2438_SHT.hex +++ /dev/null @@ -1,435 +0,0 @@ -:100000003DC05AC356C055C079C453C052C051C038 -:1000100050C04FC04EC032C24CC04BC04AC049C095 -:1000200048C008000000BE922449123EABAAAA2A8A -:10003000BECDCCCC4C3E00000080BEABAAAAAA3EEE -:1000400000000000BF000000803F0000000000082A -:100050004178D3BB4387D1133D190E3CC3BD4282C7 -:10006000AD2B3E68EC8276BED98FE1A93E4C80EF85 -:10007000FFBE01C4FF7F3F000000000011241FBE2F -:10008000CFE5D2E0DEBFCDBF10E0A0E6B0E0E4ED0A -:10009000FAE102C005900D92A239B107D9F721E02B -:1000A000A2E9B0E001C01D92A736B207E1F76CD417 -:1000B0000FCDA6CF2FEFF1E02750FFBB60E0EAE8BD -:1000C000F0E007C02FEFF1E02F50FFBB60E0E2E867 -:1000D000F0E0E199FECF2EBBE09A1DB31F3F29F05F -:1000E0001193639523956830A1F708956AC311C0F1 -:1000F0004FC07FC0BCC0F2C16AC2BDC0C2C0D3C0C5 -:10010000DEC0EAC047C257C219C2A5C2AEC2BFC252 -:10011000C6C26627153591F0103FA9F01C3E39F193 -:100120004AC300911301023029F400EC0F930EE052 -:100130000F9308950395009313013DC303E00093CB -:10014000110142E03DC303E000931101E0E2F1E060 -:10015000E60F0027F01F3CC000911101013019F09B -:10016000023019F028C345E02BC346E029C30091B3 -:100170006601002341F71FC347E051E000E0009310 -:10018000600179C048E051E000E00093600179C06F -:100190003091110130FF0AC0EAE8F0E0E60F0027D5 -:1001A000F01F2081211711F03E7F79F0E2E8F0E0A6 -:1001B000E60F0027F01F2081211711F03D7F29F065 -:1001C00030931101673041F2FAC230931101F3C24A -:1001D000208100911101033021F026952695039589 -:1001E000FACF2695111F2695111F51E030E444E007 -:1001F000E8C2E0E2F1E0E60F0027F01F2191009154 -:100200001101033029F00130B9F00230E9F0D3C216 -:10021000107849F020FDCFC224FD0E7F22FD0D7F16 -:100220000093110119C021FDC6C224FF0E7F22FFD9 -:100230000D7F0093110110C0107819F025FFBBC28B -:100240000BC024FFB8C208C0107819F023FFB3C256 -:1002500003C022FFB0C200C000911101002309F4C5 -:10026000AAC26395603409F0B3CF552775CF5527DF -:1002700043E030E0A6C2E2E7F0E0E60F0027F01F1F -:1002800005C0E2E6F0E0E60F0027F01F603121F044 -:10029000613141F0108193C21091600190C21091C0 -:1002A00061018DC288C2E8E1F1E0E60F0027F01F8E -:1002B0001083673009F083C27EC24AE051E06830A3 -:1002C00039F0E8E1F1E0E60F0027F01F108177C276 -:1002D000552771C24BE073C230911101323031F0B9 -:1002E000EAE8F0E0E60F0027F01F05C0E2E8F0E0E2 -:1002F000E60F0027F01F0081101759F5613029F033 -:10030000653029F0663029F024C003E0600F639562 -:1003100057C22FEFF1E007E031FD0FE0201BFFBBDC -:10032000E8E1F1E060E0E199FECF00E00CBB2EBB1C -:1003300011911DBBE29AE19A63952395683099F774 -:100340009F938F93AF93BF933CD0BF91AF918F9109 -:100350009F9131C2000000000000000008950F933B -:1003600000E405BFDD9ADC9AF5DFCD9B0DC0CC9B88 -:100370000BC0DC98D49AEEDFCD9906C0D49800EC7F -:100380000F930EE00F93089500E806BD00E006BD50 -:1003900000E009BF00E40BBF02E003BFBA98C298B7 -:1003A00002E005BF6F931F93E199FCCF00E00FBB04 -:1003B00002E00EBBE09A0DB307FFD9D01F916F91F9 -:1003C0000F91CF93DF930F931F93FF92EF9272DE03 -:1003D00079DE68E000E0E0E2F1E0AAE8B0E0C2E83F -:1003E000D0E09D918991F92EF094E82EE09438E0C8 -:1003F000092F08232F2D2E2140E09695441FF694B7 -:10040000441F8695441FE694441F0695441F269575 -:10041000441F41933A9581F76A9519F7AAE8B0E02D -:10042000CBE6D0E007E01D9119930A95E1F7A2E829 -:10043000B0E0CBE7D0E007E01D9119930A95E1F712 -:1004400000E0009363010093620100936601BB9892 -:10045000EF90FF901F910F91DF91CF910895F89445 -:100460000F9300E000936301009365010093140172 -:1004700000936201BB980F91789408950F930FB782 -:100480000F93B29924C000E002BF01E008BFB29B05 -:10049000FECF08B700FD03C002B70035C0F000E092 -:1004A00002BF02B70E31E8F3BA9A02B70238E8F396 -:1004B000BA9801E00093630101E0009361010093A9 -:1004C0006201002700931401BB9800E40ABF09B73A -:1004D0000E7F09BF0F910FBF0F911895662718382F -:1004E00009F41FCE00E0009313011E3BB9F01E3447 -:1004F000D9F01434F1F0183421F1183BC1F015385B -:1005000009F43ACE153711F449E05AC1173A09F403 -:10051000D4CE193709F4DECE40E052C14CE051E0B0 -:1005200000E00093600136C04DE062E049C11FD099 -:1005300047C101E0009365014EE053E030E010E078 -:1005400040C162E0E4ECF0E0E60F0027F01F662710 -:10055000E199FECF00E00CBB00E00FBB6EBB119138 -:100560001DBBE29AE19A6395633091F729C162E07D -:10057000E4ECF0E0E60F0027F01F66270027E19982 -:10058000FECF0FBB6EBBE09A1DB311936395633032 -:10059000B1F70895683049F0693061F0E4ECF0E0BB -:1005A000E60F0027F01F108102C0109160016395D3 -:1005B00031E006C100C1E4ECF0E0E60F0027F01FD7 -:1005C0006395653011F01083FBC01083F4C066277B -:1005D000183809F4A6CD00E0009313011E3B11F476 -:1005E0004FE0EEC01E3411F441E1EAC0143481F052 -:1005F000143BD1F0153809F4C5CD153711F449E095 -:10060000DFC0173A09F459CE193709F463CED3C0C5 -:1006100002E000936501009196000093CE000091E6 -:1006200097000093CF00C7C00091CD0003FF07C023 -:1006300004EF0093D00001E00093D1000BC003E071 -:10064000009365010091C2000093D0000091C300A7 -:100650000093D100B0C0110F110F110F10931201B0 -:1006600051E040E100E000936001683061F06930E2 -:1006700069F000911201060FEDECF0E0E00F0027A9 -:10068000F01F10819CC01091600199C094C0110F9F -:10069000110F110F1093120142E131E091C0683047 -:1006A00051F000911201060FEDECF0E0E00F002791 -:1006B000F01F108384C07FC0BB99BA9A2F932FB7C5 -:1006C000BB982F930F9305B702600F7E05BF3F9332 -:1006D0001F935F93309162011091100150911401AA -:1006E0000BE402BF09B7016009BF01E008BF552351 -:1006F00009F1332319F453D05523B9F020E01795AD -:1007000010F0BB9A21E07F9370916001072F017078 -:10071000201721F476950CE8702701C07695709328 -:1007200060017F91330FBA9B13C002B70E36E8F316 -:10073000BA980EC002B70735E8F3169521E0B29BD0 -:1007400002C0106820E0330F19F429D0552389F630 -:10075000BB9901C013C051FD11C0B29904C002B7CA -:10076000073860F4FACFB29B06C002B7053AB29BD5 -:1007700002C0C8F303C0BA9ABB98B2CF00E40ABF64 -:100780005093140130936201109310015F911F91F7 -:100790003F910F91BA982F912FBF2F911895EF93FA -:1007A000FF934F936F934091630160916401E6E77B -:1007B000F0E0E40F0994332740E0552702C0639529 -:1007C00031E040936301609364016F914F91FF9119 -:1007D000EF9108954F925F926F927F928F929F92C6 -:1007E000AF92BF92CF92DF92EF92FF920F931F933F -:1007F000CF93DF93CDB7DEB728970FB6F894DEBF5F -:100800000FBECDBF2B013C0149015A01E982FA829A -:100810000B831C832DEC3CE44DE653E4AFD66B0117 -:100820007C0123E333E948E853E4C301B201A6D6CF -:100830009B01AC01C501B40105D720E030E040E8E0 -:100840005FE39CD66D837E838F83988724EF35EC9E -:1008500041E855E4C501B40165D82B013C01A7016D -:100860009601C501B4018AD69B01AC01C701B6014E -:1008700059D89B01AC01C301B201E4D69B01AC0184 -:1008800060E070E080E89FE378D69B01AC016D8169 -:100890007E818F81988546D829813A814B815C8100 -:1008A00041D8C62ED72EE82EF92E20E030E048ECB5 -:1008B00052E4EFD718161CF03E2D2F2D04C0C12C8A -:1008C000D12C38EC22E46C2D7D2D832F922F28968D -:1008D0000FB6F894DEBF0FBECDBFDF91CF911F9151 -:1008E0000F91FF90EF90DF90CF90BF90AF909F90CF -:1008F0008F907F906F905F904F9008951F920F920E -:100900000FB60F9211248F93809161008F5F8093B7 -:10091000610080916101813021F482E08093610166 -:1009200004C0823011F4109263018F910F900FBEBA -:100930000F901F901895E199FECF91E0980F9EBB04 -:10094000E09A2DB330E02F3F310559F0322F2227A6 -:10095000E199FECF8EBBE09A8DB3A901482BCA0165 -:100960000895862F972F0895E199FECF1CBA8EBB6C -:100970006DBBE29AE19AE199FECF1CBA8F5F8EBB04 -:100980007DBBE29AE19A0895CF93DF93CDB7DEB7AE -:100990002E970FB6F894DEBF0FBECDBF009AE4ECE1 -:1009A000F0E080E595E0918380838FE784838BE49A -:1009B000828386E483838FEF8583168290E1978319 -:1009C0008BBB88BBCCDCC19AB99AD89AD09A85B730 -:1009D0008F7B85BF85B7806885BF0F2EFDECEF2E1E -:1009E000F0E0FF2EF02DD7015C961C9261E070E0E4 -:1009F00080E0A1DFF701918F808F608D718D80E0A5 -:100A000090E0B9D620E030E048EC52E41BD6609389 -:100A100098007093990080939A0090939B0061E0F6 -:100A200070E082E088DFD70195969C938E9394972F -:100A300061E070E084E07FDFF70197A386A360E0C8 -:100A400070E086E078DFD70193969C938E9392971F -:100A500091961C921E9290970EEA10E00F2EFCEBDE -:100A60002F2EF0E03F2EF02DF80196968D919C915F -:100A7000979781939193E215F305B9F781B580615A -:100A800081BD81B5816681BD14BE0DD5B2D48CEC1B -:100A900090E017D48CEC90E034D461E280E5DBD4B4 -:100AA000EFE5FAEE3197F1F700C0000081E08093A6 -:100AB000650178940F2EF4EC4F2EF0E05F2EF02DB0 -:100AC00066246394712C0D871E87D20114968C9135 -:100AD00014978F31B9F4EFE71496EC9380E090E02F -:100AE000A0E8BFE38093980090939900A0939A00A8 -:100AF000B0939B001092E6001092E50060E070E079 -:100B000080E032DFD20114968C9114978530B1F5D4 -:100B1000EFE71496EC937092F2006092F1007092FD -:100B2000F4006092F3001092F0001092EF00109227 -:100B3000EE001092ED0080E090E0A0E8BFE380932B -:100B4000980090939900A0939A00B0939B006FEF48 -:100B500070E080E009DF6FEF70E082E005DF6FEFAB -:100B600070E084E001DF6FEF70E086E0FDDEED8590 -:100B7000FE8561927192E215F305D9F780916100CB -:100B8000882309F435C38091ED009091EE00019621 -:100B90009093EE008093ED008091ED009091EE0037 -:100BA0008131974208F49EC01092EE001092ED0041 -:100BB0008091EF009091F00001969093F000809367 -:100BC000EF001092F4001092F3008091F1009091E8 -:100BD000F2009093BD008093BC00ED85FE8582817C -:100BE0009381819391932091F3003091F400281721 -:100BF000390720F49093F4008093F3002E163F06FB -:100C000071F78091EF009091F000089748F0809183 -:100C1000F3009091F4009093E6008093E50008C003 -:100C20008091F1009091F2009093E6008093E500AE -:100C30006091E5007091E600E090E500F090E6003C -:100C400080E090E098D520E030E048EC52E4FAD41F -:100C50004B015C01C70164E670E026D780E090E0BC -:100C60008AD5209198003091990040919A00509136 -:100C70009B0083D420E030E040E05FE353D69B014B -:100C8000AC01C501B40179D46093980070939900C8 -:100C900080939A0090939B0020E030E048EC52E46F -:100CA00041D63DD57093E6006093E5006091E50084 -:100CB0007091E60080E058DE6091F1007091F200E2 -:100CC00082E052DE6091F3007091F40084E04CDE2B -:100CD0006091EF007091F00086E046DE1092F20025 -:100CE0001092F10080916000882319F08150809368 -:100CF000600068EA70E080E019D360EC70E081E0A9 -:100D000015D38091C0009091C10095D36093A0004D -:100D10007093A1008093A2009093A3008091A800FB -:100D20009091A90078D36B017C0160939C00709333 -:100D30009D0080939E0090939F008090A0009090D3 -:100D4000A100A090A200B090A3009B01AC01EAD545 -:100D500069837A838B839C83A5019401C501B401C7 -:100D6000E1D56D837E838F8398872BE237E943EA51 -:100D700051E369817A818B819C81D4D59B01AC013F -:100D80006D817E818F819885CDD569877A878B87A4 -:100D90009C8728E33DE145ED54E369817A818B81AD -:100DA0009C81C0D59B01AC01C501B401BBD59B01A1 -:100DB000AC0169857A858B859C85DFD369877A87C5 -:100DC0008B879C872FE130E84BE258E369817A8179 -:100DD0008B819C81A7D59B01AC0169857A858B8528 -:100DE0009C85CCD369837A838B839C8326E43AECFD -:100DF0004FE855E3C701B60195D59B01AC016D8164 -:100E00007E818F8198858ED59B01AC0169817A8125 -:100E10008B819C81B2D369837A838B839C8329EDF8 -:100E200033E343EF58E3C701B6017CD59B01AC0126 -:100E3000C501B40177D59B01AC0169817A818B81B1 -:100E40009C819CD369837A838B839C8324E236E0E4 -:100E500046E25CE3C701B60165D59B01AC0169813F -:100E60007A818B819C8189D369837A838B839C83EC -:100E700027E533EC4BE259E36D817E818F819885C4 -:100E800051D59B01AC0169817A818B819C8176D39C -:100E900069837A838B839C8327EE32E945EC5CE39C -:100EA000C501B4013FD59B01AC0169817A818B8179 -:100EB0009C8163D32FE038E247EE5FE35FD360931A -:100EC000920070939300809394009093950020E09B -:100ED00030E04AE754E426D51DD47093EB006093CC -:100EE000EA008701760126E636E646EE5EEBC501AE -:100EF000B40170DC20E030E040E251E413D54B0156 -:100F00005C0160939C0070939D0080939E00909381 -:100F10009F0020E030E040E251E46091A000709139 -:100F2000A1008091A2009091A300FCD420E030E0C9 -:100F300040E950E422D36B017C016093A0007093E0 -:100F4000A1008093A2009093A3002FE03EE742E629 -:100F500059E3E8D49B01AC0162E27DEF86E89FE3B0 -:100F60000CD39B01AC01C501B401DCD46093AA0091 -:100F70007093AB008093AC009093AD0025EE30ED04 -:100F800042EA5EE3CFD420E030E048E952E4F6D212 -:100F9000C6D37093C3006093C2002DEC3CEC4CECC4 -:100FA00051E4C701B601BED4B5D3709397006093E6 -:100FB00096001092BF001092BE00C198EBE2F1E0E3 -:100FC0003197F1F700C0000056D22091BE00309159 -:100FD000BF00820F931F9093BF008093BE008BE2EF -:100FE00091E00197F1F700C0000045D22091BE00CA -:100FF0003091BF00820F931F9093BF008093BE007B -:10100000C19A8091E900882351F08091BE009091AF -:10101000BF008059984E9093BF008093BE0080918E -:10102000BE009091BF0081329C4150F08091E90058 -:10103000811106C060E280E50ED281E08093E90074 -:101040008091BE009091BF008115994148F4809134 -:10105000E900813029F461E280E5FDD11092E900D8 -:101060006091BE007091BF00CB01880F991F880F5F -:10107000991F860F971F969587959093E800809308 -:10108000E70080E090E077D320E030E04AE755E4E5 -:10109000D9D29B01AC0160E070E080E490E4D2D250 -:1010A00020E030E040E85FE368D220E030E040EF4D -:1010B00051E438D46B017C0120E030E048EC52E48C -:1010C00031D428D37093D3006093D2002091920042 -:1010D000309193004091940050919500C701B60162 -:1010E000B1D26B017C016093A4007093A500809342 -:1010F000A6009093A7008091600081114CC02091C0 -:1011000098003091990040919A0050919B00C7013E -:10111000B601BFD31816D4F4C0929800D0929900AB -:10112000E0929A00F0929B0020E030E048EC52E41C -:10113000C701B601F7D3F3D27093E6006093E500E0 -:101140006091E5007091E60080E00EDC20E030E088 -:1011500048EC52E46091A4007091A5008091A60033 -:101160009091A700DFD36B017C018091F1009091F9 -:10117000F200BC0180E090E0FED29B01AC01C7010F -:10118000B60187D318163CF4C701B601C8D27093D4 -:10119000F2006093F1002091980030919900409105 -:1011A0009A0050919B006091A4007091A5008091DD -:1011B000A6009091A70046D29B01AC0160E070E0D0 -:1011C00080E89FE33FD26ED320E030E040E253E47A -:1011D000A9D320E030E040E850E4A4D36093A40019 -:1011E0007093A5008093A6009093A70010926100D1 -:1011F00080916501813029F56091A4007091A5006E -:101200008091A6009091A7008AD29B0132952295E9 -:101210002F7023273F702327322FF2012281438131 -:10122000431728F441E0231718F040E001C041E0E3 -:10123000F894D20111967C936E9340936601789452 -:101240000ED9809165018250823010F410926501B0 -:1012500009B600FC0BC080916301811107C085B7FE -:10126000806385BF85B78D7F85BF06C085B78062E7 -:1012700085BF85B78F7E85BF889527CC6623D9F03B -:10128000FC012FEF260F30E02F5F3F4FBC01620FB4 -:10129000731F90E088E031E321919227282F992352 -:1012A0001CF4990F932701C0990F2150C1F7E6173D -:1012B000F70791F701C090E081E0941301C080E04E -:1012C00008950F931F93CF938C0148D180E819D1D3 -:1012D000C82F87EE16D1C82B41D181E812D1C82B77 -:1012E00081E029D1F801808380E025D1482F61E099 -:1012F000C801C4DFC82B3FD18C2FCF911F910F9114 -:1013000008950F931F93CF938C0128D180E8F9D0D3 -:10131000C82F86EEF6D0C82BF8018081F2D0C82BFA -:101320002AD18C2FCF911F910F910895CF92DF92E8 -:10133000FF920F931F93CF93DF9300D0CDB7DEB70B -:10134000182F6B010BD180E8DCD0F82E112319F097 -:10135000113029F007C085EFD4D0F82A03C083EFFD -:10136000D0D0F82AFBD02FEF81EE94E021508040BE -:101370009040E1F700C0000001E010E00FC0EED0A7 -:10138000EFEFF1EE24E0E150F0402040E1F700C043 -:1013900000000F5F1F4F0531110539F081E8B1D012 -:1013A000843069F30431110518F08F2D8260F82E16 -:1013B00081E0C1D0898381E0BED0282F8A838981D2 -:1013C00030E0382BF6013183208380E0B4D0482F01 -:1013D00062E0CE01019652DFF82ACDD08F2D0F901A -:1013E0000F90DF91CF911F910F91FF90DF90CF90E1 -:1013F0000895CF93B3D080E884D0C82F8EEF81D0EA -:10140000C82BB9D08FE295E70197F1F700C0000033 -:101410008C2FCF9108958C7FBC0180E090E0ABD100 -:1014200020E030E04AEF5AE37DD220E030E040ECAB -:1014300050E4A3D008958C7FBC0180E090E09BD164 -:1014400022E538EB4FE25BE36DD226E636E64BE36E -:1014500052E493D00895CF93DF93D82FC62F7ED038 -:101460008CE64FD08D2F80684CD08C2F4AD083D003 -:10147000DF91CF910895CF93DF9370D08DE641D067 -:1014800085ED8A95F1F7000081E055D08F70C82F67 -:10149000D0E0DC2FCC2780E04ED0C82B6CD0CE0122 -:1014A000DF91CF910895DE9ADC9AD49AD69A8FEF85 -:1014B0008FB98AE28DB980EF8EB908958EB98BE22B -:1014C0009CE19A95F1F78DB9CC9BFECF9DE09A9562 -:1014D000F1F78DB9769BF4CF8CE18A95F1F78FB156 -:1014E0009FEF9FB9D69A0895DE98DC9ACC9BFECFE9 -:1014F0008DE08A95F1F7DE9A8CE18A95F1F781E02B -:101500000895DC988FB980EFD9DFD6988EEFD6DFBB -:10151000982F917080FF0DC080910D0180FF05C054 -:1015200086E080930D0192E004C085E080930D0178 -:1015300092E0892F0895CF93DF93D82FD69880EF2C -:10154000BDDFC82FD11103C08FEF8FB901C01FB805 -:101550008EEFB4DF8C2FDF91CF910895DC9ACC9B76 -:10156000FECF8DE08A95F1F7DE988DE08A95F1F750 -:10157000DC98DE9A0895B8DF08955058BB27AA2753 -:101580000ED04DC13ED130F043D120F031F49F3F19 -:1015900011F41EF433C10EF4E095E7FB29C1E92FE5 -:1015A0004FD180F3BA17620773078407950718F0C5 -:1015B00071F49EF567C10EF4E0950B2EBA2FA02DA5 -:1015C0000B01B90190010C01CA01A0011124FF27F0 -:1015D000591B99F0593F50F4503E68F11A16F040EB -:1015E000A22F232F342F4427585FF3CF46953795EA -:1015F0002795A795F0405395C9F77EF41F16BA0BAF -:10160000620B730B840BBAF09150A1F0FF0FBB1F5C -:10161000661F771F881FC2F70EC0BA0F621F731FA5 -:10162000841F48F4879577956795B795F7959E3F02 -:1016300008F0B3CF9395880F08F09927EE0F979590 -:10164000879508950CD0EBC0E3D040F0DAD030F0AD -:1016500021F45F3F19F0CCC0511115C1CFC0F0D0BB -:1016600098F39923C9F35523B1F3951B550BBB2769 -:10167000AA2762177307840738F09F5F5F4F220F16 -:10168000331F441FAA1FA9F333D00E2E3AF0E0E80F -:1016900030D091505040E695001CCAF729D0FE2F5B -:1016A00027D0660F771F881FBB1F261737074807ED -:1016B000AB07B0E809F0BB0B802DBF01FF279358A3 -:1016C0005F4F2AF09E3F510568F092C0DCC05F3F3B -:1016D000ECF3983EDCF3869577956795B795F7958B -:1016E0009F5FC9F7880F911D9695879597F9089583 -:1016F000E1E0660F771F881FBB1F6217730784071F -:10170000BA0720F0621B730B840BBA0BEE1F88F72D -:10171000E095089504D06894B111B5C0089598D0AB -:1017200088F09F5790F0B92F9927B751A0F0D1F0CA -:10173000660F771F881F991F1AF0BA95C9F712C054 -:10174000B13081F09FD0B1E008959CC0672F782F11 -:101750008827B85F39F0B93FCCF3869577956795C0 -:10176000B395D9F73EF490958095709561957F4F2C -:101770008F4F9F4F0895E89409C097FB3EF49095D2 -:101780008095709561957F4F8F4F9F4F9923A9F05A -:10179000F92F96E9BB279395F695879577956795E9 -:1017A000B795F111F8CFFAF4BB0F11F460FF1BC02D -:1017B0006F5F7F4F8F4F9F4F16C0882311F096E9C0 -:1017C00011C0772321F09EE8872F762F05C066236E -:1017D00071F096E8862F70E060E02AF09A95660F27 -:1017E000771F881FDAF7880F9695879597F90895E0 -:1017F00097F99F6780E870E060E008959FEF80ECC4 -:10180000089500240A941616170618060906089566 -:1018100000240A9412161306140605060895092ECC -:101820000394000C11F4882352F0BB0F40F4BF2B3B -:1018300011F460FF04C06F5F7F4F8F4F9F4F08957B -:1018400057FD9058440F551F59F05F3F71F0479571 -:10185000880F97FB991F61F09F3F79F08795089556 -:10186000121613061406551FF2CF4695F1DF08C075 -:10187000161617061806991FF1CF86957105610592 -:1018800008940895E894BB2766277727CB0197F93A -:101890000895B3D008F48FEF08950EF0D2C0AECF04 -:1018A0006894A6CFD5DFC8F39923D1F3C6F3DF93AD -:1018B000CF931F930F93FF92C92FDD2788232AF020 -:1018C0002197660F771F881FDAF720E030E040E8A5 -:1018D0005FEB9FE3883920F0803E30F021968F77D0 -:1018E0004DDEE2E2F0E003C049DEEFE4F0E0B7D025 -:1018F0008B01BE01EC01FB2E6F5771097595771FA7 -:10190000880B990B3ADF28E132E741E35FE315D01A -:10191000AF2D9801AE01FF900F911F91CF91DF91F4 -:101920003EDE7DCF0AD07BCF6CDF28F071DF18F070 -:10193000952309F05DCF62CFA6CF82DFA8F399236C -:10194000D9F35523C9F3950F50E0551FAA27EE2769 -:10195000FF27BB2700240894679520F4E20FF31FAC -:10196000B41F0A1E220F331F441FAA1F6695A9F732 -:10197000779530F4F30FB41F0A1E121E08F4639516 -:10198000330F441FAA1F221F769599F7879520F4DD -:10199000B40F0A1E121E631F440FAA1F221F331FFB -:1019A0008695A9F7862F712D602D11249F575040E1 -:1019B0008AF0E1F088234AF0EE0FFF1FBB1F661F7D -:1019C000771F881F91505040A9F79E3F510570F036 -:1019D0000FCF59CF5F3FECF3983EDCF386957795B8 -:1019E0006795B795F795E7959F5FC1F7FE2B880F31 -:1019F000911D9695879597F90895990F0008550FB1 -:101A0000AA0BE0E8FEEF16161706E807F907C0F084 -:101A100012161306E407F50798F0621B730B840B8C -:101A2000950B39F40A2661F0232B242B252B21F466 -:101A300008950A2609F4A140A6958FEF811D811D06 -:101A400008959F3F31F0915020F4879577956795E1 -:101A5000B795880F911D9695879597F90895DF930F -:101A6000CF931F930F93FF92EF92DF927B018C0134 -:101A7000689405C0DA2EEF0160DFFE01E894A591BD -:101A80002591359145915591AEF3EF0188DDFE0129 -:101A90009701A801DA9479F7DF90EF90FF900F910A -:101AA0001F91CF91DF910895AA1BBB1B51E107C085 -:101AB000AA1FBB1FA617B70710F0A61BB70B881FDE -:101AC000991F5A95A9F780959095BC01CD0108956D -:041AD000F894FFCFB8 -:101AD4000A010106050804070708010000000000C8 -:101AE40000000801000000000000010000000000E8 -:101AF400000026A3D9840016056728A3D9840016FC -:021B04000518C2 -:00000001FF diff --git a/DS18B20_VOC_DS2438_SHT/Makefile b/DS18B20_VOC_DS2438_SHT/Makefile new file mode 100644 index 0000000..5b3f725 --- /dev/null +++ b/DS18B20_VOC_DS2438_SHT/Makefile @@ -0,0 +1,201 @@ +# Hey Emacs, this is a -*- makefile -*- + +# AVR-GCC Makefile template, derived from the WinAVR template (which +# is public domain), believed to be neutral to any flavor of "make" +# (GNU make, BSD make, SysV make) + + +MCU = attiny84 +FORMAT = ihex +TARGET = DS18B20_VOC_DS2438_SHT +SRC = ../common/calibr.c DS18B20_DS2438.c ../common/I2C/SHT2x.c ../common/I2C/MAX1164x.c ../common/I2C/USI_TWI_Master.c +ASRC = ../common/OWDS18B20_DS2438.S + +# Name of this Makefile (used for "make depend"). +MAKEFILE = Makefile + + +CFLAGS = -x c -funsigned-char -funsigned-bitfields -I. -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -Wall -std=gnu99 -MD -MP + +#ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs + + +#Additional libraries. + +# Minimalistic printf version +PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires MATH_LIB = -lm below) +PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt + +PRINTF_LIB = + +# Minimalistic scanf version +SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min + +# Floating point + %[ scanf version (requires MATH_LIB = -lm below) +SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt + +SCANF_LIB = + +MATH_LIB = -lm + +# External memory options + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# used for variables (.data/.bss) and heap (malloc()). +#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# only used for heap (malloc()). +#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff + +EXTMEMOPTS = + +#LDMAP = $(LDFLAGS) -Wl,-Map=$(TARGET).map,--cref +#LDFLAGS = $(EXTMEMOPTS) $(LDMAP) $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) +LDFLAGS = -Wl,--start-group -Wl,-lm -Wl,--end-group -Wl,--gc-sections -mmcu=$(MCU) + +# Programming support using avrdude. Settings and variables. + +AVRDUDE_PROGRAMMER = stk500 +AVRDUDE_PORT = /dev/term/a + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +AVRDUDE_BASIC = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS = $(AVRDUDE_BASIC) $(AVRDUDE_NO_VERIFY) $(AVRDUDE_VERBOSE) $(AVRDUDE_ERASE_COUNTER) + + +CC = avr-gcc +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +NM = avr-nm +AVRDUDE = avrdude +REMOVE = rm -f +MV = mv -f + +# Define all object files. +OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) + +# Define all listing files. +LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + +# Default target. +all: build + +build: elf hex eep + +elf: $(TARGET).elf +hex: $(TARGET).hex +eep: $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + + + + +# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. +COFFCONVERT=$(OBJCOPY) --debugging \ +--change-section-address .data-0x800000 \ +--change-section-address .bss-0x800000 \ +--change-section-address .noinit-0x800000 \ +--change-section-address .eeprom-0x810000 + + +coff: $(TARGET).elf + $(COFFCONVERT) -O coff-avr $(TARGET).elf $(TARGET).cof + + +extcoff: $(TARGET).elf + $(COFFCONVERT) -O coff-ext-avr $(TARGET).elf $(TARGET).cof + + +.SUFFIXES: .elf .hex .eep .lss .sym + +.elf.hex: + $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ + +.elf.eep: + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ + +# Create extended listing file from ELF output file. +.elf.lss: + $(OBJDUMP) -h -S $< > $@ + +# Create a symbol table from ELF output file. +.elf.sym: + $(NM) -n $< > $@ + + + +# Link: create ELF output file from object files. +$(TARGET).elf: $(OBJ) + $(CC) $(OBJ) --output $@ $(LDFLAGS) + + +# Compile: create object files from C source files. +.c.o: + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +.c.s: + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +.S.o: + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + + + +# Target: clean project. +clean: + $(REMOVE) $(TARGET).hex $(TARGET).eep $(TARGET).cof $(TARGET).elf \ + $(TARGET).map $(TARGET).sym $(TARGET).lss \ + $(OBJ) $(LST) $(SRC:.c=.s) $(SRC:.c=.d) + +depend: + if grep '^# DO NOT DELETE' $(MAKEFILE) >/dev/null; \ + then \ + sed -e '/^# DO NOT DELETE/,$$d' $(MAKEFILE) > \ + $(MAKEFILE).$$$$ && \ + $(MV) $(MAKEFILE).$$$$ $(MAKEFILE); \ + fi + echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' \ + >> $(MAKEFILE); \ + $(CC) -M -mmcu=$(MCU) $(CDEFS) $(CINCS) $(SRC) $(ASRC) >> $(MAKEFILE) + +.PHONY: all build elf hex eep lss sym program coff extcoff clean depend + + diff --git a/DS2450_VOC_SHT_BMP/DS2450.atsln b/DS2450_VOC_SHT_BMP/DS2450.atsln new file mode 100644 index 0000000..848bac3 --- /dev/null +++ b/DS2450_VOC_SHT_BMP/DS2450.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}") = "DS2450", "DS2450.cproj", "{DCE6C7E3-EE26-4D79-826B-08594B9AD897}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|AVR = Debug|AVR + Release|AVR = Release|AVR + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {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 + EndGlobalSection +EndGlobal diff --git a/DS2450_VOC_SHT_BMP/DS2450.cproj b/DS2450_VOC_SHT_BMP/DS2450.cproj new file mode 100644 index 0000000..491b6b0 --- /dev/null +++ b/DS2450_VOC_SHT_BMP/DS2450.cproj @@ -0,0 +1,153 @@ + + + + 2.0 + 7.0 + com.Atmel.AVRGCC8.C + dce6c7e3-ee26-4d79-826b-08594b9ad897 + ATtiny84A + none + Executable + C + $(MSBuildProjectName) + .elf + $(MSBuildProjectDirectory)\$(Configuration) + DS2450 + DS2450 + DS2450 + Native + true + false + true + true + 0x20000000 + + true + exception_table + 2 + 1 + + + + + + + + + + + + + + com.atmel.avrdbg.tool.atmelice + J41800000789 + 0x1E930C + + + + 125000 + + debugWIRE + + com.atmel.avrdbg.tool.atmelice + J41800000789 + Atmel-ICE + + debugWIRE + 125000 + + + + + -mmcu=attiny84a -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\gcc\dev\attiny84a" + True + True + True + True + False + True + True + + + NDEBUG + + + + + %24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\include + + + 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) + + + + + + compile + BMP280.c + + + compile + MAX1164x.c + + + compile + SHT2x.c + + + compile + USI_TWI_Master.c + + + compile + OWDS2450.S + + + compile + + + + \ No newline at end of file diff --git a/common/I2C/BMP280.c b/common/I2C/BMP280.c index 27adba5..6d23946 100644 --- a/common/I2C/BMP280.c +++ b/common/I2C/BMP280.c @@ -110,6 +110,30 @@ int32_t bmp280ReadPressure(uint8_t oss) { } + +int32_t bmp280ReadPressure_simple() { + uint8_t msb, lsb,xlsb; + volatile int32_t data; + I2c_StartCondition(); + I2c_WriteByte(0xEC); + I2c_WriteByte(0xF7); + I2c_StopCondition(); + I2c_StartCondition(); + I2c_WriteByte(0xED); + msb=I2c_ReadByte(ACK); + lsb=I2c_ReadByte(ACK); + xlsb=I2c_ReadByte(NO_ACK); + I2c_StopCondition(); + + data = (int32_t)msb << 12; + data |= (int16_t)lsb<<4; + data|=xlsb>>4; + + return data; + + +} + void bmp280ConvertInt(int32_t * temperature,uint32_t *pressure,uint8_t oss) { int32_t var1,var2,T,t_fine; @@ -143,6 +167,7 @@ void bmp280ConvertInt(int32_t * temperature,uint32_t *pressure,uint8_t oss) { *pressure=p; } + void bmp280Convert(double * temperature, double * pressure,uint8_t oss) { uint32_t p; @@ -152,7 +177,63 @@ void bmp280Convert(double * temperature, double * pressure,uint8_t oss) { *pressure=p/100.0; } - - +void bmp280ConvertIntP(int32_t temp256,uint32_t *pressure) { + int32_t var1,var2,t_fine; + //T = (t_fine * 5 + 128) >> 8; + t_fine=((temp256)-128)/5; + int32_t adc_P= bmp280ReadPressure_simple(); + uint32_t p; + var1 = (((int32_t)t_fine)>>1) - (int32_t)64000; + var2 = (((var1>>2) * (var1>>2)) >> 11 ) * ((int32_t)dig_P6); + var2 = var2 + ((var1*((int32_t)dig_P5))<<1); + var2 = (var2>>2)+(((int32_t)dig_P4)<<16); + var1 = (((dig_P3 * (((var1>>2) * (var1>>2)) >> 13 )) >> 3) + ((((int32_t)dig_P2) * var1)>>1))>>18; + var1 =((((32768+var1))*((int32_t)dig_P1))>>15); + if (var1 == 0) { + return ; // avoid exception caused by division by zero + } + p = (((uint32_t)(((int32_t)1048576)-adc_P)-(var2>>12)))*3125; + if (p < 0x80000000){ + p = (p << 1) / ((uint32_t)var1); + }else{ + p = (p / (uint32_t)var1) * 2; + } + var1 = (((int32_t)dig_P9) * ((int32_t)(((p>>3) * (p>>3))>>13)))>>12; + var2 = (((int32_t)(p>>2)) * ((int32_t)dig_P8))>>13; + p = (uint32_t)((int32_t)p + ((var1 + var2 + dig_P7) >> 4)); + *pressure=p; +} + +void bmp280ConvertIntP1(uint32_t *pressure) { + int32_t var1,var2,T,t_fine; + + int32_t adc_T=bmp280ReadTemp(); + var1 = ((((adc_T>>3) - ((int32_t)dig_T1<<1))) * ((int32_t)dig_T2)) >> 11; + var2 = ((((((adc_T>>4) - ((int32_t)dig_T1)) * ((adc_T>>4) - (int32_t)dig_T1))) >> 12) *((int32_t)dig_T3)) >> 14; + t_fine = var1 + var2; + T = (t_fine * 5 + 128) >> 8; + int32_t adc_P= bmp280ReadPressure_simple(); + uint32_t p; + var1 = (((int32_t)t_fine)>>1) - (int32_t)64000; + var2 = (((var1>>2) * (var1>>2)) >> 11 ) * ((int32_t)dig_P6); + var2 = var2 + ((var1*((int32_t)dig_P5))<<1); + var2 = (var2>>2)+(((int32_t)dig_P4)<<16); + var1 = (((dig_P3 * (((var1>>2) * (var1>>2)) >> 13 )) >> 3) + ((((int32_t)dig_P2) * var1)>>1))>>18; + var1 =((((32768+var1))*((int32_t)dig_P1))>>15); + if (var1 == 0) { + return ; // avoid exception caused by division by zero + } + p = (((uint32_t)(((int32_t)1048576)-adc_P)-(var2>>12)))*3125; + if (p < 0x80000000){ + p = (p << 1) / ((uint32_t)var1); + }else{ + p = (p / (uint32_t)var1) * 2; + } + var1 = (((int32_t)dig_P9) * ((int32_t)(((p>>3) * (p>>3))>>13)))>>12; + var2 = (((int32_t)(p>>2)) * ((int32_t)dig_P8))>>13; + p = (uint32_t)((int32_t)p + ((var1 + var2 + dig_P7) >> 4)); + *pressure=p; + +} diff --git a/common/I2C/BMP280.h b/common/I2C/BMP280.h index 8ea7059..5c9f86d 100644 --- a/common/I2C/BMP280.h +++ b/common/I2C/BMP280.h @@ -6,8 +6,10 @@ void bmp280Init(void); int32_t bmp280ReadTemp(void); int32_t bmp280ReadPressure(uint8_t oss); +int32_t bmp280ReadPressure_simple(); void bmp280Convert(double * temperature, double * pressure,uint8_t oss); void bmp280ConvertInt(int32_t * temperature,uint32_t *pressure,uint8_t oss); +void bmp280ConvertIntP(int32_t temp256,uint32_t *pressure) ; +void bmp280ConvertIntP1(uint32_t *pressure) ; - -#endif \ No newline at end of file +#endif diff --git a/common/OWDS2450.S b/common/OWDS2450.S new file mode 100644 index 0000000..a60addd --- /dev/null +++ b/common/OWDS2450.S @@ -0,0 +1,247 @@ + +// Copyright (c) 2015, Tobias Mueller tm(at)tm3d.de +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the +// distribution. +// * All advertising materials mentioning features or use of this +// software must display the following acknowledgement: This product +// includes software developed by tm3d.de and its contributors. +// * Neither the name of tm3d.de nor the names of its contributors may +// be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +//#define _CHANGEABLE_ID_ +#define _ZERO_POLLING_ + +#include "../common/OWConfig.s" +#include "../common/OWCRC16.s" + +.extern pack,8 +.comm addr,1 ;zweites Adressbyte ist unnoetig (Warum auch immer fuer 32 Byte 16 Bit Adressen verwendet werden....) +.comm crcsave,1 ; zwischenspeicherspeicher fuer crc nur zweites byte.... +//.extern am2302_temp,2 + + + +.macro CHIP_INIT +.endm + +.macro COMMAND_TABLE + rjmp h_readmemoryaddr + rjmp h_readmemory + rjmp h_readmemorycrc1 + rjmp h_readmemorycrc2 + rjmp h_writememoryaddr + rjmp h_writememory + rjmp h_writememorycrc1 + rjmp h_writememorycrc2 + rjmp h_writememoryreadback + rjmp h_convert + rjmp h_convertcrc1 + rjmp h_convertcrc2 + rjmp h_convert_conv +.endm + +#include "../common/OWRomFunctions.s" +#include "../common/OWTimerInterrupt.s" + + + +; Ab hier Geraeteabhaenging +#define OW_READ_MEMORY_ADDR OW_FIRST_COMMAND+0 +#define OW_READ_MEMORY OW_FIRST_COMMAND+1 +#define OW_READ_MEMORY_CRC1 OW_FIRST_COMMAND+2 +#define OW_READ_MEMORY_CRC2 OW_FIRST_COMMAND+3 +#define OW_WRITE_MEMORY_ADDR OW_FIRST_COMMAND+4 +#define OW_WRITE_MEMORY OW_FIRST_COMMAND+5 +#define OW_WRITE_MEMORY_CRC1 OW_FIRST_COMMAND+6 +#define OW_WRITE_MEMORY_CRC2 OW_FIRST_COMMAND+7 +#define OW_WRITE_MEMORY_READBACK OW_FIRST_COMMAND+8 +#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 +;--------------------------------------------------- + + +h_readcommand: + clr r_bytep +#ifndef _DIS_FLASH_ + FLASH_COMMANDS ; muss zu erst sein.... +#endif + cset 0xAA,OW_READ_MEMORY_ADDR + cset 0x55,OW_WRITE_MEMORY_ADDR + cset 0x3C,OW_CONVERT + FW_CONFIG_INFO +#ifdef _CHANGEABLE_ID_ + CHANGE_ID_COMMANDS +#endif + ldi r_mode,OW_SLEEP + rjmp handle_end + + +h_readmemoryaddr: + cpi r_bytep,0 ;erstes Adressbyte ? + brne h_readmemory_addr_byte1 ;nein dann weiter + andi r_rwbyte,0x1F ; nur Adressen zwischen 0 und 0x1F zulassen + sts addr,r_rwbyte ;speichern des ersten bytes + rjmp handle_end_inc +h_readmemory_addr_byte1: ;zweiters Addressbyte wird nicht gespeichert! + ldi r_mode,OW_READ_MEMORY ;weiter zu read Memory + ;;ldi r_bcount,1 ;ist unten + ldi r_sendflag,1 ;jetzt sendet der Slave zum Master + clr r_bytep + rjmp h_readmemory2 +h_readmemory: + lds r_bytep,addr + inc r_bytep + sts addr,r_bytep + andi r_bytep,0x07 + breq h_readmemory_init_crc +h_readmemory2: + lds r_bytep,addr + ;andi r_bytep,0x1F ist oben + configZ pack,r_bytep + ld r_rwbyte,Z + ;ldi r_bcount,1 + rjmp handle_end ;sendet das Byte und geht zu h_readmemory +h_readmemory_init_crc:; init erstes CRC byte + lds r_rwbyte,crc + com r_rwbyte + lds r_temp,crc+1 + com r_temp + sts crcsave,r_temp + ldi r_mode,OW_READ_MEMORY_CRC1 + ;ldi r_bcount,1 + rjmp handle_end +h_readmemory_end: + ldi r_mode,OW_SLEEP + clr r_sendflag + rjmp handle_end +h_readmemorycrc1:;init zweites CRC Byte + lds r_rwbyte,crcsave + ;ldi r_bcount,1 + ldi r_mode,OW_READ_MEMORY_CRC2 + rjmp handle_end +h_readmemorycrc2:;weiteres senden..... nach zweitem Byte + lds r_temp,addr + andi r_temp,0xE0 + brne h_readmemory_end; ende des speichers + ldi r_mode,OW_READ_MEMORY + CRCInit1 ;Start with new CRC + rjmp h_readmemory2 + +h_writememoryaddr: + cpi r_bytep,0 ;erstes Adressbyte ? + brne h_writememory_addr_byte1 ;nein dann weiter + andi r_rwbyte,0x1F ; nur Adressen zwischen 0 und 0x1F zulassen + sts addr,r_rwbyte ;speichern des ersten bytes + inc r_bytep + ;ldi r_bcount,1 + rjmp handle_end +h_writememory_addr_byte1: ;zweiters Addressbyte wird nicht gespeichert! + ldi r_mode,OW_WRITE_MEMORY ;weiter zu read Memory + ;ldi r_bcount,1 ;; _________________________________________________in handle_end integrieren..... + lds r_bytep,addr + rjmp handle_end ;read Memory Byte +h_writememory: + lds r_bytep,addr + configZ pack,r_bytep + st Z,r_rwbyte + ;ldi r_bcount,1 + ldi r_mode,OW_WRITE_MEMORY_CRC1 + ldi r_sendflag,1 ;jetzt sendet der Slave zum Master + lds r_rwbyte,crc + com r_rwbyte + lds r_temp,crc+1 + com r_temp + sts crcsave,r_temp + rjmp handle_end +h_writememorycrc1: + lds r_rwbyte,crcsave + ;ldi r_bcount,1 + ldi r_mode,OW_WRITE_MEMORY_CRC2 + rjmp handle_end +h_writememorycrc2: + lds r_temp,addr + configZ pack,r_temp + ld r_rwbyte,Z + ;ldi r_bcount,1 + ldi r_mode,OW_WRITE_MEMORY_READBACK + rjmp handle_end +h_writememoryreadback: + ldi r_temp,0x00 + sts crc+1,r_temp + lds r_temp,addr + inc r_temp + sts addr,r_temp + sts crc,r_temp + ldi r_sendflag,0 + ;ldi r_bcount,1 + ldi r_mode,OW_WRITE_MEMORY + rjmp handle_end + +h_convert: + cpi r_bytep,0 ;erstes Adressbyte ? + brne h_convert_byte1 ;nein dann weiter + inc r_bytep + sts pack+0x20,r_rwbyte + ;ldi r_bcount,1 + rjmp handle_end +h_convert_byte1: ;zweies byte glesen go crc# + sts pack+0x21,r_rwbyte + lds r_rwbyte,crc + com r_rwbyte + lds r_temp,crc+1 + com r_temp + sts crcsave,r_temp + ldi r_mode,OW_CONVERT_CRC1 + ;ldi r_bcount,1 + ldi r_sendflag,1 + rjmp handle_end +h_convertcrc1: + lds r_rwbyte,crcsave + ;ldi r_bcount,1 + ldi r_mode,OW_CONVERT_CRC2 + rjmp handle_end +h_convertcrc2: + ldi r_temp,1 + sts gcontrol,r_temp + ;ldi r_bcount,1 + 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 + + + + +#include "../common/OWPinInterrupt.s" +.end \ No newline at end of file diff --git a/programmer/flash/flashp18_atmelice.bat b/programmer/flash/flashp18_atmelice.bat new file mode 100644 index 0000000..7c4150c --- /dev/null +++ b/programmer/flash/flashp18_atmelice.bat @@ -0,0 +1,2 @@ +avrdude -c atmelice_isp -p t84 -U lfuse:w:0xE2:m -U hfuse:w:0xDE:m -U efuse:w:0xFE:m +avrdude -c atmelice_isp -p t84 -e -U flash:w:"../programmer/Release/programmer.hex" diff --git a/programmer/flash/flashp18_usbasb b/programmer/flash/flashp18_usbasb new file mode 100644 index 0000000..daa92f6 --- /dev/null +++ b/programmer/flash/flashp18_usbasb @@ -0,0 +1,2 @@ +avrdude -c usbasp -p t84 -U lfuse:w:0xE2:m -U hfuse:w:0xDE:m -U efuse:w:0xFE:m +avrdude -c usbasp -p t84 -e -U flash:w:"/media/muto/Daten/oc/dev/owSlave2/programmer/flash/programmer.hex" diff --git a/vergleiche liste.xlsx b/vergleiche liste.xlsx deleted file mode 100644 index a0eedd9..0000000 Binary files a/vergleiche liste.xlsx and /dev/null differ