Encode And Decode - Siemens SIMATIC S7 System Manual

Hide thumbs Also See for SIMATIC S7:
Table of Contents

Advertisement

Program instructions
7.5 Convert
7.5.5

Encode and decode

LAD / FBD
STL
ENCO IN, OUT
DECO IN, OUT
Non-fatal error conditions with ENO =
0
0006H Indirect address
Input / output
Data type
IN
WORD (ENCO)
BYTE (DECO)
OUT
BYTE (ENCO)
WORD (DECO)
Example: Encode and decode
LAD
252
Description
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.
SM bits affected
None
Operand
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
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
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.
STL
Network 1
LD I3.1
DECO AC2, VW40
ENCO AC3, VB50
System Manual, V2.3, 07/2017, A5E03822230-AF
S7-200 SMART

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Simatic s7-200 smart

Table of Contents