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

Page 142

Advertising
background image

L-force | PLC Designer

Quickstart

140

DMS 4.1 EN 03/2011 TD29

Write a PLC program
(3) Declare variables in PLC_PRG
Open POU "PLC_PRG", which by default is already available in the Devices window, in
a ST language editor window. For this purpose perform a double-click on entry
"PLC_PRG" in the Devices tree.
The POU "PLC_PRG", which by default is already available in the Devices window, is
automatically opened in a ST language editor window in the center part of the PLC
Designer user interface. Basically a POU always can be opened in its editor view by a
double-click on the entry in the devices resp. POUs tree.
The ST editor consists of a declaration part (upper) and a "body" (lower part), separated
by a movable screen divider.
The declaration part shows line numbers at the left border, the POUs type and name
("PROGRAM PLC_PRG") and the embracing keywords "VAR" and "END_VAR" for the
variables declaration.
The body is empty, only line number 1 is displayed:


In the declaration part of the editor put the cursor behind VAR and press the <Return>-
key. An empty line will be inserted where you may enter the declaration of the
variables "ivar" and "erg" of type INT and fbinst of type FB1:

PROGRAM PLC_PRG
VAR
ivar: INT;
fbinst: FB1;
erg: INT;
END_VAR

Alternatively, you may directly type an instruction in the implementation part of the
editor (body) and make use of the Autodeclare function.

Advertising