Regin EXOLINE
Detaljer
- Typ
- Drivrutin
- Upplaggd av
- Ove Jansson, Abelko Innovation
- Version
- 1
- Uppdaterad
- 2013-08-28
- Skapad
- 2013-08-28
- Kategori
- Kyla, Modbus, Övrig utrustning, Värme, Ventilation
- Visningar
- 2929
Beskrivning
Drivrutin
Bruksanvisning
Hur man installerar typdefinitionerna och driftsätter modulerna finns beskrivet i användarmanualen, kapitel 18.7.
Juridisk information
Alla skript tillhandahålls i befintligt skick och all användning sker på eget ansvar. Felaktig använding kan leda till skadad eller förstörd utrustning.
Skript kod
DEVICETYPE ReginAnalog NAMED "Regin analog" TYPEID 21408 IS
PARAMETER
Id : "Adress";
PUBLIC
V1 : "AI_SupplyTemp" ["°C"]DEC1;
V2 : "AI_ExhaustTemp" ["°C"]DEC1;
V3 : "AI_FrostTemp" ["°C"]DEC1;
V4 : "AI_OutDoorTemp" ["°C"]DEC1;
V5 : "AI_AI1" ["°C"]DEC1;
V6 : "AI_AI2" ["°C"]DEC1;
V7 : "AI_AI3" ["°C"]DEC1;
V8 : "AI_AI4" ["°C"]DEC1;
V9 : "AOHeatingOutput" ["°C"]DEC1;
V10 : "AOCoolingOutput" ["°C"]DEC1;
V11 : "AORotatingSpeed" ["%"]DEC1;
V12 : "AO_AQ1" ["%"]DEC1;
V13 : "AO_AQ2" ["%"]DEC1;
V14 : "AO_AQ3" ["%"]DEC1;
PRIVATE
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM AnalogInput NAMED "Läs analog" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(04); % Modbus command "04h" Read registers
DATA[2] := RWORD(1); % OBS!! Register adress = Modbusadress in spec
DATA[4] := RWORD(14); % Number of registers
ANSWER SIZE 33 % antal register *2 + 5
DATA[0] = BYTE(Id); % ID
DATA[1] = HEX(04); % Modbus command "04h" Read registers
DATA[2] = BYTE(28); % Byte count
DATA[3] -> RWORD(IF (DATA>=32768) THEN V1:=(DATA-65536)/10; ELSE V1:=DATA/10; ENDIF;); % V1: "AI_SupplyTemp" ["°C"]
DATA[5] -> RWORD(IF (DATA>=32768) THEN V2:=(DATA-65536)/10; ELSE V2:=DATA/10; ENDIF;); % V2: "AI_ExhaustAirTemp" ["°C"]
DATA[7] -> RWORD(IF (DATA>=32768) THEN V3:=(DATA-65536)/10; ELSE V3:=DATA/10; ENDIF;); % V3: "AI_FrostProtectionTemp" ["°C"];
DATA[9] -> RWORD(IF (DATA>=32768) THEN V4:=(DATA-65536)/10; ELSE V4:=DATA/10; ENDIF;); % V4: "AI_OutDoorTemp" ["°C"];
DATA[11] -> RWORD(IF (DATA>=32768) THEN V5:=(DATA-65536)/10; ELSE V5:=DATA/10; ENDIF;); % V5: "AI_AI1" ["°C"];
DATA[13] -> RWORD(IF (DATA>=32768) THEN V6:=(DATA-65536)/10; ELSE V6:=DATA/10; ENDIF;); % V6: "AI_AI2" ["°C"];
DATA[15] -> RWORD(IF (DATA>=32768) THEN V7:=(DATA-65536)/10; ELSE V7:=DATA/10; ENDIF;); % V7: "AI_AI3" ["°C"];
DATA[17] -> RWORD(IF (DATA>=32768) THEN V8:=(DATA-65536)/10; ELSE V8:=DATA/10; ENDIF;); % V8: "AI_AI4" ["°C"];
DATA[19] -> RWORD(IF (DATA>=32768) THEN V9:=(DATA-65536)/10; ELSE V9:=DATA/10; ENDIF;); % V9: "AO_Heating_Output" ["°C"];
DATA[21] -> RWORD(IF (DATA>=32768) THEN V10:=(DATA-65536)/10; ELSE V10:=DATA/10; ENDIF;); % 10* V10: "AO_Cooling_Output" ["°C"];
DATA[23] -> RWORD(V11:= DATA / 10;); % V11: "AO_RotatingSpeed" ["%"];
DATA[25] -> RWORD(V12:= DATA / 10;); % V12: "AO_AQ1" [""];
DATA[27] -> RWORD(V13:= DATA / 10;); % V13: "AO_AQ2" [""];
DATA[29] -> RWORD(V14:= DATA / 10;); % V14: "AO_AQ3" [""];
TIMEOUT 2000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for REGIN EXOLINE settings
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Ove Jansson, ABELKO AB Luleå
% History: 2011-03-15 initial version
%
DEVICETYPE ReginOutput NAMED "Regin ställ" TYPEID 21409 IS
PARAMETER
Id :"Adress";
S1 :"Unitmode" [""]; % 0=Manual off, 1=Manual low, 2=Manual medium, 3=Manual high, 4(default)=Auto
S2 :"SetPoint_M20" ["°C"]; %Outdoortemp.comp At -20, default=20
S3 :"SetPoint_M15" ["°C"]; %Outdoortemp.comp At +15, default=0
S4 :"MinSupplyTemp"["°C"]; %Supply setpoint Min
S5 :"MaxSupplyTemp"["°C"]; %Supply setpoint Max
PUBLIC
%V1 :"Unitmode" [""];
%V2 :"SetPoint_M20" ["°C"];
%V3 :"SetPoint_M15" ["°C"];
%V4 :"MinSupplyTemp"["°C"];
%V5 :"MaxSupplyTemp"["°C"];
PRIVATE
Cnt;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM WriteSet NAMED "Ställ värden" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := BYTE(6); % Modbus command "0x06" write singel register
DATA[2] <- RWORD( % Register address
Cnt:=Cnt+1;
IF Cnt>4 THEN Cnt:=0; ENDIF; % OBS!! Register adress = Modbusadress in spec
IF Cnt=0 THEN DATA:=2; % Register 2 Unitmode
ELSIF Cnt=1 THEN DATA:=21; % Register 21 SetPoint_M20
ELSIF Cnt=2 THEN DATA:=22; % Register 22 SetPoint_M15
ELSIF Cnt=3 THEN DATA:=23; % Register 23 MinSupplyTemp
ELSIF Cnt=4 THEN DATA:=24; % Register 24 MaxSupplyTemp
ENDIF;
);
DATA[4] <- RWORD( % Register value
IF Cnt=0 THEN DATA:=S1; % Register 2 Unitmode
ELSIF Cnt=1 THEN DATA:=S2; % Register 21 SetPoint_M20
ELSIF Cnt=2 THEN DATA:=S3; % Register 22 SetPoint_M15
ELSIF Cnt=3 THEN DATA:=S4; % Register 23 MinSupplyTemp
ELSIF Cnt=4 THEN DATA:=S5; % Register 24 MaxSupplyTemp
ENDIF;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = BYTE(6);
TIMEOUT 2000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for REGIN EXOLINE Digital inputs/outputs
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Ove Jansson, ABELKO AB Luleå
% History: 2008-10-23 initial version
%
DEVICETYPE ReginDigital NAMED "Regin DI/DU" TYPEID 21407 IS
PARAMETER
Id : "Adress";
Ack : "Kvittera";
PUBLIC
DI0 : "Unit_OffOn"; % Off, On
DI1 : "Fan_alarm"; % On, Off, Inverted
DI2 : "Overheat"; % Off, On
DI3 : "Timer_push"; % Off, On
DI4 : "AlarmExchanger"; % Off, On
DI5 : "FireAlarm"; % Off, On
DI6 : "Fanspeed_Low"; % Off, On
DI7 : "Fanspeed_Medium"; % Off, On
DI8 : "Fanspeed_High"; % Off, On
DI9 : "Exchanger"; % Off, On
DI10 : "Alarm_Filter"; % Alarm no. 1
DI11 : "Alarm_Fan_motor"; % Alarm no. 2
DI12 : "Alarm_Overheat"; % Alarm no. 3
DI13 : "Alarm_Exchanger"; % Alarm no. 4
DI14 : "Alarm_Fire"; % Alarm no. 6
DI15 : "Alarm_FrostProt"; % Alarm no. 7
DI16 : "SensErrorSupply"; % Alarm no. 8
DI17 : "SensErrorExhaust"; % Alarm no. 9
DI18 : "SensErrorFrost"; % Alarm no. 10
DI19 : "SensErrorOuttemp"; % Alarm no. 11
PRIVATE
Started;
MAck;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM DigitalInput NAMED "Digital status" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(02); % Modbus command "02h" read discrete input (bit)
DATA[2] := RWORD(1); % OBS!! Register adress = Modbusadress in spec
DATA[4] := RWORD(10); % Number of inputs
ANSWER SIZE 7
DATA[0] = BYTE(Id);
DATA[1] = HEX(02);
DATA[3] -> BYTE(IF (DATA & 1) THEN DI0 := 1; ELSE DI0 := 0; ENDIF;
IF (DATA & 2) THEN DI1 := 1; ELSE DI1 := 0; ENDIF;
IF (DATA & 4) THEN DI2 := 1; ELSE DI2 := 0; ENDIF;
IF (DATA & 8) THEN DI3 := 1; ELSE DI3 := 0; ENDIF;
IF (DATA & 16) THEN DI4 := 1; ELSE DI4 := 0; ENDIF;
IF (DATA & 32) THEN DI5 := 1; ELSE DI5 := 0; ENDIF;
IF (DATA & 64) THEN DI6 := 1; ELSE DI6 := 0; ENDIF;
IF (DATA & 128) THEN DI7 := 1; ELSE DI7 := 0; ENDIF;
);
DATA[4] -> BYTE(IF (DATA & 1) THEN DI8 := 1; ELSE DI8 := 0; ENDIF;
IF (DATA & 2) THEN DI9 := 1; ELSE DI9 := 0; ENDIF;
);
TIMEOUT 2000
END;
TELEGRAM AlarmInput NAMED "Alarm status" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(02); % Modbus command "02h" read discrete input (bit)
DATA[2] := RWORD(50); % OBS!! Register adress = Modbusadress in spec
DATA[4] := RWORD(11); % Number of inputs
ANSWER SIZE 7
DATA[0] = BYTE(Id);
DATA[1] = HEX(02);
DATA[3] -> BYTE(IF (DATA & 1) THEN DI10 := 1; ELSE DI10 := 0; ENDIF; %1
IF (DATA & 2) THEN DI11 := 1; ELSE DI11 := 0; ENDIF; %2
IF (DATA & 4) THEN DI12 := 1; ELSE DI12 := 0; ENDIF; %3
IF (DATA & 8) THEN DI13 := 1; ELSE DI13 := 0; ENDIF; %4
%IF (DATA & 16) THEN DIxx := 1; ELSE DIxx := 0; ENDIF; % Hoppa över 5 (16) eftersom den inte används
IF (DATA & 32) THEN DI14 := 1; ELSE DI14 := 0; ENDIF; %6
IF (DATA & 64) THEN DI15 := 1; ELSE DI15 := 0; ENDIF; %7
IF (DATA & 128) THEN DI16 := 1; ELSE DI16 := 0; ENDIF; %8
);
DATA[4] -> BYTE(IF (DATA & 1) THEN DI17 := 1; ELSE DI17 := 0; ENDIF; %9
IF (DATA & 2) THEN DI18 := 1; ELSE DI18 := 0; ENDIF; %10
IF (DATA & 4) THEN DI19 := 1; ELSE DI19 := 0; ENDIF; %11
);
TIMEOUT 2000
END;
TELEGRAM SendAcknowledge NAMED "Kvittera larm" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := BYTE(6); %Write singel register
DATA[2] := RWORD(150); %Adress 150, OBS!! Register adress = Modbusadress in spec
DATA[4] := RWORD(1); %Set RESET
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = BYTE(6);
TIMEOUT 2000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GROUP SendAckGroup OF MAX 5 DEVICE TYPEID 21407
SELECT ALL
ITERATOR SendAck
ALIAS
BEGIN
IF (Started) THEN
IF (Ack > MAck) THEN
SEND SendAcknowledge;
ELSE
SILENCE SendAcknowledge;
ENDIF;
MAck := Ack;
ELSE
SILENCE SendAcknowledge;
MAck := Ack;
Started := 1;
ENDIF;
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ROUTINE Acknowledge
BEGIN
CALL SendAckGroup.SendAck;
END;
PARAMETER
Id : "Adress";
PUBLIC
V1 : "AI_SupplyTemp" ["°C"]DEC1;
V2 : "AI_ExhaustTemp" ["°C"]DEC1;
V3 : "AI_FrostTemp" ["°C"]DEC1;
V4 : "AI_OutDoorTemp" ["°C"]DEC1;
V5 : "AI_AI1" ["°C"]DEC1;
V6 : "AI_AI2" ["°C"]DEC1;
V7 : "AI_AI3" ["°C"]DEC1;
V8 : "AI_AI4" ["°C"]DEC1;
V9 : "AOHeatingOutput" ["°C"]DEC1;
V10 : "AOCoolingOutput" ["°C"]DEC1;
V11 : "AORotatingSpeed" ["%"]DEC1;
V12 : "AO_AQ1" ["%"]DEC1;
V13 : "AO_AQ2" ["%"]DEC1;
V14 : "AO_AQ3" ["%"]DEC1;
PRIVATE
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM AnalogInput NAMED "Läs analog" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(04); % Modbus command "04h" Read registers
DATA[2] := RWORD(1); % OBS!! Register adress = Modbusadress in spec
DATA[4] := RWORD(14); % Number of registers
ANSWER SIZE 33 % antal register *2 + 5
DATA[0] = BYTE(Id); % ID
DATA[1] = HEX(04); % Modbus command "04h" Read registers
DATA[2] = BYTE(28); % Byte count
DATA[3] -> RWORD(IF (DATA>=32768) THEN V1:=(DATA-65536)/10; ELSE V1:=DATA/10; ENDIF;); % V1: "AI_SupplyTemp" ["°C"]
DATA[5] -> RWORD(IF (DATA>=32768) THEN V2:=(DATA-65536)/10; ELSE V2:=DATA/10; ENDIF;); % V2: "AI_ExhaustAirTemp" ["°C"]
DATA[7] -> RWORD(IF (DATA>=32768) THEN V3:=(DATA-65536)/10; ELSE V3:=DATA/10; ENDIF;); % V3: "AI_FrostProtectionTemp" ["°C"];
DATA[9] -> RWORD(IF (DATA>=32768) THEN V4:=(DATA-65536)/10; ELSE V4:=DATA/10; ENDIF;); % V4: "AI_OutDoorTemp" ["°C"];
DATA[11] -> RWORD(IF (DATA>=32768) THEN V5:=(DATA-65536)/10; ELSE V5:=DATA/10; ENDIF;); % V5: "AI_AI1" ["°C"];
DATA[13] -> RWORD(IF (DATA>=32768) THEN V6:=(DATA-65536)/10; ELSE V6:=DATA/10; ENDIF;); % V6: "AI_AI2" ["°C"];
DATA[15] -> RWORD(IF (DATA>=32768) THEN V7:=(DATA-65536)/10; ELSE V7:=DATA/10; ENDIF;); % V7: "AI_AI3" ["°C"];
DATA[17] -> RWORD(IF (DATA>=32768) THEN V8:=(DATA-65536)/10; ELSE V8:=DATA/10; ENDIF;); % V8: "AI_AI4" ["°C"];
DATA[19] -> RWORD(IF (DATA>=32768) THEN V9:=(DATA-65536)/10; ELSE V9:=DATA/10; ENDIF;); % V9: "AO_Heating_Output" ["°C"];
DATA[21] -> RWORD(IF (DATA>=32768) THEN V10:=(DATA-65536)/10; ELSE V10:=DATA/10; ENDIF;); % 10* V10: "AO_Cooling_Output" ["°C"];
DATA[23] -> RWORD(V11:= DATA / 10;); % V11: "AO_RotatingSpeed" ["%"];
DATA[25] -> RWORD(V12:= DATA / 10;); % V12: "AO_AQ1" [""];
DATA[27] -> RWORD(V13:= DATA / 10;); % V13: "AO_AQ2" [""];
DATA[29] -> RWORD(V14:= DATA / 10;); % V14: "AO_AQ3" [""];
TIMEOUT 2000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for REGIN EXOLINE settings
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Ove Jansson, ABELKO AB Luleå
% History: 2011-03-15 initial version
%
DEVICETYPE ReginOutput NAMED "Regin ställ" TYPEID 21409 IS
PARAMETER
Id :"Adress";
S1 :"Unitmode" [""]; % 0=Manual off, 1=Manual low, 2=Manual medium, 3=Manual high, 4(default)=Auto
S2 :"SetPoint_M20" ["°C"]; %Outdoortemp.comp At -20, default=20
S3 :"SetPoint_M15" ["°C"]; %Outdoortemp.comp At +15, default=0
S4 :"MinSupplyTemp"["°C"]; %Supply setpoint Min
S5 :"MaxSupplyTemp"["°C"]; %Supply setpoint Max
PUBLIC
%V1 :"Unitmode" [""];
%V2 :"SetPoint_M20" ["°C"];
%V3 :"SetPoint_M15" ["°C"];
%V4 :"MinSupplyTemp"["°C"];
%V5 :"MaxSupplyTemp"["°C"];
PRIVATE
Cnt;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM WriteSet NAMED "Ställ värden" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := BYTE(6); % Modbus command "0x06" write singel register
DATA[2] <- RWORD( % Register address
Cnt:=Cnt+1;
IF Cnt>4 THEN Cnt:=0; ENDIF; % OBS!! Register adress = Modbusadress in spec
IF Cnt=0 THEN DATA:=2; % Register 2 Unitmode
ELSIF Cnt=1 THEN DATA:=21; % Register 21 SetPoint_M20
ELSIF Cnt=2 THEN DATA:=22; % Register 22 SetPoint_M15
ELSIF Cnt=3 THEN DATA:=23; % Register 23 MinSupplyTemp
ELSIF Cnt=4 THEN DATA:=24; % Register 24 MaxSupplyTemp
ENDIF;
);
DATA[4] <- RWORD( % Register value
IF Cnt=0 THEN DATA:=S1; % Register 2 Unitmode
ELSIF Cnt=1 THEN DATA:=S2; % Register 21 SetPoint_M20
ELSIF Cnt=2 THEN DATA:=S3; % Register 22 SetPoint_M15
ELSIF Cnt=3 THEN DATA:=S4; % Register 23 MinSupplyTemp
ELSIF Cnt=4 THEN DATA:=S5; % Register 24 MaxSupplyTemp
ENDIF;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = BYTE(6);
TIMEOUT 2000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for REGIN EXOLINE Digital inputs/outputs
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Ove Jansson, ABELKO AB Luleå
% History: 2008-10-23 initial version
%
DEVICETYPE ReginDigital NAMED "Regin DI/DU" TYPEID 21407 IS
PARAMETER
Id : "Adress";
Ack : "Kvittera";
PUBLIC
DI0 : "Unit_OffOn"; % Off, On
DI1 : "Fan_alarm"; % On, Off, Inverted
DI2 : "Overheat"; % Off, On
DI3 : "Timer_push"; % Off, On
DI4 : "AlarmExchanger"; % Off, On
DI5 : "FireAlarm"; % Off, On
DI6 : "Fanspeed_Low"; % Off, On
DI7 : "Fanspeed_Medium"; % Off, On
DI8 : "Fanspeed_High"; % Off, On
DI9 : "Exchanger"; % Off, On
DI10 : "Alarm_Filter"; % Alarm no. 1
DI11 : "Alarm_Fan_motor"; % Alarm no. 2
DI12 : "Alarm_Overheat"; % Alarm no. 3
DI13 : "Alarm_Exchanger"; % Alarm no. 4
DI14 : "Alarm_Fire"; % Alarm no. 6
DI15 : "Alarm_FrostProt"; % Alarm no. 7
DI16 : "SensErrorSupply"; % Alarm no. 8
DI17 : "SensErrorExhaust"; % Alarm no. 9
DI18 : "SensErrorFrost"; % Alarm no. 10
DI19 : "SensErrorOuttemp"; % Alarm no. 11
PRIVATE
Started;
MAck;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM DigitalInput NAMED "Digital status" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(02); % Modbus command "02h" read discrete input (bit)
DATA[2] := RWORD(1); % OBS!! Register adress = Modbusadress in spec
DATA[4] := RWORD(10); % Number of inputs
ANSWER SIZE 7
DATA[0] = BYTE(Id);
DATA[1] = HEX(02);
DATA[3] -> BYTE(IF (DATA & 1) THEN DI0 := 1; ELSE DI0 := 0; ENDIF;
IF (DATA & 2) THEN DI1 := 1; ELSE DI1 := 0; ENDIF;
IF (DATA & 4) THEN DI2 := 1; ELSE DI2 := 0; ENDIF;
IF (DATA & 8) THEN DI3 := 1; ELSE DI3 := 0; ENDIF;
IF (DATA & 16) THEN DI4 := 1; ELSE DI4 := 0; ENDIF;
IF (DATA & 32) THEN DI5 := 1; ELSE DI5 := 0; ENDIF;
IF (DATA & 64) THEN DI6 := 1; ELSE DI6 := 0; ENDIF;
IF (DATA & 128) THEN DI7 := 1; ELSE DI7 := 0; ENDIF;
);
DATA[4] -> BYTE(IF (DATA & 1) THEN DI8 := 1; ELSE DI8 := 0; ENDIF;
IF (DATA & 2) THEN DI9 := 1; ELSE DI9 := 0; ENDIF;
);
TIMEOUT 2000
END;
TELEGRAM AlarmInput NAMED "Alarm status" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(02); % Modbus command "02h" read discrete input (bit)
DATA[2] := RWORD(50); % OBS!! Register adress = Modbusadress in spec
DATA[4] := RWORD(11); % Number of inputs
ANSWER SIZE 7
DATA[0] = BYTE(Id);
DATA[1] = HEX(02);
DATA[3] -> BYTE(IF (DATA & 1) THEN DI10 := 1; ELSE DI10 := 0; ENDIF; %1
IF (DATA & 2) THEN DI11 := 1; ELSE DI11 := 0; ENDIF; %2
IF (DATA & 4) THEN DI12 := 1; ELSE DI12 := 0; ENDIF; %3
IF (DATA & 8) THEN DI13 := 1; ELSE DI13 := 0; ENDIF; %4
%IF (DATA & 16) THEN DIxx := 1; ELSE DIxx := 0; ENDIF; % Hoppa över 5 (16) eftersom den inte används
IF (DATA & 32) THEN DI14 := 1; ELSE DI14 := 0; ENDIF; %6
IF (DATA & 64) THEN DI15 := 1; ELSE DI15 := 0; ENDIF; %7
IF (DATA & 128) THEN DI16 := 1; ELSE DI16 := 0; ENDIF; %8
);
DATA[4] -> BYTE(IF (DATA & 1) THEN DI17 := 1; ELSE DI17 := 0; ENDIF; %9
IF (DATA & 2) THEN DI18 := 1; ELSE DI18 := 0; ENDIF; %10
IF (DATA & 4) THEN DI19 := 1; ELSE DI19 := 0; ENDIF; %11
);
TIMEOUT 2000
END;
TELEGRAM SendAcknowledge NAMED "Kvittera larm" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := BYTE(6); %Write singel register
DATA[2] := RWORD(150); %Adress 150, OBS!! Register adress = Modbusadress in spec
DATA[4] := RWORD(1); %Set RESET
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = BYTE(6);
TIMEOUT 2000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GROUP SendAckGroup OF MAX 5 DEVICE TYPEID 21407
SELECT ALL
ITERATOR SendAck
ALIAS
BEGIN
IF (Started) THEN
IF (Ack > MAck) THEN
SEND SendAcknowledge;
ELSE
SILENCE SendAcknowledge;
ENDIF;
MAck := Ack;
ELSE
SILENCE SendAcknowledge;
MAck := Ack;
Started := 1;
ENDIF;
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ROUTINE Acknowledge
BEGIN
CALL SendAckGroup.SendAck;
END;
Användarnas noteringar
Du måste vara inloggad för att göra en notering. Bli medlem eller logga in. Vi använder en moderator som godkänner noteringarna innan de visas.