7 Applied Instructions
7.3 Arithmetic and Logical Operation
193
FXCPU Structured Programming Manual
(Basic & Applied Instruction)
1
Outline
2
Instruction List
3
Configuration of
Instruction
4
How to Read
Explanation of
Instructions
5
Basic Instruction
6
Step Ladder
Instructions
7
Applied
Instructions
8
Interrupt Function
and Pulse Catch
Function
A
Relationships
between devices
and addresses
Function and operation explanation
1. 16-bit operation(INC, INCP)
The contents of the device specified by is incremented by "1", and the increment result is transferred to
.
2. 32-bit operation(DINC, DINCP)
The contents of the device specified by is incremented by "1", and the increment result is transferred to
.
Cautions
1) When handling array data or 32-bit data in a structured program, a 16-bit device cannot be specified
directly as in the case of a simple project. Use a label to handle array data or 32-bit data.
A 32-bit counter can be specified directly as it is a 32-bit long device.
Use a global label to specify a device.
2) The FX
0, FX0S or FX0N PLC does not support the instructions of pulse operation type.
To execute pulse operation, make the instruction execution condition pulse type.
3) Note that data is incremented in every operation cycle in a continuous operation type instruction.
4) In a 16-bit operation, when "+32,767" is incremented by "1", the result is "-32,768". Flags (zero, borrow
and carry) are not activated at this time.
5) In a 32-bit operation, when "+2,147,483,647" is incremented by "1", the result is "-2,147,483,648". Flags
(zero, borrow and carry) are not activated at this time.
6) Some restrictions to applicable devices
S1:The FX
3U, FX3UC and FX3G PLCs only are applicable.
S2:The FX
3U and FX3UC PLCs only are applicable.
Program examples
Command input
+1 addition data
+1 →
d d
INC
EN ENO
d
Command input
Label1
*1
*1 This defines the device that stores the data to be added by "1".
DINC
EN ENO
d
d
[ +1, ] +1 → [ +1, ]
dd d
0 → (Z)
(C 0Z) → (K4Y000)
BIN BCD
(Z)+1 → (Z)
When (Z) is 10
M 1=ON
The current values of counter C0 to C9 are BCD
converted, and the result is outputted into
K4Y000.
Z is cleared by reset input X010.
Every time X011 turns ON, the current values
are outputted one at a time in the order of
C0, C1, ... and C9.
X010
MOVP
EN
s
ENO
d
K0
Z
M1
Z
INCP
EN ENO
d
BCDP
EN
s
ENO
d
CN0Z
K4Y000
X011
CMPP
EN
s1
s2
ENO
d
K10
Z
M0
[Structured ladder]
[ ST ]
MOVP(X010 OR M1, K0, Z);
BCDP(X011, CN0Z, K4Y000);
INCP(X011, Z);
CMPP(X011, K10, Z, M0);