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

Page 144

Advertising
background image

L-force | PLC Designer

Quickstart

142

DMS 4.1 EN 03/2011 TD29

(5) Create a further programming POU (ST function block FB1)
We supply another function block FB1, which will add "2" on the input given by
variable "in". The result will be written to output "out":
Choose commandAdd object from the Project menu.
Select 'POU' in the left part of the 'Add Object' dialog. Enter the name "FB1" for the POU
and activate option Function Block in the Type section.
Choose 'Structured Text (ST)' for the Implementation language.
Press button Open to confirm the object settings.
A further editor window will open for the new function block FB1. Declare there in the
same way as done for PLC_PRG the following variables:

FUNCTION_BLOCK FB1
VAR_INPUT
in:INT;
END_VAR
VAR_OUTPUT
out:INT;
END_VAR
VAR
ivar:INT:=2;
END_VAR

In the implementation part of the editor enter the following:

out:=in+ivar;


Advertising