Flags function, 2 instructions, To-4 bit conversion – Omron SYSMAC CP CP1E-N@@D@-@ User Manual
Page 233: S: first source word, R: result word
2-197
2 Instructions
CP1E CPU Unit Instructions Reference Manual(W483)
Con
v
e
rs
ion I
n
stru
ctio
ns
2
DMPX
256-to-8 bit conversion
C: Control word
Operand Specifications
Flags
Function
DMPX(077) can perform 16-to-4 bit or 256-to-8 bit conversions. Set the leftmost digit of C to 0 to specify
16-to-4 bit conversion and set it to 1 to specify 256-to-8 bit conversion.
16-to-4 bit Conversion
When the fourth (leftmost) digit of C is 0, DMPX(077) finds the locations of the leftmost or rightmost ON
bits in up to 4 source words and writes these locations to R beginning with the specified digit.
S: First Source Word
S+15 to S: 1st digit of digits to be encoded
S+31 to S+16: 2nd digit of digits to be encoded
R: Result Word
Note The source words must be in the same
data area.
Area
Word addresses
Indirect DM addresses
Constants
CF
Pulse bits
TR bits
CIO
WR
HR
AR
T
C
DM
@DM
*DM
S,R
OK
OK
OK
OK
OK
OK
OK
OK
OK
---
---
---
---
C
OK
Name
Label
Operation
Error Flag
P_ER
• ON if any of the source words contains 0000 hex (i.e., no bit to encode).
• ON if C is not within the specified ranges.
• OFF in all other cases.
R
8
15
Digit 1
Digit 0
0
7
The results of encoding of S to S+15, S+16 to
S+31 are stored from the starting digit going
left (returns to digit 0 after digit 1).
C
1
Specifies the first digit/byte to receive converted data.
0 or 1 (byte 0 or 1)
Number of digits/bytes to be converted
0 or 1 (1 or 2bytes)
8
11
12
15
l
n
0
3
4
7
Bit to encode
0: Leftmost bit (highest bit address)
1: Rightmost bit (lowest bit address)
Conversion process
1: 256-to-8 bits (16-word range to byte)
R
m
C
Leftmost bit
n=2 (Start with digit 2.)
R=1 (Convert
2 words.)
FInds leftmost bit
(Highest bit address)
16-to-4 bit decoding
(Location of leftmost bit (m)
is written to R.)
n
0
0
l
n
p
m
S+1
S
1
1
p
0
15