Exomatic DUC
Detaljer
- Typ
- Drivrutin
- Upplaggd av
- Ove Jansson, Abelko Innovation
- Version
- 5
- Uppdaterad
- 2014-03-12
- Skapad
- 2013-10-08
- Kategori
- Modbus, Ventilation
- Visningar
- 3309
Beskrivning
Modbus drivrutin till ventillationsstyrning
Bruksanvisning
Exomatic är programmerbar och detta skript är för en enhet där temperaturer anges med en decimal och övriga värden som tex tryck anges i heltal.
OBS! Dokumentationen var fel för att läsa Input Register, den började på adress 1 istället för 0. Det är justerat med DATA:= tmp + 1;
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
% Skapad med Modbus Creator
DEVICETYPE ExomaticLarm NAMED "Exomatic Larm" TYPEID 22114 IS
PARAMETER
Id : "Adress";
PUBLIC
V1 : "GT81 Frysvakt larm" [""];
V2 : "LB1 VÅV låg verkningsgrad" [""];
V3 : "LB1 GT11 låg temp" [""];
V4 : "LB1 GT11 hög temp " [""];
V5 : "LB1 GP11 lågt tryck" [""];
V6 : "LB1 GP11 högt tryck" [""];
V7 : "LB1 GP12 Lågt tryck" [""];
V8 : "LB1 GP12 Högt tryck" [""];
V9 : "GX71 GX72 Röklarm" [""];
V10 : "LB2 GT81 frysvakts" [""];
V11 : "LB2 GT11 låg temp" [""];
V12 : "LB2 GT11 hög temp" [""];
V13 : "Centralt Brandlarm" [""];
PRIVATE
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM Read2 NAMED "Read 2" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(02); % Modbus kommando för att läsa register kod 02
DATA[2] := RWORD(45); % Start address
DATA[4] := RWORD(34); % Antal register att läsa
ANSWER SIZE 10 % (Antal register / 8) avrundat uppåt + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(02);
DATA[2] = BYTE(5); % Antal Bytes
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;
IF (DATA & 8) THEN V4 := 1; ELSE V4 := 0; ENDIF;
IF (DATA & 16) THEN V5 := 1; ELSE V5 := 0; ENDIF;
IF (DATA & 32) THEN V6 := 1; ELSE V6 := 0; ENDIF;
IF (DATA & 64) THEN V7 := 1; ELSE V7 := 0; ENDIF;
IF (DATA & 128) THEN V8 := 1; ELSE V8 := 0; ENDIF;
);
DATA[4] -> BYTE(
IF (DATA & 1) THEN V9 := 1; ELSE V9 := 0; ENDIF;
);
DATA[5] -> BYTE(
IF (DATA & 16) THEN V10 := 1; ELSE V10 := 0; ENDIF;
IF (DATA & 32) THEN V11 := 1; ELSE V11 := 0; ENDIF;
IF (DATA & 64) THEN V12 := 1; ELSE V12 := 0; ENDIF;
);
DATA[7] -> BYTE(
IF (DATA & 2) THEN V13 := 1; ELSE V13 := 0; ENDIF;
);
TIMEOUT 300
END;
END;
% Skapad med Modbus Creator
DEVICETYPE ExomaticInput NAMED "Exomatic Input" TYPEID 22115 IS
PARAMETER
Id : "Adress";
PUBLIC
V1 : "LB1 GT11" ["°C"]DEC1;
V2 : "LB1 GT31" ["°C"]DEC1;
V3 : "LB1 GT41" ["°C"]DEC1;
V4 : "LB1 GT42" ["°C"]DEC1;
V5 : "LB1 GT81" ["°C"]DEC1;
V6 : "LB2 GT11" ["°C"]DEC1;
V7 : "LB2 GT81" ["°C"]DEC1;
V8 : "FF4 GT51" ["°C"]DEC1;
V9 : "LB1 GP11" ["Pa"];
V10 : "LB1 GP12" ["Pa"];
V11 : "LB1 SV21" ["%"];
V12 : "LB1 SV31" ["%"];
V13 : "LB1 TA1 Omformare" ["%"];
V14 : "LB1 FA1 Omformare" ["%"];
V15 : "LB2 SV21" ["%"];
V16 : "LB2 FF2 Omformare" ["%"];
V17 : "RAD GT11" ["°C"]DEC1;
V18 : "RAD SV21" ["%"];
PRIVATE
count4;
tmp;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM Read4 NAMED "Read 4" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(04); % Modbus kommando för att läsa register
DATA[2] <- RWORD(
IF(count4>17) THEN count4 := 0; ENDIF;
IF (count4=0) THEN tmp := 0;
ELSIF (count4=1) THEN tmp := 1;
ELSIF (count4=2) THEN tmp := 2;
ELSIF (count4=3) THEN tmp := 3;
ELSIF (count4=4) THEN tmp := 4;
ELSIF (count4=5) THEN tmp := 5;
ELSIF (count4=6) THEN tmp := 6;
ELSIF (count4=7) THEN tmp := 7;
ELSIF (count4=8) THEN tmp := 8;
ELSIF (count4=9) THEN tmp := 9;
ELSIF (count4=10) THEN tmp := 10;
ELSIF (count4=11) THEN tmp := 11;
ELSIF (count4=12) THEN tmp := 12;
ELSIF (count4=13) THEN tmp := 13;
ELSIF (count4=14) THEN tmp := 14;
ELSIF (count4=15) THEN tmp := 15;
ELSIF (count4=16) THEN tmp := 16;
ELSIF (count4=17) THEN tmp := 17;
ENDIF;
DATA:= tmp + 1;
);
DATA[4] := RWORD(01);
ANSWER SIZE 7
DATA[0] = BYTE(Id);
DATA[1] = BYTE(04);
DATA[3] -> RWORD(
IF (count4=0) THEN V1 := DATA/10;
ELSIF (count4=1) THEN V2 := DATA/10;
ELSIF (count4=2) THEN V3 := DATA/10;
ELSIF (count4=3) THEN V4 := DATA/10;
ELSIF (count4=4) THEN V5 := DATA/10;
ELSIF (count4=5) THEN V6 := DATA/10;
ELSIF (count4=6) THEN V7 := DATA/10;
ELSIF (count4=7) THEN V8 := DATA/10;
ELSIF (count4=8) THEN V9 := DATA/10;
ELSIF (count4=9) THEN V10 := DATA/10;
ELSIF (count4=10) THEN V11 := DATA/10;
ELSIF (count4=11) THEN V12 := DATA/10;
ELSIF (count4=12) THEN V13 := DATA/10;
ELSIF (count4=13) THEN V14 := DATA/10;
ELSIF (count4=14) THEN V15 := DATA/10;
ELSIF (count4=15) THEN V16 := DATA/10;
ELSIF (count4=16) THEN V17 := DATA/10;
ELSIF (count4=17) THEN V18 := DATA/10;
ENDIF;
count4 := count4+1;
);
TIMEOUT 800
END;
END;
% Skapad med Modbus Creator
DEVICETYPE ExomaticW NAMED "ExomaticW" TYPEID 22116 IS
PARAMETER
Id : "Adress";
V9 : "wLB1 TA1 bör tryck" ["Pa"];
V10 : "wLB1 FA1 Bör tryck" ["Pa"];
V11 : "wLB2 Bör temp" ["°C"]DEC1;
V12 : "wFF2 Bör steg 1" ["Pa"];
V13 : "wFF2 Bör steg 2" ["Pa"];
V14 : "wFF2 Bör steg 3" ["Pa"];
V15 : "wFF4 start temp" ["°C"]DEC1;
V16 : "FF4 stop temp" ["°C"]DEC1;
PUBLIC
V1 : "LB1 TA1 börvärde tryck" ["Pa"];
V2 : "LB1 FA1 Bör tryck" ["Pa"];
V3 : "LB2 Bör temp " ["°C"]DEC1;
V4 : "FF2 Bör steg 1" ["Pa"];
V5 : "FF2 Bör steg 2" ["Pa"];
V6 : "FF2 Bör steg 3" ["Pa"];
V7 : "FF4 start temp" ["°C"]DEC1;
V8 : "FF4 stop temp" ["°C"]DEC1;
PRIVATE
count3;
count6;
tmp;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM Read3 NAMED "Read 3" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(03); % Modbus kommando för att läsa register
DATA[2] <- RWORD(
IF(count3>7) THEN count3 := 0; ENDIF;
IF (count3=0) THEN tmp := 28;
ELSIF (count3=1) THEN tmp := 29;
ELSIF (count3=2) THEN tmp := 39;
ELSIF (count3=3) THEN tmp := 43;
ELSIF (count3=4) THEN tmp := 44;
ELSIF (count3=5) THEN tmp := 45;
ELSIF (count3=6) THEN tmp := 48;
ELSIF (count3=7) THEN tmp := 49;
ENDIF;
DATA:= tmp;
);
DATA[4] := RWORD(01);
ANSWER SIZE 7
DATA[0] = BYTE(Id);
DATA[1] = BYTE(03);
DATA[3] -> RWORD(
IF (count3=0) THEN V1 := DATA;
ELSIF (count3=1) THEN V2 := DATA/10;
ELSIF (count3=2) THEN V3 := DATA/10;
ELSIF (count3=3) THEN V4 := DATA;
ELSIF (count3=4) THEN V5 := DATA;
ELSIF (count3=5) THEN V6 := DATA;
ELSIF (count3=6) THEN V7 := DATA/10;
ELSIF (count3=7) THEN V8 := DATA/10;
ENDIF;
count3 := count3+1;
);
TIMEOUT 800
END;
TELEGRAM WriteRegister NAMED "Write Register" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(06); % Modbus kommando för att skriva ett register
DATA[2] <- RWORD(
IF(count6>7) THEN count6 := 0; ENDIF;
IF (count6=0) THEN DATA := 28;
ELSIF (count6=1) THEN DATA := 29;
ELSIF (count6=2) THEN DATA := 39;
ELSIF (count6=3) THEN DATA := 43;
ELSIF (count6=4) THEN DATA := 44;
ELSIF (count6=5) THEN DATA := 45;
ELSIF (count6=6) THEN DATA := 48;
ELSIF (count6=7) THEN DATA := 49;
ENDIF;
); % Register adress
DATA[4] <- RWORD(
IF (count6=0) THEN DATA := V9;
ELSIF (count6=1) THEN DATA := V10*10;
ELSIF (count6=2) THEN DATA := V11*10;
ELSIF (count6=3) THEN DATA := V12;
ELSIF (count6=4) THEN DATA := V13;
ELSIF (count6=5) THEN DATA := V14;
ELSIF (count6=6) THEN DATA := V15*10;
ELSIF (count6=7) THEN DATA := V16*10;
ENDIF;
count6 := count6+1;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = BYTE(06);
TIMEOUT 800
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.