![Mitsubishi Electric MELSEC FX3G Programming Manual Download Page 609](http://html.mh-extra.com/html/mitsubishi-electric/melsec-fx3g/melsec-fx3g_programming-manual_239083609.webp)
607
FX
3G
/FX
3U
/FX
3UC
Series Programmable Controllers
Programming Manual - Basic & Applied Instruction Edition
22 External Device – FNC170 to FNC179
22.1 FNC170 – GRY / Decimal to Gray Code Conversion
21
FN
C
160-
FN
C
169
R
eal T
im
e C
lo
ck
C
ont
ro
l
22
FN
C
170-
FN
C
179
Exter
nal D
ev
ice
23
FN
C
180
Al
ter
nate
In
str
uc
tions
24
FN
C
181-
FN
C
189
O
ther
s
25
FN
C
190-
FN
C
199
B
lock D
ata
O
per
at
ion
26
FN
C
200
-F
N
C
20
9
C
har
acter
S
tring
C
ont
ro
l
27
FN
C
210-
FN
C
219
Da
ta
O
per
ation 3
28
FN
C
220-
FN
C
249
Da
ta
C
om
par
ison
29
FN
C
250
-F
N
C
26
9
D
ata T
abl
e
O
per
ati
on
30
FN
C
270-
FN
C
274
Ex
-D
ev
ice
Inv
ert
er
Com
m
s
22.1
FNC170 – GRY / Decimal to Gray Code Conversion
Outline
This instruction converts a binary value into a gray code, and transfers it.
1. Instruction format
2. Set data
3. Applicable devices
S
:This function is supported only in FX
3U
/FX
3UC
PLCs.
Explanation of function and operation
1. 16-bit operation (GRY and GRYP)
-
can store a value from 0 to 32767.
2. 32-bit operation (DGRY and DGRYP)
- A binary value can be converted into a gray code of up to 32 bits.
-
can store a value from 0 to 2,147,483,647.
Caution
The data conversion speed depends on the scan time of the PLC.
Operand Type
Description
Data Type
Conversion source data or word device storing conversion source data
16- or 32-bit binary
Word device storing data after conversion
16- or 32-bit binary
Oper-
and
Type
Bit Devices
Word Devices
Others
System User
Digit Specification
System User
Special
Unit
Index
Con-
stant
Real
Number
Charac-
ter String
Pointer
X Y M T C S D
.b KnX KnY KnM KnS T C D R U
\G
V Z Modify K H
E
"
"
P
3
3
3
3
3 3 3 3
S
3 3
3
3 3
3
3
3
3 3 3 3
S
3 3
3
DGRY
DGRYP
Mnemonic
Operation Condition
P
FNC 170
GRY
D
16-bit Instruction
5 steps
GRY
GRYP
Mnemonic
Operation Condition
Continuous
Operation
Pulse (Single)
Operation
32-bit Instruction
9 steps
Continuous
Operation
Pulse (Single)
Operation
S
D
S
D
BIN 1234
1
1
0
1
1
1
0
1
0
1
1
0
0
1
0
0
1
0
1
1
0
0
1
0
0
0
0
0
b0
b15
This instruction converts and transfers data from
the source (binary) to the destination (gray code).
FNC170
GRY
Y23
Y20 Y17
Y10
GRY 1234
When is K1234 and is K3Y10
Command
input
D
S
S
D
S
S