Trådlös Modbus via RCW-M32
Detaljer
- Typ
- Drivrutin
- Upplaggd av
- Ove Jansson, Abelko Innovation
- Version
- 1
- Uppdaterad
- 2019-04-17
- Skapad
- 2019-04-17
- Kategori
- IO enheter, Modbus
- Visningar
- 3691
Beskrivning
Drivrutin för Rumsgivare TG-R5W(temp)/HTRT5W (temp plus fukt) Utomhusgivare TG-R6W/TG-R6EW samt DCW dörrkontakt, IRCW takmonterad rörelsesensor samt IRW rörelsesensor
Stöd för:
- Medel, max och min värden för rumstemperaturer
- fukt i %RH
- Lägg till eller ta bort givare
- Sätt sovtid (wake up) tid, läs sovtid
- Batteri larm med summalarm batteri
- läs mätartyp och id
Bruksanvisning
Endast Ultra och EW
Normal drift:
- Sätt telegram Koppla/Ta bort i Ingen kommunikation
- Sätt telegram Ställ sovtid i Ingen kommunikation
- Sätt modbus adress (sätts display på mottagaren)
- Sätt Tempgräns låg till lägsta rumstemperatur för att räknas. Default är 10
- Sätt Tempgräns hög till högsta rumstemperatur för att räknas. Default är 40
För att lägga till enhet:
- Sätt Välj enhet(1-32) till det enhetsnummer du vill lägga till
- Sätt Operation till Koppla
- Sätt telegram Koppla/Ta bort till 1 sekund
- Sätt telegram Koppla/Ta bort till Ingen kommunikation
- Tryck ner Test knappen på enhetens som ska läggas till
- Ett pip hörs och det är klart
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
% - 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 RCWM32 NAMED "RCW-M32" TYPEID 11084 IS
PARAMETER
Id : "Adress" INT;
Device : "Välj enhet(1-32)" INT;
Oper : "Operation" ["Ingen,Koppla,Ta bort"]ENUM;
LowLimit : "Tempgräns låg" ["°C"]DEC2;
HighLimit : "Tempgräns hög" ["°C"]DEC2;
DeviceZ : "Sovtid enhet(1-32)" INT;
WakeUpTime : "Sovtid att skriva" ["x10 sek"]INT;
PUBLIC
T1 : "Tempgivare 1" ["°C"]DEC2;
T2 : "Tempgivare 2" ["°C"]DEC2;
T3 : "Tempgivare 3" ["°C"]DEC2;
T4 : "Tempgivare 4" ["°C"]DEC2;
T5 : "Tempgivare 5" ["°C"]DEC2;
T6 : "Tempgivare 6" ["°C"]DEC2;
T7 : "Tempgivare 7" ["°C"]DEC2;
T8 : "Tempgivare 8" ["°C"]DEC2;
T9 : "Tempgivare 9" ["°C"]DEC2;
T10 : "Tempgivare 10" ["°C"]DEC2;
T11 : "Tempgivare 11" ["°C"]DEC2;
T12 : "Tempgivare 12" ["°C"]DEC2;
T13 : "Tempgivare 13" ["°C"]DEC2;
T14 : "Tempgivare 14" ["°C"]DEC2;
T15 : "Tempgivare 15" ["°C"]DEC2;
T16 : "Tempgivare 16" ["°C"]DEC2;
T17 : "Tempgivare 17" ["°C"]DEC2;
T18 : "Tempgivare 18" ["°C"]DEC2;
T19 : "Tempgivare 19" ["°C"]DEC2;
T20 : "Tempgivare 20" ["°C"]DEC2;
T21 : "Tempgivare 21" ["°C"]DEC2;
T22 : "Tempgivare 22" ["°C"]DEC2;
T23 : "Tempgivare 23" ["°C"]DEC2;
T24 : "Tempgivare 24" ["°C"]DEC2;
T25 : "Tempgivare 25" ["°C"]DEC2;
T26 : "Tempgivare 26" ["°C"]DEC2;
T27 : "Tempgivare 27" ["°C"]DEC2;
T28 : "Tempgivare 28" ["°C"]DEC2;
T29 : "Tempgivare 29" ["°C"]DEC2;
T30 : "Tempgivare 30" ["°C"]DEC2;
T31 : "Tempgivare 31" ["°C"]DEC2;
T32 : "Tempgivare 32" ["°C"]DEC2;
TMean : "Rumstemp medel" ["°C"]DEC2;
TMin : "Rumstemp min" ["°C"]DEC2;
TMax : "Rumstemp max" ["°C"]DEC2;
F1 : "Fuktgivare 1" ["%RH"]INT;
F2 : "Fuktgivare 2" ["%RH"]INT;
F3 : "Fuktgivare 3" ["%RH"]INT;
F4 : "Fuktgivare 4" ["%RH"]INT;
F5 : "Fuktgivare 5" ["%RH"]INT;
F6 : "Fuktgivare 6" ["%RH"]INT;
F7 : "Fuktgivare 7" ["%RH"]INT;
F8 : "Fuktgivare 8" ["%RH"]INT;
F9 : "Fuktgivare 9" ["%RH"]INT;
F10 : "Fuktgivare 10" ["%RH"]INT;
F11 : "Fuktgivare 11" ["%RH"]INT;
F12 : "Fuktgivare 12" ["%RH"]INT;
F13 : "Fuktgivare 13" ["%RH"]INT;
F14 : "Fuktgivare 14" ["%RH"]INT;
F15 : "Fuktgivare 15" ["%RH"]INT;
F16 : "Fuktgivare 16" ["%RH"]INT;
F17 : "Fuktgivare 17" ["%RH"]INT;
F18 : "Fuktgivare 18" ["%RH"]INT;
F19 : "Fuktgivare 19" ["%RH"]INT;
F20 : "Fuktgivare 20" ["%RH"]INT;
F21 : "Fuktgivare 21" ["%RH"]INT;
F22 : "Fuktgivare 22" ["%RH"]INT;
F23 : "Fuktgivare 23" ["%RH"]INT;
F24 : "Fuktgivare 24" ["%RH"]INT;
F25 : "Fuktgivare 25" ["%RH"]INT;
F26 : "Fuktgivare 26" ["%RH"]INT;
F27 : "Fuktgivare 27" ["%RH"]INT;
F28 : "Fuktgivare 28" ["%RH"]INT;
F29 : "Fuktgivare 29" ["%RH"]INT;
F30 : "Fuktgivare 30" ["%RH"]INT;
F31 : "Fuktgivare 31" ["%RH"]INT;
F32 : "Fuktgivare 32" ["%RH"]INT;
E1 : "Enhet 1 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E2 : "Enhet 2 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E3 : "Enhet 3 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E4 : "Enhet 4 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E5 : "Enhet 5 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E6 : "Enhet 6 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E7 : "Enhet 7 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E8 : "Enhet 8 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E9 : "Enhet 9 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E10 : "Enhet 10 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E11 : "Enhet 11 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E12 : "Enhet 12 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E13 : "Enhet 13 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E14 : "Enhet 14 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E15 : "Enhet 15 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E16 : "Enhet 16 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E17 : "Enhet 17 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E18 : "Enhet 18 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E19 : "Enhet 19 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E20 : "Enhet 20 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E21 : "Enhet 21 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E22 : "Enhet 22 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E23 : "Enhet 23 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E24 : "Enhet 24 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E25 : "Enhet 25 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E26 : "Enhet 26 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E27 : "Enhet 27 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E28 : "Enhet 28 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E29 : "Enhet 29 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E30 : "Enhet 30 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E31 : "Enhet 31 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
E32 : "Enhet 32 Typ" ["Ingen,Dörr,Närvaro,Rumtemp,Utetemp,Opt,Rumtempfukt,Okänd"]ENUM;
S1 : "Signal 1" ["dB"]INT;
S2 : "Signal 2" ["dB"]INT;
S3 : "Signal 3" ["dB"]INT;
S4 : "Signal 4" ["dB"]INT;
S5 : "Signal 5" ["dB"]INT;
S6 : "Signal 6" ["dB"]INT;
S7 : "Signal 7" ["dB"]INT;
S8 : "Signal 8" ["dB"]INT;
S9 : "Signal 9" ["dB"]INT;
S10 : "Signal 10" ["dB"]INT;
S11 : "Signal 11" ["dB"]INT;
S12 : "Signal 12" ["dB"]INT;
S13 : "Signal 13" ["dB"]INT;
S14 : "Signal 14" ["dB"]INT;
S15 : "Signal 15" ["dB"]INT;
S16 : "Signal 16" ["dB"]INT;
S17 : "Signal 17" ["dB"]INT;
S18 : "Signal 18" ["dB"]INT;
S19 : "Signal 19" ["dB"]INT;
S20 : "Signal 20" ["dB"]INT;
S21 : "Signal 21" ["dB"]INT;
S22 : "Signal 22" ["dB"]INT;
S23 : "Signal 23" ["dB"]INT;
S24 : "Signal 24" ["dB"]INT;
S25 : "Signal 25" ["dB"]INT;
S26 : "Signal 26" ["dB"]INT;
S27 : "Signal 27" ["dB"]INT;
S28 : "Signal 28" ["dB"]INT;
S29 : "Signal 29" ["dB"]INT;
S30 : "Signal 30" ["dB"]INT;
S31 : "Signal 31" ["dB"]INT;
S32 : "Signal 32" ["dB"]INT;
V1 : "Enhet 1 ID" [""]INT;
V2 : "Enhet 2 ID" [""]INT;
V3 : "Enhet 3 ID" [""]INT;
V4 : "Enhet 4 ID" [""]INT;
V5 : "Enhet 5 ID" [""]INT;
V6 : "Enhet 6 ID" [""]INT;
V7 : "Enhet 7 ID" [""]INT;
V8 : "Enhet 8 ID" [""]INT;
V9 : "Enhet 9 ID" [""]INT;
V10 : "Enhet 10 ID" [""]INT;
V11 : "Enhet 11 ID" [""]INT;
V12 : "Enhet 12 ID" [""]INT;
V13 : "Enhet 13 ID" [""]INT;
V14 : "Enhet 14 ID" [""]INT;
V15 : "Enhet 15 ID" [""]INT;
V16 : "Enhet 16 ID" [""]INT;
V17 : "Enhet 17 ID" [""]INT;
V18 : "Enhet 18 ID" [""]INT;
V19 : "Enhet 19 ID" [""]INT;
V20 : "Enhet 20 ID" [""]INT;
V21 : "Enhet 21 ID" [""]INT;
V22 : "Enhet 22 ID" [""]INT;
V23 : "Enhet 23 ID" [""]INT;
V24 : "Enhet 24 ID" [""]INT;
V25 : "Enhet 25 ID" [""]INT;
V26 : "Enhet 26 ID" [""]INT;
V27 : "Enhet 27 ID" [""]INT;
V28 : "Enhet 28 ID" [""]INT;
V29 : "Enhet 29 ID" [""]INT;
V30 : "Enhet 30 ID" [""]INT;
V31 : "Enhet 31 ID" [""]INT;
V32 : "Enhet 32 ID" [""]INT;
ASum : "Summalarm Batteri" INT;
A1 : "Enhet 1 larm Batteri" INT;
A2 : "Enhet 2 larm Batteri" INT;
A3 : "Enhet 3 larm Batteri" INT;
A4 : "Enhet 4 larm Batteri" INT;
A5 : "Enhet 5 larm Batteri" INT;
A6 : "Enhet 6 larm Batteri" INT;
A7 : "Enhet 7 larm Batteri" INT;
A8 : "Enhet 8 larm Batteri" INT;
A9 : "Enhet 9 larm Batteri" INT;
A10 : "Enhet 10 larm Batteri" INT;
A11 : "Enhet 11 larm Batteri" INT;
A12 : "Enhet 12 larm Batteri" INT;
A13 : "Enhet 13 larm Batteri" INT;
A14 : "Enhet 14 larm Batteri" INT;
A15 : "Enhet 15 larm Batteri" INT;
A16 : "Enhet 16 larm Batteri" INT;
A17 : "Enhet 17 larm Batteri" INT;
A18 : "Enhet 18 larm Batteri" INT;
A19 : "Enhet 19 larm Batteri" INT;
A20 : "Enhet 20 larm Batteri" INT;
A21 : "Enhet 21 larm Batteri" INT;
A22 : "Enhet 22 larm Batteri" INT;
A23 : "Enhet 23 larm Batteri" INT;
A24 : "Enhet 24 larm Batteri" INT;
A25 : "Enhet 25 larm Batteri" INT;
A26 : "Enhet 26 larm Batteri" INT;
A27 : "Enhet 27 larm Batteri" INT;
A28 : "Enhet 28 larm Batteri" INT;
A29 : "Enhet 29 larm Batteri" INT;
A30 : "Enhet 30 larm Batteri" INT;
A31 : "Enhet 31 larm Batteri" INT;
A32 : "Enhet 32 larm Batteri" INT;
Z1 : "Sovtid 1" ["sek"]INT;
Z2 : "Sovtid 2" ["sek"]INT;
Z3 : "Sovtid 3" ["sek"]INT;
Z4 : "Sovtid 4" ["sek"]INT;
Z5 : "Sovtid 5" ["sek"]INT;
Z6 : "Sovtid 6" ["sek"]INT;
Z7 : "Sovtid 7" ["sek"]INT;
Z8 : "Sovtid 8" ["sek"]INT;
Z9 : "Sovtid 9" ["sek"]INT;
Z10 : "Sovtid 10" ["sek"]INT;
Z11 : "Sovtid 11" ["sek"]INT;
Z12 : "Sovtid 12" ["sek"]INT;
Z13 : "Sovtid 13" ["sek"]INT;
Z14 : "Sovtid 14" ["sek"]INT;
Z15 : "Sovtid 15" ["sek"]INT;
Z16 : "Sovtid 16" ["sek"]INT;
Z17 : "Sovtid 17" ["sek"]INT;
Z18 : "Sovtid 18" ["sek"]INT;
Z19 : "Sovtid 19" ["sek"]INT;
Z20 : "Sovtid 20" ["sek"]INT;
Z21 : "Sovtid 21" ["sek"]INT;
Z22 : "Sovtid 22" ["sek"]INT;
Z23 : "Sovtid 23" ["sek"]INT;
Z24 : "Sovtid 24" ["sek"]INT;
Z25 : "Sovtid 25" ["sek"]INT;
Z26 : "Sovtid 26" ["sek"]INT;
Z27 : "Sovtid 27" ["sek"]INT;
Z28 : "Sovtid 28" ["sek"]INT;
Z29 : "Sovtid 29" ["sek"]INT;
Z30 : "Sovtid 30" ["sek"]INT;
Z31 : "Sovtid 31" ["sek"]INT;
Z32 : "Sovtid 32" ["sek"]INT;
P1 : "Närvaro/Dörr 1" INT;
P2 : "Närvaro/Dörr 2" INT;
P3 : "Närvaro/Dörr 3" INT;
P4 : "Närvaro/Dörr 4" INT;
P5 : "Närvaro/Dörr 5" INT;
P6 : "Närvaro/Dörr 6" INT;
P7 : "Närvaro/Dörr 7" INT;
P8 : "Närvaro/Dörr 8" INT;
P9 : "Närvaro/Dörr 9" INT;
P10 : "Närvaro/Dörr 10" INT;
P11 : "Närvaro/Dörr 11" INT;
P12 : "Närvaro/Dörr 12" INT;
P13 : "Närvaro/Dörr 13" INT;
P14 : "Närvaro/Dörr 14" INT;
P15 : "Närvaro/Dörr 15" INT;
P16 : "Närvaro/Dörr 16" INT;
P17 : "Närvaro/Dörr 17" INT;
P18 : "Närvaro/Dörr 18" INT;
P19 : "Närvaro/Dörr 19" INT;
P20 : "Närvaro/Dörr 20" INT;
P21 : "Närvaro/Dörr 21" INT;
P22 : "Närvaro/Dörr 22" INT;
P23 : "Närvaro/Dörr 23" INT;
P24 : "Närvaro/Dörr 24" INT;
P25 : "Närvaro/Dörr 25" INT;
P26 : "Närvaro/Dörr 26" INT;
P27 : "Närvaro/Dörr 27" INT;
P28 : "Närvaro/Dörr 28" INT;
P29 : "Närvaro/Dörr 29" INT;
P30 : "Närvaro/Dörr 30" INT;
P31 : "Närvaro/Dörr 31" INT;
P32 : "Närvaro/Dörr 32" INT;
PRIVATE
Tmp;
Sum;
Count;
TLow;
THigh;
Type;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM ReadTemp NAMED "Läs temperatur" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(04); % Modbus kommando för att läsa register kod 04
DATA[2] := RWORD(0); % Start address
DATA[4] := RWORD(32); % Antal register att läsa
ANSWER SIZE 69 % (Antal register * 2) + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(04);
DATA[2] = BYTE(64); % Antal Bytes
DATA[3] -> RWORD(
Count:=0;
Sum:=0;
TLow:=LowLimit;
THigh:=HighLimit;
IF TLow=0 AND THigh=0 THEN TLow:=10; THigh:=40; ENDIF;
IF (DATA>=32768) THEN Tmp:=(DATA-65536)/100; ELSE Tmp:=DATA/100; ENDIF;Type:=E1;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; TMin:=Tmp; TMax:=Tmp; ENDIF;
T1:=Tmp;
);
DATA[5] -> RWORD(IF (DATA>=32768) THEN Tmp:=(DATA-65536)/100; ELSE Tmp:=DATA/100; ENDIF;Type:=E2;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T2:=Tmp;
);
DATA[7] -> RWORD(IF (DATA>=32768) THEN Tmp:=(DATA-65536)/100; ELSE Tmp:=DATA/100; ENDIF;Type:=E3;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T3:=Tmp;
);
DATA[9] -> RWORD(IF (DATA>=32768) THEN Tmp:=(DATA-65536)/100; ELSE Tmp:=DATA/100; ENDIF;Type:=E4;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T4:=Tmp;
);
DATA[11] -> RWORD(IF (DATA>=32768) THEN Tmp:=(DATA-65536)/100; ELSE Tmp:=DATA/100; ENDIF;Type:=E5;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T5:=Tmp;
);
DATA[13] -> RWORD(IF (DATA>=32768) THEN Tmp:=(DATA-65536)/100; ELSE Tmp:=DATA/100; ENDIF;Type:=E6;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T6:=Tmp;
);
DATA[15] -> RWORD(IF (DATA>=32768) THEN Tmp:=(DATA-65536)/100; ELSE Tmp:=DATA/100; ENDIF;Type:=E7;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T7:=Tmp;
);
DATA[17] -> RWORD(IF (DATA>=32768) THEN Tmp:=(DATA-65536)/100; ELSE Tmp:=DATA/100; ENDIF;Type:=E8;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T8:=Tmp;
);
DATA[19] -> RWORD(IF (DATA>=32768) THEN Tmp:=(DATA-65536)/100; ELSE Tmp:=DATA/100; ENDIF;Type:=E9;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T9:=Tmp;
);
DATA[21] -> RWORD(IF (DATA>=32768) THEN Tmp:=(DATA-65536)/100; ELSE Tmp:=DATA/100; ENDIF;Type:=E10;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T10:=Tmp;
);
DATA[23] -> RWORD(IF (DATA>=32768) THEN Tmp:=(DATA-65536)/100; ELSE Tmp:=DATA/100; ENDIF;Type:=E11;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T11:=Tmp;
);
DATA[25] -> RWORD(IF (DATA>=32768) THEN Tmp:=(DATA-65536)/100; ELSE Tmp:=DATA/100; ENDIF;Type:=E12;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T12:=Tmp;
);
DATA[27] -> RWORD(IF (DATA>=32768) THEN Tmp:=(DATA-65536)/100; ELSE Tmp:=DATA/100; ENDIF;Type:=E13;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T13:=Tmp;
);
DATA[29] -> RWORD(IF (DATA>=32768) THEN Tmp:=(DATA-65536)/100; ELSE Tmp:=DATA/100; ENDIF;Type:=E14;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T14:=Tmp;
);
DATA[31] -> RWORD(IF (DATA>=32768) THEN Tmp:=(DATA-65536)/100; ELSE Tmp:=DATA/100; ENDIF;Type:=E15;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T15:=Tmp;
);
DATA[33] -> RWORD(IF (DATA>=32768) THEN Tmp:=(DATA-65536)/100; ELSE Tmp:=DATA/100; ENDIF;Type:=E16;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T16:=Tmp;
);
DATA[35] -> RINT(Tmp:=DATA/100; Type:=E17;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T17:=Tmp;
);
DATA[37] -> RINT(Tmp:=DATA/100; Type:=E18;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T18:=Tmp;
);
DATA[39] -> RINT(Tmp:=DATA/100; Type:=E19;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T19:=Tmp;
);
DATA[41] -> RINT(Tmp:=DATA/100; Type:=E20;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T20:=Tmp;
);
DATA[43] -> RINT(Tmp:=DATA/100; Type:=E21;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T21:=Tmp;
);
DATA[45] -> RINT(Tmp:=DATA/100; Type:=E22;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T22:=Tmp;
);
DATA[47] -> RINT(Tmp:=DATA/100; Type:=E23;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T23:=Tmp;
);
DATA[49] -> RINT(Tmp:=DATA/100; Type:=E24;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T24:=Tmp;
);
DATA[51] -> RINT(Tmp:=DATA/100; Type:=E25;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T25:=Tmp;
);
DATA[53] -> RINT(Tmp:=DATA/100; Type:=E26;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T26:=Tmp;
);
DATA[55] -> RINT(Tmp:=DATA/100; Type:=E27;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T27:=Tmp;
);
DATA[57] -> RINT(Tmp:=DATA/100; Type:=E28;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T28:=Tmp;
);
DATA[59] -> RINT(Tmp:=DATA/100; Type:=E29;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T29:=Tmp;
);
DATA[61] -> RINT(Tmp:=DATA/100; Type:=E30;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T30:=Tmp;
);
DATA[63] -> RINT(Tmp:=DATA/100; Type:=E31;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T31:=Tmp;
);
DATA[65] -> RINT(Tmp:=DATA/100; Type:=E32;
IF((Type=3 OR Type=6) AND Tmp>TLow AND Tmp<THigh) THEN Sum:=Sum+Tmp; Count:=Count+1; IF Tmp<TMin THEN TMin:=Tmp; ENDIF; IF Tmp>TMax THEN TMax:=Tmp; ENDIF; ENDIF;
T32:=Tmp;
TMean:=Sum/Count;
);
TIMEOUT 300
END;
TELEGRAM ReadType NAMED "Läs typ" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(04); % Modbus kommando för att läsa register kod 04
DATA[2] := RWORD(7000); % Start address
DATA[4] := RWORD(32); % Antal register att läsa
ANSWER SIZE 69 % (Antal register * 2) + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(04);
DATA[2] = BYTE(64); % Antal Bytes
DATA[3] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E1:=Tmp;);
DATA[5] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E2:=Tmp;);
DATA[7] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E3:=Tmp;);
DATA[9] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E4:=Tmp;);
DATA[11] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E5:=Tmp;);
DATA[13] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E6:=Tmp;);
DATA[15] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E7:=Tmp;);
DATA[17] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E8:=Tmp;);
DATA[19] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E9:=Tmp;);
DATA[21] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E10:=Tmp;);
DATA[23] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E11:=Tmp;);
DATA[25] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E12:=Tmp;);
DATA[27] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E13:=Tmp;);
DATA[29] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E14:=Tmp;);
DATA[31] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E15:=Tmp;);
DATA[33] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E16:=Tmp;);
DATA[35] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E17:=Tmp;);
DATA[37] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E18:=Tmp;);
DATA[39] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E19:=Tmp;);
DATA[41] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E20:=Tmp;);
DATA[43] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E21:=Tmp;);
DATA[45] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E22:=Tmp;);
DATA[47] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E23:=Tmp;);
DATA[49] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E24:=Tmp;);
DATA[51] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E25:=Tmp;);
DATA[53] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E26:=Tmp;);
DATA[55] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E27:=Tmp;);
DATA[57] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E28:=Tmp;);
DATA[59] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E29:=Tmp;);
DATA[61] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E30:=Tmp;);
DATA[63] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E31:=Tmp;);
DATA[65] -> RWORD(Tmp := 7; IF DATA=10 THEN Tmp:=1; ELSIF DATA=21 OR DATA=23 THEN Tmp:=2; ELSIF DATA=100 THEN Tmp:=3; ELSIF DATA=120 THEN Tmp:=4; ELSIF DATA=200 THEN Tmp:=5; ELSIF DATA=101 THEN Tmp:=6; ENDIF; E32:=Tmp;);
TIMEOUT 300
END;
TELEGRAM ReadSignal NAMED "Läs signal" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(04); % Modbus kommando för att läsa register kod 04
DATA[2] := RWORD(7200); % Start address
DATA[4] := RWORD(32); % Antal register att läsa
ANSWER SIZE 69 % (Antal register * 2) + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(04);
DATA[2] = BYTE(64); % Antal Bytes
DATA[3] ->RWORD(S1:=DATA;);
DATA[5] ->RWORD(S2:=DATA;);
DATA[7] ->RWORD(S3:=DATA;);
DATA[9] ->RWORD(S4:=DATA;);
DATA[11] ->RWORD(S5:=DATA;);
DATA[13] ->RWORD(S6:=DATA;);
DATA[15] ->RWORD(S7:=DATA;);
DATA[17] ->RWORD(S8:=DATA;);
DATA[19] ->RWORD(S9:=DATA;);
DATA[21] ->RWORD(S10:=DATA;);
DATA[23] ->RWORD(S11:=DATA;);
DATA[25] ->RWORD(S12:=DATA;);
DATA[27] ->RWORD(S13:=DATA;);
DATA[29] ->RWORD(S14:=DATA;);
DATA[31] ->RWORD(S15:=DATA;);
DATA[33] ->RWORD(S16:=DATA;);
DATA[35] ->RWORD(S17:=DATA;);
DATA[37] ->RWORD(S18:=DATA;);
DATA[39] ->RWORD(S19:=DATA;);
DATA[41] ->RWORD(S20:=DATA;);
DATA[43] ->RWORD(S21:=DATA;);
DATA[45] ->RWORD(S22:=DATA;);
DATA[47] ->RWORD(S23:=DATA;);
DATA[49] ->RWORD(S24:=DATA;);
DATA[51] ->RWORD(S25:=DATA;);
DATA[53] ->RWORD(S26:=DATA;);
DATA[55] ->RWORD(S27:=DATA;);
DATA[57] ->RWORD(S28:=DATA;);
DATA[59] ->RWORD(S29:=DATA;);
DATA[61] ->RWORD(S30:=DATA;);
DATA[63] ->RWORD(S31:=DATA;);
DATA[65] ->RWORD(S32:=DATA;);
TIMEOUT 300
END;
TELEGRAM ReadHum NAMED "Läs Fukt" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(04); % Modbus kommando för att läsa register kod 04
DATA[2] := RWORD(400); % Start address
DATA[4] := RWORD(32); % Antal register att läsa
ANSWER SIZE 69 % (Antal register * 2) + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(04);
DATA[2] = BYTE(64); % Antal Bytes
DATA[3] ->RWORD(F1:=DATA;);
DATA[5] ->RWORD(F2:=DATA;);
DATA[7] ->RWORD(F3:=DATA;);
DATA[9] ->RWORD(F4:=DATA;);
DATA[11] ->RWORD(F5:=DATA;);
DATA[13] ->RWORD(F6:=DATA;);
DATA[15] ->RWORD(F7:=DATA;);
DATA[17] ->RWORD(F8:=DATA;);
DATA[19] ->RWORD(F9:=DATA;);
DATA[21] ->RWORD(F10:=DATA;);
DATA[23] ->RWORD(F11:=DATA;);
DATA[25] ->RWORD(F12:=DATA;);
DATA[27] ->RWORD(F13:=DATA;);
DATA[29] ->RWORD(F14:=DATA;);
DATA[31] ->RWORD(F15:=DATA;);
DATA[33] ->RWORD(F16:=DATA;);
DATA[35] ->RWORD(F17:=DATA;);
DATA[37] ->RWORD(F18:=DATA;);
DATA[39] ->RWORD(F19:=DATA;);
DATA[41] ->RWORD(F20:=DATA;);
DATA[43] ->RWORD(F21:=DATA;);
DATA[45] ->RWORD(F22:=DATA;);
DATA[47] ->RWORD(F23:=DATA;);
DATA[49] ->RWORD(F24:=DATA;);
DATA[51] ->RWORD(F25:=DATA;);
DATA[53] ->RWORD(F26:=DATA;);
DATA[55] ->RWORD(F27:=DATA;);
DATA[57] ->RWORD(F28:=DATA;);
DATA[59] ->RWORD(F29:=DATA;);
DATA[61] ->RWORD(F30:=DATA;);
DATA[63] ->RWORD(F31:=DATA;);
DATA[65] ->RWORD(F32:=DATA;);
TIMEOUT 300
END;
TELEGRAM ReadID NAMED "Läs id" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(04); % Modbus kommando för att läsa register kod 04
DATA[2] := RWORD(7100); % Start address
DATA[4] := RWORD(32); % Antal register att läsa
ANSWER SIZE 69 % (Antal register * 2) + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(04);
DATA[2] = BYTE(64); % Antal Bytes
DATA[3] -> RWORD(V1:=DATA;);
DATA[5] -> RWORD(V2:=DATA;);
DATA[7] -> RWORD(V3:=DATA;);
DATA[9] -> RWORD(V4:=DATA;);
DATA[11] ->RWORD(V5:=DATA;);
DATA[13] ->RWORD(V6:=DATA;);
DATA[15] ->RWORD(V7:=DATA;);
DATA[17] ->RWORD(V8:=DATA;);
DATA[19] ->RWORD(V9:=DATA;);
DATA[21] ->RWORD(V10:=DATA;);
DATA[23] ->RWORD(V11:=DATA;);
DATA[25] ->RWORD(V12:=DATA;);
DATA[27] ->RWORD(V13:=DATA;);
DATA[29] ->RWORD(V14:=DATA;);
DATA[31] ->RWORD(V15:=DATA;);
DATA[33] ->RWORD(V16:=DATA;);
DATA[35] ->RWORD(V17:=DATA;);
DATA[37] ->RWORD(V18:=DATA;);
DATA[39] ->RWORD(V19:=DATA;);
DATA[41] ->RWORD(V20:=DATA;);
DATA[43] ->RWORD(V21:=DATA;);
DATA[45] ->RWORD(V22:=DATA;);
DATA[47] ->RWORD(V23:=DATA;);
DATA[49] ->RWORD(V24:=DATA;);
DATA[51] ->RWORD(V25:=DATA;);
DATA[53] ->RWORD(V26:=DATA;);
DATA[55] ->RWORD(V27:=DATA;);
DATA[57] ->RWORD(V28:=DATA;);
DATA[59] ->RWORD(V29:=DATA;);
DATA[61] ->RWORD(V30:=DATA;);
DATA[63] ->RWORD(V31:=DATA;);
DATA[65] ->RWORD(V32:=DATA;);
TIMEOUT 300
END;
TELEGRAM WriteProgram NAMED "Koppla/Ta bort" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(10); % Modbus kommando för att skriva flera register
DATA[2] <- RWORD(IF Device<1 OR Device>32 THEN DATA:=7000; ELSE DATA:=6999+Device; ENDIF; ); % Register adress
DATA[4] := RWORD(1); % Antal register
DATA[6] := BYTE(2); % Antal byte
DATA[7] <- RWORD(
IF Device<1 OR Device>32 THEN DATA:=0; ELSIF Oper=1 THEN DATA:=1; ELSIF Oper=2 THEN DATA:=3; ELSE DATA:=0; ENDIF;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(10);
TIMEOUT 300
END;
TELEGRAM ReadBatry NAMED "Läs batterilarm" 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(100); % Start address
DATA[4] := RWORD(32); % Antal register att läsa
ANSWER SIZE 9 % (Antal register / 8) avrundat uppåt + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(02);
DATA[2] = BYTE(4); % Antal Bytes
DATA[3] -> BYTE(
ASum:=0;
IF DATA>0 THEN ASum:=1; ENDIF;
IF (DATA & 1) THEN A1 := 1; ELSE A1 := 0; ENDIF;
IF (DATA & 2) THEN A2 := 1; ELSE A2 := 0; ENDIF;
IF (DATA & 4) THEN A3 := 1; ELSE A3 := 0; ENDIF;
IF (DATA & 8) THEN A4 := 1; ELSE A4 := 0; ENDIF;
IF (DATA & 16) THEN A5 := 1; ELSE A5 := 0; ENDIF;
IF (DATA & 32) THEN A6 := 1; ELSE A6 := 0; ENDIF;
IF (DATA & 64) THEN A7 := 1; ELSE A7 := 0; ENDIF;
IF (DATA & 128) THEN A8 := 1; ELSE A8 := 0; ENDIF;
);
DATA[4] -> BYTE(
IF DATA>0 THEN ASum:=1; ENDIF;
IF (DATA & 1) THEN A9 := 1; ELSE A9 := 0; ENDIF;
IF (DATA & 2) THEN A10 := 1; ELSE A10 := 0; ENDIF;
IF (DATA & 4) THEN A11 := 1; ELSE A11 := 0; ENDIF;
IF (DATA & 8) THEN A12 := 1; ELSE A12 := 0; ENDIF;
IF (DATA & 16) THEN A13 := 1; ELSE A13 := 0; ENDIF;
IF (DATA & 32) THEN A14 := 1; ELSE A14 := 0; ENDIF;
IF (DATA & 64) THEN A15 := 1; ELSE A15 := 0; ENDIF;
IF (DATA & 128) THEN A16 := 1; ELSE A16 := 0; ENDIF;
);
DATA[3] -> BYTE(
IF DATA>0 THEN ASum:=1; ENDIF;
IF (DATA & 1) THEN A17 := 1; ELSE A17 := 0; ENDIF;
IF (DATA & 2) THEN A18 := 1; ELSE A18 := 0; ENDIF;
IF (DATA & 4) THEN A19 := 1; ELSE A19 := 0; ENDIF;
IF (DATA & 8) THEN A20 := 1; ELSE A20 := 0; ENDIF;
IF (DATA & 16) THEN A21 := 1; ELSE A21 := 0; ENDIF;
IF (DATA & 32) THEN A22 := 1; ELSE A22 := 0; ENDIF;
IF (DATA & 64) THEN A23 := 1; ELSE A23 := 0; ENDIF;
IF (DATA & 128) THEN A24 := 1; ELSE A24 := 0; ENDIF;
);
DATA[4] -> BYTE(
IF DATA>0 THEN ASum:=1; ENDIF;
IF (DATA & 1) THEN A25 := 1; ELSE A25 := 0; ENDIF;
IF (DATA & 2) THEN A26 := 1; ELSE A26 := 0; ENDIF;
IF (DATA & 4) THEN A27 := 1; ELSE A27 := 0; ENDIF;
IF (DATA & 8) THEN A28 := 1; ELSE A28 := 0; ENDIF;
IF (DATA & 16) THEN A29 := 1; ELSE A29 := 0; ENDIF;
IF (DATA & 32) THEN A30 := 1; ELSE A30 := 0; ENDIF;
IF (DATA & 64) THEN A31 := 1; ELSE A31 := 0; ENDIF;
IF (DATA & 128) THEN A32 := 1; ELSE A32 := 0; ENDIF;
);
TIMEOUT 300
END;
TELEGRAM ReadPD NAMED "Läs närvaro och dörr" 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(0); % Start address
DATA[4] := RWORD(32); % Antal register att läsa
ANSWER SIZE 9 % (Antal register / 8) avrundat uppåt + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(02);
DATA[2] = BYTE(4); % Antal Bytes
DATA[3] -> BYTE(
IF (DATA & 1) THEN P1 := 1; ELSE P1 := 0; ENDIF;
IF (DATA & 2) THEN P2 := 1; ELSE P2 := 0; ENDIF;
IF (DATA & 4) THEN P3 := 1; ELSE P3 := 0; ENDIF;
IF (DATA & 8) THEN P4 := 1; ELSE P4 := 0; ENDIF;
IF (DATA & 16) THEN P5 := 1; ELSE P5 := 0; ENDIF;
IF (DATA & 32) THEN P6 := 1; ELSE P6 := 0; ENDIF;
IF (DATA & 64) THEN P7 := 1; ELSE P7 := 0; ENDIF;
IF (DATA & 128) THEN P8 := 1; ELSE P8 := 0; ENDIF;
);
DATA[4] -> BYTE(
IF (DATA & 1) THEN P9 := 1; ELSE P9 := 0; ENDIF;
IF (DATA & 2) THEN P10 := 1; ELSE P10 := 0; ENDIF;
IF (DATA & 4) THEN P11 := 1; ELSE P11 := 0; ENDIF;
IF (DATA & 8) THEN P12 := 1; ELSE P12 := 0; ENDIF;
IF (DATA & 16) THEN P13 := 1; ELSE P13 := 0; ENDIF;
IF (DATA & 32) THEN P14 := 1; ELSE P14 := 0; ENDIF;
IF (DATA & 64) THEN P15 := 1; ELSE P15 := 0; ENDIF;
IF (DATA & 128) THEN P16 := 1; ELSE P16 := 0; ENDIF;
);
DATA[5] -> BYTE(
IF (DATA & 1) THEN P17 := 1; ELSE P17 := 0; ENDIF;
IF (DATA & 2) THEN P18 := 1; ELSE P18 := 0; ENDIF;
IF (DATA & 4) THEN P19 := 1; ELSE P19 := 0; ENDIF;
IF (DATA & 8) THEN P20 := 1; ELSE P20 := 0; ENDIF;
IF (DATA & 16) THEN P21 := 1; ELSE P21 := 0; ENDIF;
IF (DATA & 32) THEN P22 := 1; ELSE P22 := 0; ENDIF;
IF (DATA & 64) THEN P23 := 1; ELSE P23 := 0; ENDIF;
IF (DATA & 128) THEN P24 := 1; ELSE P24 := 0; ENDIF;
);
DATA[6] -> BYTE(
IF (DATA & 1) THEN P25 := 1; ELSE P25 := 0; ENDIF;
IF (DATA & 2) THEN P26 := 1; ELSE P26 := 0; ENDIF;
IF (DATA & 4) THEN P27 := 1; ELSE P27 := 0; ENDIF;
IF (DATA & 8) THEN P28 := 1; ELSE P28 := 0; ENDIF;
IF (DATA & 16) THEN P29 := 1; ELSE P29 := 0; ENDIF;
IF (DATA & 32) THEN P30 := 1; ELSE P30 := 0; ENDIF;
IF (DATA & 64) THEN P31 := 1; ELSE P31 := 0; ENDIF;
IF (DATA & 128) THEN P32 := 1; ELSE P32 := 0; ENDIF;
);
TIMEOUT 300
END;
TELEGRAM ReadSleep NAMED "Läs Sovtid" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := BYTE(3); % Modbus kommando för att läsa register kod 3
DATA[2] := RWORD(100); % Start address
DATA[4] := RWORD(32); % Antal register att läsa
ANSWER SIZE 69 % (Antal register * 2) + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(3);
DATA[2] = BYTE(64); % Antal Bytes
DATA[3] ->RWORD(Z1:=DATA*10;);
DATA[5] ->RWORD(Z2:=DATA*10;);
DATA[7] ->RWORD(Z3:=DATA*10;);
DATA[9] ->RWORD(Z4:=DATA*10;);
DATA[11] ->RWORD(Z5:=DATA*10;);
DATA[13] ->RWORD(Z6:=DATA*10;);
DATA[15] ->RWORD(Z7:=DATA*10;);
DATA[17] ->RWORD(Z8:=DATA*10;);
DATA[19] ->RWORD(Z9:=DATA*10;);
DATA[21] ->RWORD(Z10:=DATA*10;);
DATA[23] ->RWORD(Z11:=DATA*10;);
DATA[25] ->RWORD(Z12:=DATA*10;);
DATA[27] ->RWORD(Z13:=DATA*10;);
DATA[29] ->RWORD(Z14:=DATA*10;);
DATA[31] ->RWORD(Z15:=DATA*10;);
DATA[33] ->RWORD(Z16:=DATA*10;);
DATA[35] ->RWORD(Z17:=DATA*10;);
DATA[37] ->RWORD(Z18:=DATA*10;);
DATA[39] ->RWORD(Z19:=DATA*10;);
DATA[41] ->RWORD(Z20:=DATA*10;);
DATA[43] ->RWORD(Z21:=DATA*10;);
DATA[45] ->RWORD(Z22:=DATA*10;);
DATA[47] ->RWORD(Z23:=DATA*10;);
DATA[49] ->RWORD(Z24:=DATA*10;);
DATA[51] ->RWORD(Z25:=DATA*10;);
DATA[53] ->RWORD(Z26:=DATA*10;);
DATA[55] ->RWORD(Z27:=DATA*10;);
DATA[57] ->RWORD(Z28:=DATA*10;);
DATA[59] ->RWORD(Z29:=DATA*10;);
DATA[61] ->RWORD(Z30:=DATA*10;);
DATA[63] ->RWORD(Z31:=DATA*10;);
DATA[65] ->RWORD(Z32:=DATA*10;);
TIMEOUT 300
END;
TELEGRAM WriteWakeUp NAMED "Ställ sovtid" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(10); % Modbus kommando för att skriva flera register
DATA[2] <- RWORD(IF DeviceZ<1 OR Device>32 THEN DATA:=100; ELSE DATA:=99+DeviceZ; ENDIF; ); % Register adress
DATA[4] := RWORD(1); % Antal register
DATA[6] := BYTE(2); % Antal byte
DATA[7] <- RWORD(
IF Device<1 OR Device>32 THEN DATA:=12; ELSE DATA:=WakeUpTime; ENDIF;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(10);
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.