Predefined function blocks. Schneider Electric PL7 Micro/Junior/Pro - Detailed
Реклама
Реклама
Standard instructions
1.3
Predefined function blocks
Introduction
Aim of this subsection
What's in this
Section?
This sub-section describes PL7 language predefined function Blocks
This Section contains the following Maps:
Topic
Introduction to timer function block %TMi
%TMi timer block operating mode
Operation of timer function block %TMi in TON mode
Operation of timer function block %TMi in TOF mode
Operation of timer function block %TMi in TP mode
Programming and configuring timer function blocks
Specific cases of operation for the series 7 timer
Introduction to the up-down counter function block
How the up/down counter function block works
Configuration and programming
Page
TLX DR PL7 xxE
31
Standard instructions
Introduction to timer function block %TMi
General
Illustration
The timer has 3 operating modes: l l l
TON
TOF
TP
: is used to manage delays on engagement (on delays),
: is used to manage delays on release (off delays),
: is used to create a pulse of precise duration.
The delays or pulse periods are programmable and may or may not be modified via the terminal.
The following is the graphic presentation of the timer function block:
%TMi
IN Q
MODE : TON
TB:1mn
TM.P:9999
MODIF:Y
Characteristics
32
The timer has the following characteristics:
Characteristic
Timer number
Mode
Time base
Current value
Preset value
Terminal adjustment
(MODIF)
Address Value
%TMi 0 to 63 for a TSX 37, 0 to 254 for a TSX 57
TON
TOF
• default delay on engagement (on delay)
• delay on release (off delay)
TP
TB
%TMi.V
%TMi.P
Y/N
• monostable
1mn (default), 1s, 100ms, 10ms (16 timers max. at 10ms).
The shorter the time base, the more precise the timer.
Word which increases from 0 to %TMi.P on completion of the timer cycle. May be read, tested, but not written in a program (%TMi.V may be modified by the terminal).
0-%TMi.P-9999. Word which may be read, tested and written in a program. Is set at the value of 9999 by default.
The period or delay generated is equal to %Tmi.P x TB.
Y: possibility to modify the preset %Tmi.P value in adjust mode.
N: cannot be accessed in adjust mode.
TLX DR PL7 xxE
Standard instructions
Characteristic
Input (instruction)
"Activation"
Output "Timer"
Address Value
IN Starts the timer on rising edge (TON or TP mode) or falling
"Activation" edge (TOF mode).
Q %Tmi.Q associated bit; setting to 1 depends on the TON,
TOF or TP function.
TLX DR PL7 xxE
33
Standard instructions
%TMi timer block operating mode
Description The following table shows the operating modes specific to the timer block.
Impact...
of a cold restart of a warm restart
Description
(%S0=1), causes the current value to set to 0, the output %TMi.Q to set to 0 while the preset value is reset to the value defined on configuration.
(%S1=1) has no effect on the timer’s current value, or on the preset value. The current value does not change during power outage.
of a shift to stop mode, deactivation of a task or execution of a breakpoint
does not freeze the current value.
a program jump of the alteration to the preset value
Not polling the instructions in which the timer block is programmed does not freeze the current %TMi.V value; this continues to increase to %TMi.P.
Similarly, the %TMi.Q bit associated with the Q output of the timer block maintains its normal operation and can thus be tested by another instruction. However the output, which is directly connected to the block output, is not activated since it is not polled by the PLC
The alteration to the preset value by instruction or in adjust mode is only taken into account at the next activation of the timer.
The alteration to the preset value in the variables editor is only taken into account after a cold restart (%S0=1).
Note: it is advisable to test the %TMi.Q bit once only during the program.
34
TLX DR PL7 xxE
Standard instructions
Operation of timer function block %TMi in TON mode
General
Illustration
Operation in TONmode is used to manage the on delays.
The timing diagram illustrates the operation of the timer in TON mode.
(1)
IN
(3) (4)
Q
%TMi.P
%TMi.V
(2)
(5)
Operation The following table shows the operation of the timer in TON mode.
Phase
1
2
3
4
5
Description
The timer is started with a rising edge on the IN input
The current value %TMi.V of the timer increases from 0 to %TMi.P by one unit at each pulse of the time base TB
The %TMi.Q output bit moves to 1 when the current value has reached %TMi.P
The %TMi.Q output bit stays at 1 while the IN input is at 1.
When the IN input is at 0, the timer is stopped even if it is still running: %TMi.V takes the value 0.
TLX DR PL7 xxE
35
Standard instructions
Operation of timer function block %TMi in TOF mode
General
Illustration
Operation in TOF mode is used to manage the off delays.
The timing diagram illustrates the operation of the timer in TOF mode.
IN
(2)
Q
%TMi.P
%TMi.V
(1)
(3)
(4)
(5)
(1)
Operation The following table shows the operation of the timer in TOF mode.
Phase
1
2
3
4
5
Description
The current value %TMi.V takes 0, on a rising edge of the IN input (even if the timer is running)
The %TMi.Q output bit moves to 1.
The timer is started with a falling edge on the IN input.
The current value %TMi.P increases to %TMi.P by one unit at each pulse of the time base TB.
The %TMi.Q output bit returns to 0 when the current value has reached %TMi.P
36
TLX DR PL7 xxE
Standard instructions
Operation of timer function block %TMi in TP mode
General
Illustration
Timer operation in TP mode is used to manage the creation of a pulse of precise duration (monostable funtion).
The timing diagram illustrates the operation of the timer in TP mode.
(1)
IN
(2) (6)
Q
%TMi.P
%TMi.V
(3)
(4)
(5)
Operation The following table shows the operation of the timer in TP mode.
Phase
1
2
3
4
5
6
Description
The timer is started with a rising edge on the IN input
The %TMi.Q output bit moves to 1.
The current value %TMi.V of the timer increases from 0 to %TMi.P by one unit at each pulse of the time base TB
The %TMi.Q output bit returns to 0 when the current value has reached %TMi.P.
When the IN input and the %TMi.Q output are at 0, %TMi.V takes the value 0.
This monostable cannot be reactivated.
TLX DR PL7 xxE
37
Standard instructions
Programming and configuring timer function blocks
General
Configuration
Programming timer function blocks is always the same regardless of the selected user mode.
The choice between TON, TOF or TP operation is made in the variables editor.
This involves setting the following parameters :
Parameter
Mode
TB
%TMi.P
MODIF
Values
TON, TOF or TP.
1min, 1s, 100ms or 10ms
0 to 9999
Y or N
Programming in ladder language
The following program illustrates the use of a timer function block in ladder language.
%TM1
%I1.1
%Q2.3
IN Q
Example in instruction list
The following program illustrates the use of a timer function block in instruction list .
LD %I1.1
IN %TM1
LD
ST
%TM1.Q
%Q2.3
38
TLX DR PL7 xxE
Example in structured text
Standard instructions
The following program illustrates the use of a timer function block in structured text language.
IF RE %I1.1 THEN
START %TM1 ;
ELSIF FE %I1.1 THEN
DOWN %TM1 ;
END_IF;
%Q2.3 := %TM1.Q
;
The instruction START %TMi , generates a rising edge on the IN input of the timer block.
The instruction DOWN %TMi , generates a falling edge on the IN input of the timer block.
TLX DR PL7 xxE
39
Standard instructions
Specific cases of operation for the series 7 timer
Specific cases l l l l l
Incidence of a "cold restart" : (%S0 = 1) loads the preset value (defined by the variables editor) in the current value and sets the output %Ti.D at 0, as the preset value, which may have been altered by the terminal, has been lost.
Incidence of a "warm restart" : there is no incidence of (%S1=1) on the current value of the timer.
Incidence of a switch to stop mode : the switch of the PLC into stop mode does not freeze the current value. The same applies when the current task is deactivated or on execution of a breakpoint.
Incidence of a program jump : not polling the network in which the timer block is programmed does not freeze the current value %Ti.V which continues to decrease to 0. Similarly, the %Ti.D and %Ti.R bits associated with the D and R outputs maintain their normal operation and can thus be tested on another network. However the spools which are directly connected to the block outputs are not activated since they are not polled by the PLC.
Test of %Ti.D and %Ti.R bits : these bits can change state during the cycle.
40
TLX DR PL7 xxE
Introduction to the up-down counter function block
General
Illustration
This function block is used for: l l
Counting an event
Down counting events
These operations can happen simultaneously
Graphic representation of the up-down counter function block
R E
S
C.P. : 9999
CU
MODIF : Y
CD
D
F
Standard instructions
Characteristics The up-down counter has the following characteristics:
Characteristics
Number Counter
Current value
Preset value
Terminal adjustment
(MODIF)
Y/N
Input (instruction)
"Resetting to zero"
Input (instruction)
"Preset"
Input (instruction)
"Counting"
Input (instruction)
"Down counting"
Address
%Ci
%Ci.V
%Ci.P
R
S
CU
CD
Value
0 to 31 for a TSX 37, 0 to 254 for a TSX 57
Increased or decreased word according to the CU and
CD inputs. May be read, and tested but not written by the program. Can be set by the terminal
0
≤
%Ci.P
≤
9999 . Word which can be read, tested and written (with a default value of 9999) l l
Y: possibility to modify the preset value in adjust mode
N: cannot be accessed in adjust mode
On state 1: %Ci.V = 0
On state 1: %Ci.V = %Ci.P
%Ci.V increment on rising edge
%Ci.V decreased on rising edge
TLX DR PL7 xxE
41
Standard instructions
Characteristics
Output Overrun
Preset Output reached
Output Overrun
Address Value
E (Empty) When %Ci.V switches from 0 to 9999 (set when %Ci.V is equal to 9999), the associated bit %Ci.E=1 is cleared if the counter continues counting down. When there is an overrun, bit %S18 switches to 1
D (Done) Associated bit %Ci.D=1, when %Ci.V=%Ci.P.
F (Full) When %Ci.V switches from 9999 to 0 (set when %Ci.V is equal to 0), the associated bit %Ci.F is cleared if the counter continues counting up. When there is an overrun, bit %S18 switches to 1
42
TLX DR PL7 xxE
Standard instructions
How the up/down counter function block works
Operation Counting Function
Action
A rising edge appears on the CU counting input
The %Ci.V current value is equal to the
%Ci.P preset value
Result
The %Ci.V current value is increased by one unit the %Ci.D output bit "preset reached" associated to output D switches to set
The %Ci.V current value switches from
9999 to 0
The counter continues counting
The %Ci.F output bit (counting overrun) switches to set
The %Ci.F output bit (counting overrun) is reset to clear
Down counting Function
Action
A rising edge appears on the CU down counting input
Result
The %Ci.V current value is decreased by one unit
The %Ci.V current value switches from 0 to
9999
The %Ci.E output bit (counting overrun) switches to set
The counter continues down counting The %Ci.E output bit (counting overrun) is reset to clear
Up/Down Counting Function
Action
A rising edge appears on the CU counting input
Result
The %Ci.V current value is increased by one unit
A rising edge appears on the CU down counting input
The two inputs set simultaneously
The %Ci.V current value is decreased by one unit
The current value remains unchanged
Reset to zero
When Result
Input R is set (this input has priority over the other inputs)
The %Ci.V current value is forced to 0. Outputs
%Ci.V, %CI.D and %CI.F are at 0
TLX DR PL7 xxE
43
Standard instructions
Preset
Action
Input S "Preset" is in state 1 and input R
"Reset to zero"
Result
The %Ci.V current value takes the %Ci.P value and the %Ci.D output switches to 1
Note
Specific cases
On reset to 0 (input R or instruction R): l In language data, the CU and CD input archives are updated with the connected values l In instruction list language and in structured text language, the archives of the CU and CD inputs are not updated; each input keeps the value it had before the call
Different specific cases
Action l Cold reset (%S0=1) l l l l l
Warm restart (%S1=1)
Switch to stop
Task deactivation
Breakpoint execution
Modification of the %Ci.P preset
Result l l l
The %Ci.V current value is set to zero
The %Ci.E, %Ci.D and %Ci.F output bits are set to zero
The preset value is initialized to the value defined during configuration l No incidence on the current counter value
(%Ci.V) l Modifying the preset value by instruction or during recalibration is taken into account during the application’s block management
(activating one of the inputs
44
TLX DR PL7 xxE
Standard instructions
Configuration and programming
Example
Configuration
Programming
Counting of number of parts = 5000. Each pulse on the input %I1.2 (when the internal %M0 bit is at 1) causes the incrementation of the counter %C8 up to the final preset counter value %C8 (bit %C8.D=1). The input %I1.1 resets the counter to zero.
The following are the parameters to be entered using the variables editor: l l
%Ci.P, fixed at 5000 in this example
MODIF: Y
Ladder language
%I1.2
%I1.1
%M0
%C8
R E
S
C.P : 5000
CU
MODIF : Y
CD
D
F
%C8.D
%Q2.0
Instruction list language
LD %I1.1
R %C8
LD %I1.2
AND %M0
CU %C8
LD %C8.D
ST %Q2.0
Structured text language
TLX DR PL7 xxE
45
Standard instructions
IF %I1.1 THEN
RESET %C8
END_IF;
%M1:=%I1.2 THEN
UP %C8 ;
END_IF;
%Q2.0: = %C8.D
; l l l l
In structured text language, 4 instructions are used to program the up/down counter function blocks:
RESET %Ci: Resets the current value to zero.
PRESET
UP
DOWN
%Ci: Loads the preset value in the current value
%Ci: Increments the current value
%Ci: Lowers the current value
In the case of structured text language, the CU and CD inputs archive is reset to zero when the instructions UP and DOWN are used. It is therefore the user who must manage the rising edges for these two instructions.
46
TLX DR PL7 xxE
Завантажити
Реклама