BAS2-MBIO-A42 (modbus)
Detaljer
- Typ
- Drivrutin
- Upplaggd av
- Ove Jansson, Abelko Innovation
- Version
- 8
- Uppdaterad
- 2017-02-21
- Skapad
- 2015-08-28
- Kategori
- IO enheter, Modbus
- Visningar
- 3351
Beskrivning
Enheten har 4 analoga ingångar för 0-10V eller PT1000 och 2 analoga utgångar 0-10V.
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
% Type of input depends on dip switches
% 170221 (PW) Changed startadress read from 100 to 99 and write from 201 to 200.
DEVICETYPE BAS2A42 NAMED "BAS2-MBIO-A42" TYPEID 15895 IS
PARAMETER
Id : "Adress";
W1 : "Output 1" ["V"]DEC3;
W2 : "Output 1" ["V"]DEC3;
PUBLIC
A1 : "IN1 Fail" [""]INT; %
A2 : "IN2 Fail" [""]INT; %
A3 : "IN3 Fail" ["˚"]INT; %
A4 : "IN4 Fail" ["˚"]INT; %
T1 : "Temp 1" ["˚C"]DEC2; %
T2 : "Temp 2" ["˚C"]DEC2; %
T3 : "Temp 3" ["˚C"]DEC2; %
T4 : "Temp 4" ["˚C"]DEC2; %
V1 : "Volt 1" ["V"]DEC3; %
V2 : "Volt 2" ["V"]DEC3; %
V3 : "Volt 3" ["V"]DEC3; %
V4 : "Volt 4" ["V"]DEC3; %
PRIVATE
count;
tmp;
BAUDRATE 9600;
PARITY EVEN;
CHECKSUM MODBUS SWAPPED;
TELEGRAM Read NAMED "Read" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(04);
DATA[2] := RWORD(99);
DATA[4] := RWORD(5);
ANSWER SIZE 15
DATA[0] = BYTE(Id);
DATA[1] = HEX(04);
DATA[3] -> RWORD(
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;
);
DATA[5] -> RWORD(T1:=DATA/100;V1:=DATA/1000;);
DATA[7] -> RWORD(T2:=DATA/100;V2:=DATA/1000;);
DATA[9] -> RWORD(T3:=DATA/100;V3:=DATA/1000;);
DATA[11] -> RWORD(T4:=DATA/100;V4:=DATA/1000;);
TIMEOUT 300
END;
TELEGRAM Write NAMED "Write" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(10);
DATA[2] := RWORD(200);
DATA[4] := BYTE(2);
DATA[5] := RWORD(W1*1000);
DATA[7] := RWORD(W2*1000);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(10);
TIMEOUT 300
END;
END;
% 170221 (PW) Changed startadress read from 100 to 99 and write from 201 to 200.
DEVICETYPE BAS2A42 NAMED "BAS2-MBIO-A42" TYPEID 15895 IS
PARAMETER
Id : "Adress";
W1 : "Output 1" ["V"]DEC3;
W2 : "Output 1" ["V"]DEC3;
PUBLIC
A1 : "IN1 Fail" [""]INT; %
A2 : "IN2 Fail" [""]INT; %
A3 : "IN3 Fail" ["˚"]INT; %
A4 : "IN4 Fail" ["˚"]INT; %
T1 : "Temp 1" ["˚C"]DEC2; %
T2 : "Temp 2" ["˚C"]DEC2; %
T3 : "Temp 3" ["˚C"]DEC2; %
T4 : "Temp 4" ["˚C"]DEC2; %
V1 : "Volt 1" ["V"]DEC3; %
V2 : "Volt 2" ["V"]DEC3; %
V3 : "Volt 3" ["V"]DEC3; %
V4 : "Volt 4" ["V"]DEC3; %
PRIVATE
count;
tmp;
BAUDRATE 9600;
PARITY EVEN;
CHECKSUM MODBUS SWAPPED;
TELEGRAM Read NAMED "Read" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(04);
DATA[2] := RWORD(99);
DATA[4] := RWORD(5);
ANSWER SIZE 15
DATA[0] = BYTE(Id);
DATA[1] = HEX(04);
DATA[3] -> RWORD(
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;
);
DATA[5] -> RWORD(T1:=DATA/100;V1:=DATA/1000;);
DATA[7] -> RWORD(T2:=DATA/100;V2:=DATA/1000;);
DATA[9] -> RWORD(T3:=DATA/100;V3:=DATA/1000;);
DATA[11] -> RWORD(T4:=DATA/100;V4:=DATA/1000;);
TIMEOUT 300
END;
TELEGRAM Write NAMED "Write" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(10);
DATA[2] := RWORD(200);
DATA[4] := BYTE(2);
DATA[5] := RWORD(W1*1000);
DATA[7] := RWORD(W2*1000);
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.