SenseAirInput
Detaljer
- Typ
- Drivrutin
- Upplaggd av
- Ove Jansson, Abelko Innovation
- Version
- 3
- Uppdaterad
- 2016-08-30
- Skapad
- 2016-05-23
- Kategori
- Modbus, Ventilation
- Visningar
- 2129
Beskrivning
.
Bruksanvisning
.
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
% - OBS! Användaren ansvarar själv för att samma TYPID inte används flera gånger i samma apparat.
% TYPID 10000-19999 är för användardefinierade enheter
DEVICETYPE SenseAirInput NAMED "SenseAirInput" TYPEID 11123 IS
PARAMETER
Id : "Adress";
PUBLIC
V1 : "Error status" [""]; % 1=CO2 module com error, 1=CO2 measure error, 2=NTC measure error, 3=RH/temp module com error, 4=RH measure error, 5=Temp measure error, 8=Output config error
V2 : "CO2 value" ["ppm"];
V3 : "Temperature" ["°C"]DEC2;
V4 : "RH" ["%"]DEC2;
V5 : "NTC" ["°C"]DEC2;
V6 : "CO2 status" [""];
V7 : "Temp status" [""];
V8 : "RH status" [""];
V9 : "NTC status" [""];
V10 : "Out 1 value" [""];
V11 : "Out 2 value" [""];
V12 : "Out 3 value" [""];
V13 : "Out 4 (relay) value" [""];
V14 : "Out 1 status" [""];
V15 : "Out 2 status" [""];
V16 : "Out 3 status" [""];
V17 : "Out 4 (relay) status" [""];
PRIVATE
count4;
tmp;
BAUDRATE 19200;
CHECKSUM MODBUS SWAPPED;
TELEGRAM ReadInput NAMED "ReadInput" 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>16) THEN count4 := 0; ENDIF;
IF (count4=0) THEN tmp := 0;
ELSIF (count4=1) THEN tmp := 3;
ELSIF (count4=2) THEN tmp := 4;
ELSIF (count4=3) THEN tmp := 5;
ELSIF (count4=4) THEN tmp := 6;
ELSIF (count4=5) THEN tmp := 11;
ELSIF (count4=6) THEN tmp := 12;
ELSIF (count4=7) THEN tmp := 13;
ELSIF (count4=8) THEN tmp := 14;
ELSIF (count4=9) THEN tmp := 21;
ELSIF (count4=10) THEN tmp := 22;
ELSIF (count4=11) THEN tmp := 23;
ELSIF (count4=12) THEN tmp := 24;
ELSIF (count4=13) THEN tmp := 25;
ELSIF (count4=14) THEN tmp := 26;
ELSIF (count4=15) THEN tmp := 27;
ELSIF (count4=16) THEN tmp := 28;
ENDIF;
DATA:= tmp;
);
DATA[4] := RWORD(01);
ANSWER SIZE 7 DATA[0] = BYTE(Id);
DATA[1] = BYTE(04);
DATA[3] -> RWORD(
IF (count4=0) THEN V1 := DATA;
ELSIF (count4=1) THEN IF (DATA>=32768) THEN V2:=(DATA-65536); ELSE V2:=DATA; ENDIF;
ELSIF (count4=2) THEN IF (DATA>=32768) THEN V3:=(DATA-65536)/100; ELSE V3:=DATA/100; ENDIF;
ELSIF (count4=3) THEN IF (DATA>=32768) THEN V4:=(DATA-65536)/100; ELSE V4:=DATA/100; ENDIF;
ELSIF (count4=4) THEN IF (DATA>=32768) THEN V5:=(DATA-65536)/100; ELSE V5:=DATA/100; ENDIF;
ELSIF (count4=5) THEN IF DATA & 2 THEN V6 := 1; ELSE V6:=0; ENDIF;
ELSIF (count4=6) THEN IF DATA & 2 THEN V7 := 1; ELSE V7:=0; ENDIF;
ELSIF (count4=7) THEN IF DATA & 2 THEN V8 := 1; ELSE V8:=0; ENDIF;
ELSIF (count4=8) THEN IF DATA & 2 THEN V9 := 1; ELSE V9:=0; ENDIF;
ELSIF (count4=9) THEN V10 := DATA/65.536;
ELSIF (count4=10) THEN V11 := DATA/65.536;
ELSIF (count4=11) THEN V12 := DATA/65.536;
ELSIF (count4=12) THEN V13 := DATA/65.536;
ELSIF (count4=13) THEN IF DATA & 2 THEN V14 := 1; ELSE V14:=0; ENDIF;
ELSIF (count4=14) THEN IF DATA & 2 THEN V15 := 1; ELSE V15:=0; ENDIF;
ELSIF (count4=15) THEN IF DATA & 2 THEN V16 := 1; ELSE V16:=0; ENDIF;
ELSIF (count4=16) THEN IF DATA & 2 THEN V17 := 1; ELSE V17:=0; ENDIF;
ENDIF;
count4 := count4+1;
);
TIMEOUT 300
END;
END;
% - OBS! Användaren ansvarar själv för att samma TYPID inte används flera gånger i samma apparat.
% TYPID 10000-19999 är för användardefinierade enheter
DEVICETYPE SenseAirInput NAMED "SenseAirInput" TYPEID 11123 IS
PARAMETER
Id : "Adress";
PUBLIC
V1 : "Error status" [""]; % 1=CO2 module com error, 1=CO2 measure error, 2=NTC measure error, 3=RH/temp module com error, 4=RH measure error, 5=Temp measure error, 8=Output config error
V2 : "CO2 value" ["ppm"];
V3 : "Temperature" ["°C"]DEC2;
V4 : "RH" ["%"]DEC2;
V5 : "NTC" ["°C"]DEC2;
V6 : "CO2 status" [""];
V7 : "Temp status" [""];
V8 : "RH status" [""];
V9 : "NTC status" [""];
V10 : "Out 1 value" [""];
V11 : "Out 2 value" [""];
V12 : "Out 3 value" [""];
V13 : "Out 4 (relay) value" [""];
V14 : "Out 1 status" [""];
V15 : "Out 2 status" [""];
V16 : "Out 3 status" [""];
V17 : "Out 4 (relay) status" [""];
PRIVATE
count4;
tmp;
BAUDRATE 19200;
CHECKSUM MODBUS SWAPPED;
TELEGRAM ReadInput NAMED "ReadInput" 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>16) THEN count4 := 0; ENDIF;
IF (count4=0) THEN tmp := 0;
ELSIF (count4=1) THEN tmp := 3;
ELSIF (count4=2) THEN tmp := 4;
ELSIF (count4=3) THEN tmp := 5;
ELSIF (count4=4) THEN tmp := 6;
ELSIF (count4=5) THEN tmp := 11;
ELSIF (count4=6) THEN tmp := 12;
ELSIF (count4=7) THEN tmp := 13;
ELSIF (count4=8) THEN tmp := 14;
ELSIF (count4=9) THEN tmp := 21;
ELSIF (count4=10) THEN tmp := 22;
ELSIF (count4=11) THEN tmp := 23;
ELSIF (count4=12) THEN tmp := 24;
ELSIF (count4=13) THEN tmp := 25;
ELSIF (count4=14) THEN tmp := 26;
ELSIF (count4=15) THEN tmp := 27;
ELSIF (count4=16) THEN tmp := 28;
ENDIF;
DATA:= tmp;
);
DATA[4] := RWORD(01);
ANSWER SIZE 7 DATA[0] = BYTE(Id);
DATA[1] = BYTE(04);
DATA[3] -> RWORD(
IF (count4=0) THEN V1 := DATA;
ELSIF (count4=1) THEN IF (DATA>=32768) THEN V2:=(DATA-65536); ELSE V2:=DATA; ENDIF;
ELSIF (count4=2) THEN IF (DATA>=32768) THEN V3:=(DATA-65536)/100; ELSE V3:=DATA/100; ENDIF;
ELSIF (count4=3) THEN IF (DATA>=32768) THEN V4:=(DATA-65536)/100; ELSE V4:=DATA/100; ENDIF;
ELSIF (count4=4) THEN IF (DATA>=32768) THEN V5:=(DATA-65536)/100; ELSE V5:=DATA/100; ENDIF;
ELSIF (count4=5) THEN IF DATA & 2 THEN V6 := 1; ELSE V6:=0; ENDIF;
ELSIF (count4=6) THEN IF DATA & 2 THEN V7 := 1; ELSE V7:=0; ENDIF;
ELSIF (count4=7) THEN IF DATA & 2 THEN V8 := 1; ELSE V8:=0; ENDIF;
ELSIF (count4=8) THEN IF DATA & 2 THEN V9 := 1; ELSE V9:=0; ENDIF;
ELSIF (count4=9) THEN V10 := DATA/65.536;
ELSIF (count4=10) THEN V11 := DATA/65.536;
ELSIF (count4=11) THEN V12 := DATA/65.536;
ELSIF (count4=12) THEN V13 := DATA/65.536;
ELSIF (count4=13) THEN IF DATA & 2 THEN V14 := 1; ELSE V14:=0; ENDIF;
ELSIF (count4=14) THEN IF DATA & 2 THEN V15 := 1; ELSE V15:=0; ENDIF;
ELSIF (count4=15) THEN IF DATA & 2 THEN V16 := 1; ELSE V16:=0; ENDIF;
ELSIF (count4=16) THEN IF DATA & 2 THEN V17 := 1; ELSE V17:=0; ENDIF;
ENDIF;
count4 := count4+1;
);
TIMEOUT 300
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.