Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (16.5 MB, 964 trang )
FX3S/FX3G/FX3GC/FX3U/FX3UC Series
7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition
7.5 LDP, LDF, ANDP, ANDF, ORP, ORF
1
Introduction
Explanation of function and operation
1. LDP, ANDP, and ORP instructions (initial logical operation of rising edge pulse, serial
connection of rising edge pulse, and parallel connection of rising edge pulse)
Circuit program
LDP instruction
0000
0002
0004
0005
0006
0008
M0
X001
ORP instruction
M8000
X002
ANDP instruction
LDP
ORP
OUT
LD
ANDP
OUT
2
Overview
X000
List program
X000
X001
M0
M8000
X002
M1
3
Instruction
List
M1
RUN monitor
Timing chart
X000
ORP instruction
ON
X001
ON
Specified the
Device &
Constant
ON
ON
ON
6
ON during
one operation cycle
In the example shown above, M0 or M1 is ON during only one operation cycle when X000 to X002 turn from OFF to
ON.
Before
Programming
M1
5
ON
M8000
X002
ON
ON during one
operation cycle
M0
ANDP instruction
4
ON
Devices
in Detail
LDP instruction
7
Basic
Instruction
8
FNC00-FNC09
Program Flow
9
FNC10-FNC19
Move & Compare
10
FNC20-FNC29
Arith. & Logic
Operation
195
FX3S/FX3G/FX3GC/FX3U/FX3UC Series
7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition
7.5 LDP, LDF, ANDP, ANDF, ORP, ORF
2. LDF, ANDF, and ORF instructions (initial logical operation of falling/trailing edge pulse, serial
connection of falling/trailing edge pulse, and parallel connection of falling/trailing edge pulse)
Circuit program
X000
List program
LDF instruction
0000
0002
0004
0005
0006
0008
M0
X001
M8000
ORF instruction
X002
ANDF instruction
M1
LDF
ORF
OUT
LD
ANDF
OUT
X000
X001
M0
M8000
X002
M1
RUN monitor
Timing chart
LDF instruction
ORF instruction
ON
X000
ON
X001
ON
ON during
one operation cycle
M0
ON
M8000
ANDF instruction
X002
M1
ON
ON
ON
ON
ON during
one operation cycle
In the example shown above, M0 or M1 is ON during only one operation cycle when X000 to X002 turn OFF from ON.
3. Bit specification of a data register (D)*1
A bit in data register (D) can be specified as a device used in LDP, LDF, ANDP, ANDF, ORP and ORF instructions.
When specifying a bit in a data register, input "."
Circuit program
List program
after a data register (D) number, and then input a
bit number (0 to F) consecutively.
Only 16-bit data registers are available.
0000 LDP D0.3
D0.3
Specify a bit number as "0, 1, 2, ... 9, A, B, ... F"
0003 OUT Y000
Y000
from the least significant bit.
Example: In the example shown on the left, LDP
contact turns ON (becomes
conductive) or OFF (becomes nonconductive) when bit 3 of D0 turns ON
or OFF.
*1.
196
This function is supported only in FX3U/FX3UC PLCs.
FX3S/FX3G/FX3GC/FX3U/FX3UC Series
7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition
7.5 LDP, LDF, ANDP, ANDF, ORP, ORF
1
Introduction
4. Output drive side
The following two circuits offer the same operation:
X010
X010
=
M6
PLS
2
M6
Overview
X010
M 6
Operation
cycle
Operation
cycle
3
In each circuit, M6 is ON during only one operation cycle when X010 turns from OFF to ON.
X020
FNC 12
MOV
Instruction
List
K10
D0
=
X020
FNC 12
MOVP
K10
D0
4
In each circuit, MOV instruction is executed only once when X020 turns from OFF to ON.
Devices
in Detail
5
Specified the
Device &
Constant
6
Before
Programming
7
Basic
Instruction
8
FNC00-FNC09
Program Flow
9
FNC10-FNC19
Move & Compare
10
FNC20-FNC29
Arith. & Logic
Operation
197
FX3S/FX3G/FX3GC/FX3U/FX3UC Series
7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition
7.5 LDP, LDF, ANDP, ANDF, ORP, ORF
5. Differences in the operation caused by auxiliary relay (M) numbers
When an auxiliary relay (M) is specified as a device in LDP, LDF, ANDP, ANDF, ORP and ORF instructions, the
operation varies depending on the device number range as shown in the figure below.
[1]
After M0 is driven by X000, all contacts [1] to [4] corresponding to
M0 are activated.
M0
SET
M50
•The contacts [1] to [3] detect the rising edge of M0.
•Because of LD instruction, the contact [4] is conductive
while M0 is ON.
X000
M0
[2] M0
SET
SET
[3]
M51
M52
M0
[4] M0
M53
M2800
M2800
X000
M2800
M2800
M2800
M2800
M2800
SET
M0
SET
M1
M2800
SET
M2
SET
M3
Block B
SET
M4
SET
M5
SET
M6
M2800
M7
198
Block A
Block C
From M2800 driven by X000, the program is divided into the upper
block (block A) and the lower block (block B). In each of the blocks
A and B, only the first contact which detects the rising or falling edge
is activated.
Because of LD instruction, the contact in the block C is conductive
while M2800 is ON.
By utilizing these characteristics, "transition of state by same signal"
in a step ladder circuit can be efficiently programmed.
FX3S/FX3G/FX3GC/FX3U/FX3UC Series
7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition
7.5 LDP, LDF, ANDP, ANDF, ORP, ORF
1
1. Cautions when the LDP, LDF, ANDP, ANDF, ORP, or ORF instruction programmed in the same
step is executed two or more times within one operation cycle
When LDP, LDF, ANDP, ANDF, ORP or ORF instruction programmed in the same step is executed two or more times
within one operation cycle, the following operation results:
• Program between FOR and NEXT instructions
• Program which executes the same subroutine program from two or more
CALL instructions during one operation cycle
• Program which jumps to a label (P) in a smaller step number by CJ
instruction
K
3
FNC 09
NEXT
When a device turns from OFF to ON
1st time: LDP, ANDP or ORP instruction turns ON.
2nd time and later: When the device status is the same as the time when the instruction was executed last, the
instruction turns OFF.
2)
When a device turns OFF from ON
1st time: LDF, ANDF or ORF instruction turns ON.
2nd time and later: When the device status is the same as the time when the instruction was executed last, the
instruction turns OFF.
4
Devices
in Detail
1)
Instruction
List
Operation
X000
FNC 08
FOR
2
Overview
Programs executed two or more times
Introduction
Cautions
2. Cautions on writing during RUN
1)
Instructions for rising edge pulse
When writing is completed during RUN for a circuit including an instruction for rising edge pulse, the instruction for
rising edge pulse is executed if a target device of the instruction for rising edge pulse or the operation condition
device is ON.
Target instructions for rising edge pulse: LDP, ANDP, ORP, and pulse operation type applied instructions (such
as MOVP)
Instruction for rising edge pulse
Instruction for falling edge pulse
OFF
Not executed
Not executed
ON
Executed*1
7
Basic
Instruction
Contact ON/OFF status
(while writing is executed during RUN)
6
Before
Programming
2)
5
Specified the
Device &
Constant
Instructions for falling edge pulse
When writing is completed during RUN for a circuit including an instruction for falling edge pulse (LDF, ANDF, or
ORF instruction), the instruction for falling edge pulse is not executed regardless of the ON/OFF status of the
target device of the instruction for falling edge pulse.
When writing is completed during RUN for a circuit including an instruction for falling edge pulse (PLF instruction),
the instruction for falling edge pulse is not executed regardless of the ON/OFF status of the operation condition
device.
It is necessary to set to ON the target device or operation condition device once and then set it to OFF for
executing the instruction for falling edge pulse.
Not executed
PLS instruction is not executed.
FNC00-FNC09
Program Flow
*1.
8
9
FNC10-FNC19
Move & Compare
10
FNC20-FNC29
Arith. & Logic
Operation
199
FX3S/FX3G/FX3GC/FX3U/FX3UC Series
7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition
7.6
7.6 ORB
ORB
Outline
A circuit in which two or more contacts are connected in series is called serial circuit block.
1. Instruction format
Basic Instruction
ORB
1 step
Mnemonic
ORB
−
OR Block
Operation Condition
Continuous
Operation
Pulse (Single)
Operation
2. Applicable devices
Bit Devices
Instruction
Word Devices
System User
Digit Specification
System User
X Y M T C S D .b KnX KnY KnM KnS T
ORB
Others
Special
Unit
C D R U \G
Index
V
Constant
Z Modify K
Real
CharacPointer
Number ter String
H
E
" "
P
There are no applicable devices.
Explanation of function and operation
1. ORB instruction (parallel connection of multiple contact circuits)
When connecting serial circuit blocks in parallel, use LD or LDI instruction at the start of branch, and use ORB
instruction at the end of branch.
ORB instruction is an independent instruction not associated with any device number in the same way as ANB
instruction described later.
When there are many parallel circuits, ORB instruction can be used for each circuit block to connect them.
Circuit program
X000
List program
X001
Y006
ORB instruction
X002
X003
ORB instruction
X004
Appropriate program
0000 LD
X000
0001 AND X001
0002 LD
X002
0003 AND X003
0004 ORB
0005 LDI X004
0006 AND X005
0007 ORB
0008 OUT Y006
Inappropriate program
0000 LD
X000
0001 AND X001
0002 LD
X002
0003 AND X003
0004 LDI X004
0005 AND X005
0006 ORB
0007 ORB
0008 OUT Y006
X005
Serial circuit block
Caution
There is no limitation in the number of parallel circuits which can be connected by ORB instructions (in the case of
appropriate program shown above).
Though ORB instructions can be used at one time, note that the repeated use of LD or LDI instruction is limited to 8 or
less (in the case of inappropriate program shown above).
200
FX3S/FX3G/FX3GC/FX3U/FX3UC Series
7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition
1
ANB
Introduction
7.7
7.7 ANB
Outline
1. Instruction format
Basic Instruction
ANB
1 step
Mnemonic
ANB
3
Instruction
List
−
AND Block
Operation Condition
Continuous
Operation
Pulse (Single)
Operation
2. Applicable devices
Bit Devices
Word Devices
System User
Digit Specification
System User
X Y M T C S D .b KnX KnY KnM KnS T
ANB
Others
Special
Unit
C D R U \G
Index
V
Constant
Z Modify K
H
Real
CharacPointer
Number ter String
E
" "
P
There are no applicable devices.
Explanation of function and operation
5
ANB
X000
List program
LD
X002
X003
Y007
X004
X005
X006
Parallel block
LD
OR
LD
AND
LDI
AND
ORB
OR
ANB
OR
OUT
X000
X001
X002
X003
X004
X005
6
Branch start point
Parallel block is completed.
X006
X003
Y007
7
It is connected to the
preceding circuit in series.
Basic
Instruction
X003
ORB
0000
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
Before
Programming
X001
Specified the
Device &
Constant
1. ANB instruction (serial connection of multiple parallel circuits)
Circuit program
4
Devices
in Detail
Instruction
2
Overview
Use ANB instruction to connect a branch circuit (parallel circuit block) to the preceding circuit in series.
Use LD or LDI instruction at the start of branch. After completing a parallel circuit block, connect the parallel circuit
block to the preceding circuit in series by ANB instruction.
When there are many parallel circuits, ANB instruction can be used in each circuit block to connect them.
OR instruction before ANB instruction
OR instruction after ANB instruction
8
There is no limitation in the number of ANB instruction.
Though ANB instructions can be used at one time, note that the repeated use of LD or LDI instruction is limited to 8 or
less in the same way as ORB instruction.
FNC00-FNC09
Program Flow
Caution
9
FNC10-FNC19
Move & Compare
10
FNC20-FNC29
Arith. & Logic
Operation
201
FX3S/FX3G/FX3GC/FX3U/FX3UC Series
7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition
7.8
7.8 MPS, MRD, MPP
MPS, MRD, MPP
Outline
FX3G, FX3U FX3GC and FX3UC PLCs have 11 memories called "Stack" which store the intermediate result (ON or OFF)
of operations.
1. Instruction format
Basic Instruction
MPS
1 step
Memory Point Store
−
Basic Instruction
MRD
1 step
Mnemonic
MRD
−
Memory Read
Basic Instruction
MPP
Mnemonic
MPS
1 step
Mnemonic
MPP
−
Memory POP
Operation Condition
Continuous
Operation
Pulse (Single)
Operation
Operation Condition
Continuous
Operation
Pulse (Single)
Operation
Operation Condition
Continuous
Operation
Pulse (Single)
Operation
2. Applicable devices
Bit Devices
Instruction
Word Devices
System User
Digit Specification
System User
X Y M T C S D .b KnX KnY KnM KnS T
Others
Special
Unit
Index
C D R U \G
V
MPS
H
E
" "
P
There are no applicable devices.
MPP
Z Modify K
Real
CharacPointer
Number ter String
There are no applicable devices.
MRD
Constant
There are no applicable devices.
Explanation of function and operation
These instructions are convenient in programming branched multi-output circuits.
1. MPS, MRD, and MPP instructions (stores the current result of the internal PLC operations, reads
the current result of the internal PLC operations, and pops (recalls and removes) the currently
stored result)
18
MPS
X004 X005
X006
MRD
MRD
MPP
Y002
Y003
Y004
X007
Y005
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
LD
MPS
AND
OUT
MRD
AND
OUT
MRD
OUT
MPP
AND
OUT
END
X004
X005
Y002
1
2
3
X006
Y003
Y004
X007
Y005
[2]
[1]
MPP
MRD
MPS
MPP
10
11
Stack
• Use MPS instruction to store the intermediate result of operation, and then drive the output Y002.
• Use MRD instruction to read the stored data, and then drive the output Y003.
MRD instruction can be programmed as many times as necessary.
• In the final output circuit, use MPP instruction instead of MRD instruction.
MPP instruction reads the stored data described above, and then resets it.
Error
MPS instruction can be used two or more times.
However, the difference between number of MPS instructions and the number of MPP instructions should be 11 or
less, and should be 0 at the end.
202
FX3S/FX3G/FX3GC/FX3U/FX3UC Series
7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition
7.8 MPS, MRD, MPP
1
1)
Introduction
Program examples
Program example 1: One stack
Only one stack is used in this example.
Circuit program
List program
MPS
X001
X002
Y000
Y001
MPP
MPS
X004
Y002
X005
Y003
MPP
X006
X007
Y004
X010
Y005
X011
MRD
X012
Y006
Y007
2)
3
Y001
X003
X004
Y002
4
X005
Y003
X006
X007
Y004
5
X010
Y005
X011
Y006
6
X012
Y007
Before
Programming
MPP
X002
Y000
Specified the
Device &
Constant
MRD
2
X000
X001
Devices
in Detail
MPS
LD
AND
MPS
AND
OUT
MPP
OUT
LD
MPS
AND
OUT
MPP
AND
OUT
LD
MPS
AND
OUT
MRD
AND
OUT
MRD
AND
OUT
MPP
AND
OUT
Instruction
List
X003
0000
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
Overview
X000
Program example 2: One stack with ANB and ORB instructions
Circuit program
List program
MPS
7
X001
Y000
X002
X003
X004
Y001
X005
X006
X007
Y002
MPP
X010
X011
X000
X001
X002
8
Y000
X003
X004
X005
X006
9
FNC10-FNC19
Move & Compare
Y003
Y001
X007
Y002
X010
X011
10
FNC20-FNC29
Arith. & Logic
Operation
LD
MPS
LD
OR
ANB
OUT
MRD
LD
AND
LD
AND
ORB
ANB
OUT
MPP
AND
OUT
LD
OR
ANB
OUT
FNC00-FNC09
Program Flow
MRD
0000
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
Basic
Instruction
X000
Y003
203
FX3S/FX3G/FX3GC/FX3U/FX3UC Series
7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition
3)
7.8 MPS, MRD, MPP
Program example 3: Two stacks
Circuit program
X000
List program
X001
X002
Y000
MPS
X003
MPS
Y001
MPP
X004
X005
Y002
MPP
X006
MPS
Y003
MPP
4)
0000
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
LD
MPS
AND
MPS
AND
OUT
MPP
AND
OUT
MPP
AND
MPS
AND
OUT
MPP
AND
OUT
X000
X001
X002
Y000
X003
Y001
X004
X005
Y002
X006
Y003
Program example 4: Four stacks
Circuit program
MPS
X000
List program
MPS
X001
MPS
X002
MPS
X003
X004
Y000
Y001
MPP
Y002
MPP
Y003
0000
0001
0002
0003
0004
0005
0006
0007
0008
LD
MPS
AND
MPS
AND
MPS
AND
MPS
AND
0000
0001
0002
0003
0004
0005
0006
0007
0008
0009
LD
OUT
AND
OUT
AND
OUT
AND
OUT
AND
OUT
X000
X001
X002
X003
X004
0009
0010
0011
0012
0013
0014
0015
0016
0017
OUT
MPP
OUT
MPP
OUT
MPP
OUT
MPP
OUT
Y000
Y001
Y002
Y003
Y004
MPP
Y004
MPP
X000
Y004
X001
Y003
X002
Y002
X003
Y001
X004
X000
Y004
X001
Y003
X002
Y002
X003
Y001
X004
Y000
Y000
In programming a circuit on the upper side, it is necessary to MPS instruction three times.
By changing the circuit on the upper side into the circuit on the lower side, the same contents can be programmed
easily without MPS instruction.
204
FX3S/FX3G/FX3GC/FX3U/FX3UC Series
7 Basic Instruction
Programming Manual - Basic & Applied Instruction Edition
1
MC, MCR
Introduction
7.9
7.9 MC, MCR
Outline
2
Overview
When MC instruction is executed, the bus line (LD or LDI point) is moved to a position after MC contact.
The bus line can be returned to the original position by MCR instruction.
By changing a device (Y or M) number, MC instruction can be used as many times as necessary.
If the same device number is used twice, however, it results in the double coil operation in the same way as OUT
instruction.
1. Instruction format
Basic Instruction
MC
Mnemonic
−
Master Control
Basic Instruction
MCR
2 steps
Mnemonic
MCR
Operation Condition
Continuous
Operation
Pulse (Single)
Operation
4
→ For the number of steps of MC instruction, refer to Section 7.16.
Devices
in Detail
−
Master Control
Reset
3
Operation Condition
Continuous
Operation
Pulse (Single)
Operation
Instruction
List
MC
2. Applicable devices
Bit Devices
Word Devices
System User
Digit Specification
System User
X Y M T C S D .b KnX KnY KnM KnS T
Others
Special
Unit
C D R U \G
Index
V
Constant
Z Modify K
H
Real
CharacPointer
Number ter String
E
" "
P
MC
MCR
There are no applicable devices.
6
: Except special auxiliary relays (M)
1. MC and MCR instructions (denotes the start of a master control block and denotes the end of a
master control block)
MC
N 0
M100
X001
M100
Y000
X002
Y001
N 0
0004
0005
0006
0007
0008
LD
MC
SP
LD
OUT
LD
OUT
MCR
9
X000
N000
Three-step instruction
M100
X001
Y000
X002
Y001
N 0 ← Two-step instruction
10
FNC20-FNC29
Arith. & Logic
Operation
MCR
0000
0001
FNC10-FNC19
Move & Compare
N0
List program
8
FNC00-FNC09
Program Flow
Circuit program
7
Basic
Instruction
When MC instruction is executed, the bus line is moved to a position after MC contact.
Drive instructions connected to the bus line after the MC contact execute each operation only when the MC instruction
is executed, and execute each operation in the contact OFF status regardless of the contact status before drive
instructions when a MC instruction is not executed. If an instruction (such as FOR/NEXT, EI and DI instruction) not
requiring a contact instruction exists in a circuit using master control, such an instruction is executed regardless of the
MC instruction execution command.
In the program example below, the instructions from MC to MCR are executed as they are while the input X000 is ON.
However, while the input X000 is OFF, each driven device offers the following operation:
Timers (except retentive type timers) and devices driven by OUT instruction: Turn OFF.
Retentive type timers, counters and devices driven by SET/RST instruction: Hold the current status.
The expressions of circuit programs used to explain operations are circuits (for reading or monitoring) of GX Works2
and GX Developer.
Before
Programming
Explanation of function and operation
X000
5
Specified the
Device &
Constant
Instruction
← Write MCR N0 instruction.
205