L-force | plc designer – Lenze PLC Designer PLC Designer (R3-1) User Manual

Page 966

Advertising
background image

L-force | PLC Designer

Programming Reference

964

DMS 4.1 EN 03/2011 TD29

(2) Variable names in »PLC Designer« V3.x Libraries
Basically see above (1) Variable names, with the following exception: global variables
and constants do not need a library prefix, because using the namespace takes the
function of a prefix.
Example:
g_iTest: INT; (declaration)
CAN.g_iTest (implementation, call in an application program)

(3) User-defined data types (DUT)
Structure
: The name of each structure data type consists of a library prefix (Example:
CAN), an underscore and a preferably short expressive description (for example:
SDOTelegram) of the structure. The associated prefix for used variables of this
structure should follow directly after the colon.
Example:

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


Enumerations start with the library prefix (Example: CAL), followed by an underscore
and the identifier in capital letters..
Notice that in previous versions of»PLC Designer« ENUM values > 16#7FFF have caused
inconsistencies, because they did not get converted automatically to INT values. For
this reason ENUMs should be defined with correct INT values.
Example:

TYPE CAL_Day :(
CAL_MONDAY,
CAL_TUESDAY,
CAL_WEDNESDAY,
CAL_THIRSDAY,
CAL_FRIDAY,
CAL_SATURDAY,
CAL_SUNDAY);

Advertising