Omron CJ - REFERENCE MANUAL 02-2010 Reference Manual page 459

Table of Contents

Advertisement

Function
GRY(474) converts the gray binary code in the word specified in S at the resolution specified in C using
one of the following conversion modes (binary, BCD, or 360 ), also specified in C, and places the results
in D and D+1.
Conversion mode
Binary Mode
BCD Mode
360 Mode
Hint
GRY(474) is normally used when inputting, through a DC Input Unit, a parallel signal (2n) from an
absolute encoder that outputs a gray binary code.
Note If the word specified for S is allocated to an Input Unit, the input data converted by GRY(474) will be for the
gray binary code from the previous CPU Unit cycle, i.e., it will be one cycle time old.
Example Programming
When CIO 0.00 is ON in the following
example, the gray binary code in CIO 10 is
converted according to the settings in the
control data in D0 to D2 and the result is
output to D200 and D201.
Example 1:
Converting to Binary Data with an 8-bit Resolution and Zero Point Offset of 001A Hex
15
C: D0
C+1: D1
Zero point offset: 001A hex
C+2: D2
User-specified resolution: Not used.
S: 10
0
D: D200
D+1: D201
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Gray binary code is converted to binary data between 0000 0000 and 0000 7FFF hex. Zero point offset and
remainder compensation is applied and then the result is output to D and D+1.
Gray binary code is converted to BCD data. Zero point offset and remainder compensation is applied, the data is
converted to BCD between 0000 0000 and 0003 2767, and then the result is output to D and D+1.
Gray binary code is converted to BCD data. Zero point offset and remainder compensation is applied, the data is
converted to an angle between 0000 0000 and 0000 3599 (0.0 to 359.9 in 0.1 increments), and then the result is
output to D and D+1.
12
11
8
7
4 3
0
0
0
Conversion mode: Binary Mode
Operating mode: Gray binary code conversion
001A
0
000
0
0
0
0
0
0
0
0
0
1
0
Converted and offset.
0017
0000
Function
0.00
0
8
Resolution: 8-bit
1
0
0
1
Gray binary code
Result of binary conversion and offsetting stored.
3. Instructions
GRY
D0
C
S
10
D
D200
423
3

Advertisement

Table of Contents
loading

Table of Contents