Conversion instructions
666
Part III FP Instructions
F236_DGRY
32-bit data -> 32-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 F236_DGRY (see page 1323)
Variable Data type Function
s source data to be converted
d
ANY32
destination for storing gray code
For Relay T/C Register Constant
s DWX DWY DWR DWL DSV DEV DDT DLD DFL dec. or hex.
d - DWY DWR DWL DSV DEV DDT DLD DFL -
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
F236_DGRY(input_value, output_value);
END_IF;