...
Comments can be entered anywhere in the program. The strings starting with ‘//’ are treated as comments until the end of the line.
(1)
...
Declaration Part
Item | Description |
Variable Declaration | Declares the internal variables in the following format: VAR variable_name [, variable_name];. The initial value of the declared variables is 0. To declare more than one variable, use a comma “ , ” between them. You can use several VAR keywords before the program part starts. The variable name cannot be duplicated with the tag names (Group, Digital, Analog, String). The duplicated name may cause compile errors or incorrect operation. |
Input Parameter Declaration | Declares the input parameters in the following format: PARAM 1st parameter [, 2nd parameter …]; . The input parameter is required when a program is called by another program or a command. The declaration order must be identical to the order of input parameters. The parameter will be initialized with the values assigned by the caller. To declare more than one parameter, use a comma “ , ” between them. You can use several PARAM keywords before the program part starts. |
Example | Program Name: MyPgm VAR a, b; VAR c; PARAM p1, p2; PARAM p3;
The program MyPgm can be called by the external caller as shown below. MyPgm(1,2,3); In the parameter p1, p2, p3, assigned values (1, 2, 3) will be stored. The variables a, b, c, will be initialized as 0. |
(2)
...
Program part
In the program part, all program statements except the declaration (variables and parameters) can be used. The example of the most basic statement is the function call, calculation and storing the result.
...
Each statement must end with a semicolon “ ; ”. Each function returns a single result to the caller. The program mentioned above returns the result to “Tag_b”.
(3) Constants
When you use constants in the program, you can use the notations as shown below.
Item | Description |
Octal Constants | Only used from 0 to 7. The octal constant must start with 0. (E.g. 01277) |
Decimal Constants | General notation is used. (E.g. 153, 3.14, 2.45E-12) |
Hexadecimal Constants | It must start with ‘0x’. Use alphabet or number characters between ‘0’ and ‘F’. (E.g. 0xFFFF) |
String Constants | Enter the string between the two double-quotation marks (“ ”). (E.g. “String Variable1”) |
...