431
3. Instructions
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Conversion Instructions
3
BIN_GRAY/BIN_GRAYL
Function
z BIN_GRAY(480)
BIN_GRAY(480) converts one word of binary data to one word of gray code. S specifies the source
word containing the binary data and the gray code is output to D.
z BIN_GRAYL(481)
BIN_GRAYL(481) converts two words of binary data to two words of gray code. S specifies the first of
the two words containing the binary data and the gray code is output to D and D+1.
Example Programming
z BIN_GRAY
When CIO 0.01 turns ON in the following example, the binary data in D10 is converted to gray code and
stored in D0.
z BIN_GRAYL
When CIO 0.01 turns ON in the following example, the binary data in D10 and D11 is converted to gray
code and stored in D0 and D1.
BIN_GRAY
D10
D0
0.01
D10
#11DF
D0
#1930
Result of executing
BIN_GRAY
BIN_GRAYL
D10
D0
0.01
D10 and D11
#1C19F1EF
D0 and D1
#12150918
Result of executing
BIN_GRAYL