Iec 61131-3 Second edition 2003-01 Programmable controllers – Part 3: Programming languages
Download 1.35 Mb. Pdf ko'rish
|
ourdev 569653
2.5.2.2 Declaration
As illustrated in figure 10, a function block shall be declared textually or graphically in the same manner as defined for functions in 2.5.1.3, with the differences described below and summarized in table 33: 1) The delimiting keywords for declaration of function blocks shall be FUNCTION_BLOCK...END_FUNCTION_BLOCK. 2) The RETAIN qualifier defined in 2.4.3 can be used for internal and output variables of a function block, as shown in features 1, 2, and 3 in table 33. 3) The values of variables which are passed to the function block via a VAR_EXTERNAL construct can be modified from within the function block, as shown in feature 10 of table 33. 4) The output values of a function block instance whose name is passed into the function block via a VAR_INPUT, VAR_IN_OUT, or VAR_EXTERNAL construct can be accessed, but not modified, from within the function block, as shown in features 5, 6, and 7 of table 33. 5) A function block whose instance name is passed into the function block via a VAR_IN_OUT or VAR_EXTERNAL construction can be invoked from inside the function block, as shown in features 6 and 7 of table 33. 6) In textual declarations, the R_EDGE and F_EDGE qualifiers can be used to indicate an edge- detection function on Boolean inputs. This shall cause the implicit declaration of a function block of type R_TRIG or F_TRIG, respectively, as defined in 2.5.2.3.2, to perform the required edge detection. For an example of this construction, see features 8a and 8b of table 33 and the accompanying NOTE. 7) The construction illustrated in features 9a and 9b of table 33 shall be used in graphical declarations for rising and falling edge detection. When the character set defined in 2.1.1 is used, the “greater than” (>) or “less than” (<) character shall be in line with the edge of the function block. When graphic or semigraphic representations are employed, the notation of IEC 60617-12 for dynamic inputs shall be used. 8) If the generic data types given in table 11 are used in the declaration of standard function block inputs and outputs, then the rules for inferring the actual types of the outputs of such function block types shall be part of the function block type definition. In textual invocations of such function blocks assignments of the outputs to variables shall be made directly in the invocation statement (using the operator ‘=>‘). 9) The asterisk notation (feature No. 10 in table 15) can be used in the declaration of internal variables of a function block. 10) EN/ENO inputs and outputs shall be declared and used as described in 2.5.1.2a). 11) It shall be an error if no value is specified for: (i) an in-out variable of a function block instance; (ii) a function block instance used as an input variable of another function block instance. Copyright International Electrotechnical Commission Provided by IHS under license with IEC Not for Resale No reproduction or networking permitted without license from IHS --``````-`-`,,`,,`,`,,`--- – 70 – 61131-3 IEC:2003(E) As illustrated in figure 12, only variables or function block instance names can be passed into a function block via the VAR_IN_OUT construct, i.e., function or function block outputs cannot be passed via this construction. This is to prevent the inadvertent modifications of such outputs. However, “cascading” of VAR_IN_OUT constructions is permitted, as illustrated in figure 12 c). (* a) Textual declaration in ST language (see 3.3) *) FUNCTION_BLOCK DEBOUNCE (*** External Interface ***) VAR_INPUT IN : BOOL ; (* Default = 0 *) DB_TIME : TIME := t#10ms ; (* Default = t#10ms *) END_VAR VAR_OUTPUT OUT : BOOL ; (* Default = 0 *) ET_OFF : TIME ; (* Default = t#0s *) END_VAR VAR DB_ON : TON ; (** Internal Variables **) DB_OFF : TON ; (** and FB Instances **) DB_FF : SR ; END_VAR (** Function Block Body **) DB_ON(IN := IN, PT := DB_TIME) ; DB_OFF(IN := NOT IN, PT:=DB_TIME) ; DB_FF(S1 :=DB_ON.Q, R := DB_OFF.Q) ; OUT := DB_FF.Q ; ET_OFF := DB_OFF.ET ; END_FUNCTION_BLOCK (* b) Graphical declaration in FBD language (see 4.3) *) FUNCTION_BLOCK (** External Interface **) +---------------+ | DEBOUNCE | BOOL---|IN OUT|---BOOL TIME---|DB_TIME ET_OFF|---TIME +---------------+ (** Function Block Body **) DB_ON DB_FF +-----+ +----+ | TON | | SR | IN----+------|IN Q|-----|S1 Q|---OUT | +---|PT ET| +--|R | | | +-----+ | +----+ | | | | | DB_OFF | | | +-----+ | | | | TON | | +--|--O|IN Q|--+ DB_TIME--+---|PT ET|--------------ET_OFF +-----+ END_FUNCTION_BLOCK Download 1.35 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling