Conversion instructions
665
Part III FP Instructions
F235_GRY
16-bit data -> 16-bit Gray code
This instruction also exists as a P instruction (for FP2/2SH, FP3/5, FP10/10SH PLC types), which
is only executed at the rising edge of the EN trigger. Select [Insert P instruction] from the
"Instructions" pane if you require a P instruction. To facilitate reuse, the instruction then appears
under "Recently used" in the pop-up menu. Press <Ctrl>+<Shift>+<v> within the programming
area to open the list of recently used elements.
PLC types
Availability of F235_GRY (see page 1323)
Variable Data type Function
s source data to be converted
d
ANY16
destination for storing gray codes
For Relay T/C Register Constant
s WX WY WR WL SV EV DT LD FL dec. or hex.
d - WY WR WL SV EV DT LD FL -
In this example, the input variable input_value is declared. However, you can write a constant
directly at the input contact of the function instead.
Description
The function converts a value at input s to a gray code value. The result of the conversion is
returned at output d.
Data types
Operands
Example
In this example, the same POU header is used for all programming languages. For an example
using IL (instruction list), please refer to the online help.
POU header
All input and output variables used for programming this function have been declared in the POU
header.
Body
When the variable start is set to TRUE, the function is carried out.
LD
ST
When programming with structured text, enter the following:
IF start THEN
F235_GRY(input_value, output_value);
END_IF;