2-355
2 Instructions
CP1E CPU Unit Instructions Reference Manual(W483)
Basic I/O Unit Instructions
2
SDEC
Function
Precaution
If more than one digit is specified for conversion in Di, digits are converted in order toward the most-
significant digit. Digit 0 is the next digit after digit 3.
Results are stored in D in order from the specified portion toward higher-address words. If just one of
the bytes in a destination word receives converted data, the other byte is left unchanged.
Sample program
When CIO 0.00 turns ON in the following example, the contents of the 3 digits beginning with digit 1 in
D100 will be converted from hexadecimal data to 7-segment data, and the results will be output to the
upper byte of D200 and both bytes of D201. The specifications of the bytes to be converted and the
location of the output bytes are made in CIO 100.
SDEC(078) regards the data specified by
S as 4-digit hexadecimal data, converts the
digits specified in S by Di (first digit and
number of digits) to 7-segment data and
outputs the results to D in the bits specified
in Di.
Number of digits
Rightmost 8 bits (0)
7-segment
First digit to convert
S
S+1
n
m
D
D+1
D+2
Di 0 1/0
811
1215
mn
03
47
HEX
SDEC
D100
100
D200
0.00
S
Di
D
8111215
3210
0347
1
811
1215
21F
1
71
5B06
03
47
Hexadecimal to 7-segment data conversion
(F 71, 1 06, and 2 5B)
S: D100
Di: 100 3
D: D200
D201