tm3d
/
owSlave2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Change Slave sends '0' during convert prozess on all DS18B20
[owSlave2.git]
/
DS18B20_MAX44009_DS2438_SHT
/
DS18B20_DS2438.c
diff --git
a/DS18B20_MAX44009_DS2438_SHT/DS18B20_DS2438.c
b/DS18B20_MAX44009_DS2438_SHT/DS18B20_DS2438.c
index
d737c59
..
3cdc7ec
100644
(file)
--- a/
DS18B20_MAX44009_DS2438_SHT/DS18B20_DS2438.c
+++ b/
DS18B20_MAX44009_DS2438_SHT/DS18B20_DS2438.c
@@
-44,7
+44,7
@@
extern void OWINIT();
extern void OWINIT();
-
+extern void EXTERN_SLEEP();
uint8_t owid1[8]={0x28, 0xA3, 0xD9, 0x84, 0x00, 0x16, 0x05, 0x18};/**/
uint8_t owid1[8]={0x28, 0xA3, 0xD9, 0x84, 0x00, 0x16, 0x05, 0x18};/**/
@@
-139,6
+139,7
@@
int16_t sRH,sT;
volatile double temperatureC,humidityRH;
volatile double l;
volatile double temperatureC,humidityRH;
volatile double l;
+uint8_t max_adr=0;
int main(void){
PRR|=(1<<PRADC); // adc for save Power
int main(void){
PRR|=(1<<PRADC); // adc for save Power
@@
-162,6
+163,7
@@
int main(void){
MCUSR=0;
USI_TWI_Master_Initialise();
MCUSR=0;
USI_TWI_Master_Initialise();
+ if (checkMAX44009(0)) max_adr=0; else max_adr=1 ;
SHT2x_SoftReset();
SHT2x_ReadUserRegister(userRegister);
//(userRegister & ~SHT2x_RES_MASK) | SHT2x_RES_10_13BIT;
SHT2x_SoftReset();
SHT2x_ReadUserRegister(userRegister);
//(userRegister & ~SHT2x_RES_MASK) | SHT2x_RES_10_13BIT;
@@
-176,8
+178,10
@@
int main(void){
gcontrol=1;
sei();
gcontrol=1;
sei();
+ //DDRB|=(1<<PINB1);
while(1) {
if (wdcounter>0) {
while(1) {
if (wdcounter>0) {
+ //PORTB|=(1<<PINB1); //Dauer 440ms
SHT2x_MeasurePoll(HUMIDITY, &sRH);
// --- measure temperature with "Polling Mode" (no hold master) ---
SHT2x_MeasurePoll(TEMP, &sT);
SHT2x_MeasurePoll(HUMIDITY, &sRH);
// --- measure temperature with "Polling Mode" (no hold master) ---
SHT2x_MeasurePoll(TEMP, &sT);
@@
-187,11
+191,12
@@
int main(void){
double hhum=(1.0546-0.000216*temperatureC)*(humidityRH);
am2302_hum=0.318*hhum +76.0;
am2302_temp=temperatureC*25.6;
double hhum=(1.0546-0.000216*temperatureC)*(humidityRH);
am2302_hum=0.318*hhum +76.0;
am2302_temp=temperatureC*25.6;
+ //PORTB&=~(1<<PINB1);
wdcounter=0;
}
if (gcontrol==1) {
wdcounter=0;
}
if (gcontrol==1) {
- l=MAX44009getlux(
0);
+ l=MAX44009getlux(
max_adr);
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;
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;
@@
-205,7
+210,7
@@
int main(void){
//pack.temp++;
alarmflag=af;
sei();
//pack.temp++;
alarmflag=af;
sei();
- gcontrol=0;
+ EXTERN_SLEEP();
}
if ((gcontrol==2)||(gcontrol==3)) {
gcontrol=0;
}
if ((gcontrol==2)||(gcontrol==3)) {
gcontrol=0;
@@
-227,7
+232,6
@@
int main(void){
MCUCR|=(1<<SE);
MCUCR&=~(1<<SM1);
}
MCUCR|=(1<<SE);
MCUCR&=~(1<<SM1);
}
- //MCUCR&=~(1<<ISC01);
asm("SLEEP");
}
asm("SLEEP");
}