Example of the application
10.2
Programming details for the example
At a Glance
Subject of this section
What's in this
Section?
This section describes in detail the PL7 programming needed to install the counting application.
This section contains the following topics:
Topic
The application structure
Program: preliminary processing
Program: sequential processing
Program: step 0 of the sequential processing
Program: step 2 of the sequential processing
Program: subsequent processing
Program: event processing
Page
191
192
193
194
197
199
200
190
35015371 00 May 2007
The application structure
Structure view of the application
The diagram below shows the application’s structure.
Application Browser
+
+
Structure view
STATION
Configuration
Hardware configuration
Software configuration
Configuring Grafcet objects
Program
Mast task
Sections
Sequential
Prl
Chart
Post
Sr
Events
DFB types
Variables
Evt0
Animation tables
Documentation
Operating screens
Example of the application
35015371 00 May 2007 191
Example of the application
Program: preliminary processing
The aims of the preliminary processing z z
The preliminary processing manages the forced operating modes: changing the palette, changing the compartment.
The operation of the preliminary processing
The diagram below shows the programming of the preliminary processing.
LD: MAST - Sequential - Prl
(*new compartment*)
%I3.14
P
(*new palette: reset grafcet*)
%M0
R
%I3.13
P
%S21
S
%I1.0.ERR
P
(*General and special unmasking*)
OPERATE
UNMASKEVT()
%QW1.0.3:X5
S
F2 F3
P
F4
N
F5 F6 F7 F8 F9 F10
S
F11
R
F12 1.F2
OPER COHP
1.F3
1.F4
COHP
1.F5
1S.F6
1F7
F (...)
1.F8
192
35015371 00 May 2007
Example of the application
Program: sequential processing
General Sequential processing constitutes the heart of the application. It concerns monitoring the compartments being filled and changing the palette.
Flowchart of the sequential processing
The diagram below shows the GRAFCET flowchart of the sequential processing.
GRAFCET: MAST - Sequential - Chart
0
(*new palette*)
1
(*waiting to position compartment>>
2
(*filling compartment*)
F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 1F2
35015371 00 May 2007 193
Example of the application
Program: step 0 of the sequential processing
Introduction of step 0 z z
Step 0 initializes the loop: stops the motor, confirms the counting module’s IVal input, z unmasks the zero value overshoot event.
194
35015371 00 May 2007
Example of the application
Step 0: Action on
P1 activation
The diagram below shows the action on activation of step 0 (P1).
LD: MAST - Sequential - Chart - PAGE0 %X0 P1
(*stopping motor for whatever reason*)
%M0
R
(*take palette out*)
OPERATE
%MW0:=4
(*new palette load request*)
%M1
S
(*Store compartment sizes*)
%I3.15
%I3.15
OPERATE
%MW1:=50
OPERATE
%MW1:=25
The diagram below shows the result of the action on activation of step 0 (P1).
LD: MAST - Sequential - Chart - PAGE0 %X0 P1
(*writing of down counter preset value according to compartment size*)
OPERATE
%MD1.0.4:=%MW1
OPERATE
WRITE_PARAM %CH5.0
(*confirm IEna enabling input *)
%Q1.0.5
S
(*prepare direct preset*)
%Q1.0.1
R
(*unmask event enabling*)
OPERATE
%QW1.0.1 := 16#0020
35015371 00 May 2007 195
Example of the application
Step 0: action on
P0 deactivation
The diagram below shows the action on deactivation of step 0 (P0).
LD: MAST - Sequential - Chart - PAGE0 %X0 P0
(*Return the jack to its starting position*)
OPERATE
%MW0:=1
(*Direct preset*)
%Q1.0.1
S
F2 F3
P
F4
N
F5 F6 F7
X
F8 F9 F10 F11
S
F12
R
S.F1
S.F2
OPER
S.F3
COHP
H
S.F4
COHP
V
S.F5
S.F6
FB
S.F7
F (...)
S.F8
Transition of step 0 to step 1
Illustration
The transition conditions from step 0 to step 1 are as follows: z palette ready to receive objects, z exchanges between the PLC and the counting module are terminated.
The diagram below shows the transition conditions from step 0 to step 1.
LD: MAST - Sequential - Chart - PAGE0 %X(0) >%X(1)
%M1 %MW1.0:X1
F2 F3
P
F4
N
F5 F6
X
F7 F8 F9
COHP
I F4
COHP
I F5
196
35015371 00 May 2007
Example of the application
Program: step 2 of the sequential processing
Introduction of step 2
Step 2 deals with monitoring the compartments being stacked.
Step 2: action on
P1 activation
The diagram below shows the action on activation of step 2 (P1).
LD: MAST - Sequential - Chart - PAGE 0 %X2 P1
%M0
S
Step 2: action on
P0 deactivation
The diagram below shows the action on deactivation of step 2 (P0).
LD: MAST - Sequential - Chart - PAGE 0 %X2 P0
(*Advance palette by one notch*)
OPERATE
INC %MW0
Transition from step 2 to step 0
The diagram below shows the transition conditions from step 2 to step 0.
LD: MAST - Sequential - Chart - PAGE0 %X(2)->%X(0)
%M0
COMPARE
%MW0>=3
F2 F3 F4
P N
F5 F6 F7
X
F8 F9
COHP
H
I F4
COHP
V
I F5
35015371 00 May 2007 197
Example of the application
Transition from step 2 to step 1
The diagram below shows the transition conditions from step 2 to step 1.
LD: MAST - Sequential - Chart - PAGE0 %X(2)->%X(1)
%M0
COMPARE
%MW0<4
F2 F3 F4
P N
F5 F6 F7
X
F8 F9
COHP
I F4
COHP
I F5
Transition from step 1 to step 2
The diagram below shows the transition conditions from step 1 to step 2, (this always applies).
LD: MAST - CHART - PAGE 0 %X ( 1 ) - > %X ( 2 )
F2 F3
P
F4
N
F5 F6 F7
X
F8 F9
#
F10
COHP
H
S.F4
COHP
S.F5
198
35015371 00 May 2007
Example of the application
Program: subsequent processing
The aim of subsequent processing
Subsequent processing manages errors and stops the motor if there is a PLC error.
The operation of subsequent processing
The diagram below shows the programming of the subsequent processing.
LD: MAST - Sequential - Post
(*Stop motor in the event of an error*)
%I1.0.ERR
OPERATE
READ_STS %CH1.0
%M0
R
35015371 00 May 2007 199
Example of the application
Program: event processing
At a glance
Illustration
Event processing stops the motor by resetting the %M0 when the switch to zero value event is enabled.
The diagram below shows the programming of the 0 event task.
LD: EVTO - Evt0
%IW1.0.3:X5
%M0
R
F2 F3
P
F4
N
F5 F6 F7 F8 F9 F10
S
F11
R
F12 1.F2
OPER COHP
1.F3
1.F4
COHP
1.F5
1S.F6
1F7
F (...)
1.F8
200
35015371 00 May 2007
Index
A
Adjusting
Absolute encoder offset, 126
Fault processing, 128
Frequency output, 131
Preset, 127
Set points, 129
Speed measurement, 130
Switches, 132
Thresholds, 129
Adjustment
At a Glance, 124
C
Configuration
Absolute encoder interface, 110
Capturing a counting register, 112
Input TSX CTY 2A/4A, 106
Input TSX CTY 2C, 107
Screen, 104
Configuring
Combined input IEna/Q2, 115
Event processing, 114
Faulty outputs, 119
Multiplexing absolute encoders, 116
Preset, 113
Reset, 113
Setpoint crossing, 118
Special functions, 121
Switch to zero, 118
35015371 00 May 2007
Counting
Direction, 38
Introduction, 11
Resetting, 52
CTY2A/4A
Introduction, 16
CTY2C
Introduction, 24
D
Dealing with an
invalid measurement, 100
Debugging
At a Glance, 136
LEDs and buttons, 143
Maximized screen, 137
Minimized screen, 139
Use, 142
Diagnostics
Display, 146
List of faults, 148
Down counting
Principle, 18, 19
E
Entrée
Interface, 37
Event processing
Programming, 157
A C
201
Index
Example
Configuration, 184, 187
Programming, 190
F
Fault
Masking, 128
Storing, 128
Faults
Processing, 98
Function
Capture, 43
Comparison, 61
Event processing, 155
Physical outputs, 78
Preset, 47
Reset, 47
Special, 94
Speed Monitoring, 92
Switch, 67
I
Input
Counting, 37
L
Language objects
Exchange management, 178
Explicit exchanges, 169
Implicit, 161
User defined exchanges, 172
O
Operating modes
Counting function, 152
S
Speed measurement
Principle, 30
202
U
Up counting
Principle, 18, 19
Up counting/Down counting
Principle, 20, 27
Up counting/down counting
Principle, 22, 29
35015371 00 May 2007