Connecting the standard.lib, Wait" declaration, L-force | plc designer – Lenze PLC Designer PLC Designer (R2-x) User Manual

Page 84

Advertising
background image

L-force | PLC Designer

We Write a Little Program

82

DMS 3.2 EN 02/2011 TD29



5.1.10

Connecting the standard.lib

For the timer in the POU WAIT we need a POU from the standard library. Therefore,
open the library manager with 'Window' 'Library Manager. Choose 'Insert' 'Additional
library'. The dialog box appears for opening files. From the list of the libraries choose
standard.lib.

5.1.11

"WAIT" declaration

Now let us turn to the POU WAIT. This POU is supposed to become a timer with which
we can determine the length of the time period of each TRAFFICSIGNAL phase. Our
POU receives as input variable a variable TIME of the type TIME, and as output it
produces a Boolean value which we want to call OK and which should be TRUE when
the desired time period is finished. We set this value with FALSE by inserting at the
end of the declaration (before the semicolon, however) " := FALSE ".

For our purposes we need the POU TP, a clock generator. This has two inputs (IN, PT)
and two outputs (Q, ET). TP does the following:

As long as IN is FALSE, ET is 0 and Q is FALSE. As soon as IN provides the value TRUE,

the time is calculated at the output ET in milliseconds. When ET reaches the value PT,
then ET is no longer counted. Meanwhile Q produces TRUE as long as ET is smaller
than PT. As soon as the value PT has been reached, then Q produces FALSE again. See
the chapter on the standard library for short descriptions of all POUs.

In order to use the POU TP in the POU WAIT we must create a local instance from TP.
For this we declare a local variable ZAB (for elapsed time) of the type TP (between the
keywords VAR, END_VAR).

The declaration part of WAIT thus looks like this:

Function Block WAIT, Declaration Part

Advertising