Procon MODMUX PM4RO
Detaljer
- Typ
- Drivrutin
- Upplaggd av
- Ove Jansson, Abelko Innovation
- Version
- 1
- Uppdaterad
- 2013-08-27
- Skapad
- 2013-08-27
- Kategori
- IO enheter, Modbus
- Visningar
- 2338
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 PM4RO.
%
% Denna modul har 4 reläutgångar.
% Datablad för modulerna hittar man på Procons hemsida:
% http://www.proconel.com/modmux.htm
%
% Note!
% Normaly telegram "Modul setup" don't need to be active.
% Set the update time for the telegram to be sure that the
% status of registers 40101-40104 is set to 0. Then set the
% telegram in "no communication".
%
% Baudrate: 9600
%
% Original: 100209 PW
%
DEVICETYPE ProconPM4RO NAMED "Procon 4RO" TYPEID 21105 IS
PARAMETER
Id : "Modbus address";
DO1 : "Relay 1";
DO2 : "Relay 2";
DO3 : "Relay 3";
DO4 : "Relay 4";
PUBLIC
pDO1 : "Relay 1";
pDO2 : "Relay 2";
pDO3 : "Relay 3";
pDO4 : "Relay 4";
PRIVATE
Tmp;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM WriteDOut NAMED "Set Relay" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(06); % Write singel register
DATA[2] := RWORD(1); % Address
DATA[4] <- 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;
DATA := Tmp;
pDO1 := DO1;
pDO2 := DO2;
pDO3 := DO3;
pDO4 := DO4;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(06);
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 PM4RO.
%
% Denna modul har 4 reläutgångar.
% Datablad för modulerna hittar man på Procons hemsida:
% http://www.proconel.com/modmux.htm
%
% Note!
% Normaly telegram "Modul setup" don't need to be active.
% Set the update time for the telegram to be sure that the
% status of registers 40101-40104 is set to 0. Then set the
% telegram in "no communication".
%
% Baudrate: 9600
%
% Original: 100209 PW
%
DEVICETYPE ProconPM4RO NAMED "Procon 4RO" TYPEID 21105 IS
PARAMETER
Id : "Modbus address";
DO1 : "Relay 1";
DO2 : "Relay 2";
DO3 : "Relay 3";
DO4 : "Relay 4";
PUBLIC
pDO1 : "Relay 1";
pDO2 : "Relay 2";
pDO3 : "Relay 3";
pDO4 : "Relay 4";
PRIVATE
Tmp;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM WriteDOut NAMED "Set Relay" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(06); % Write singel register
DATA[2] := RWORD(1); % Address
DATA[4] <- 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;
DATA := Tmp;
pDO1 := DO1;
pDO2 := DO2;
pDO3 := DO3;
pDO4 := DO4;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(06);
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;
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.