Conversion instructions
657
Part III FP Instructions
F90_DECO
Decode hexadecimal -> bit state
n specifies the starting bit position and the number of bits to be decoded using hexadecimal data:
Bit No. 0 to 3: number of bits to be decoded
Bit No. 8 to 11: starting bit position to be decoded
(The bits No. 4 through No. 7 and No. 12 through No. 15 are invalid.)
e.g. when n = 16#0404, four bits beginning at bit position four are decoded.
Relationship between number of bits and occupied data area for decoded result:
Number of bits to
be decoded
Data area required for
the result
Valid bits in the area for
the result
1 1-word 2-bit*
2 1-word 4-bit*
3 1-word 8-bit*
4 1-word 16-bit
5 2-word 32-bit
6 4-word 64-bit
7 8-word 128-bit
8 16-word 256-bit
*Invalid bits in the data area required for the result are set to 0.
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 F90_DECO (see page 1326)
Variable Data type Function
s source 16-bit area or equivalent constant to be decoded
n control data to specify the starting bit position and number of
bits to be decoded
d
ANY16
starting 16-bit area for storing decoded data (destination)
The variables s, n and d have to be of the same data type.
Description
Decodes the contents of 16-bit data specified by s according to the contents of n if the trigger EN is
in the ON-state. The decoded result is stored in the area starting with the 16-bit area specified by
d.
Data types