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
24 Others – FNC181 to FNC189
Programming Manual - Basic & Applied Instruction Edition
24.5 FNC189 – HCMOV / High-Speed Counter Move
21
1)
Current value update timing
Hardware counter
When OUT instruction for the counter is executed
Software counter
Every time a pulse is input
By using DHCMOV instruction, the current value can be updated and transferred when it is executed.
2)
23
Effect of DHCMOV instruction
Program EI (FNC 04) and FEND (FNC 06) instructions in the main program. They are necessary to execute an
input interrupt program.
→ For EI (FNC 04) and FEND (FNC 06) instructions, refer to Section 8.5 and Section 8.7.
2)
When programming DHCMOV instruction in the 1st line in an input interrupt program, make sure to use the
pattern program shown below. Make sure to use the command contact M8394. Do not add, change, or delete this
pattern program when writing during RUN. Interrupt programs may not operate normally.
M8394
FNC189
DHCMOV
S
D
n
Pattern program for using the
DHCMOV instruction in an interrupt
program
27
FNC210-FNC219
Data
Operation 3
1)
26
FNC200-FNC209
Character String
Control
When programming DHCMOV instruction in an input interrupt program, the following points should be observed.
For assignment of pointers for input interrupt and inputs, refer to the table shown in 5) below.
25
FNC190-FNC199
Block Data
Operation
Cautions
24
FNC181-FNC189
Others
• When DHCMOV instruction is used just before a comparison instruction (CMP, ZCP or comparison contact
instruction), the latest value of a high-speed counter is used in comparison. The following points must be kept
in mind when using the DHCMOV command.
- When the current value of a high-speed counter is compared using CMP, ZCP or comparison contact
instruction (not using a designated high-speed counter comparison instruction), a hardware counter does
not change into a software counter.
→ For the condition in which a hardware counter is handled as a software counter, refer to Subsection 4.8.9.
- When the number of high-speed software counter comparison instructions is reduced, the total frequency
limitation is decreased.
→ For the limitation in software counters by the total frequency, refer to Subsection 4.8.10.
- When it is necessary to execute comparison and change an output contact (Y) as soon as the current value
of a high-speed counter changes, use a designated high-speed counter comparison instruction (HSCS,
HSCR or HSZ).
- DHCMOV instruction can be used as many times as necessary.
FNC180
Alternate
Instructions
• By using both input interrupt and DHCMOV instruction, the current value of a high-speed counter can be
received at the rising edge or falling edge of an external input (at reception of input interrupt).
→ Refer to the Program example 2.
I
22
FNC170-FNC179
External Device
High-speed counter current value update timing
When a pulse is input to an input terminal for a high-speed counter (C235 to C255), the high-speed counter
executes up-counting or down-counting.
If the current value of a high-speed counter is handled in an applied instruction such as the normal MOV
instruction, the current value is updated at the timing shown in the table below. As a result, it is affected by the
program scan time.
FNC160-FNC169
Real Time Clock
Control
2. High-speed counter current value update timing and the effect of DHCMOV instruction
28
FNC220-FNC249
Data
Comparison
Program to be processed as input
interrupt
FNC 03
IRET
29
FNC250-FNC269
Data Table
Operation
30
FNC270-FNC276
Ex-Device
597
FX3S/FX3G/FX3GC/FX3U/FX3UC Series
24 Others – FNC181 to FNC189
Programming Manual - Basic & Applied Instruction Edition
3)
24.5 FNC189 – HCMOV / High-Speed Counter Move
If two or more DHCMOV instructions are used in one input interrupt program, only the first instruction (just after
the interrupt pointer) is executed when the interrupt is generated.
The rest of the interrupt, including additional DHCMOV instructions, is executed according to normal interrupt
processing.
Do not use M8394 as the command contact for the DHCMOV instructions following the first.
I301
M8394
M8000
FNC189
DHCMOV
S
FNC189
DHCMOV
S
'
D
When the input X003 turns from OFF
to ON (that is, when input interrupt is
accepted):
S → [ D +1, D ]
n
D
'
n'
FNC 03
IRET
4)
When this instruction is executed in
interrupt program:
S ' → [ D ' +1, D ' ]
It is not permitted to use DHCMOV instruction for the same counter in two or more input interrupt programs.
I000 M8394
FNC189
DHCMOV
C236
D0
FNC03
IRET
Same counter
I200
M8394
FNC189
DHCMOV
K0
C236
D2
K1
FNC03
IRET
5)
While input interrupts are disabled by the interrupt disable flags (shown in the table below), DHCMOV instructions
are not executed when they are placed inside a corresponding interrupt.
Interrupt disable flag
Corresponding interrupt pointer
Input number corresponding to interrupt pointer
M8050*1
I000,I001
X000
M8051*1
I100,I101
X001
M8052*1
I200,I201
X002
M8053*1
I300,I301
X003
M8054*1
I400,I401
X004
M8055*1
I500,I501
X005
*1.Cleared when the PLC mode is changed from RUN to STOP.
6)
If an input interrupt is generated while input interrupts are disabled by something other than the interrupt disable
flags M8050 to M8055 (after execution of DI instruction and before execution of EI instruction), DHCMOV
instruction is immediately executed, but execution of the interrupt program is held. The interrupt program will be
executed after EI instruction is executed and interrupts are enabled.
Function change depending on the version
The function of FNC189 instruction changes depending on the version as shown in the table below.
Applicable version
FX3U
Ver. 2.20 or
later
Ver. 2.20 or
later
Item
FX3UC
Target device
Outline of function
Ring counter (D8099 and D8398) can be specified in
S
.
Error
An operation error occurs in the following case; The error flag M8067 turns ON, and the error code is stored in D8067.
• When a device specified in
598
S
or [ D
+1,
D
] is outside the allowable range (error code: K6705)
FX3S/FX3G/FX3GC/FX3U/FX3UC Series
24 Others – FNC181 to FNC189
Programming Manual - Basic & Applied Instruction Edition
24.5 FNC189 – HCMOV / High-Speed Counter Move
21
1. Program example 1
In the program example below, the current value of the high-speed counter C235 is compared in each operation cycle,
and then the output Y000 is set to ON if the current value is "K500" or more (when the current value of C235 is not
cleared).
FNC189
DHCMOV
FNC238
DAND>=
D0
C235
K500
K0*1
Y000
D0
The current value of C235 is
transferred to D1 and D0.
(The current value of C235 is not
cleared.)
In the case of "(D1, D0) ≥ K500",
Y000 is set to ON.
23
FNC180
Alternate
Instructions
END
*1.
K0: The current value of the high-speed counter is not cleared when DHCMOV instruction is executed.
K1: The current value of the high-speed counter is cleared when DHCMOV instruction is executed.
2. Program example 2
FNC 04
EI
25
M8394
FNC189
DHCMOV
C235
D200
K1*2
*2.
When X001 turns from OFF to ON, the
interrupt program from I101 to IRET is
executed.
The current value of C235 is
transferred to D201 and D200.
(The current value of C235 is cleared
to “0”.)
26
FNC200-FNC209
Character String
Control
FNC 03
IRET
FNC190-FNC199
Block Data
Operation
FNC 06
FEND
I101
24
FNC181-FNC189
Others
In the program example shown below, the current value of C235 is transferred to D201 and D200, and the current
value of C235 is cleared when X001 turns from OFF to ON.
0
22
FNC170-FNC179
External Device
M8000
FNC160-FNC169
Real Time Clock
Control
Program examples
K0: The current value of the high-speed counter is not cleared when DHCMOV instruction is executed.
K1: The current value of the high-speed counter is cleared when DHCMOV instruction is executed.
27
FNC210-FNC219
Data
Operation 3
28
FNC220-FNC249
Data
Comparison
29
FNC250-FNC269
Data Table
Operation
30
FNC270-FNC276
Ex-Device
599
FX3S/FX3G/FX3GC/FX3U/FX3UC Series
25 Block Data Operation – FNC190 to FNC199
Programming Manual - Basic & Applied Instruction Edition
25. Block Data Operation – FNC190 to FNC199
FNC190 to FNC199 provide instructions for adding, subtracting and comparing block data.
FNC No.
190
–
–
191
–
–
192
BK+
BK+
S1 S2 D n
Block Data Addition
Section 25.1
193
BK–
BK-
S1 S2 D n
Block Data Subtraction
Section 25.2
194
BKCMP=
BKCMP= S1 S2 D n
Block Data Compare
S1 = S2
Section 25.3
195
BKCMP>
BKCMP> S1 S2 D n
Block Data Compare
S1 > S2
Section 25.3
196
BKCMP<
BKCMP< S1 S2 D n
Block Data Compare
S1 < S2
Section 25.3
197
BKCMP<>
BKCMP<> S1 S2 D n
Block Data Compare
S1 ≠ S2
Section 25.3
198
BKCMP<=
BKCMP<= S1 S2 D n
Block Data Compare
S1 ≤ S2
Section 25.3
199
600
Mnemonic
Symbol
Function
Reference
BKCMP>=
BKCMP>= S1 S2 D n
Block Data Compare
S1 ≥ S2
Section 25.3
FX3S/FX3G/FX3GC/FX3U/FX3UC Series
25 Block Data Operation – FNC190 to FNC199
Programming Manual - Basic & Applied Instruction Edition
21
FNC192 – BK+ / Block Data Addition
FNC160-FNC169
Real Time Clock
Control
25.1
25.1 FNC192 – BK+ / Block Data Addition
Outline
22
This instruction adds binary block data.
FNC 192
P
BK+
D
16-bit Instruction
9 steps
Mnemonic
Operation Condition
BK+
BK+P
32-bit Instruction Mnemonic
Operation Condition
DBK+
17 steps
DBK+P
Continuous
Operation
Pulse (Single)
Operation
Continuous
Operation
Pulse (Single)
Operation
FNC180
Alternate
Instructions
16- or 32-bit binary
24
Description
Head device number storing addition data
S2
Added constant or head device number storing addition data
D
Head device number storing operation result
n
FNC181-FNC189
Others
S1
Number of data
3. 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
C
D
Others
Special
Unit
R U \G
Index
V
Constant
Z
K
Modify
Real
CharacPointer
Number ter String
H
E
" "
P
S1
S2
26
D
FNC200-FNC209
Character String
Control
n
Explanation of function and operation
1. 16-bit operation (BK+ and BK+P)
Command
input
FNC192
BK+
S1
27
S2
D
"n" 16-bit binary data starting from
S2
n
are added to "n" 16-bit binary data starting from
operation result is stored in "n" points starting from
+0
+1
+2
+(n-2)
+(n-1)
S2
"n"
points
+
+0
+1
+2
+(n-2)
+(n-1)
K-1234
K4000
b15
b0
K4000
K1234
K-1234
+0
+1
+2
"n"
points
+(n-2)
+(n-1)
K5000
K4321
K-1234
K4000
+
S2
K4321
28
"n"
points
K3766
K8321
29
.
D
"n"
points
b15
b0
K5234
K5801
K-3234
+0
+1
+2
+(n-2)
+(n-1)
b15
b0
K5555
K8888
K2321
"n"
points
30
K3087
K8321
FNC270-FNC276
Ex-Device
+(n-2)
+(n-1)
b15
b0
K1234
K4567
K-2000
+0
+1
+2
D
A (16-bit) constant from -32768 to +32767 can be directly specified in S2
S1
, and the
FNC250-FNC269
Data Table
Operation
2)
b15
b0
K1234
K4567
K-2000
S1
.
FNC220-FNC249
Data
Comparison
S1
D
FNC210-FNC219
Data
Operation 3
1)
25
FNC190-FNC199
Block Data
Operation
Operand
Type
23
Data Type
2. Set data
Operand Type
FNC170-FNC179
External Device
1. Instruction format
601