Good evening,
I'm trying to change the program that measures the temperature with ds18b20.
The sample program manages one but I would like to add one more.
I added a rTemp1 variable and assigned it to DS18B20_1.rTemp ----- rTemp1
But I can not understand why the temperature display is the same as the first DS18B20.
What should I do to add other sensors?
Thanks, Alberto
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Goodmorning everyone
I'm trying to understand why I can not see the two temperatures.
The temperature of only one DS18b20 is always shown.
If I touch the DS18B20_1 nothing changes if I touch the DS18B20 change both
What's wrong ?
This is var
PROGRAMOneWireVARÂ Â tempExt:REAL;Â Â tempCaldaia:REAL;Â Â Â Â rTemp:REAL;Â Â astrID:ARRAY[1..20]OFSTRING;Â Â ui:uINT;Â Â x:BOOL;Â Â actDate:SYSTIMEDATE;Â Â dwActDate:DWORD;Â Â dtTimestamp:DT;END_VAR
This is code
IFNOTxTHEN  x:=TRUE;  //scanfunction  Onewire_master.Scan();  FORui:=1TOMIN(Onewire_master.uiScannedDevices,20)DO    astrID[ui]:=Onewire_master.pasScannedDevices^[ui-1].StringRepresentation;    //dynamicwritethescannedsensorstotheconfiguration    DS18B20.ID:=Onewire_master.pasScannedDevices^[ui-1];  END_FOREND_IFactDate:=DS18B20.stdTimeStamp;SysTimeRtcConvertDateToUtc(actDate,dwActDate);dtTimestamp:=DWORD_TO_DT(dwActDate);tempExt:=DS18B20.rTemp;tempCaldaia:=DS18B20_1.rTemp;
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
PROGRAMOneWireVARÂ Â tempExt:REAL;Â Â tempCaldaia:REAL;Â Â Â Â rTemp:REAL;Â Â astrID:ARRAY[1..20]OFSTRING;Â Â ui:uINT;Â Â x:BOOL;Â Â actDate:SYSTIMEDATE;Â Â dwActDate:DWORD;Â Â dtTimestamp:DT;END_VAR
IFNOTxTHEN
  x :=TRUE;
  //scanfunction
  Onewire_master.Scan();
  FORui:=1TOMIN(Onewire_master.uiScannedDevices, 20)DO
    astrID[ui] :=Onewire_master.pasScannedDevices^[ui-1].StringRepresentation;
    //dynamicwritethescannedsensorstotheconfiguration//    DS18B20.ID :=Onewire_master.pasScannedDevices^[ui-1];
  END_FOREND_IFT_Esterna.ID :=Onewire_master.pasScannedDevices^[0];T_Caldaia.ID :=Onewire_master.pasScannedDevices^[1];actDate :=T_Esterna.stdTimeStamp;SysTimeRtcConvertDateToUtc(actDate,dwActDate);dtTimestamp :=DWORD_TO_DT(dwActDate);
Good evening,
I'm trying to change the program that measures the temperature with ds18b20.
The sample program manages one but I would like to add one more.
I added a rTemp1 variable and assigned it to DS18B20_1.rTemp ----- rTemp1
But I can not understand why the temperature display is the same as the first DS18B20.
What should I do to add other sensors?
Thanks, Alberto
Goodmorning everyone
I'm trying to understand why I can not see the two temperatures.
The temperature of only one DS18b20 is always shown.
If I touch the DS18B20_1 nothing changes if I touch the DS18B20 change both
What's wrong ?
This is var
This is code
Solved
Related
Talk.ru: 1