Simotion ST 程序接口声明内容和顺序 interface
Posted lion-ming
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Simotion ST 程序接口声明内容和顺序 interface相关的知识,希望对你有一定的参考价值。
The interface section has the following syntax:
Syntax
INTERFACE
// Interface statements (optional)
END_INTERFACE
An individual identifier of the section cannot be specified.
Optionally, interface statements exist in the following order between reserved words INTERFACE and END_INTERFACE.
-
声明使用的工艺包Specification of utilized technology package. Syntax:
USEPACKAGE tp-name [AS namespace];
For more details, refer to the SIMOTION Basic Functions Function Manual.
-
声明库Specification of utilized libraries.
Syntax:
USELIB library-name-list [AS namespace];
For more information, see "Using data types, functions and function blocks from libraries".
-
引用的其他部分Reference to other units in order to use their public components.
The syntax is:
USES unit_name-list;
For more information, see "USES statement in a using unit".
-
Declarations and information regarding declaration as public to other program sources:
-
User-defined data types (UDT) that are public and valid within the entire ST source file
-
Unit variables and unit constants that are public and valid within the entire ST source file.
Permissible keywords: See Section "Variable declaration".
-
Object-oriented interfaces that are public and valid within the entire ST source file.
As of version V4.5 of the SIMOTION Kernel and with compiler option “Permit object-oriented programming” enabled.
Note Object-oriented interfaces utilize the same keywords as the interface section (INTERFACE / END_INTERFACE).
-
Specification of the program organization units (POUs) to be declared public.
Syntax:
FUNCTION fc_name;
FUNCTION_BLOCK fb_name;
PROGRAM program_name;
CLASS class_name;
(as of version V4.5 of the SIMOTION Kernel and with compiler option "Permit object-oriented programming” enabled)If the "Permit forward declarations" compiler option is activated, they are also interpreted as POU prototypes for the forward declaration.
-
POU prototypes for the forward declaration.
Specification of the prototypes for program organization units with forward declaration (only effective if the "Permit forward declarations" compiler option is activated).
They are also interpreted as POUs to be exported.
-
All technology packages, libraries, units used, data type declarations, variable declarations, object-oriented interfaces and program organization units listed in the interface section are declared public. For further information about declaring public, see "Interface section of a unit with Declare Public function".
Sequence
The interface section is the first section of an ST source file.
Note
Optionally, the unit statement can precede the interface section, see "Identifier of the unit". |
The order of the interface statements 1 to 4 is fixed.
Within number 4, any order is permitted. The individual declaration blocks for data type definitions (including POU prototypes) and variables declarations can appear more than once.
Please note: Identifiers must be declared before they are used.
Only if the "Permit forward declarations" compiler option is activated: When declaring an instance of a function block or a class, it is sufficient for the prototype of the function block to have been declared beforehand. It is not possible to initialize the function block or the class.
Frequency
Once per ST source file
Mandatory section
Yes
以上是关于Simotion ST 程序接口声明内容和顺序 interface的主要内容,如果未能解决你的问题,请参考以下文章