|
Topic: DMD0024 GRAY - Gray Code to Integer |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The Gray Code to Integer instruction (GRAY) converts a 16 bit Gray code value to an integer value. This instruction is designed for use with devices that use the gray code numbering scheme.
Gray codes are often used in linear encoders and rotary encoders in preference to straightforward binary encoding. This avoids the possibility that, when several bits change in the binary representation of an angle, a misread could result from some of the bits changing before others. Rotary encoders especially benefit from the cyclic nature of Gray codes, because the first and last values of the sequence differ by only one bit. |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The Gray Code to Integer instruction will directly convert a gray code number to an integer for devices having a resolution of 512 or 1024 counts per revolution.
For a device having a resolution of 360 counts per revolution you must subtract 76 from the converted value to obtain the correct result (360-Excess-76 Gray Code).
For a device having a resolution of 720 counts per revolution you must subtract 152 from the converted value to obtain the correct result (720-Excess-152 Gray Code).
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Parameters:Note: Use the F9 key (Element Browser) or Down-Arrow key (Auto-Complete) at any time to see a complete list of the memory locations that are valid in the current field of the instruction.
Input Value - designates the memory location that contains the Gray code value. This can be any constant value or any readable numeric location.
Output Value - designates a memory location to store the converted value. This can be any writable numeric location.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
See Also:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Rung Example:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||