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

Page 967

Advertising
background image

L-force | PLC Designer

Programming Reference

DMS 4.1 EN 03/2011 TD29

965

Declaration:

eToday: CAL_Day;

(4) User defined data types (DUTs) in »PLC Designer« V3.x Libraries
DUT names in »PLC Designer« V3.x libraries do not get a library prefix, because using
the namespace takes the function of a prefix. Also enumeration components are
defined without library prefices.:
Example (in library with namespace CAL):

TYPE Day :(
MONDAY,
TUESDAY,
WEDNESDAY,
THIRSDAY,
FRIDAY,
SATURDAY,
SUNDAY);

Declaration:

eToday: CAL.Day;
Use in application:
IF eToday = CAL.Day.MONDAY THEN


(4) Functions, Function blocks, Programs (POU), Actions
The names of functions, function blocks and programs consist of the library prefix
(Example: CAN), an underscore and an expressive short name (e.g: SendTelegram) of
the POU
. Like with variables always the first letter of a word of the POU name should
be a capital letter, the others should be small letters. It is recommended to compose
the name of the POU of a verb and a substantive.
Example:

FUNCTION_BLOCK CAN_SendTelegram (* prefix: canst *)

In the declaration part a short description of the POU should be provided as a
comment. Further on all inputs and outputs should be provided with comments. In
case of function blocks the associated prefix for set-up instances should follow directly
after the name.
Actions get no prefix; just actions which should be called only internally, that is by the
POU itself, start with prv_.
Each function - for the reason of compatibility with previous»PLC Designer« versions -
must have at least one parameter. External functions must not use structures as
return values.

Advertising