Program instructions
7.5 Convert
S7-200 SMART
System Manual, 09/2015, A5E03822230-AC
215
Encode writes the bit number of the least significant bit set in the input word IN, to
the least significant "nibble" (4 bits) of the output byte OUT.
Decode sets the bit in the output word OUT that corresponds to the bit number
represented by the least significant "nibble" (4 bits) of the input byte IN. All other
bits of the output word are set to 0.
Non-fatal error conditions with ENO =
0
• 0006H Indirect address
None
IN
IW, QW, VW, MW, SMW, SW, T, C, LW, AC, AIW, *VD, *LD, *AC, Constant
IB, QB, VB, MB, SMB, SB, LB, AC, *VD, *LD, *AC, Constant
OUT
IB, QB, VB, MB, SMB, SB, LB, AC, *VD, *LD, *AC
IW, QW, VW, MW, SMW, SW, T, C, LW, AC, AQW, *VD, *LD, *AC
Example: Encode and decode
If AC2 contains error bits:
1. The DECO instruction
sets the bit in VW40 that
corresponds to this error
code
2. The ENCO instruction
converts the least signif-
icant bit set to an error
code that is stored in
VB50.
LD I3.1
DECO AC2, VW40
ENCO AC3, VB50