Siox SD1 via ES2
Detaljer
- Typ
- Drivrutin
- Upplaggd av
- Ove Jansson, Abelko Innovation
- Version
- 1
- Uppdaterad
- 2018-09-26
- Skapad
- 2018-09-26
- Kategori
- IO enheter, Mätare, Modbus, Övriga protokoll
- Visningar
- 1909
Beskrivning
4x DI/DO modul via ES-2 modbus till Siox gateway
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
DEVICETYPE SD1 NAMED "Siox ES2-SD1" TYPEID 11379 IS
PARAMETER
Id : "Adress" [""]INT;
wP8B0b0 : "Set DO1" ["OFF,ON"]ENUM;
wP8B0b1 : "Set DO2" ["OFF,ON"]ENUM;
wP8B0b2 : "Set DO3" ["OFF,ON"]ENUM;
wP8B0b3 : "Set DO4" ["OFF,ON"]ENUM;
PUBLIC
P8B0b0 : "DO1" ["OFF,ON"]ENUM;
P8B0b1 : "DO2" ["OFF,ON"]ENUM;
P8B0b2 : "DO3" ["OFF,ON"]ENUM;
P8B0b3 : "DO4" ["OFF,ON"]ENUM;
P9B0b0 : "DI1" ["OFF,ON"]ENUM;
P9B0b1 : "DI2" ["OFF,ON"]ENUM;
P9B0b2 : "DI3" ["OFF,ON"]ENUM;
P9B0b3 : "DI4" ["OFF,ON"]ENUM;
P10B1b0 : "Use as DO1" ["No,Yes"]ENUM;
P10B1b1 : "Use as DO2" ["No,Yes"]ENUM;
P10B1b2 : "Use as DO3" ["No,Yes"]ENUM;
P10B1b3 : "Use as DO4" ["No,Yes"]ENUM;
P8B1b0 : "DO1 short circuit" ["No,Yes"]ENUM;
P8B1b1 : "DO2 short circuit" ["No,Yes"]ENUM;
P8B1b2 : "DO3 short circuit" ["No,Yes"]ENUM;
P8B1b3 : "DO4 short circuit" ["No,Yes"]ENUM;
P11B0b0 : "Invert DI1" ["No,Yes"]ENUM;
P11B0b1 : "Invert DI2" ["No,Yes"]ENUM;
P11B0b2 : "Invert DI3" ["No,Yes"]ENUM;
P11B0b3 : "Invert DI4" ["No,Yes"]ENUM;
P24U32 : "Resettable counter 1" INT;
P26U32 : "Resettable counter 2" INT;
P28U32 : "Resettable counter 2" INT;
P30U32 : "Resettable counter 4" INT;
PRIVATE
tmp;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM Read3 NAMED "Read" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(03);
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] = HEX(03);
DATA[2] = BYTE(64); % Antal Bytes
DATA[19] -> BYTE(
IF DATA & 1 THEN tmp:=1; ELSE tmp:=0; ENDIF; P8B1b0:=tmp;
IF DATA & 2 THEN tmp:=1; ELSE tmp:=0; ENDIF; P8B1b1:=tmp;
IF DATA & 4 THEN tmp:=1; ELSE tmp:=0; ENDIF; P8B1b2:=tmp;
IF DATA & 8 THEN tmp:=1; ELSE tmp:=0; ENDIF; P8B1b3:=tmp;
);
DATA[20] -> BYTE(
IF DATA & 1 THEN tmp:=1; ELSE tmp:=0; ENDIF; P8B0b0:=tmp;
IF DATA & 2 THEN tmp:=1; ELSE tmp:=0; ENDIF; P8B0b1:=tmp;
IF DATA & 4 THEN tmp:=1; ELSE tmp:=0; ENDIF; P8B0b2:=tmp;
IF DATA & 8 THEN tmp:=1; ELSE tmp:=0; ENDIF; P8B0b3:=tmp;
);
DATA[22] -> BYTE(
IF DATA & 1 THEN tmp:=1; ELSE tmp:=0; ENDIF; P9B0b0:=tmp;
IF DATA & 2 THEN tmp:=1; ELSE tmp:=0; ENDIF; P9B0b1:=tmp;
IF DATA & 4 THEN tmp:=1; ELSE tmp:=0; ENDIF; P9B0b2:=tmp;
IF DATA & 8 THEN tmp:=1; ELSE tmp:=0; ENDIF; P9B0b3:=tmp;
);
DATA[23] -> BYTE(
IF DATA & 1 THEN tmp:=1; ELSE tmp:=0; ENDIF; P10B1b0:=tmp;
IF DATA & 2 THEN tmp:=1; ELSE tmp:=0; ENDIF; P10B1b1:=tmp;
IF DATA & 4 THEN tmp:=1; ELSE tmp:=0; ENDIF; P10B1b2:=tmp;
IF DATA & 8 THEN tmp:=1; ELSE tmp:=0; ENDIF; P10B1b3:=tmp;
);
DATA[26] -> BYTE(
IF DATA & 1 THEN tmp:=1; ELSE tmp:=0; ENDIF; P11B0b0:=tmp;
IF DATA & 2 THEN tmp:=1; ELSE tmp:=0; ENDIF; P11B0b1:=tmp;
IF DATA & 4 THEN tmp:=1; ELSE tmp:=0; ENDIF; P11B0b2:=tmp;
IF DATA & 8 THEN tmp:=1; ELSE tmp:=0; ENDIF; P11B0b3:=tmp;
);
DATA[51] -> RWORD32(P24U32:=DATA;);
DATA[55] -> RWORD32(P26U32:=DATA;);
DATA[59] -> RWORD32(P28U32:=DATA;);
DATA[63] -> RWORD32(P30U32:=DATA;);
TIMEOUT 800
END;
TELEGRAM Write6 NAMED "Write" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(06);
DATA[2] := RWORD(8);
DATA[4] <- RWORD(
tmp:=0;
IF wP8B0b0=1 THEN tmp:=tmp+1; ENDIF;
IF wP8B0b1=1 THEN tmp:=tmp+2; ENDIF;
IF wP8B0b2=1 THEN tmp:=tmp+4; ENDIF;
IF wP8B0b3=1 THEN tmp:=tmp+8; ENDIF;
DATA := tmp;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(06);
TIMEOUT 800
END;
END;
PARAMETER
Id : "Adress" [""]INT;
wP8B0b0 : "Set DO1" ["OFF,ON"]ENUM;
wP8B0b1 : "Set DO2" ["OFF,ON"]ENUM;
wP8B0b2 : "Set DO3" ["OFF,ON"]ENUM;
wP8B0b3 : "Set DO4" ["OFF,ON"]ENUM;
PUBLIC
P8B0b0 : "DO1" ["OFF,ON"]ENUM;
P8B0b1 : "DO2" ["OFF,ON"]ENUM;
P8B0b2 : "DO3" ["OFF,ON"]ENUM;
P8B0b3 : "DO4" ["OFF,ON"]ENUM;
P9B0b0 : "DI1" ["OFF,ON"]ENUM;
P9B0b1 : "DI2" ["OFF,ON"]ENUM;
P9B0b2 : "DI3" ["OFF,ON"]ENUM;
P9B0b3 : "DI4" ["OFF,ON"]ENUM;
P10B1b0 : "Use as DO1" ["No,Yes"]ENUM;
P10B1b1 : "Use as DO2" ["No,Yes"]ENUM;
P10B1b2 : "Use as DO3" ["No,Yes"]ENUM;
P10B1b3 : "Use as DO4" ["No,Yes"]ENUM;
P8B1b0 : "DO1 short circuit" ["No,Yes"]ENUM;
P8B1b1 : "DO2 short circuit" ["No,Yes"]ENUM;
P8B1b2 : "DO3 short circuit" ["No,Yes"]ENUM;
P8B1b3 : "DO4 short circuit" ["No,Yes"]ENUM;
P11B0b0 : "Invert DI1" ["No,Yes"]ENUM;
P11B0b1 : "Invert DI2" ["No,Yes"]ENUM;
P11B0b2 : "Invert DI3" ["No,Yes"]ENUM;
P11B0b3 : "Invert DI4" ["No,Yes"]ENUM;
P24U32 : "Resettable counter 1" INT;
P26U32 : "Resettable counter 2" INT;
P28U32 : "Resettable counter 2" INT;
P30U32 : "Resettable counter 4" INT;
PRIVATE
tmp;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM Read3 NAMED "Read" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(03);
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] = HEX(03);
DATA[2] = BYTE(64); % Antal Bytes
DATA[19] -> BYTE(
IF DATA & 1 THEN tmp:=1; ELSE tmp:=0; ENDIF; P8B1b0:=tmp;
IF DATA & 2 THEN tmp:=1; ELSE tmp:=0; ENDIF; P8B1b1:=tmp;
IF DATA & 4 THEN tmp:=1; ELSE tmp:=0; ENDIF; P8B1b2:=tmp;
IF DATA & 8 THEN tmp:=1; ELSE tmp:=0; ENDIF; P8B1b3:=tmp;
);
DATA[20] -> BYTE(
IF DATA & 1 THEN tmp:=1; ELSE tmp:=0; ENDIF; P8B0b0:=tmp;
IF DATA & 2 THEN tmp:=1; ELSE tmp:=0; ENDIF; P8B0b1:=tmp;
IF DATA & 4 THEN tmp:=1; ELSE tmp:=0; ENDIF; P8B0b2:=tmp;
IF DATA & 8 THEN tmp:=1; ELSE tmp:=0; ENDIF; P8B0b3:=tmp;
);
DATA[22] -> BYTE(
IF DATA & 1 THEN tmp:=1; ELSE tmp:=0; ENDIF; P9B0b0:=tmp;
IF DATA & 2 THEN tmp:=1; ELSE tmp:=0; ENDIF; P9B0b1:=tmp;
IF DATA & 4 THEN tmp:=1; ELSE tmp:=0; ENDIF; P9B0b2:=tmp;
IF DATA & 8 THEN tmp:=1; ELSE tmp:=0; ENDIF; P9B0b3:=tmp;
);
DATA[23] -> BYTE(
IF DATA & 1 THEN tmp:=1; ELSE tmp:=0; ENDIF; P10B1b0:=tmp;
IF DATA & 2 THEN tmp:=1; ELSE tmp:=0; ENDIF; P10B1b1:=tmp;
IF DATA & 4 THEN tmp:=1; ELSE tmp:=0; ENDIF; P10B1b2:=tmp;
IF DATA & 8 THEN tmp:=1; ELSE tmp:=0; ENDIF; P10B1b3:=tmp;
);
DATA[26] -> BYTE(
IF DATA & 1 THEN tmp:=1; ELSE tmp:=0; ENDIF; P11B0b0:=tmp;
IF DATA & 2 THEN tmp:=1; ELSE tmp:=0; ENDIF; P11B0b1:=tmp;
IF DATA & 4 THEN tmp:=1; ELSE tmp:=0; ENDIF; P11B0b2:=tmp;
IF DATA & 8 THEN tmp:=1; ELSE tmp:=0; ENDIF; P11B0b3:=tmp;
);
DATA[51] -> RWORD32(P24U32:=DATA;);
DATA[55] -> RWORD32(P26U32:=DATA;);
DATA[59] -> RWORD32(P28U32:=DATA;);
DATA[63] -> RWORD32(P30U32:=DATA;);
TIMEOUT 800
END;
TELEGRAM Write6 NAMED "Write" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(06);
DATA[2] := RWORD(8);
DATA[4] <- RWORD(
tmp:=0;
IF wP8B0b0=1 THEN tmp:=tmp+1; ENDIF;
IF wP8B0b1=1 THEN tmp:=tmp+2; ENDIF;
IF wP8B0b2=1 THEN tmp:=tmp+4; ENDIF;
IF wP8B0b3=1 THEN tmp:=tmp+8; ENDIF;
DATA := tmp;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(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.