01.07.2013 Views

Programming manual M238 | 3 MB - BERGER - POSITEC

Programming manual M238 | 3 MB - BERGER - POSITEC

Programming manual M238 | 3 MB - BERGER - POSITEC

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Function and Function Block Representation<br />

Differences Between a Function and a Function Block<br />

Function<br />

Function Block<br />

A function:<br />

is a POU (Program Organization Unit) that returns one immediate result<br />

is directly called with its name (not through an Instance)<br />

has no persistent state from one call to the other<br />

can be used as an operand in other expressions<br />

Examples: boolean operators (AND), calculations, conversion (BYTE_TO_INT)<br />

A function block:<br />

is a POU (Program Organization Unit) that returns one or more outputs<br />

is always called through an Instance (function block copy with dedicated name<br />

and variables)<br />

each Instance has a persistent state (outputs and internal variables) from one<br />

call to the other<br />

Examples: timers, counters<br />

In the example below, Timer_ON is an instance of the Function Block TON:<br />

228 EIO0000000384 04/2012

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!