FIDELIX Analoga outputs UltraBase
Detaljer
- Typ
- Drivrutin
- Upplaggd av
- Ove Jansson, Abelko Innovation
- Version
- 3
- Uppdaterad
- 2019-01-07
- Skapad
- 2013-04-07
- Kategori
- IO enheter, Modbus
- Visningar
- 3452
Beskrivning
Stöd för Fidelix Analoga outputs i UltraBase.
Bruksanvisning
Aktivera telegram "Ställ AU" för att uppdatera utgångar. Alla utgångar kommer att ställas. Sätt lämpligt uppdateringsintervall t.ex 5 sekunder.
Aktivera telegram "Ställ AU start" bara om startvärdet för utgångar måste anta ett visst värde när Fidelix modulen startas. Lämpligt uppdateringsintervall 60 sekunder eller mer.
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 FIDELIX Analog outputs
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2009-01-12
% History: 2019-01-04 Changed to Ultra skript.
%
DEVICETYPE FidelixAOUT NAMED "Fidelix AU" TYPEID 21221 IS
PARAMETER
Id : "Adress" INT;
AU1 : "Analog ut 1" ["V"] DEC2;
AU2 : "Analog ut 2" ["V"] DEC2;
AU3 : "Analog ut 3" ["V"] DEC2;
AU4 : "Analog ut 4" ["V"] DEC2;
AU5 : "Analog ut 5" ["V"] DEC2;
AU6 : "Analog ut 6" ["V"] DEC2;
AU7 : "Analog ut 7" ["V"] DEC2;
AU8 : "Analog ut 8" ["V"] DEC2;
AU1_Start : "Startvärde AU1" ["V"] DEC2;
AU2_Start : "Startvärde AU2" ["V"] DEC2;
AU3_Start : "Startvärde AU3" ["V"] DEC2;
AU4_Start : "Startvärde AU4" ["V"] DEC2;
AU5_Start : "Startvärde AU5" ["V"] DEC2;
AU6_Start : "Startvärde AU6" ["V"] DEC2;
AU7_Start : "Startvärde AU7" ["V"] DEC2;
AU8_Start : "Startvärde AU8" ["V"] DEC2;
PUBLIC
PRIVATE
Tmp;
BAUDRATE 9600;
CHRGAPTIMEOUT 5;
CHECKSUM MODBUS SWAPPED;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
TELEGRAM AnalogOutput NAMED "Ställ AU" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(10); % Modbus command "0x10" write multiple registers
DATA[2] := RWORD(0); % start register
DATA[4] := RWORD(8); % number of registers to write
DATA[6] := BYTE(16); % number of bytes
DATA[7] <- RWORD(IF AU1<0 THEN DATA := 0;
ELSIF AU1<10 THEN DATA := AU1*102.3;
ELSE DATA := 1023;
ENDIF;
);
DATA[9] <- RWORD(IF AU2<0 THEN DATA := 0;
ELSIF AU2<10 THEN DATA := AU2*102.3;
ELSE DATA := 1023;
ENDIF;
);
DATA[11]<- RWORD(IF AU3<0 THEN DATA := 0;
ELSIF AU3<10 THEN DATA := AU3*102.3;
ELSE DATA := 1023;
ENDIF;
);
DATA[13]<- RWORD(IF AU4<0 THEN DATA := 0;
ELSIF AU4<10 THEN DATA := AU4*102.3;
ELSE DATA := 1023;
ENDIF;
);
DATA[15]<- RWORD(IF AU5<0 THEN DATA := 0;
ELSIF AU5<10 THEN DATA := AU5*102.3;
ELSE DATA := 1023;
ENDIF;
);
DATA[17]<- RWORD(IF AU6<0 THEN DATA := 0;
ELSIF AU6<10 THEN DATA := AU6*102.3;
ELSE DATA := 1023;
ENDIF;
);
DATA[19]<- RWORD(IF AU7<0 THEN DATA := 0;
ELSIF AU7<10 THEN DATA := AU7*102.3;
ELSE DATA := 1023;
ENDIF;
);
DATA[21]<- RWORD(IF AU8<0 THEN DATA := 0;
ELSIF AU8<10 THEN DATA := AU8*102.3;
ELSE DATA := 1023;
ENDIF;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(10);
%DATA[2] = RWORD(0); % start register
%DATA[4] = RWORD(8); % number of registers to write
TIMEOUT 1000
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
TELEGRAM AnalogStart NAMED "Ställ AU start" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(10); % Modbus command "0x10" write multiple registers
DATA[2] := RWORD(8); % start register
DATA[4] := RWORD(9); % number of registers to write
DATA[6] := BYTE(18); % number of bytes
DATA[7] <- RWORD(Tmp := 0;
IF AU1_Start<0 OR AU1_Start>10 THEN
DATA := 0;
ELSE
DATA := AU1_Start*102.3 + 32768;
Tmp := 1;
ENDIF;
);
DATA[9] <- RWORD(IF AU2_Start<0 OR AU2_Start>10 THEN
DATA := 0;
ELSE
DATA := AU2_Start*102.3 + 32768;
Tmp := Tmp + 2;
ENDIF;
);
DATA[11]<- RWORD(IF AU3_Start<0 OR AU3_Start>10 THEN
DATA := 0;
ELSE
DATA := AU3_Start*102.3 + 32768;
Tmp := Tmp + 4;
ENDIF;
);
DATA[13]<- RWORD(IF AU4_Start<0 OR AU4_Start>10 THEN
DATA := 0;
ELSE
DATA := AU4_Start*102.3 + 32768;
Tmp := Tmp + 8;
ENDIF;
);
DATA[15]<- RWORD(IF AU5_Start<0 OR AU5_Start>10 THEN
DATA := 0;
ELSE
DATA := AU5_Start*102.3 + 32768;
Tmp := Tmp + 16;
ENDIF;
);
DATA[17]<- RWORD(IF AU6_Start<0 OR AU6_Start>10 THEN
DATA := 0;
ELSE
DATA := AU6_Start*102.3 + 32768;
Tmp := Tmp + 32;
ENDIF;
);
DATA[19]<- RWORD(IF AU7_Start<0 OR AU7_Start>10 THEN
DATA := 0;
ELSE
DATA := AU7_Start*102.3 + 32768;
Tmp := Tmp + 64;
ENDIF;
);
DATA[21]<- RWORD(IF AU8_Start<0 OR AU8_Start>10 THEN
DATA := 0;
ELSE
DATA := AU8_Start*102.3 + 32768;
Tmp := Tmp + 128;
ENDIF;
);
DATA[23]<- RWORD(DATA := Tmp;); % Enable AU
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(10);
%DATA[2] = RWORD(8); % start register
%DATA[4] = RWORD(8); % number of registers to write
TIMEOUT 1000
END;
END;
% Device definition for FIDELIX Analog outputs
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2009-01-12
% History: 2019-01-04 Changed to Ultra skript.
%
DEVICETYPE FidelixAOUT NAMED "Fidelix AU" TYPEID 21221 IS
PARAMETER
Id : "Adress" INT;
AU1 : "Analog ut 1" ["V"] DEC2;
AU2 : "Analog ut 2" ["V"] DEC2;
AU3 : "Analog ut 3" ["V"] DEC2;
AU4 : "Analog ut 4" ["V"] DEC2;
AU5 : "Analog ut 5" ["V"] DEC2;
AU6 : "Analog ut 6" ["V"] DEC2;
AU7 : "Analog ut 7" ["V"] DEC2;
AU8 : "Analog ut 8" ["V"] DEC2;
AU1_Start : "Startvärde AU1" ["V"] DEC2;
AU2_Start : "Startvärde AU2" ["V"] DEC2;
AU3_Start : "Startvärde AU3" ["V"] DEC2;
AU4_Start : "Startvärde AU4" ["V"] DEC2;
AU5_Start : "Startvärde AU5" ["V"] DEC2;
AU6_Start : "Startvärde AU6" ["V"] DEC2;
AU7_Start : "Startvärde AU7" ["V"] DEC2;
AU8_Start : "Startvärde AU8" ["V"] DEC2;
PUBLIC
PRIVATE
Tmp;
BAUDRATE 9600;
CHRGAPTIMEOUT 5;
CHECKSUM MODBUS SWAPPED;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
TELEGRAM AnalogOutput NAMED "Ställ AU" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(10); % Modbus command "0x10" write multiple registers
DATA[2] := RWORD(0); % start register
DATA[4] := RWORD(8); % number of registers to write
DATA[6] := BYTE(16); % number of bytes
DATA[7] <- RWORD(IF AU1<0 THEN DATA := 0;
ELSIF AU1<10 THEN DATA := AU1*102.3;
ELSE DATA := 1023;
ENDIF;
);
DATA[9] <- RWORD(IF AU2<0 THEN DATA := 0;
ELSIF AU2<10 THEN DATA := AU2*102.3;
ELSE DATA := 1023;
ENDIF;
);
DATA[11]<- RWORD(IF AU3<0 THEN DATA := 0;
ELSIF AU3<10 THEN DATA := AU3*102.3;
ELSE DATA := 1023;
ENDIF;
);
DATA[13]<- RWORD(IF AU4<0 THEN DATA := 0;
ELSIF AU4<10 THEN DATA := AU4*102.3;
ELSE DATA := 1023;
ENDIF;
);
DATA[15]<- RWORD(IF AU5<0 THEN DATA := 0;
ELSIF AU5<10 THEN DATA := AU5*102.3;
ELSE DATA := 1023;
ENDIF;
);
DATA[17]<- RWORD(IF AU6<0 THEN DATA := 0;
ELSIF AU6<10 THEN DATA := AU6*102.3;
ELSE DATA := 1023;
ENDIF;
);
DATA[19]<- RWORD(IF AU7<0 THEN DATA := 0;
ELSIF AU7<10 THEN DATA := AU7*102.3;
ELSE DATA := 1023;
ENDIF;
);
DATA[21]<- RWORD(IF AU8<0 THEN DATA := 0;
ELSIF AU8<10 THEN DATA := AU8*102.3;
ELSE DATA := 1023;
ENDIF;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(10);
%DATA[2] = RWORD(0); % start register
%DATA[4] = RWORD(8); % number of registers to write
TIMEOUT 1000
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
TELEGRAM AnalogStart NAMED "Ställ AU start" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(10); % Modbus command "0x10" write multiple registers
DATA[2] := RWORD(8); % start register
DATA[4] := RWORD(9); % number of registers to write
DATA[6] := BYTE(18); % number of bytes
DATA[7] <- RWORD(Tmp := 0;
IF AU1_Start<0 OR AU1_Start>10 THEN
DATA := 0;
ELSE
DATA := AU1_Start*102.3 + 32768;
Tmp := 1;
ENDIF;
);
DATA[9] <- RWORD(IF AU2_Start<0 OR AU2_Start>10 THEN
DATA := 0;
ELSE
DATA := AU2_Start*102.3 + 32768;
Tmp := Tmp + 2;
ENDIF;
);
DATA[11]<- RWORD(IF AU3_Start<0 OR AU3_Start>10 THEN
DATA := 0;
ELSE
DATA := AU3_Start*102.3 + 32768;
Tmp := Tmp + 4;
ENDIF;
);
DATA[13]<- RWORD(IF AU4_Start<0 OR AU4_Start>10 THEN
DATA := 0;
ELSE
DATA := AU4_Start*102.3 + 32768;
Tmp := Tmp + 8;
ENDIF;
);
DATA[15]<- RWORD(IF AU5_Start<0 OR AU5_Start>10 THEN
DATA := 0;
ELSE
DATA := AU5_Start*102.3 + 32768;
Tmp := Tmp + 16;
ENDIF;
);
DATA[17]<- RWORD(IF AU6_Start<0 OR AU6_Start>10 THEN
DATA := 0;
ELSE
DATA := AU6_Start*102.3 + 32768;
Tmp := Tmp + 32;
ENDIF;
);
DATA[19]<- RWORD(IF AU7_Start<0 OR AU7_Start>10 THEN
DATA := 0;
ELSE
DATA := AU7_Start*102.3 + 32768;
Tmp := Tmp + 64;
ENDIF;
);
DATA[21]<- RWORD(IF AU8_Start<0 OR AU8_Start>10 THEN
DATA := 0;
ELSE
DATA := AU8_Start*102.3 + 32768;
Tmp := Tmp + 128;
ENDIF;
);
DATA[23]<- RWORD(DATA := Tmp;); % Enable AU
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(10);
%DATA[2] = RWORD(8); % start register
%DATA[4] = RWORD(8); % number of registers to write
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.