Sample program, 2 instructions, To-4 bit conversion – Omron SYSMAC CP CP1E-N@@D@-@ User Manual
Page 235: Example of multi-digit decoding, Example of 16-to-4 bit decoding

2-199
2 Instructions
CP1E CPU Unit Instructions Reference Manual(W483)
Con
v
e
rs
ion I
n
stru
ctio
ns
2
DMPX
Sample program
16-to-4 bit Conversion
When CIO 0.00 is ON in the following example, DMPX(077) will find the leftmost ON bits in CIO 100,
CIO 101, and CIO 102 and write those locations to 3 digits in R beginning with digit 1 (the second digit),
as indicated by C (#0021).
Example of multi-digit decoding
• Example of 16-to-4 bit decoding
C: #
R: D100
S
R
C
Digits
DMPX(077) finds the
leftmost ON bits.
Starting digit
(Digit 1)
0.00
0
3
4
7
8
15
12 11
0
3
4
7
8
15
12 11
1
2
0
0
0
1
2
3
5
A
2
1
1
1
0
1
2
3
4
5
6
7
8
9
15 14 13 12 11 10
DMPX
100
D100
#0021
S: 100
101
102
C: #0032
C: #0011
C: #0030
C: #0013
R
R
R
R
Digit 1
Digit 3
Digit 1
Digit 3
Digit 1
Digit 3
Digit 1
Digit 3
Digit 2
Digit 0
Digit 2
Digit 0
Digit 2
Digit 0
Digit 2
Digit 0
S
S+1
15
0
S
S+1
S+2
S+3
15
0
8
11
12
15
0
3
4
7
S
S+1
15
0
8
11
12
15
0
3
4
7
8
11
12
15
0
3
4
7
S
S+1
S+2
S+3
15
0
8
11
12
15
0
3
4
7