Skip to main content

For Custom Data Types

Identifier designation recommendation for

Description

Example

Structures

Library prefix followed by an underscore and a short, informative description of the structure

The associated prefix for created variables of this structure should follow the colon as a comment.

TYPE CAN_SDOTelegram : (* prefix: sdo *)
    STRUCT
        wIndex : WORD;
        bySubIndex : BYTE;
        byLen : BYTE;
        abyData: ARRAY [0..3] OF BYTE;
    END_STRUCT
END_TYPE

Enumerations

Library prefix followed by an underscore and the identifier in uppercase

Note

Note: In past CODESYS versions, enumeration values > 16#7FFF caused errors because they were not automatically converted to INT. For this reason, always declare enumerations with correct INT values.

TYPE CAL_Day :
(
CAL_MONDAY,
CAL_TUESDAY, 
CAL_WEDNESDAY,
CAL_THURSDAY,
CAL_SUNDAY
);

Declaration:

eToday: CAL_DAY;