298
FX
3U
/FX
3UC
Series Programmable Controllers
Programming Manual - Basic & Applied Instruction Edition
12 Data Operation – FNC 40 to FNC 49
12.2 FNC 41 – DECO / Decode
Program example
1. When setting bit devices to ON according to the value of a data register
The value of D0 (whose current value is "14" in this example) is decoded to M0 to M15.
• When the value of b0 to b3 of D0 is "14 (= 0 + 2 + 4 + 8)", M14 (which is the 15th from M0) becomes "1"
(turn ON).
• When the value of D0 is "0", M0 becomes "1" (turns ON).
• When "n" is set to "K4", either one point among M0 to M15 turns ON according to the value of D0 (0 to 15).
• By changing "n" from K1 to K8, D0 can correspond to numeric values from 0 to 255.
However, because the device range of
is occupied for decoding accordingly, such device range
should not be used for another control.
2. Turning ON the bit out of word devices according to the contents of bit devices
The value expressed by X000 to X002 is decoded to D0 (X000 and X001 are ON, and X002 is OFF in this
example.).
• When the values expressed by X000 to X002 are "3 (= 1 + 2 + 0)", b3 (which is the 4th from b0) becomes
1 (turns ON).
• When all of X000 to X002 are "0" (OFF), b0 becomes "1" (turns ON).
M8000
FNC 41
DECO
D 0
M 0
K 4
S
D
n
Turns ON when D0 is K0.
(D0 b4 to b15)
0
0
0
0
1
1
1
0
b0
1
2
3
4
5
6
7
1
2
4
8
16
32
64
128
←
2
n
S
b15
…
When the value of b0 to
b3 of D0 is "14"
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
←
n = K4
D
Up to 256 bits (The number of occupied bits varies depending on the specified "n" value.)
Up to
M31
Up to
M63
Up to
M127
Up to
M255
…
…
…
K1
K2
K3
K4
K5
K6
K7
K8
M255
M0
M1
M2
M3
M4
M5
M6
M7
M8
M9
M
10
M
11
M
12
M
13
M
14
M
15
When is M0
Ignored
4 bits
(D0 b0 to b3)
D
1
D
M8000
FNC 41
DECO
X000
D0
K3
S
D
n
Turns ON when all
bits of are OFF.
All of these bits are
"0" (OFF).
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
←
n
D
S
K1
K2
K3
0
1
1
1
2
4
←
2
n
S
X0
X1
X2
b0
b1
b2
b3
b4
b5
b6
b7
b8
b9
b10
b11
b12
b13
b14
b15
=D0