6 BASIC INSTRUCTIONS
6.3 Data Conversion Instructions
283
6
Conversion from BIN 16-bit data to Gray code, conversion from
BIN 32-bit data to Gray code
GRY(P), DGRY(P)
■GRY
• Converts BIN 16-bit data at the device designated by (S) to Gray code, and stores result at device designated by (D).
■DGRY
• Converts BIN 32-bit data at the device designated by (S) to Gray code, and stores result at device designated by (D).
• In any of the following cases, an operation error occurs, the error flag (SM0) turns ON, and an error code is stored into SD0.
(S): BIN data or head number of the devices where the BIN data is stored (BIN 16/32 bits)
(D): Head number of the devices where the converted Gray code will be stored (BIN 16/32 bits)
Setting
data
Internal device R, ZR J\ U\G Zn Constant
K, H
Others
Bit Word Bit Word
(S)
(D)
Error
code
Error details Q00J/
Q00/
Q01
QnH QnPH QnPRH QnU LCPU
4100 The data at (S) is a negative value.
Basic
Process
High
performance
Redundant
Universal
LCPU
Command
Command
S D
DS
GRYP, DGRYP
GRY, DGRY
P
indicates an instruction symbol of GRY, DGRY.
b15
0
BIN 1234
0
0 0 0
1
0 0
1 1
0
1
0 0
1
0
b0
16 bits
b15
0
Gray code 1234
0
0 0 0 1 1 0 1 0 1 1 1 0 11
b0
S
D
0
BIN 305419896
001 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 00
b31 b16 b0b15
+1 (Upper 16 bits) (Lower 16 bits)
0
Gray code 305419896
001 1 0 1 1 0 0 1 0 1 1 1 0 0 1 1 1 1 1 0 1 0 1 0 0 0 1 00
+1
S
D
b31 b16 b0b15
S S
D D