6. Standard Function Blocks. Mitsubishi Electronics Mitsubishi Digital Electronics Welding System FXCPU, FXCPU


Add to my manuals
236 Pages

advertisement

6. Standard Function Blocks. Mitsubishi Electronics Mitsubishi Digital Electronics Welding System FXCPU, FXCPU | Manualzz

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

Was this manual useful for you? Yes No
Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Related manuals

Download PDF

advertisement

Table of contents