Nibe Modbus 40 F1145/1245 (v1260)
Detaljer
Beskrivning
Skript för Nibe Modbus 40 F1145/1245 (v1260)
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Skript för Nibe Modbus 40 F1145/1245 (v1260)
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Ove Jansson, ABELKO AB Luleå
% History: 2011-06-10 initial version
%
% 21413 NIBE Modbus 40 Läs 1
DEVICETYPE NibeMB40Read1 NAMED "NibeMB40Read1" TYPEID 21413 IS
PARAMETER
Id : "Adress";
PUBLIC
V1 : "S1_BT1 Utetemp" ["°C"]DEC1; % x10 (Hreg 40004)
V2 : "S1_BT2 Framl.Temp" ["°C"]DEC1; % x10 (Hreg 40008)
V3 : "S1_BT3 Ret.Temp1" ["°C"]DEC1; % x10 (Hreg 40012)
V4 : "S1_BT10 BrineInTemp" ["°C"]DEC1; % x10 (Hreg 40015)
V5 : "S1_BT11 BrineUtTemp" ["°C"]DEC1; % x10 (Hreg 40016)
PRIVATE
Ct;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM AnalogInput1 NAMED "AnalogInput1" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(03); % Modbus command "03h" Read holding registers
DATA[2] := HEX(9C); % Address 40004-40016 = 9Cxx
DATA[3] <- BYTE( Ct := Ct + 1;
IF Ct > 5 THEN Ct := 1;
ENDIF;
IF Ct = 1 THEN DATA := 68; % Address DEC=40004, HEX=9C44, BYTE=156:68
ELSIF Ct = 2 THEN DATA := 72; % Address DEC=40008, HEX=9C48, BYTE=156:72
ELSIF Ct = 3 THEN DATA := 76; % Address DEC=40012, HEX=9C4C, BYTE=156:76
ELSIF Ct = 4 THEN DATA := 79; % Address DEC=40015, HEX=9C4F, BYTE=156:79
ELSIF Ct = 5 THEN DATA := 80; % Address DEC=40016, HEX=9C50, BYTE=156:80
ENDIF;
);
DATA[4] := RWORD(1); % Number of modbus registers
ANSWER SIZE 7 % Bytes = Number of registers *2 + 5
DATA[0] = BYTE(Id); % Modbus ID=Adress
DATA[1] = HEX(03); % Modbus command "03h" Read holding registers
DATA[2] = BYTE(2); % Byte count = Number of Registers x2
DATA[3] -> RWORD(
IF Ct = 1 THEN IF DATA > 32767 THEN V1 := (DATA - 65536) / 10; ELSE V1 := DATA / 10; ENDIF;
ELSIF Ct = 2 THEN IF DATA > 32767 THEN V2 := (DATA - 65536) / 10; ELSE V2 := DATA / 10; ENDIF;
ELSIF Ct = 3 THEN IF DATA > 32767 THEN V3 := (DATA - 65536) / 10; ELSE V3 := DATA / 10; ENDIF;
ELSIF Ct = 4 THEN IF DATA > 32767 THEN V4 := (DATA - 65536) / 10; ELSE V4 := DATA / 10; ENDIF;
ELSIF Ct = 5 THEN IF DATA > 32767 THEN V5 := (DATA - 65536) / 10; ELSE V5 := DATA / 10; ENDIF;
ENDIF;
);
TIMEOUT 2000
END;
END;
% Skript för Nibe Modbus 40 F1145/1245 (v1260)
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Ove Jansson, ABELKO AB Luleå
% History: 2011-06-10 initial version
%
% 21413 NIBE Modbus 40 Läs 1
DEVICETYPE NibeMB40Read1 NAMED "NibeMB40Read1" TYPEID 21413 IS
PARAMETER
Id : "Adress";
PUBLIC
V1 : "S1_BT1 Utetemp" ["°C"]DEC1; % x10 (Hreg 40004)
V2 : "S1_BT2 Framl.Temp" ["°C"]DEC1; % x10 (Hreg 40008)
V3 : "S1_BT3 Ret.Temp1" ["°C"]DEC1; % x10 (Hreg 40012)
V4 : "S1_BT10 BrineInTemp" ["°C"]DEC1; % x10 (Hreg 40015)
V5 : "S1_BT11 BrineUtTemp" ["°C"]DEC1; % x10 (Hreg 40016)
PRIVATE
Ct;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM AnalogInput1 NAMED "AnalogInput1" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(03); % Modbus command "03h" Read holding registers
DATA[2] := HEX(9C); % Address 40004-40016 = 9Cxx
DATA[3] <- BYTE( Ct := Ct + 1;
IF Ct > 5 THEN Ct := 1;
ENDIF;
IF Ct = 1 THEN DATA := 68; % Address DEC=40004, HEX=9C44, BYTE=156:68
ELSIF Ct = 2 THEN DATA := 72; % Address DEC=40008, HEX=9C48, BYTE=156:72
ELSIF Ct = 3 THEN DATA := 76; % Address DEC=40012, HEX=9C4C, BYTE=156:76
ELSIF Ct = 4 THEN DATA := 79; % Address DEC=40015, HEX=9C4F, BYTE=156:79
ELSIF Ct = 5 THEN DATA := 80; % Address DEC=40016, HEX=9C50, BYTE=156:80
ENDIF;
);
DATA[4] := RWORD(1); % Number of modbus registers
ANSWER SIZE 7 % Bytes = Number of registers *2 + 5
DATA[0] = BYTE(Id); % Modbus ID=Adress
DATA[1] = HEX(03); % Modbus command "03h" Read holding registers
DATA[2] = BYTE(2); % Byte count = Number of Registers x2
DATA[3] -> RWORD(
IF Ct = 1 THEN IF DATA > 32767 THEN V1 := (DATA - 65536) / 10; ELSE V1 := DATA / 10; ENDIF;
ELSIF Ct = 2 THEN IF DATA > 32767 THEN V2 := (DATA - 65536) / 10; ELSE V2 := DATA / 10; ENDIF;
ELSIF Ct = 3 THEN IF DATA > 32767 THEN V3 := (DATA - 65536) / 10; ELSE V3 := DATA / 10; ENDIF;
ELSIF Ct = 4 THEN IF DATA > 32767 THEN V4 := (DATA - 65536) / 10; ELSE V4 := DATA / 10; ENDIF;
ELSIF Ct = 5 THEN IF DATA > 32767 THEN V5 := (DATA - 65536) / 10; ELSE V5 := DATA / 10; ENDIF;
ENDIF;
);
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.