Appendix The can take on one of the enumeration values and will be initialized with the first one. These values are compatible with whole numbers which means that you can perform operations with them just as you would with INT. You can assign a number x to the . If the enumeration values are not initialized, counting will begin with 0. When initializing, make certain the initial values are increasing. The validity of the number will be reviewed at the time it is run. Example: TRAFFIC_SIGNAL:
(Red, Yellow, Green:=10); (*The initial value for each of the colors is red 0, yellow 1, green 10 *) TRAFFIC_SIGNAL:=0; (* The value of the traffic signal is red*) FOR i:= Red TO Green DO i := i + 1; END_FOR; You may not use the same enumeration value more than once. Example: TRAFFIC_SIGNAL: (red, yellow, green); COLOR: (blue, white, red); Error: red may not be used for both TRAFFIC_SIGNAL and COLOR. 10.4.2.4 Structures (STRUCT) Structures are created as objects in the Object Organizer under the register card Data types. They begin with the keyword TYPE and end with END_TYPE.The syntax for structure declarations is as follows: TYPE : STRUCT . .
END_STRUCT END_TYPE is a type that is recognized throughout the project and can be used like a standard data type. Interlocking structures are allowed. The only restriction is that variables may not be placed at addresses (the AT declaration is not allowed!). Example for a structure definition named Polygonline: TYPE Polygonline: STRUCT Start:ARRAY [1..2] OF INT; Point1:ARRAY [1..2] OF INT; TwinCAT 2 PLC Control 302 Version: 1.0