7 APPLICATION INSTRUCTIONS
7.5 Data Processing Instructions
425
7
Encoding from 256 to 8 bits
ENCO(P)
• Stores the binary value corresponding to the bits which are "1" included in the 2
n
-bit data of (S) to (D).
• The value of n can be designated at between 1 and 8.
• If n=0, there will be no operation, and the contents of (D) will not change.
• Bit devices are treated as 1 bit, and word devices as 16 bits.
• If more than 1 bit is at 1, processing will be conducted at the upper bit location.
• In any of the following cases, an operation error occurs, the error flag (SM0) turns ON, and an error code is stored into SD0.
(S): Head number of the device where the data to be encoded is stored (Device name)
(D): Number of the device where the encoding result will be stored (BIN 16 bits)
n: Valid bit length (1 to 8), 0: No processing (BIN 16 bits)
Setting
data
Internal device R, ZR J\ U\G Zn Constant
K, H
Others
Bit Word Bit Word
(S)
(D)
n
Error
code
Error details Q00J/
Q00/
Q01
QnH QnPH QnPRH QnU LCPU
4100 The value of n is other than 0 to 8. All data 2
n
bits from (S) is "0".
4101 The range 2
n
bits from (S) exceeds the range of the corresponding device.
Basic
Process
High
performance
Redundant
Universal
LCPU
n
n
ENCO
ENCOP
D
D
Command
Command
ENCOP
ENCO S
S
7
0
8 6
(Binary value = 6)
543 210
0 1000000
110
S
D