2-381
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Conversion Instructions
2
Gray
Gray
The Gray instruction converts a gray code into an angle.
* 0 to 359.999999999999
The Gray instruction converts the gray code in In to an integer, compensates (decreases) it by encoder
remainder correction ERC and zero point correction ZPC. It then converts the result to an angle accord-
ing to resolution Resolution. The conversion result Out will be an angle in degrees.
Instruction Name FB/FUN Graphic expression ST expression
Gray Gray Code Conver-
sion
FUN Out:=Gray(In, Resolution,
ERC, ZPC);
Variables
Name Meaning I/O Description Valid range Unit Default
In Data to
convert
Input
Gray code to convert Depends on data type.
---
0
Resolution Resolution Resolution _R256, _R1B to
_R15B, _R360, _R720,
or _R1024
_R256
ERC Encoder
remainder
correction
Encoder remainder
correction
0 to Resolution 0
ZPC Zero point
correction
Zero point correction
Out Conver-
sion result
Output Conversion result * °
---
Boolean
Bit strings Integers
Real
numbers
Times, durations,
dates, and text strings
BOOL
BYTE
WORD
DWORD
LWORD
USINT
UINT
UDINT
ULINT
SINT
INT
DINT
LINT
REAL
LREAL
TIME
DATE
TOD
DT
STRING
In OK
Resolution Refer to Function for the enumerators of the enumerated type _eGRY_RESOLUTION.
ERC OK
ZPC OK
Out OK
Function
(@)Gray
EN ENO
In Out
Resolution
ERC
ZPC