6. Standard Function Blocks. Mitsubishi Electronics Mitsubishi Digital Electronics Welding System FXCPU, FXCPU
Add to my manuals
236 Pages
advertisement
FXCPU Structured Programming Manual
(Application Functions)
6 Standard Function Blocks
6.1 R_TRIG(_E)
6. Standard Function Blocks
6.1
R_TRIG(_E)
FX 3U(C) FX 3G FX 2N(C) FX 1N(C) FX 1S FX U /FX 2C FX 0N FX 0(S)
Outline
This function block detects the rising edge of a signal, and outputs pulse signal.
1. Format
Function name
R_TRIG
R_TRIG_E
M0
Expression in each language
Structured ladder
Instance name
R_TRIG
_CLK Q M10
ST
R_TRIG(_CLK); *1
Example:
Instance name(_CLK:=M0);
M10:=Instance name.Q;
X000
M0
Instance name
R_TRIG_E
EN
_CLK
ENO
Q M10
R_TRIG_E(EN,_CLK); *1
Example:
Instance name(EN:=X000,
_CLK:=M0);
M10:=Instance name.Q;
*1.
Refer to caution points.
2. Set data
Input variable
Output variable
Variable
EN
_CLK (
ENO
Q ( s
) d
)
Description
Execution condition
Input signal whose rising edge is to be detected
Execution status
Output signal
In explanation of functions, I/O variables inside ( ) are described.
Bit
Bit
Bit
Bit
Data type
Explanation of function and operation
This function block sets to ON a device specified in keeps ON the device specified in d d
when a device specified in
only for 1 operation cycle.
s
turns ON, and
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) Expression of function blocks in each language
*1.
Set the instance when using a function block.
Describe the instance name when programming a function block.
Error
1) When an output number is specified in d
and the specified output number does not exist due to indexing, M8316 (I/O inexistence error) turns ON.
(Applicable to the FX
3U
and FX
3UC
PLCs only)
2) When a device (M, T or C) other than I/O number is specified in d
and the specified device number does not exist due to indexing, an operation error (Error code: 6706) occurs.
206
FXCPU Structured Programming Manual
(Application Functions)
6 Standard Function Blocks
6.1 R_TRIG(_E)
Program example
In this program, a device specified in d
turns ON when the bit data stored in a device specified in turns ON from OFF, and the device specified in d
remains ON only for 1 operation cycle.
1) Function without EN/ENO(R_TRIG) s
[Structured ladder]
R_TRIG_Instance g_bool1 _CLK
R_TRIG
Q g_bool2
[ST]
R_TRIG_Instance(_CLK:=g_bool1);g_bool2:=R_TRIG_Instance.Q;
2) Function with EN/ENO(R_TRIG_E)
[Structured ladder]
X000 g_bool1
R_TRIG_E_Instance
EN
_CLK
R_TRIG_E
ENO
Q
Y010 g_bool2
[ST]
R_TRIG_E_Instance(EN:=X000,_CLK:=g_bool1);Y010=R_TRIG_E_Instance.ENO; g_bool2:=R_TRIG_E_Instance.Q;
1
2
3
4
5
6
A
207
FXCPU Structured Programming Manual
(Application Functions)
6.2
F_TRIG(_E)
6 Standard Function Blocks
6.2 F_TRIG(_E)
FX 3U(C) FX 3G FX 2N(C) FX 1N(C) FX 1S FX U /FX 2C FX 0N FX 0(S)
Outline
This function block detects the falling edge of a signal, and outputs pulse signal.
1. Format
Function name
F_TRIG
F_TRIG_E
X000
M0
M0
Expression in each language
Structured ladder
Instance name
F_TRIG
_CLK Q M10
ST
F_TRIG(_CLK); *1
Example:
Instance name(_CLK:=M0);
M10:=Instance name.Q;
Instance name
F_TRIG_E
EN ENO
_CLK Q M10
F_TRIG_E(EN,_CLK); *1
Example:
Instance name(EN:=X000,
_CLK:=M0);
M10:=Instance name.Q;
*1.
Refer to caution points.
2. Set data
Input variable
Output variable
Variable
EN
_CLK (
ENO
Q ( s
) d
)
Description
Execution condition
Input signal whose falling edge is to be detected
Execution status
Output signal
In explanation of functions, I/O variables inside ( ) are described.
Bit
Bit
Bit
Bit
Data type
Explanation of function and operation
This function block sets to ON a device specified in keeps ON the device specified in d d
when a device specified in
only for 1 operation cycle.
s
turns OFF, and
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) Expression of function blocks in each language
*1.
Set the instance when using a function block.
Describe the instance name when programming a function block.
Error
1) When an output number is specified in d
and the specified output number does not exist due to indexing, M8316 (I/O inexistence error) turns ON.
(Applicable to the FX
3U
and FX
3UC
PLCs only)
2) When a device (M, T or C) other than I/O number is specified in d
and the specified device number does not exist due to indexing, an operation error (Error code: 6706) occurs.
208
FXCPU Structured Programming Manual
(Application Functions)
6 Standard Function Blocks
6.2 F_TRIG(_E)
Program example
In this program, a device specified in d
turns ON when the bit data stored in a device specified in turns OFF from ON, and the device specified in d
remains ON only for 1 operation cycle.
1) Function without EN/ENO(F_TRIG) s
[Structured ladder]
F_TRIG_Instance g_bool1 _CLK
F_TRIG
Q g_bool2
[ST]
F_TRIG_Instance(_CLK:=g_bool1);g_bool2:=F_TRIG_Instance.Q;
2) Function with EN/ENO(F_TRIG_E)
[Structured ladder]
X000 g_bool1
F_TRIG_E_Instance
EN
_CLK
F_TRIG_E
ENO Y010
Q g_bool2
[ST]
F_TRIG_E_Instance(EN:=X000,_CLK:=g_bool1);Y010=F_TRIG_E_Instance; g_bool2:=F_TRIG_E_Instance.Q;
1
2
3
4
5
6
A
209
FXCPU Structured Programming Manual
(Application Functions)
6.3
CTU(_E)
6 Standard Function Blocks
6.3 CTU(_E)
FX 3U(C) FX 3G FX 2N(C) FX 1N(C) FX 1S FX U /FX 2C FX 0N FX 0(S)
Outline
This function block counts up the number of times of rising of a signal.
1. Format
Function name
CTU
M0
M10
D0
Expression in each language
Structured ladder
Instance name
CU
CTU
RESET
PV
Q M20
CV D10
ST
CTU(CU,RESET,PV); *1
Example:
Instance name(CU:=M0,
RESET=M10, PV=D0);
M20:=Instance name.Q;
D10:=Instance name.CV;
CTU_E
X000
M0
M10
D0
Instance name
EN
CTU_E
ENO
CU
RESET
Q M20
CV D10
PV
*1.
Refer to caution points.
2. Set data
Input variable
Output variable
Variable
EN
CU (
RESET (
PV
ENO
( s1 s2 n
Q
CV
(
( d1 d2
)
)
)
)
)
Execution condition
Count source signal
Reset input signal
Counter set value
Execution status
Count-up output signal
Number of times of rising
Description
In explanation of functions, I/O variables inside ( ) are described.
CTU_E(EN,CU,RESET,PV); *1
Example:
Instance name(EN=X000,
CU:=M0, RESET=M10, PV=D0);
M20:=Instance name.Q;
D10:=Instance name.CV;
Data type
Bit
Bit
Bit
Word [signed]
Bit
Bit
Word [signed]
Explanation of function and operation
This function block counts up (adds "1" to) the value stored in a device specified in specified in s1
turns ON.
When the count value reaches a value specified in
When a device specified in s2 n
, a device specified in d1
turns ON.
turns ON, this function block turns OFF a device specified in resets the count value of a device specified in d2
.
d2
when a device d1
, and
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) Expression of function blocks in each language
*1.
Set the instance when using a function block.
Describe the instance name when programming a function block.
210
FXCPU Structured Programming Manual
(Application Functions)
6 Standard Function Blocks
6.3 CTU(_E)
Program example
In this program, the number of times the bit data stored in a device specified in counted, and the count value is output to a device specified in d2
.
s1
1) Function without EN/ENO(CTU)
turns ON from OFF is
[Structured ladder] g_bool1 g_bool2
CTU_Instance
CTU
CU
RESET
Q g_bool3
CV g_int2 g_int1 PV
[ST]
CTU_Instance(CU:=g_bool1,RESET:=g_bool2,PV:=g_int1); g_bool3:=CTU_Instance.Q; g_int2:=CTU_Instance.CV;
2) Function with EN/ENO(CTU_E)
[Structured ladder]
M10
EN g_bool1 CU
CTU_E_Instance
CTU_E g_bool2 RESET g_int1 PV
ENO M11
Q g_bool3
CV g_int2
[ST]
CTU_E_Instance(EN:=M10,CU:=g_bool1,RESET:=g_bool2,PV:=g_int1);
M11:=CTU_E_Instance.ENO; g_bool3:=CTU_E_Instance.Q; g_int2:=CTU_E_Instance.CV;
1
2
3
4
5
6
A
211
FXCPU Structured Programming Manual
(Application Functions)
6.4
CTD(_E)
6 Standard Function Blocks
6.4 CTD(_E)
FX 3U(C) FX 3G FX 2N(C) FX 1N(C) FX 1S FX U /FX 2C FX 0N FX 0(S)
Outline
This function block counts down the number of times of rising of a signal.
1. Format
Function name
CTD
M0
M10
D0
Expression in each language
Structured ladder
Instance name
CD
CTD
LOAD
PV
Q M20
CV D10
ST
CTD(CD,LOAD,PV); *1
Example:
Instance name(CD:=M0,
LOAD=M10, PV=D0);
M20:=Instance name.Q;
D10:=Instance name.CV;
CTD_E
X000
M0
M10
D0
Instance name
EN
CTD_E
ENO
CD
LOAD
Q M20
CV D10
PV
CTD_E(EN,CD,LOAD,PV); *1
Example:
Instance name(EN=X000,
CD:=M0, LOAD=M10, PV=D0);
M20:=Instance name.Q;
D10:=Instance name.CV;
*1.
Refer to caution points.
2. Set data
Input variable
Output variable
Variable
EN
CD (
LOAD (
PV
ENO
( s1 s2 n
)
)
)
Q
CV
(
( d1 d2
)
)
Description Data type
Execution condition
Count source signal
Reset input signal
Counter set value
Bit
Bit
Bit
Word [signed]
Execution status
Output signal (which turns ON when the current counter value becomes "0" or less)
Number of times of rising
Bit
Bit
Word [signed]
In explanation of functions, I/O variables inside ( ) are described.
Explanation of function and operation
This function block counts down (subtracts "1" from) the value stored in a device specified in device specified in s1
turns ON.
The value n
specifies the initial value for subtraction.
This function block turns ON a device specified in d1
when the count value becomes "0".
When a device specified in s2
turns ON, this function block turns OFF a device specified in the initial value for subtraction specified in n
to the count value of a device specified in d2
.
d1 d2
when a
, and sets
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) Expression of function blocks in each language
*1.
Set the instance when using a function block.
Describe the instance name when programming a function block.
212
FXCPU Structured Programming Manual
(Application Functions)
6 Standard Function Blocks
6.4 CTD(_E)
Program example
In this program, the number of times the bit data stored in a device specified in counted, and a device specified in becomes "0".
d1 s1
turns ON from OFF is
turns ON when the value stored in a device specified in d2
1) Function without EN/ENO(CTD)
[Structured ladder] g_bool1 g_bool2
CTD_Instance
CTD
CD
LOAD
Q g_bool3
CV g_int2 g_int1 PV
[ST]
CTD_Instance(CD:=g_bool1,LOAD:=g_bool2,PV:=g_int1); g_bool3:=CTD_Instance.Q; g_int2:=CTD_Instance.CV;
2) Function with EN/ENO(CTD_E)
[Structured ladder]
M10
EN g_bool1 CD
CTD_E_Instance
CTD_E g_bool2 LOAD g_int1 PV
ENO M11
Q g_bool3
CV g_int2
[ST]
CTD_E_Instance(EN:=M10,CD:=g_bool1,LOAD:=g_bool2,PV:=g_int1);
M11:=CTD_E_Instance.ENO; g_bool3:=CTD_E_Instance.Q; g_int2:=CTD_E_Instance.CV;
1
2
3
4
5
6
A
213
FXCPU Structured Programming Manual
(Application Functions)
6.5
CTUD(_E)
6 Standard Function Blocks
6.5 CTUD(_E)
FX 3U(C) FX 3G FX 2N(C) FX 1N(C) FX 1S FX U /FX 2C FX 0N FX 0(S)
Outline
This function block counts up/down the number of times of rising of a signal.
1. Format
Function name
CTUD
M0
M10
M20
M30
D0
Expression in each language
Structured ladder
Instance name
CU
CD
CTUD
RESET
LOAD
PV
QU M40
QD
CV
M50
D10
ST
CTUD(CU,CD,RESET,LOAD,PV);
*1
Example:
Instance name(CU:=M0,
CD:=M10,RESET:=M20,LOAD:=
M30,PV:=D0);
M40:=Instance name.QU;
M50:=Instance name.QD;
D10:=Instance name.CV;
CTUD_E
X000
M0
M10
M20
M30
D0
Instance name
CTUD_E
EN ENO
CU
CD
QU
QD
M40
M50
CV D10 RESET
LOAD
PV
CTUD_E(EN,CU,CD,RESET,LOA
D,PV); *1
Example:
Instance name(EN=X000,
CU:=M0,CD:=M10,RESET:=M20,
LOAD:=M30,PV:=D0);
M40:=Instance name.QU;
M50:=Instance name.QD;
D10:=Instance name.CV;
*1.
Refer to caution points.
2. Set data
Input variable
Output variable
Variable
EN
CU ( s1
)
CD (
RESET ( s2 s3
LOAD ( s4
PV
ENO
QU
(
( n d1
)
)
)
)
)
QD ( d2
)
Description Data type
Execution condition
Count up signal
Count down signal
Reset input signal
Resetting signal
Bit
Bit
Bit
Bit
Bit
Counter set value
Execution status
Count-up output signal
Output signal (which turns ON when the current counter value becomes "0" or less)
Count value data
Word [signed]
Bit
Bit
Bit
Word [signed] CV ( d3
)
In explanation of functions, I/O variables inside ( ) are described.
Explanation of function and operation
This function block counts up (adds "1" to) the value stored in a device specified in specified in s1
turns ON.
d3
when a device
This function block counts down (subtracts "1" from) the value stored in a device specified in device specified in s2
turns ON.
d3
when a n
specifies the maximum value of the counter.
When the value stored in a device specified in d3 specified in d1
turns ON.
When the value stored in a device specified in d3
reaches the maximum value n
of the counter, a device
becomes "0", a device specified in d2
turns ON.
214
FXCPU Structured Programming Manual
(Application Functions)
6 Standard Function Blocks
6.5 CTUD(_E)
This function block resets the count value of a device specified in
ON.
This function block sets the value stored in turns ON.
n d3
when a device specified in
to a device specified in d3 s3
turns
when a device specified in s4
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) Expression of function blocks in each language
*1.
Set the instance when using a function block.
Describe the instance name when programming a function block.
1
2
3
4
5
6
A
215
FXCPU Structured Programming Manual
(Application Functions)
6 Standard Function Blocks
6.5 CTUD(_E)
Program example
In this program, the number of times the bit data stored in a device specified in counted up (added by "1"). When the value stored in a device specified in d3 s1
turns ON from OFF is
reaches the value specified in n
, a device specified in d1
turns ON.
At the same time, the number of times the bit data stored in a device specified in counted down (subtracted by "1"). When the value stored in a device specified in specified in d2
turns ON.
s2 d3
turns ON from OFF is
becomes "0", a device
1) Function without EN/ENO(CTUD)
[Structured ladder]
CTUD_Instance
CTUD g_bool1 CU g_bool2 CD g_bool3 RESET g_bool4 LOAD g_int1 PV
QU g_bool5
QD g_bool6
CV g_int2
[ST]
CTUD_Instance(CU:=g_bool1,CD:=g_bool2,RESET:=g_bool3,LOAD:=g_bool4,PV:=g_int1); g_bool5:=CTUD_Instance.QU; g_bool6:=CTUD_Instance.QD; g_int2:=CTUD_Instance.CV;
2) Function with EN/ENO(CTUD_E)
[Structured ladder]
M0
EN g_bool1 CU g_bool2 g_bool3
CTUD_E_Instance
CTUD_E
CD
RESET g_bool4 LOAD g_int1 PV
ENO
QU
M10 g_bool5
QD g_bool6
CV g_int2
[ST]
CTUD_E_Instance(EN:=M0,CU:=g_bool1,CD:=g_bool2,RESET:=g_bool3,LOAD:=g_bool4,PV:=g_int1);
M10:=CTUD_E_Instance.ENO; g_bool5:=CTUD_E_Instance.QU; g_bool6:=CTUD_E_Instance.QD; g_int2:=CTUD_E_Instance.CV;
216
FXCPU Structured Programming Manual
(Application Functions)
6.6
TP(_E)
6 Standard Function Blocks
6.6 TP(_E)
FX 3U(C) FX 3G FX 2N(C) FX 1N(C) FX 1S FX U /FX 2C FX 0N FX 0(S)
1
Outline
This function block keeps ON a signal for specified duration.
1. Format
Function name
TP
TP_E
M0
Label 1
X000
M0
Label 1
Expression in each language
Structured ladder
Instance name
IN
PT
TP
Q
ET
M10
Label 2
ST
TP(IN,PT); *1
Example:
Instance name(IN:=M0,
PT:=Label 1);
M10:=Instance name.Q;
Label 2:=Instance name. ET;
Instance name
EN
TP_E
ENO
IN
PT
Q
ET
M10
Label 2
TP_E(EN,IN,PT); *1
Example:
Instance name(EN:=X000,
IN:=M0,PT:=Label 1);
M10:=Instance name.Q;
Label 2:=Instance name. ET;
*1.
Refer to caution points.
2. Set data
Input variable
Output variable
Variable
EN
IN (
PT (
ENO s n
Q (
ET ( d1 d2
)
)
)
)
Execution condition
ON start input signal
ON duration data
Execution status
Output signal
ON duration current value
Description
In explanation of functions, I/O variables inside ( ) are described.
Bit
Bit
Time
Bit
Bit
Time
Data type
Explanation of function and operation
When a device specified in it ON for duration specified in s n
turns ON, this function block turns ON a device specified in
.
The elapsed time while a device specified in
A device specified in d1 d1
remains ON is set to a device specified in
turns OFF when the elapsed time reaches the set value.
d1 d2
.
, and keeps
Even if a device specified in device specified in s d1
turns OFF, this function block does not reset the elapsed time. When a
turns ON from OFF next time, this function block resets the elapsed time and turns
ON again a device specified in d1
.
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
3) Expression of function blocks in each language
*1.
Set the instance when using a function block.
Describe the instance name when programming a function block.
2
3
4
5
6
A
217
FXCPU Structured Programming Manual
(Application Functions)
6 Standard Function Blocks
6.6 TP(_E)
Program example
In this program, when bit data stored in a device specified in specified in d1
turns ON and remains ON for 10 seconds.
1) Function without EN/ENO(TP) s
turns ON, bit data stored in a device
[Structured ladder] g_bool1 IN
T#10s PT
TP_Instance
TP
Q
ET g_bool2 g_time1
[ST]
TP_Instance(IN:=g_bool1,PT:=T#10s); g_bool2:=TP_Instance.Q; g_time1:=TP_Instance.ET;
2) Function with EN/ENO(TP_E)
[Structured ladder]
M0 g_bool1
T#10s
EN
IN
TP_E_Instance
TP_E
ENO M10
Q g_bool2
PT ET g_time1
[ST]
TP_E_Instance(EN:=M0,IN:=g_bool1,PT:=T#10s);
M10:=TP_E_Instance.ENO; g_bool2:=TP_E_Instance.Q; g_time1:=TP_E_Instance.ET;
218
FXCPU Structured Programming Manual
(Application Functions)
6.7
TON(_E)
6 Standard Function Blocks
6.7 TON(_E)
FX 3U(C) FX 3G FX 2N(C) FX 1N(C) FX 1S FX U /FX 2C FX 0N FX 0(S)
1
Outline
This function block turns ON after specified time.
1. Format
Function name
TON
TON_E
M0
Label 1
X000
M0
Label 1
Expression in each language
Structured ladder
Instance name
IN
PT
TON
Q
ET
M10
Label 2
ST
TON(IN,PT); *1
Example:
Instance name(IN:=M0,
PT:=Label 1);
M10:=Instance name.Q;
Label 2:=Instance name. ET;
Instance name
EN
TON_E
ENO
IN
PT
Q
ET
M10
Label 2
TON_E(EN,IN,PT); *1
Example:
Instance name(EN:=X000,
IN:=M0,PT:=Label 1);
M10:=Instance name.Q;
Label 2:=Instance name.ET;
*1.
Refer to caution points.
2. Set data
Input variable
Output variable
Variable
EN
IN (
PT (
ENO s n
Q (
ET ( d1 d2
)
)
)
)
Execution condition
Input signal
ON start time data
Execution status
Output signal
ON start time current value
Description
In explanation of functions, I/O variables inside ( ) are described.
Bit
Bit
Time
Bit
Bit
Time
Data type
Explanation of function and operation
When a device specified in time specified in n
.
s
turns ON, this function block turns ON a device specified in d1
The delay elapsed time until a device specified in
When a device specified in resets the delay elapsed time.
s d1
turns ON is set to a device specified in d2
turns OFF, this function block turns OFF a device specified in
.
after the d1
and
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
3) Expression of function blocks in each language
*1.
Set the instance when using a function block.
Describe the instance name when programming a function block.
2
3
4
5
6
A
219
FXCPU Structured Programming Manual
(Application Functions)
6 Standard Function Blocks
6.7 TON(_E)
Program example
In this program, when bit data stored in a device specified in specified in d1
turns ON 10 seconds later.
1) Function without EN/ENO(TON) s
turns ON, bit data stored in a device
[Structured ladder] g_bool1 IN
T#10s PT
TON_Instance
TON
Q
ET g_bool2 g_time1
[ST]
TON_Instance(IN:=g_bool1,PT:=T#10s); g_bool2:=TON_Instance.Q; g_time1:=TON_Instance.ET;
2) Function with EN/ENO(TON_E)
[Structured ladder]
M0 g_bool1
T#10s
TON_E_Instance
TON_E
EN
IN
ENO M10
Q g_bool2
PT ET g_time1
[ST]
TON_E_Instance(EN:=M0,IN:=g_bool1,PT:=T#10s);
M10:=TON_E_Instance.ENO; g_bool2:=TON_E_Instance.Q; g_time1:=TON_E_Instance.ET;
220
FXCPU Structured Programming Manual
(Application Functions)
6.8
TOF(_E)
6 Standard Function Blocks
6.8 TOF(_E)
FX 3U(C) FX 3G FX 2N(C) FX 1N(C) FX 1S FX U /FX 2C FX 0N FX 0(S)
1
Outline
When the input signal turns OFF, this function block turns OFF the output signal after the specified time.
1. Format
Function name
TOF
TOF_E
M0
Label 1
X000
M0
Label 1
Expression in each language
Structured ladder
Instance name
IN
PT
TOF
Q
ET
M10
Label 2
ST
TOF(IN,PT); *1
Example:
Instance name(IN:=M0,
PT:=Label 1);
M10:=Instance name.Q;
Label 2:=Instance name. ET;
Instance name
EN
TOF_E
ENO
IN
PT
Q
ET
M10
Label 2
TON_F(EN,IN,PT); *1
Example:
Instance name(EN:=X000,
IN:=M0,PT:=Label 1);
M10:=Instance name.Q;
Label 2:=Instance name.ET;
*1.
Refer to caution points.
2. Set data
Input variable
Output variable
Variable
EN
IN (
PT (
ENO s n
Q (
ET ( d1 d2
)
)
)
)
Execution condition
Input signal
OFF duration data
Execution status
Output signal
OFF duration current value
Description
In explanation of functions, I/O variables inside ( ) are described.
Bit
Bit
Time
Bit
Bit
Time
Data type
Explanation of function and operation
When a device specified in
When a device specified in s s
turns ON, this function block turns ON a device specified in d1
.
turns OFF from ON, this function block turns OFF a device specified in after the time specified in
When a device specified in resets the elapsed time.
n s
.
The elapsed time until a device specified in d1
turns OFF is set to a device specified in d2
.
turns ON again, this function block turns ON a device specified in d1 d1
and
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
3) Expression of function blocks in each language
*1.
Set the instance when using a function block.
Describe the instance name when programming a function block.
2
3
4
5
6
A
221
FXCPU Structured Programming Manual
(Application Functions)
6 Standard Function Blocks
6.8 TOF(_E)
Program example
In this program, when bit data stored in a device specified in specified in d1 s
turns ON, bit data stored in a device
turns ON. When bit data stored in a device specified in s
turns OFF, bit data stored in a device specified in d1
turns OFF 10 seconds later.
1) Function without EN/ENO(TOF)
[Structured ladder] g_bool1 IN
T#10s PT
TOF_Instance
TOF
Q
ET g_bool2 g_time1
[ST]
TOF_Instance(IN:=g_bool1,PT:=T#10s); g_bool2:=TOF_Instance.Q; g_time1:=TOF_Instance.ET;
2) Function with EN/ENO(TOF_E)
[Structured ladder]
M0 g_bool1
T#10s
TOF_E_Instance
TOF_E
EN
IN
ENO M10
Q g_bool2
PT ET g_time1
[ST]
TOF_E_Instance(EN:=M0,IN:=g_bool1,PT:=T#10s);
M10:=TOF_E_Instance.ENO; g_bool2:=TOF_E_Instance.Q; g_time1:=TOF_E_Instance.ET;
222
FXCPU Structured Programming Manual
(Application Functions)
6.9
COUNTER_FB_M
6 Standard Function Blocks
6.9 COUNTER_FB_M
FX 3U(C) FX 3G FX 2N(C) FX 1N(C) FX 1S FX U /FX 2C FX 0N FX 0(S)
1
Outline
This counter starts counting when the condition turns ON from OFF and generates an output when counting up to the set value.
A counter initial value can be set.
1. Format
Function name
COUNTER_FB_M
Expression in each language
Structured ladder ST
COUNTER_FB_M(Coil,Preset,
ValueIn); *1
Instance name
COUNTER_FB_M
Coil ValueOut
Preset
ValueIn
Status
Example:
Instance name
(Coil:=X000,Preset:=D0,
ValueIn:=D10);
D20:=Instance name
ValueOut;
M0:=Instance name
Status;
*1.
Refer to "Cautions".
2. Set data
Input variable
Output variable
Variable
Coil
Preset
ValueIn
ValueOut
Status
Execution condition
Counter set value
Counter initial value
Counter current value
Counter output contact
Description Data type
Bit
Word [signed]
Word [signed]
ANY16
Bit
Function and operation explanation
The counter starts counting when detecting the rising edge (from OFF to ON) of the input argument Coil. It does not start counting if the Coil remains ON.
The counter starts counting from the value of input argument ValueIn. When the input argument Preset value is reached, the output argument Status turns ON.
The current count value is stored in the output argument ValueOut.
timing chart [Structured ladder]
Var_M0
10
1
Instance name
COUNTER_FB_M
Coil ValueOut
Preset
ValueIn
Status
Var_D10
Var_M10
*1
*2
[ ST ]
Instance name (Coil:= Var_M0,Preset:=10,Valueln:=1);
Var_D10:=Instance name.ValueOut;
Var_M10:=Instance name.Status;
Var_M0
Value of Var_D10
Var_M10
1
ON
2
ON
3
ON
10
ON
*1.
Var_D10 is a global label and is defined as D10.
*2.
Var_M10 is a global label and is defined as M10.
2
3
4
5
6
A
223
FXCPU Structured Programming Manual
(Application Functions)
6 Standard Function Blocks
6.9 COUNTER_FB_M
Cautions
1) Expression in each language of function block
*1.
Set the instance when using the function block.
Describe the instance name when programming the function block.
2) For the function block, the automatic allocation device needs to be set as the counter numbers are allocated automatically.
224
FXCPU Structured Programming Manual
(Application Functions)
6.10
TIMER_10_FB_M
6 Standard Function Blocks
6.10 TIMER_10_FB_M
FX 3U(C) FX 3G FX 2N(C) FX 1N(C) FX 1S FX U /FX 2C FX 0N FX 0(S)
1
Outline
This function block generates an output when the condition continues for the specified time.
The initial value and setting value of the timer is multiplied by 10 ms.
1. Format
Function name
Expression in each language
Structured ladder ST
TIMER_10_FB_M
Instance name
TIMER_10_FB_M
Coil ValueOut
Preset
ValueIn
Status
TIMER_10_FB_M(Coil,Preset,
ValueIn); *1
*1.
Refer to "Cautions".
2. Set data
Input variable
Output variable
Variable
Coil
Preset
ValueIn
ValueOut
Status
Execution condition
Timer set value
Initial timer value
Current timer value
Timer output contact
Description Data type
Bit
Word [signed]
Word [signed]
ANY16
Bit
Function and operation explanation
1) When the execution condition of the input argument Coil turns ON, counting the current value starts.
The timer starts counting from "ValueIn × 10 ms". When it counts up to "Preset × 10 ms", the output argument Status turns ON.
The current measurement value is outputted into ValueOut.
2) When the execution condition of the input argument Coil turns OFF, the current value takes on the value of ValueIn and the output argument Status also turns OFF.
[Structured ladder]
Instance name
Var_M0
10
1
TIMER_10_FB_M
Coil
Preset
ValueIn
ValueOut Var_D10 *1
Status Var_M10 *2
[ ST ]
Instance name (Coil:= Var_M0,Preset:= 10,Valueln:= 1);
Var_D10:=Instance name.ValueOut;
Var_M10:= Instance name.Status;
*1.
Var_D10 is a global label and is defined as D10.
*2.
Var_M10 is a global label and is defined as M10.
timing chart
Var_M0
Value of Var_D10
Var_M10
1
ON
90ms
10
ON
Cautions
1) Expression in each language of function block
*1.
Set the instance when using the function block.
Describe the instance name when programming the function block.
2) For the function block, the automatic allocation device needs to be set as the timer numbers are allocated automatically.
2
3
4
5
6
A
225
FXCPU Structured Programming Manual
(Application Functions)
6.11
TIMER_CONT_FB_M
6 Standard Function Blocks
6.11 TIMER_CONT_FB_M
FX 3U(C) FX 3G FX 2N(C) FX 1N(C) FX 1S FX U /FX 2C FX 0N FX 0(S)
Outline
This function block counts the period of time while the condition is satisfied, and generates an output when the timer counts up the specified time.
1. Format
Function name
Expression in each language
Structured ladder ST
TIMER_
CONT_FB_M
Instance name
TIMER_CONT_FB_M
Coil ValueOut
Preset
ValueIn
Status
TIMER_CONT_FB_M(Coil,
Preset,ValueIn); *1
*1.
Refer to "Cautions".
2. Set data
Input variable
Output variable
Variable
Coil
Preset
ValueIn
ValueOut
Status
Execution condition
Timer set value
Initial timer value
Current timer value
Timer output contact
Description Data type
Bit
Word [signed]
Word [signed]
ANY16
Bit
Function and operation explanation
1) This is a retentive timer that counts the time when the variable is ON. It starts counting the current value when the execution condition of the input argument Coil turns ON.
The timer starts counting from "ValueIn × 1 to 1000 ms". When it counts up to "Preset × 1 to 1000 ms", the output argument Status turns ON.
The current measurement value is outputted into ValueOut.
2) The condition of measurement ValueOut and output argument ON/OFF status is maintained even if the execution condition of the input argument Coil turns OFF.
When the execution condition of the input argument Coil turns ON, the timer resume counting from the measurement it holds.
[Structured ladder]
Instance name
Var_M0
200
0
TIMER_CONT_FB_M
Coil ValueOut
Preset
ValueIn
Status
Var_D10 *1
Var_M10 *2 timing chart
Var_M0
Value of Var_D10
0 1
ON
15 sec
150
ON
5 sec
151-200
[ ST ]
Instance name (Coil:= Var_M0,Preset:= 10,Valueln:= 1);
Var_D10:=Instance name.ValueOut;
Var_M10:=Instance name.Status;
*1.
Var_D10 is a global label and is defined as D10.
*2.
Var_M10 is a global label and is defined as M10.
Var_M10
ON
226
FXCPU Structured Programming Manual
(Application Functions)
6 Standard Function Blocks
6.11 TIMER_CONT_FB_M
Cautions
1) Expression in each language of function block
*1.
Set the instance when using the function block.
Describe the instance name when programming the function block.
2) For the function block, the automatic allocation device needs to be set as the timer numbers are allocated automatically.
1
2
3
4
5
6
A
227
FXCPU Structured Programming Manual
(Application Functions)
6.12
TIMER_100_FB_M
6 Standard Function Blocks
6.12 TIMER_100_FB_M
FX 3U(C) FX 3G FX 2N(C) FX 1N(C) FX 1S FX U /FX 2C FX 0N FX 0(S)
228
Outline
This function block generates an output when the condition continues for the specified time.
The initial value and setting value of the timer is multiplied by 100 ms.
1. Format
Function name
Expression in each language
Structured ladder ST
TIMER_100_FB_M
Instance name
TIMER_100_FB_M
Coil ValueOut
Preset
ValueIn
Status
TIMER_100_FB_M(Coil,
Preset,ValueIn); *1
*1.
Refer to "Cautions".
2. Set data
Input variable
Output variable
Variable
Coil
Preset
ValueIn
ValueOut
Status
Execution condition
Timer set value
Initial timer value
Current timer value
Timer output contact
Description Data type
Bit
Word [signed]
Word [signed]
ANY16
Bit
Function and operation explanation
1) When the execution condition of the input argument Coil turns ON, counting the current value starts.
The timer starts counting from "ValueIn × 100 ms". When it counts up to "Preset × 100 ms", the output argument Status turns ON.
The current measurement value is outputted into ValueOut.
2) When the execution condition of the input argument Coil turns OFF, the current value takes on the value of ValueIn and the output argument Status also turns OFF.
[Structured ladder]
Var_M0
TIMER_100_FB_M
Coil
10 Preset
ValueOut
Status
Var_D10
Var_M10
*1
*2
1 ValueIn
[ ST ]
Instance name
Instance name (Coil:= Var_M0,Preset:= 10,Valueln:= 1);
Var_D10:=Instance name.ValueOut;
Var_M10:=Instance name.Status;
*1.
Var_D10 is a global label and is defined as D10.
*2.
Var_M10 is a global label and is defined as M10.
timing chart
Var_M0
Value of Var_D10
Var_M10
1
ON
900ms
10
ON
Cautions
1) Expression in each language of function block
*1.
Set the instance when using the function block.
Describe the instance name when programming the function block.
2) For the function block, the automatic allocation device needs to be set as the timer numbers are allocated automatically.
advertisement
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Related manuals
advertisement
Table of contents
- 1 Front Cover
- 3 Manual number
- 5 Table of Contents
- 9 Positioning of This Manual
- 12 Related Manuals
- 15 Generic Names and Abbreviations Used in Manuals
- 16 1. Outline
- 16 1.1 Outline of Structured Programs and Programming Languages
- 16 1.1.1 Outline of structured programs
- 17 1.1.2 Programming languages
- 17 1.2 PLC Series and Programming Software Version
- 18 1.3 Cautions on Creation of Fundamental Programs
- 18 1.3.1 I/O processing and response delay
- 19 1.3.2 Double output (double coil) operation and countermeasures
- 20 1.3.3 Circuits not available in structured ladder programs and countermeasures
- 20 1.3.4 Handling of general flags
- 23 1.3.5 Handling of operation error flag
- 24 2. Function List
- 24 2.1 Type Conversion Functions
- 26 2.2 Standard Functions Of One Numeric Variable
- 26 2.3 Standard Arithmetic Functions
- 27 2.4 Standard Bit Shift Functions
- 27 2.5 Standard Bitwise Boolean Functions
- 27 2.6 Standard Selection Functions
- 28 2.7 Standard Comparison Functions
- 28 2.8 Standard Character String Functions
- 28 2.9 Functions Of Time Data Types
- 29 2.10 Standard Function Blocks
- 30 3. Function Construction
- 30 3.1 Applied Function Expression and Execution Type
- 31 3.2 Labels
- 34 3.3 Device and Address
- 35 3.4 EN and ENO
- 36 4. How to Read Explanation of Functions
- 38 5. Applied Functions
- 38 5.1 Type Conversion Functions
- 38 5.1.1 BOOL_TO_INT(_E)
- 40 5.1.2 BOOL_TO_DINT(_E)
- 42 5.1.3 BOOL_TO_STR(_E)
- 44 5.1.4 BOOL_TO_WORD(_E)
- 46 5.1.5 BOOL_TO_DWORD(_E)
- 48 5.1.6 BOOL_TO_TIME(_E)
- 50 5.1.7 INT_TO_DINT(_E)
- 52 5.1.8 DINT_TO_INT(_E)
- 54 5.1.9 INT_TO_BOOL(_E)
- 56 5.1.10 DINT_TO_BOOL(_E)
- 58 5.1.11 INT_TO_REAL(_E)
- 60 5.1.12 DINT_TO_REAL(_E)
- 62 5.1.13 INT_TO_STR(_E)
- 64 5.1.14 DINT_TO_STR(_E)
- 66 5.1.15 INT_TO_WORD(_E)
- 68 5.1.16 DINT_TO_WORD(_E)
- 70 5.1.17 INT_TO_DWORD(_E)
- 72 5.1.18 DINT_TO_DWORD(_E)
- 74 5.1.19 INT_TO_BCD(_E)
- 76 5.1.20 DINT_TO_BCD(_E)
- 78 5.1.21 INT_TO_TIME(_E)
- 80 5.1.22 DINT_TO_TIME(_E)
- 82 5.1.23 REAL_TO_INT(_E)
- 84 5.1.24 REAL_TO_DINT(_E)
- 86 5.1.25 REAL_TO_STR(_E)
- 89 5.1.26 WORD_TO_BOOL(_E)
- 91 5.1.27 DWORD_TO_BOOL(_E)
- 93 5.1.28 WORD_TO_INT(_E)
- 95 5.1.29 WORD_TO_DINT(_E)
- 97 5.1.30 DWORD_TO_INT(_E)
- 99 5.1.31 DWORD_TO_DINT(_E)
- 101 5.1.32 WORD_TO_DWORD(_E)
- 103 5.1.33 DWORD_TO_WORD(_E)
- 105 5.1.34 WORD_TO_TIME(_E)
- 107 5.1.35 DWORD_TO_TIME(_E)
- 109 5.1.36 STR_TO_BOOL(_E)
- 111 5.1.37 STR_TO_INT(_E)
- 113 5.1.38 STR_TO_DINT(_E)
- 115 5.1.39 STR_TO_REAL(_E)
- 118 5.1.40 STR_TO_TIME(_E)
- 120 5.1.41 BCD_TO_INT(_E)
- 122 5.1.42 BCD_TO_DINT(_E)
- 124 5.1.43 TIME_TO_BOOL(_E)
- 126 5.1.44 TIME_TO_INT(_E)
- 128 5.1.45 TIME_TO_DINT(_E)
- 130 5.1.46 TIME_TO_STR(_E)
- 132 5.1.47 TIME_TO_WORD(_E)
- 134 5.1.48 TIME_TO_DWORD(_E)
- 136 5.2 Standard Functions Of One Numeric Variable
- 136 5.2.1 ABS(_E)
- 138 5.3 Standard Arithmetic Functions
- 138 5.3.1 ADD_E
- 140 5.3.2 SUB_E
- 142 5.3.3 MUL_E
- 144 5.3.4 DIV_E
- 146 5.3.5 MOD(_E)
- 148 5.3.6 EXPT(_E)
- 150 5.3.7 MOVE(_E)
- 152 5.4 Standard Bit Shift Functions
- 152 5.4.1 SHL(_E)
- 154 5.4.2 SHR(_E)
- 156 5.5 Standard Bitwise Boolean Functions
- 156 5.5.1 AND_E
- 158 5.5.2 OR_E
- 160 5.5.3 XOR_E
- 162 5.5.4 NOT(_E)
- 164 5.6 Standard Selection Functions
- 164 5.6.1 SEL(_E)
- 166 5.6.2 MAXIMUM(_E)
- 168 5.6.3 MINIMUM(_E)
- 170 5.6.4 LIMITATION(_E)
- 172 5.6.5 MUX(_E)
- 174 5.7 Standard Comparison Functions
- 174 5.7.1 GT_E
- 176 5.7.2 GE_E
- 177 5.7.3 EQ_E
- 178 5.7.4 LE_E
- 180 5.7.5 LT_E
- 181 5.7.6 NE_E
- 183 5.8 Standard Character String Functions
- 183 5.8.1 MID(_E)
- 186 5.8.2 CONCAT(_E)
- 189 5.8.3 INSERT(_E)
- 192 5.8.4 DELETE(_E)
- 194 5.8.5 REPLACE(_E)
- 197 5.8.6 FIND(_E)
- 200 5.9 Functions Of Time Data Types
- 200 5.9.1 ADD_TIME(_E)
- 202 5.9.2 SUB_TIME(_E)
- 204 5.9.3 MUL_TIME(_E)
- 206 5.9.4 DIV_TIME(_E)
- 208 6. Standard Function Blocks
- 208 6.1 R_TRIG(_E)
- 210 6.2 F_TRIG(_E)
- 212 6.3 CTU(_E)
- 214 6.4 CTD(_E)
- 216 6.5 CTUD(_E)
- 219 6.6 TP(_E)
- 221 6.7 TON(_E)
- 223 6.8 TOF(_E)
- 225 6.9 COUNTER_FB_M
- 227 6.10 TIMER_10_FB_M
- 228 6.11 TIMER_CONT_FB_M
- 230 6.12 TIMER_100_FB_M
- 231 Appendix A: Correspondence between Devices and Addresses
- 232 Warranty
- 233 Revision History
- 236 Back Cover