322
FX3S/FX3G/FX3GC/FX3U/FX3UC Series
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
b01234567
1
2
4
8
16
32
64
128
←
2
n
S
b15
…
When the value of b0 to
b3 of D0 is "14"
0000000000000010
←
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
………
K1K2K3K4K5K6K7K8
M255
M0M1M2M3M4M5M6M7M8M9
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).
0001000000000000
←
n
D
S
K1K2K3
0 1 1
1
2
4
←
2
n
S
X0X1X2
b0b1b2b3b4b5b6b7b8b9b10b11b12b13b14b15
=D0