22 Applied Instructions (External Device)
22.1 GRY / Decimal to Gray Code Conversion
568
FXCPU Structured Programming Manual
[Basic & Applied Instruction]
Function and operation explanation
1. 16-bit operation (GRY, GRYP)
1) The device specified by can store a value from 0 to 32,767.
2. 32-bit operation (DGRY, DGRYP)
1) A binary value can be converted into a gray code of up to 32 bits.
2) The device specified by can store a value from 0 to 2,147,483,647.
Cautions
1) The data conversion speed depends on the scan time of the PLC.
2) Some restrictions to applicable devices
S1: The FX
3G, FX3GC, FX3U and FX3UC PLCs only are applicable.
S2: The FX
3U and FX3UC PLCs only are applicable.
Word device storing
data after conversion
[Structured ladder/FBD] [ST]
GRY(EN,s,d);
When the data specified by is K1234 and
the device specified by is K3Y10
s
d
This instruction converts and transfers data from the
source (binary) to the destination (gray code).
GRY
EN ENO
d
s
Conversion source data
or word device storing
conversion source data
Command
input
BIN 1234
0100101100100000
b0
b15
110111010110
Y23 Y20Y17 Y10
GRY 1234
Word device storing
data after conversion
[Structured ladder/FBD] [ST]
DGRY(EN,s,d);
DGRY
EN ENO
d
s
Command
input
Conversion source data
or word device storing
conversion source data