Procon MODMUX PM16DO
Detaljer
- Typ
- Drivrutin
- Upplaggd av
- Ove Jansson, Abelko Innovation
- Version
- 1
- Uppdaterad
- 2013-08-27
- Skapad
- 2013-08-27
- Kategori
- IO enheter, Modbus
- Visningar
- 2366
Beskrivning
Drivrutin till Procon MODMUX IO enhet
Bruksanvisning
Ladda in typdefinitionen enligt beskrivningen i manualen kapitel 18.2.
Datablad för modulerna hittar man på Procons hemsida: http://www.proconel.com/
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Typdefinition för PROCON MODMUX modul PM16DO.
%
% Denna modul har 16 reläutgångar.
% Datablad för modulerna hittar man på Procons hemsida:
% http://www.proconel.com/modmux.htm
%
% Baudrate: 9600
%
% Original: 100209 PW
%
DEVICETYPE ProconPM16DO1 NAMED "Procon16DO 1-8" TYPEID 21106 IS
PARAMETER
Id : "Modbus address";
DO1 : "Relay 1 ";
DO2 : "Relay 2 ";
DO3 : "Relay 3 ";
DO4 : "Relay 4 ";
DO5 : "Relay 5 ";
DO6 : "Relay 6 ";
DO7 : "Relay 7 ";
DO8 : "Relay 8 ";
PUBLIC
pDO1 : "Relay 1";
pDO2 : "Relay 2";
pDO3 : "Relay 3";
pDO4 : "Relay 4";
pDO5 : "Relay 5";
pDO6 : "Relay 6";
pDO7 : "Relay 7";
pDO8 : "Relay 8";
PRIVATE
Tmp;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM WriteDOut NAMED "Set Relay" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(0F); % Write multiple coils
DATA[2] := RWORD(0); % Address
DATA[4] := RWORD(8); % Number of coils (bits)
DATA[6] := BYTE(1); % Number of bytes
DATA[7] <- RWORD( % Value
IF DO1 THEN Tmp := 1; ELSE Tmp := 0; ENDIF;
IF DO2 THEN Tmp := Tmp + 2; ENDIF;
IF DO3 THEN Tmp := Tmp + 4; ENDIF;
IF DO4 THEN Tmp := Tmp + 8; ENDIF;
IF DO5 THEN Tmp := Tmp + 16; ENDIF;
IF DO6 THEN Tmp := Tmp + 32; ENDIF;
IF DO7 THEN Tmp := Tmp + 64; ENDIF;
IF DO8 THEN Tmp := Tmp + 128; ENDIF;
DATA := Tmp;
pDO1 := DO1;
pDO2 := DO2;
pDO3 := DO3;
pDO4 := DO4;
pDO5 := DO5;
pDO6 := DO6;
pDO7 := DO7;
pDO8 := DO8;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(0F);
TIMEOUT 500
END;
TELEGRAM Init NAMED "Modul setup" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(10); % Write multiple register
DATA[2] := RWORD(100); % Address
DATA[4] := RWORD(4); % Number of registers
DATA[6] := BYTE(8); % Number of data bytes
DATA[7] := RWORD(0); % Disable Watchdog timer
DATA[9] := RWORD(0); % Modbus master Timeout (x10ms)
DATA[11]:= RWORD(0); % Modbus master Poll rate (x10ms)
DATA[13]:= RWORD(0); % Output Mode, 0=bit1-4, 1=bit5-8, 2=bit9-12, 3=bit13-16
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(10);
TIMEOUT 500
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Typdefinition för PROCON MODMUX modul PM16DO.
%
% Denna modul har 16 reläutgångar.
% Datablad för modulerna hittar man på Procons hemsida:
% http://www.proconel.com/modmux.htm
%
% Baudrate: 9600
%
% Original: 100209 PW
%
DEVICETYPE ProconPM16DO2 NAMED "Procon16DO 9-16" TYPEID 21106 IS
PARAMETER
Id : "Modbus address";
DO9 : "Relay 9 ";
DO10 : "Relay 10";
DO11 : "Relay 11";
DO12 : "Relay 12";
DO13 : "Relay 13";
DO14 : "Relay 14";
DO15 : "Relay 15";
DO16 : "Relay 16";
PUBLIC
pDO9 : "Relay 9";
pDO10 : "Relay 10";
pDO11 : "Relay 11";
pDO12 : "Relay 12";
pDO13 : "Relay 13";
pDO14 : "Relay 14";
pDO15 : "Relay 15";
pDO16 : "Relay 16";
PRIVATE
Tmp;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM WriteDOut NAMED "Set Relay" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(0F); % Write multiple coils
DATA[2] := RWORD(8); % Address
DATA[4] := RWORD(8); % Number of coils (bits)
DATA[6] := BYTE(1); % Number of bytes
DATA[7] <- RWORD( % Value
IF DO9 THEN Tmp := 1; ELSE Tmp := 0; ENDIF;
IF DO10 THEN Tmp := Tmp + 2; ENDIF;
IF DO11 THEN Tmp := Tmp + 4; ENDIF;
IF DO12 THEN Tmp := Tmp + 8; ENDIF;
IF DO13 THEN Tmp := Tmp + 16; ENDIF;
IF DO14 THEN Tmp := Tmp + 32; ENDIF;
IF DO15 THEN Tmp := Tmp + 64; ENDIF;
IF DO16 THEN Tmp := Tmp + 128; ENDIF;
DATA := Tmp;
pDO9 := DO9;
pDO10 := DO10;
pDO11 := DO11;
pDO12 := DO12;
pDO13 := DO13;
pDO14 := DO14;
pDO15 := DO15;
pDO16 := DO16;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(0F);
TIMEOUT 500
END;
END;
% Typdefinition för PROCON MODMUX modul PM16DO.
%
% Denna modul har 16 reläutgångar.
% Datablad för modulerna hittar man på Procons hemsida:
% http://www.proconel.com/modmux.htm
%
% Baudrate: 9600
%
% Original: 100209 PW
%
DEVICETYPE ProconPM16DO1 NAMED "Procon16DO 1-8" TYPEID 21106 IS
PARAMETER
Id : "Modbus address";
DO1 : "Relay 1 ";
DO2 : "Relay 2 ";
DO3 : "Relay 3 ";
DO4 : "Relay 4 ";
DO5 : "Relay 5 ";
DO6 : "Relay 6 ";
DO7 : "Relay 7 ";
DO8 : "Relay 8 ";
PUBLIC
pDO1 : "Relay 1";
pDO2 : "Relay 2";
pDO3 : "Relay 3";
pDO4 : "Relay 4";
pDO5 : "Relay 5";
pDO6 : "Relay 6";
pDO7 : "Relay 7";
pDO8 : "Relay 8";
PRIVATE
Tmp;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM WriteDOut NAMED "Set Relay" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(0F); % Write multiple coils
DATA[2] := RWORD(0); % Address
DATA[4] := RWORD(8); % Number of coils (bits)
DATA[6] := BYTE(1); % Number of bytes
DATA[7] <- RWORD( % Value
IF DO1 THEN Tmp := 1; ELSE Tmp := 0; ENDIF;
IF DO2 THEN Tmp := Tmp + 2; ENDIF;
IF DO3 THEN Tmp := Tmp + 4; ENDIF;
IF DO4 THEN Tmp := Tmp + 8; ENDIF;
IF DO5 THEN Tmp := Tmp + 16; ENDIF;
IF DO6 THEN Tmp := Tmp + 32; ENDIF;
IF DO7 THEN Tmp := Tmp + 64; ENDIF;
IF DO8 THEN Tmp := Tmp + 128; ENDIF;
DATA := Tmp;
pDO1 := DO1;
pDO2 := DO2;
pDO3 := DO3;
pDO4 := DO4;
pDO5 := DO5;
pDO6 := DO6;
pDO7 := DO7;
pDO8 := DO8;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(0F);
TIMEOUT 500
END;
TELEGRAM Init NAMED "Modul setup" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(10); % Write multiple register
DATA[2] := RWORD(100); % Address
DATA[4] := RWORD(4); % Number of registers
DATA[6] := BYTE(8); % Number of data bytes
DATA[7] := RWORD(0); % Disable Watchdog timer
DATA[9] := RWORD(0); % Modbus master Timeout (x10ms)
DATA[11]:= RWORD(0); % Modbus master Poll rate (x10ms)
DATA[13]:= RWORD(0); % Output Mode, 0=bit1-4, 1=bit5-8, 2=bit9-12, 3=bit13-16
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(10);
TIMEOUT 500
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Typdefinition för PROCON MODMUX modul PM16DO.
%
% Denna modul har 16 reläutgångar.
% Datablad för modulerna hittar man på Procons hemsida:
% http://www.proconel.com/modmux.htm
%
% Baudrate: 9600
%
% Original: 100209 PW
%
DEVICETYPE ProconPM16DO2 NAMED "Procon16DO 9-16" TYPEID 21106 IS
PARAMETER
Id : "Modbus address";
DO9 : "Relay 9 ";
DO10 : "Relay 10";
DO11 : "Relay 11";
DO12 : "Relay 12";
DO13 : "Relay 13";
DO14 : "Relay 14";
DO15 : "Relay 15";
DO16 : "Relay 16";
PUBLIC
pDO9 : "Relay 9";
pDO10 : "Relay 10";
pDO11 : "Relay 11";
pDO12 : "Relay 12";
pDO13 : "Relay 13";
pDO14 : "Relay 14";
pDO15 : "Relay 15";
pDO16 : "Relay 16";
PRIVATE
Tmp;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM WriteDOut NAMED "Set Relay" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(0F); % Write multiple coils
DATA[2] := RWORD(8); % Address
DATA[4] := RWORD(8); % Number of coils (bits)
DATA[6] := BYTE(1); % Number of bytes
DATA[7] <- RWORD( % Value
IF DO9 THEN Tmp := 1; ELSE Tmp := 0; ENDIF;
IF DO10 THEN Tmp := Tmp + 2; ENDIF;
IF DO11 THEN Tmp := Tmp + 4; ENDIF;
IF DO12 THEN Tmp := Tmp + 8; ENDIF;
IF DO13 THEN Tmp := Tmp + 16; ENDIF;
IF DO14 THEN Tmp := Tmp + 32; ENDIF;
IF DO15 THEN Tmp := Tmp + 64; ENDIF;
IF DO16 THEN Tmp := Tmp + 128; ENDIF;
DATA := Tmp;
pDO9 := DO9;
pDO10 := DO10;
pDO11 := DO11;
pDO12 := DO12;
pDO13 := DO13;
pDO14 := DO14;
pDO15 := DO15;
pDO16 := DO16;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(0F);
TIMEOUT 500
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.