5 the organization unit trafficlight, The organization unit trafficlight, Drive plc developer studio – Lenze DDS v2.3 User Manual

Page 25

Advertising
background image

Drive PLC Developer Studio

Program example

3-3

l

DDS EN 2.3

Tip!

Only the organization unit named PLC_PRG of type “ Program” will be processed by the cyclical task.
The cyclical task does not need to be explicitly created.

5. Select Sequential function chart (SFC) as the language for this organization unit and

confirm with OK.

6. Now create two further objects in the

Object Organizer on tab Organization units with the help

of Project

ObjectWInsert:

TRAFFICLIGHT type Function block in the language Function block diagram (FBD)
WAIT type Function block in the language Instruction list (IL)

TRAFFICLIGHT

In the organization unit TRAFFICLIGHT, the individual light phases will be assigned to the traffic
lights, i. e., the red light will be on during the red and amber/red phases, the amber light will be on
during the amber and amber/red phases, etc.

WAIT

In the organization unit WAIT, a simple timer will be programmed to receive as input the phase
duration in milliseconds and to return an output TRUE as soon as the time has expired.

PLC_PRG

The organization unit PLC_PRG links the organization units with each other so that the traffic light
emits the correct colour at the correct time and for the specified time. It processes the entire project
during the cyclical task.

3.2.5

The organization unit TRAFFICLIGHT

7. To edit the organization unit TRAFFICLIGHT, activate its editor window by selecting

Object Organizer, tab Organization units and double-clicking TRAFFICLIGHT.

3.2.5.1

Declaration

8. In the declaration editor, declare

– as input variable (between the keywords VAR_INPUT and END_VAR) a variable named

STATE

of type INT.

– as output variables (between the keywords VAR_OUTPUT and END_VAR) the variables RED,

AMBER

, GREEN and OFF of type BOOL.

Show/Hide Bookmarks

Advertising