HK Instruments
Detaljer
- Typ
- Drivrutin
- Upplaggd av
- Ove Jansson, Abelko Innovation
- Version
- 1
- Uppdaterad
- 2013-08-27
- Skapad
- 2013-08-27
- Kategori
- Modbus, Övrig utrustning
- Visningar
- 3183
Beskrivning
Device definition for HK Instruments
Bruksanvisning
Hur man installerar typdefinitionerna och driftsätter modulerna finns beskrivet i användarmanualen, kapitel 18.7.
Note! When using the kalibration command it will only give a zero calibration command when the DO1 value changes from 0 to another value.
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for HK Instruments
%
% Settings module: Parity: None
% Mode: RTU
% Baud: 9.60
%
% Note! When using the kalibration command it will only
% give a zero calibration command when the DO1 value
% changes from 0 to another value.
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2009-05-20 inital version
%
DEVICETYPE HKInstruments NAMED "HK Instruments1" TYPEID 21330 IS
PARAMETER
Id : "Adress";
% Write singel coil (function 5)
DO1 : "Ny kalibrering"; %R1 Kalibrering nollpunkt Zero point kalibration
PUBLIC
% Input registers (function 4)
IR1 : "Program version" [""];
IR2 : "Tryck" ["kPa"];
PRIVATE
start;
DO1_old;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM AnalogRead NAMED "Läs tryck" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(04); % Modbus command "04h" Read registers
DATA[2] := RWORD(0); % Select register
DATA[4] := RWORD(2); % Number of registers
ANSWER SIZE 9
DATA[0] = BYTE(Id); % ID
DATA[1] = HEX(04); % Modbus command "04h" Read registers
DATA[2] = BYTE(4); % Byte count
DATA[3] -> RWORD(IR1:=DATA/100;); % Program version
DATA[5] -> RWORD(IF DATA>32767 THEN % Pressure
IR2:=0;
ELSE
IR2:=DATA/1000;
ENDIF;
);
TIMEOUT 1000
END;
TELEGRAM DigitalOut NAMED "Kalibrering" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(05); % Modbus command "05h" Write singel coil (bit)
DATA[2] := RWORD(0); % Start adress
DATA[4] <- BYTE(IF start=0 THEN
start := 1;
DO1_old := DO1;
ENDIF;
IF (DO1<>DO1_old) AND (DO1_old=0) THEN
DATA := 255;
ELSE
DATA:=0;
ENDIF;
DO1_old := DO1;
);
DATA[5] := BYTE(0);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(05);
DATA[2] = RWORD(0); % Start adress
%DATA[4] = BYTE(IF DO1=0 THEN DATA:=0;
% ELSE DATA:=255;
% ENDIF;
% );
DATA[5] = HEX(00);
TIMEOUT 1000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for HK Instruments Model DPT-MOD-2000-IN-AZ
%
% Settings module: Parity: None
% Mode: RTU
% Baud: 9.60
%
% Note! When using the kalibration command it will only
% give a zero calibration command when the DO1 value
% changes from 0 to another value.
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2010-02-03 inital version
%
DEVICETYPE HKInstruments NAMED "HK Instruments2" TYPEID 21331 IS
PARAMETER
Id : "Adress";
% Write singel coil (function 5)
DO1 : "Ny kalibrering"; %R1 Kalibrering nollpunkt Zero point kalibration
PUBLIC
% Input registers (function 4)
IR1 : "Program version" [""];
IR2 : "Tryck" ["kPa"];
%IR3 Not used
IR4 : "IN1 0-10 Volt" ["%"];
IR5 : "IN1 Temp PT1000" ["°C"];
IR6 : "IN1 Temp NI1000" ["°C"];
IR7 : "IN1 Temp NTC10k" ["°C"];
IR8 : "IN2 0-10 Volt" ["%"];
IR9 : "IN2 Temp PT1000" ["°C"];
IR10 : "IN2 Temp NI1000" ["°C"];
IR11 : "IN2 Temp NTC10k" ["°C"];
DI1 : "IN1 Status";
DI2 : "IN2 Status";
PRIVATE
start;
DO1_old;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM AnalogRead NAMED "Läs tryck/temp" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(04); % Modbus command "04h" Read registers
DATA[2] := RWORD(0); % Select register
DATA[4] := RWORD(11); % Number of registers
ANSWER SIZE 27
DATA[0] = BYTE(Id); % ID
DATA[1] = HEX(04); % Modbus command "04h" Read registers
%DATA[2] = BYTE(22); % Byte count
DATA[3] -> RWORD(IR1:=DATA/100;); % Program version
DATA[5] -> RWORD(IF DATA>32767 THEN % Pressure
IR2:=0;
ELSE
IR2:=DATA/1000;
ENDIF;
);
%DATA[7] -> RWORD(IR3:=DATA);
DATA[9] -> RWORD(IR4 := DATA;); % 0-100%
DATA[11] -> RWORD(IF (DATA>=32768) THEN IR5 :=(DATA-65536); ELSE IR5 :=DATA; ENDIF;); % Temp -50 - +50 °C
DATA[13] -> RWORD(IF (DATA>=32768) THEN IR6 :=(DATA-65536); ELSE IR6 :=DATA; ENDIF;); % Temp -50 - +50 °C
DATA[15] -> RWORD(IF (DATA>=32768) THEN IR7 :=(DATA-65536); ELSE IR7 :=DATA; ENDIF;); % Temp -50 - +50 °C
DATA[9] -> RWORD(IR8 := DATA;); % 0-100%
DATA[19] -> RWORD(IF (DATA>=32768) THEN IR9 :=(DATA-65536); ELSE IR9 :=DATA; ENDIF;); % Temp -50 - +50 °C
DATA[21] -> RWORD(IF (DATA>=32768) THEN IR10:=(DATA-65536); ELSE IR10:=DATA; ENDIF;); % Temp -50 - +50 °C
DATA[23] -> RWORD(IF (DATA>=32768) THEN IR11:=(DATA-65536); ELSE IR11:=DATA; ENDIF;); % Temp -50 - +50 °C
TIMEOUT 1000
END;
TELEGRAM Digital1 NAMED "Läs statusIN1-2" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(02); % Modbus command "02h" read discrete input (bit)
DATA[2] := RWORD(0); % Start address
DATA[4] := RWORD(2); % Number of inputs
ANSWER SIZE 6
DATA[0] = BYTE(Id);
DATA[1] = HEX(02);
%DATA[2] = BYTE(1);
DATA[3] -> BYTE(IF (DATA & 1) THEN DI1 := 1; ELSE DI1 := 0; ENDIF;
IF (DATA & 2) THEN DI2 := 1; ELSE DI2 := 0; ENDIF;
);
TIMEOUT 1000
END;
TELEGRAM DigitalOut NAMED "Kalibrering" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(05); % Modbus command "05h" Write singel coil (bit)
DATA[2] := RWORD(0); % Start adress
DATA[4] <- BYTE(IF start=0 THEN
start := 1;
DO1_old := DO1;
ENDIF;
IF (DO1<>DO1_old) AND (DO1_old=0) THEN
DATA := 255;
ELSE
DATA:=0;
ENDIF;
DO1_old := DO1;
);
DATA[5] := BYTE(0);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(05);
DATA[2] = RWORD(0); % Start adress
%DATA[4] = BYTE(IF DO1=0 THEN DATA:=0;
% ELSE DATA:=255;
% ENDIF;
% );
DATA[5] = HEX(00);
TIMEOUT 1000
END;
END;
% Device definition for HK Instruments
%
% Settings module: Parity: None
% Mode: RTU
% Baud: 9.60
%
% Note! When using the kalibration command it will only
% give a zero calibration command when the DO1 value
% changes from 0 to another value.
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2009-05-20 inital version
%
DEVICETYPE HKInstruments NAMED "HK Instruments1" TYPEID 21330 IS
PARAMETER
Id : "Adress";
% Write singel coil (function 5)
DO1 : "Ny kalibrering"; %R1 Kalibrering nollpunkt Zero point kalibration
PUBLIC
% Input registers (function 4)
IR1 : "Program version" [""];
IR2 : "Tryck" ["kPa"];
PRIVATE
start;
DO1_old;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM AnalogRead NAMED "Läs tryck" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(04); % Modbus command "04h" Read registers
DATA[2] := RWORD(0); % Select register
DATA[4] := RWORD(2); % Number of registers
ANSWER SIZE 9
DATA[0] = BYTE(Id); % ID
DATA[1] = HEX(04); % Modbus command "04h" Read registers
DATA[2] = BYTE(4); % Byte count
DATA[3] -> RWORD(IR1:=DATA/100;); % Program version
DATA[5] -> RWORD(IF DATA>32767 THEN % Pressure
IR2:=0;
ELSE
IR2:=DATA/1000;
ENDIF;
);
TIMEOUT 1000
END;
TELEGRAM DigitalOut NAMED "Kalibrering" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(05); % Modbus command "05h" Write singel coil (bit)
DATA[2] := RWORD(0); % Start adress
DATA[4] <- BYTE(IF start=0 THEN
start := 1;
DO1_old := DO1;
ENDIF;
IF (DO1<>DO1_old) AND (DO1_old=0) THEN
DATA := 255;
ELSE
DATA:=0;
ENDIF;
DO1_old := DO1;
);
DATA[5] := BYTE(0);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(05);
DATA[2] = RWORD(0); % Start adress
%DATA[4] = BYTE(IF DO1=0 THEN DATA:=0;
% ELSE DATA:=255;
% ENDIF;
% );
DATA[5] = HEX(00);
TIMEOUT 1000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for HK Instruments Model DPT-MOD-2000-IN-AZ
%
% Settings module: Parity: None
% Mode: RTU
% Baud: 9.60
%
% Note! When using the kalibration command it will only
% give a zero calibration command when the DO1 value
% changes from 0 to another value.
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2010-02-03 inital version
%
DEVICETYPE HKInstruments NAMED "HK Instruments2" TYPEID 21331 IS
PARAMETER
Id : "Adress";
% Write singel coil (function 5)
DO1 : "Ny kalibrering"; %R1 Kalibrering nollpunkt Zero point kalibration
PUBLIC
% Input registers (function 4)
IR1 : "Program version" [""];
IR2 : "Tryck" ["kPa"];
%IR3 Not used
IR4 : "IN1 0-10 Volt" ["%"];
IR5 : "IN1 Temp PT1000" ["°C"];
IR6 : "IN1 Temp NI1000" ["°C"];
IR7 : "IN1 Temp NTC10k" ["°C"];
IR8 : "IN2 0-10 Volt" ["%"];
IR9 : "IN2 Temp PT1000" ["°C"];
IR10 : "IN2 Temp NI1000" ["°C"];
IR11 : "IN2 Temp NTC10k" ["°C"];
DI1 : "IN1 Status";
DI2 : "IN2 Status";
PRIVATE
start;
DO1_old;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM AnalogRead NAMED "Läs tryck/temp" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(04); % Modbus command "04h" Read registers
DATA[2] := RWORD(0); % Select register
DATA[4] := RWORD(11); % Number of registers
ANSWER SIZE 27
DATA[0] = BYTE(Id); % ID
DATA[1] = HEX(04); % Modbus command "04h" Read registers
%DATA[2] = BYTE(22); % Byte count
DATA[3] -> RWORD(IR1:=DATA/100;); % Program version
DATA[5] -> RWORD(IF DATA>32767 THEN % Pressure
IR2:=0;
ELSE
IR2:=DATA/1000;
ENDIF;
);
%DATA[7] -> RWORD(IR3:=DATA);
DATA[9] -> RWORD(IR4 := DATA;); % 0-100%
DATA[11] -> RWORD(IF (DATA>=32768) THEN IR5 :=(DATA-65536); ELSE IR5 :=DATA; ENDIF;); % Temp -50 - +50 °C
DATA[13] -> RWORD(IF (DATA>=32768) THEN IR6 :=(DATA-65536); ELSE IR6 :=DATA; ENDIF;); % Temp -50 - +50 °C
DATA[15] -> RWORD(IF (DATA>=32768) THEN IR7 :=(DATA-65536); ELSE IR7 :=DATA; ENDIF;); % Temp -50 - +50 °C
DATA[9] -> RWORD(IR8 := DATA;); % 0-100%
DATA[19] -> RWORD(IF (DATA>=32768) THEN IR9 :=(DATA-65536); ELSE IR9 :=DATA; ENDIF;); % Temp -50 - +50 °C
DATA[21] -> RWORD(IF (DATA>=32768) THEN IR10:=(DATA-65536); ELSE IR10:=DATA; ENDIF;); % Temp -50 - +50 °C
DATA[23] -> RWORD(IF (DATA>=32768) THEN IR11:=(DATA-65536); ELSE IR11:=DATA; ENDIF;); % Temp -50 - +50 °C
TIMEOUT 1000
END;
TELEGRAM Digital1 NAMED "Läs statusIN1-2" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(02); % Modbus command "02h" read discrete input (bit)
DATA[2] := RWORD(0); % Start address
DATA[4] := RWORD(2); % Number of inputs
ANSWER SIZE 6
DATA[0] = BYTE(Id);
DATA[1] = HEX(02);
%DATA[2] = BYTE(1);
DATA[3] -> BYTE(IF (DATA & 1) THEN DI1 := 1; ELSE DI1 := 0; ENDIF;
IF (DATA & 2) THEN DI2 := 1; ELSE DI2 := 0; ENDIF;
);
TIMEOUT 1000
END;
TELEGRAM DigitalOut NAMED "Kalibrering" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(05); % Modbus command "05h" Write singel coil (bit)
DATA[2] := RWORD(0); % Start adress
DATA[4] <- BYTE(IF start=0 THEN
start := 1;
DO1_old := DO1;
ENDIF;
IF (DO1<>DO1_old) AND (DO1_old=0) THEN
DATA := 255;
ELSE
DATA:=0;
ENDIF;
DO1_old := DO1;
);
DATA[5] := BYTE(0);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(05);
DATA[2] = RWORD(0); % Start adress
%DATA[4] = BYTE(IF DO1=0 THEN DATA:=0;
% ELSE DATA:=255;
% ENDIF;
% );
DATA[5] = HEX(00);
TIMEOUT 1000
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.