Regin EXO Compact 2012
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
- 2765
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for REGIN EXO Compact Alarm
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Ove Jansson, ABELKO AB Luleå
% History: 2011-05-16 initial version
%
DEVICETYPE ReginAlarm NAMED "ReginAlarm" TYPEID 21423 IS
PARAMETER
Id : "Adress";
PUBLIC
V1 :"LA1_TF" ; % 0
V2 :"FF1_ind" ; % 1
V3 :"SPJ3_4_Ständ/Ö" ; % 2
V4 :"SPJ3_4_Öppen/S" ; % 3
V5 :"Test_Omkoppl" ; % 4
V6 :"Service_OmkInd" ; % 5
V7 :"FF1_Man" ; % 6
V8 :"SPJ3_4_Man" ; % 7
V9 :"VP_Steg1_Man" ; % 8
V10 :"VP_Steg2_Man" ; % 9
V11 :"ASH2SA_LarmAMan" ; % 10
V12 :"ASH2SA_LarmBMan" ; % 11
V13 :"ASH2SA_LarmCMan" ; % 12
PRIVATE
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM ReadAlarm NAMED "ReadAlarmStatus" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(02); % Modbus command "02h" read discrete input (bit)
DATA[2] := RWORD(0); % Start adress
DATA[4] := RWORD(13); % Number of inputs
ANSWER SIZE 7
DATA[0] = BYTE(Id);
DATA[1] = HEX(02);
DATA[2] = BYTE(2);
DATA[3] -> BYTE(IF (DATA & 1) THEN V1 := 1; ELSE V1 := 0; ENDIF; % V1 :"FA1_Larm_Ind" ""; % 0
IF (DATA & 2) THEN V2 := 1; ELSE V2 := 0; ENDIF; % V2 :"FF1_ind" ""; % 1
IF (DATA & 4) THEN V3 := 1; ELSE V3 := 0; ENDIF; % V3 :"SPJ3_4_Ständ/Ö" ""; % 2
IF (DATA & 8) THEN V4 := 1; ELSE V4 := 0; ENDIF; % V4 :"SPJ3_4_Öppen/S" ""; % 3
IF (DATA & 16) THEN V5 := 1; ELSE V5 := 0; ENDIF; % V5 :"Test_Omkoppl" ""; % 4
IF (DATA & 32) THEN V6 := 1; ELSE V6 := 0; ENDIF; % V6 :"Service_OmkInd" ""; % 5
IF (DATA & 64) THEN V7 := 1; ELSE V7 := 0; ENDIF; % V7 :"FF1_Man" ""; % 6
IF (DATA & 128) THEN V8 := 1; ELSE V8 := 0; ENDIF; % V8 :"SPJ3_4_Man" ""; % 7
);
DATA[4] -> BYTE(IF (DATA & 1) THEN V9 := 1; ELSE V9 := 0; ENDIF; % V9 :"VP_Steg1_Man" ""; % 8
IF (DATA & 2) THEN V10 := 1; ELSE V10 := 0; ENDIF; % V10 :"VP_Steg2_Man" ""; % 9
IF (DATA & 4) THEN V11 := 1; ELSE V11 := 0; ENDIF; % V11 :"ASH2SA_LarmAMan" ""; % 10
IF (DATA & 8) THEN V12 := 1; ELSE V12 := 0; ENDIF; % V12 :"ASH2SA_LarmBMan" ""; % 11
IF (DATA & 16) THEN V13 := 1; ELSE V13 := 0; ENDIF; % V13 :"ASH2SA_LarmCMan" ""; % 12
);
TIMEOUT 2000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for REGIN EXO Compact Coil
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Ove Jansson, ABELKO AB Luleå
% History: 2011-05-16 initial version
%
DEVICETYPE ReginCoil NAMED "ReginCoil" TYPEID 21424 IS
PARAMETER
Id : "Adress";
PUBLIC
V1 : "FA1_Start"; % 100
V2 : "VP1_Start"; % 101
V3 : "FF1_start"; % 102
PRIVATE
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM ReadCoil NAMED "ReadCoil" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(01); % Modbus command "01h" Read coil status (bit)
DATA[2] := RWORD(0); % Start adress
DATA[4] := RWORD(3); % Number of inputs
ANSWER SIZE 6
DATA[0] = BYTE(Id);
DATA[1] = HEX(02);
DATA[2] = BYTE(1);
DATA[3] -> BYTE(IF (DATA & 1) THEN V1 := 1; ELSE V1 := 0; ENDIF;
IF (DATA & 2) THEN V2 := 1; ELSE V2 := 0; ENDIF;
IF (DATA & 4) THEN V3 := 1; ELSE V3 := 0; ENDIF;
);
TIMEOUT 2000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for REGIN EXO Compact Input
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Ove Jansson, ABELKO AB Luleå
% History: 2011-04-05 initial version
%
DEVICETYPE ReginInput NAMED "ReginInput" TYPEID 21425 IS
PARAMETER
Id : "Adress";
PUBLIC
V1 : "FA1_GP1" ["Pa"]; % 200
V2 : "FA1_GT1" ["°C"]; % 202
V3 : "UTE_GT3" ["°C"]; % 204
V4 : "FA1_FO" ["%"]; % 206
V5 : "BörvärdeTryckst" ["Pa"]; % 208
PRIVATE
Sign;
Exponent;
Mantissa;
Tmp3;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM ReginInput1 NAMED "ReginInput1" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(04); % Modbus command "04h" Read registers
DATA[2] := RWORD(0); % OBS!! Register adress = Modbusadress in spec
DATA[4] := RWORD(10); % Number of registers
ANSWER SIZE 25 % antal register *2 + 5
DATA[0] = BYTE(Id); % ID
DATA[1] = HEX(04); % Modbus command "04h" Read registers
DATA[2] = BYTE(20); % Byte count
DATA[3] -> BYTE(Mantissa := DATA* 256;);
DATA[4] -> BYTE( Mantissa := Mantissa + (DATA););
DATA[5] -> BYTE(
IF (DATA&128) THEN Sign := -1; ELSE Sign := 1; ENDIF;
Exponent := (DATA&127)*2;
);
DATA[6] -> BYTE(
Exponent := Exponent+(DATA&128)-127;
Mantissa := 1+((Mantissa+((DATA&127)*65536))/8388608);
V1 := Sign * Mantissa * (2^Exponent);
);
DATA[7] -> BYTE(Mantissa := DATA * 256;);
DATA[8] -> BYTE( Mantissa := Mantissa + DATA;);
DATA[9] -> BYTE(
IF (DATA&128) THEN Sign := -1; ELSE Sign := 1; ENDIF;
Exponent := (DATA&127)*2;
);
DATA[10] -> BYTE(
Exponent := Exponent+(DATA&128)-127;
Mantissa := 1+((Mantissa+((DATA&127)*65536))/8388608);
V2 := Sign * Mantissa * (2^Exponent);
);
DATA[11] -> BYTE(Mantissa := DATA *256;);
DATA[12] -> BYTE( Mantissa := Mantissa + DATA;);
DATA[13] -> BYTE(
IF (DATA&128) THEN Sign := -1; ELSE Sign := 1; ENDIF;
Exponent := (DATA & 127)*2;
);
DATA[14] -> BYTE(
Exponent := Exponent+(DATA & 128)-127;
Mantissa := 1+((Mantissa+((DATA & 127)*65536))/8388608);
V3 := Sign * Mantissa * (2^Exponent);
);
DATA[15] -> BYTE(Mantissa := DATA *256;);
DATA[16] -> BYTE( Mantissa := Mantissa + (DATA););
DATA[17] -> BYTE(
IF (DATA&128) THEN Sign := -1; ELSE Sign := 1; ENDIF;
Exponent := (DATA & 127)*2;
);
DATA[18] -> BYTE(
Exponent := Exponent+(DATA & 128)-127;
Mantissa := 1+((Mantissa+((DATA & 127)* 65536))/8388608);
V4 := Sign * Mantissa * (2^Exponent);
);
DATA[19] -> BYTE(Mantissa := DATA*256;);
DATA[20] -> BYTE( Mantissa := Mantissa + (DATA););
DATA[21] -> BYTE(
IF (DATA&128) THEN Sign := -1; ELSE Sign := 1; ENDIF;
Exponent := (DATA&127)*2;
);
DATA[22] -> BYTE(
Exponent := Exponent+(DATA&128)-127;
Mantissa := 1+((Mantissa+((DATA&127)* 65536))/838860);
V5 := Sign * Mantissa * (2^Exponent);
);
TIMEOUT 2000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for REGIN EXO Compact Input
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Ove Jansson, ABELKO AB Luleå
% History: 2011-04-05 initial version
%
DEVICETYPE ReginHolding NAMED "ReginHolding" TYPEID 21426 IS
PARAMETER
Id : "Adress";
PUBLIC
V1 : "FF1_Brandfläkt" [""]; % 300 1=till, 2=auto, 0=off
V2 : "VP1_Steg1_Man" [""]; % 301 1=till, 2=auto, 0=off
V3 : "VP1_Steg2_Man" [""]; % 302 1=till, 2=auto, 0=off
V4 : "Börv_Högfart" ["Pa"]; % 303 32bit
V5 : "Börv_Lågfart" ["Pa"]; % 305 32bit
V6 : "BlockHögfart" ["°C"]; % 307 32bit Utetemperatur som blockerar högfart
PRIVATE
Tmp3;
Sign;
Exponent;
Mantissa;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM ReginHoldingt1 NAMED "ReginHolding1" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(03); % Modbus command "03h" Read Holding registers
DATA[2] := RWORD(0); % OBS!! Register adress = Modbusadress in spec
DATA[4] := RWORD(9); % Number of registers
ANSWER SIZE 23 % antal register *2 + 5
DATA[0] = BYTE(Id); % ID
DATA[1] = HEX(03); % Modbus command "03h" Read Holding registers
DATA[2] = BYTE(18); % Byte count
DATA[3] -> RWORD(V1 := DATA;);
DATA[5] -> RWORD(V2 := DATA;);
DATA[7] -> RWORD(V3 := DATA;);
DATA[9] -> BYTE(Mantissa := DATA * 256;);
DATA[10] -> BYTE( Mantissa := Mantissa + (DATA););
DATA[11] -> BYTE(
IF (DATA&128) THEN Sign := -1; ELSE Sign := 1; ENDIF;
Exponent := (DATA&127)*2;
);
DATA[12] -> BYTE(
Exponent := Exponent+(DATA&128)-127;
Mantissa := 1+((Mantissa+((DATA&127)*65536))/8388608);
V4 := Sign * Mantissa * (2^Exponent);
);
DATA[13] -> BYTE(Mantissa := DATA * 256;);
DATA[14] -> BYTE( Mantissa := Mantissa + (DATA););
DATA[15] -> BYTE(
IF (DATA&128) THEN Sign := -1; ELSE Sign := 1; ENDIF;
Exponent := (DATA&127)*2;
);
DATA[16] -> BYTE(
Exponent := Exponent+(DATA&128)-127;
Mantissa := 1+((Mantissa+((DATA&127)*65536))/8388608);
V5 := Sign * Mantissa * (2^Exponent);
);
DATA[17] -> BYTE(Mantissa := DATA * 256;);
DATA[18] -> BYTE( Mantissa := Mantissa + (DATA););
DATA[19] -> BYTE(
IF (DATA&128) THEN Sign := -1; ELSE Sign := 1; ENDIF;
Exponent := (DATA&127)*2;
);
DATA[20] -> BYTE(
Exponent := Exponent+(DATA&128)-127;
Mantissa := 1+((Mantissa+((DATA&127)*65536))/8388608);
V6 := Sign * Mantissa * (2^Exponent);
);
TIMEOUT 2000
END;
END;
% Device definition for REGIN EXO Compact Alarm
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Ove Jansson, ABELKO AB Luleå
% History: 2011-05-16 initial version
%
DEVICETYPE ReginAlarm NAMED "ReginAlarm" TYPEID 21423 IS
PARAMETER
Id : "Adress";
PUBLIC
V1 :"LA1_TF" ; % 0
V2 :"FF1_ind" ; % 1
V3 :"SPJ3_4_Ständ/Ö" ; % 2
V4 :"SPJ3_4_Öppen/S" ; % 3
V5 :"Test_Omkoppl" ; % 4
V6 :"Service_OmkInd" ; % 5
V7 :"FF1_Man" ; % 6
V8 :"SPJ3_4_Man" ; % 7
V9 :"VP_Steg1_Man" ; % 8
V10 :"VP_Steg2_Man" ; % 9
V11 :"ASH2SA_LarmAMan" ; % 10
V12 :"ASH2SA_LarmBMan" ; % 11
V13 :"ASH2SA_LarmCMan" ; % 12
PRIVATE
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM ReadAlarm NAMED "ReadAlarmStatus" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(02); % Modbus command "02h" read discrete input (bit)
DATA[2] := RWORD(0); % Start adress
DATA[4] := RWORD(13); % Number of inputs
ANSWER SIZE 7
DATA[0] = BYTE(Id);
DATA[1] = HEX(02);
DATA[2] = BYTE(2);
DATA[3] -> BYTE(IF (DATA & 1) THEN V1 := 1; ELSE V1 := 0; ENDIF; % V1 :"FA1_Larm_Ind" ""; % 0
IF (DATA & 2) THEN V2 := 1; ELSE V2 := 0; ENDIF; % V2 :"FF1_ind" ""; % 1
IF (DATA & 4) THEN V3 := 1; ELSE V3 := 0; ENDIF; % V3 :"SPJ3_4_Ständ/Ö" ""; % 2
IF (DATA & 8) THEN V4 := 1; ELSE V4 := 0; ENDIF; % V4 :"SPJ3_4_Öppen/S" ""; % 3
IF (DATA & 16) THEN V5 := 1; ELSE V5 := 0; ENDIF; % V5 :"Test_Omkoppl" ""; % 4
IF (DATA & 32) THEN V6 := 1; ELSE V6 := 0; ENDIF; % V6 :"Service_OmkInd" ""; % 5
IF (DATA & 64) THEN V7 := 1; ELSE V7 := 0; ENDIF; % V7 :"FF1_Man" ""; % 6
IF (DATA & 128) THEN V8 := 1; ELSE V8 := 0; ENDIF; % V8 :"SPJ3_4_Man" ""; % 7
);
DATA[4] -> BYTE(IF (DATA & 1) THEN V9 := 1; ELSE V9 := 0; ENDIF; % V9 :"VP_Steg1_Man" ""; % 8
IF (DATA & 2) THEN V10 := 1; ELSE V10 := 0; ENDIF; % V10 :"VP_Steg2_Man" ""; % 9
IF (DATA & 4) THEN V11 := 1; ELSE V11 := 0; ENDIF; % V11 :"ASH2SA_LarmAMan" ""; % 10
IF (DATA & 8) THEN V12 := 1; ELSE V12 := 0; ENDIF; % V12 :"ASH2SA_LarmBMan" ""; % 11
IF (DATA & 16) THEN V13 := 1; ELSE V13 := 0; ENDIF; % V13 :"ASH2SA_LarmCMan" ""; % 12
);
TIMEOUT 2000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for REGIN EXO Compact Coil
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Ove Jansson, ABELKO AB Luleå
% History: 2011-05-16 initial version
%
DEVICETYPE ReginCoil NAMED "ReginCoil" TYPEID 21424 IS
PARAMETER
Id : "Adress";
PUBLIC
V1 : "FA1_Start"; % 100
V2 : "VP1_Start"; % 101
V3 : "FF1_start"; % 102
PRIVATE
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM ReadCoil NAMED "ReadCoil" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(01); % Modbus command "01h" Read coil status (bit)
DATA[2] := RWORD(0); % Start adress
DATA[4] := RWORD(3); % Number of inputs
ANSWER SIZE 6
DATA[0] = BYTE(Id);
DATA[1] = HEX(02);
DATA[2] = BYTE(1);
DATA[3] -> BYTE(IF (DATA & 1) THEN V1 := 1; ELSE V1 := 0; ENDIF;
IF (DATA & 2) THEN V2 := 1; ELSE V2 := 0; ENDIF;
IF (DATA & 4) THEN V3 := 1; ELSE V3 := 0; ENDIF;
);
TIMEOUT 2000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for REGIN EXO Compact Input
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Ove Jansson, ABELKO AB Luleå
% History: 2011-04-05 initial version
%
DEVICETYPE ReginInput NAMED "ReginInput" TYPEID 21425 IS
PARAMETER
Id : "Adress";
PUBLIC
V1 : "FA1_GP1" ["Pa"]; % 200
V2 : "FA1_GT1" ["°C"]; % 202
V3 : "UTE_GT3" ["°C"]; % 204
V4 : "FA1_FO" ["%"]; % 206
V5 : "BörvärdeTryckst" ["Pa"]; % 208
PRIVATE
Sign;
Exponent;
Mantissa;
Tmp3;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM ReginInput1 NAMED "ReginInput1" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(04); % Modbus command "04h" Read registers
DATA[2] := RWORD(0); % OBS!! Register adress = Modbusadress in spec
DATA[4] := RWORD(10); % Number of registers
ANSWER SIZE 25 % antal register *2 + 5
DATA[0] = BYTE(Id); % ID
DATA[1] = HEX(04); % Modbus command "04h" Read registers
DATA[2] = BYTE(20); % Byte count
DATA[3] -> BYTE(Mantissa := DATA* 256;);
DATA[4] -> BYTE( Mantissa := Mantissa + (DATA););
DATA[5] -> BYTE(
IF (DATA&128) THEN Sign := -1; ELSE Sign := 1; ENDIF;
Exponent := (DATA&127)*2;
);
DATA[6] -> BYTE(
Exponent := Exponent+(DATA&128)-127;
Mantissa := 1+((Mantissa+((DATA&127)*65536))/8388608);
V1 := Sign * Mantissa * (2^Exponent);
);
DATA[7] -> BYTE(Mantissa := DATA * 256;);
DATA[8] -> BYTE( Mantissa := Mantissa + DATA;);
DATA[9] -> BYTE(
IF (DATA&128) THEN Sign := -1; ELSE Sign := 1; ENDIF;
Exponent := (DATA&127)*2;
);
DATA[10] -> BYTE(
Exponent := Exponent+(DATA&128)-127;
Mantissa := 1+((Mantissa+((DATA&127)*65536))/8388608);
V2 := Sign * Mantissa * (2^Exponent);
);
DATA[11] -> BYTE(Mantissa := DATA *256;);
DATA[12] -> BYTE( Mantissa := Mantissa + DATA;);
DATA[13] -> BYTE(
IF (DATA&128) THEN Sign := -1; ELSE Sign := 1; ENDIF;
Exponent := (DATA & 127)*2;
);
DATA[14] -> BYTE(
Exponent := Exponent+(DATA & 128)-127;
Mantissa := 1+((Mantissa+((DATA & 127)*65536))/8388608);
V3 := Sign * Mantissa * (2^Exponent);
);
DATA[15] -> BYTE(Mantissa := DATA *256;);
DATA[16] -> BYTE( Mantissa := Mantissa + (DATA););
DATA[17] -> BYTE(
IF (DATA&128) THEN Sign := -1; ELSE Sign := 1; ENDIF;
Exponent := (DATA & 127)*2;
);
DATA[18] -> BYTE(
Exponent := Exponent+(DATA & 128)-127;
Mantissa := 1+((Mantissa+((DATA & 127)* 65536))/8388608);
V4 := Sign * Mantissa * (2^Exponent);
);
DATA[19] -> BYTE(Mantissa := DATA*256;);
DATA[20] -> BYTE( Mantissa := Mantissa + (DATA););
DATA[21] -> BYTE(
IF (DATA&128) THEN Sign := -1; ELSE Sign := 1; ENDIF;
Exponent := (DATA&127)*2;
);
DATA[22] -> BYTE(
Exponent := Exponent+(DATA&128)-127;
Mantissa := 1+((Mantissa+((DATA&127)* 65536))/838860);
V5 := Sign * Mantissa * (2^Exponent);
);
TIMEOUT 2000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for REGIN EXO Compact Input
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Ove Jansson, ABELKO AB Luleå
% History: 2011-04-05 initial version
%
DEVICETYPE ReginHolding NAMED "ReginHolding" TYPEID 21426 IS
PARAMETER
Id : "Adress";
PUBLIC
V1 : "FF1_Brandfläkt" [""]; % 300 1=till, 2=auto, 0=off
V2 : "VP1_Steg1_Man" [""]; % 301 1=till, 2=auto, 0=off
V3 : "VP1_Steg2_Man" [""]; % 302 1=till, 2=auto, 0=off
V4 : "Börv_Högfart" ["Pa"]; % 303 32bit
V5 : "Börv_Lågfart" ["Pa"]; % 305 32bit
V6 : "BlockHögfart" ["°C"]; % 307 32bit Utetemperatur som blockerar högfart
PRIVATE
Tmp3;
Sign;
Exponent;
Mantissa;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM ReginHoldingt1 NAMED "ReginHolding1" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(03); % Modbus command "03h" Read Holding registers
DATA[2] := RWORD(0); % OBS!! Register adress = Modbusadress in spec
DATA[4] := RWORD(9); % Number of registers
ANSWER SIZE 23 % antal register *2 + 5
DATA[0] = BYTE(Id); % ID
DATA[1] = HEX(03); % Modbus command "03h" Read Holding registers
DATA[2] = BYTE(18); % Byte count
DATA[3] -> RWORD(V1 := DATA;);
DATA[5] -> RWORD(V2 := DATA;);
DATA[7] -> RWORD(V3 := DATA;);
DATA[9] -> BYTE(Mantissa := DATA * 256;);
DATA[10] -> BYTE( Mantissa := Mantissa + (DATA););
DATA[11] -> BYTE(
IF (DATA&128) THEN Sign := -1; ELSE Sign := 1; ENDIF;
Exponent := (DATA&127)*2;
);
DATA[12] -> BYTE(
Exponent := Exponent+(DATA&128)-127;
Mantissa := 1+((Mantissa+((DATA&127)*65536))/8388608);
V4 := Sign * Mantissa * (2^Exponent);
);
DATA[13] -> BYTE(Mantissa := DATA * 256;);
DATA[14] -> BYTE( Mantissa := Mantissa + (DATA););
DATA[15] -> BYTE(
IF (DATA&128) THEN Sign := -1; ELSE Sign := 1; ENDIF;
Exponent := (DATA&127)*2;
);
DATA[16] -> BYTE(
Exponent := Exponent+(DATA&128)-127;
Mantissa := 1+((Mantissa+((DATA&127)*65536))/8388608);
V5 := Sign * Mantissa * (2^Exponent);
);
DATA[17] -> BYTE(Mantissa := DATA * 256;);
DATA[18] -> BYTE( Mantissa := Mantissa + (DATA););
DATA[19] -> BYTE(
IF (DATA&128) THEN Sign := -1; ELSE Sign := 1; ENDIF;
Exponent := (DATA&127)*2;
);
DATA[20] -> BYTE(
Exponent := Exponent+(DATA&128)-127;
Mantissa := 1+((Mantissa+((DATA&127)*65536))/8388608);
V6 := Sign * Mantissa * (2^Exponent);
);
TIMEOUT 2000
END;
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.