CP80S54E ETC2 [List of Unclassifed Manufacturers], CP80S54E Datasheet - Page 22

no-image

CP80S54E

Manufacturer Part Number
CP80S54E
Description
EPROM/ROM-Based 8-Bit Microcontroller Series
Manufacturer
ETC2 [List of Unclassifed Manufacturers]
Datasheet
2.7 Hexadecimal Convert to Decimal (HCD)
Decimal format is another number format for CP80S54/S56. When the content of the data memory has been
assigned as decimal format, it is necessary to convert the results to decimal format after the execution of ALU
instructions. When the decimal converting operation is processing, all of the operand data (including the contents of
the data memory (RAM), accumulator (ACC), immediate data, and look-up table) should be in the decimal format, or
the results of conversion will be incorrect.
Instruction DAA can convert the ACC data from hexadecimal to decimal format after any addition operation and
restored to ACC.
The conversion operation is illustrated in example 2.2.
EXAMPLE 2.2: DAA CONVERSION
Instruction DAS can convert the ACC data from hexadecimal to decimal format after any subtraction
operation and restored to ACC.
The conversion operation is illustrated in example 2.3.
EXAMPLE 2.3: DAS CONVERSION
MOVIA
MOVAR
MOVIA
ADDAR
DAA
MOVIA
MOVAR
MOVIA
SUBAR
DAS
90h
30h
10h
30h, 0
10h
30h
20h
30h, 0
;Set immediate data = decimal format number “90” (ACC
;Load immediate data “90” to data memory address 30H
;Set immediate data = decimal format number “10” (ACC
;Contents of the data memory address 30H and ACC are binary-added
;the result loads to the ACC (ACC
;Convert the content of ACC to decimal format, and restored to ACC
;The result in the ACC is “00” and the carry bit C is “1”. This represents the
;decimal number “100”
;Set immediate data = decimal format number “10” (ACC
;Load immediate data “10” to data memory address 30H
;Set immediate data = decimal format number “20” (ACC
;Contents of the data memory address 30H and ACC are binary-subtracted
;the result loads to the ACC (ACC
;Convert the content of ACC to decimal format, and restored to ACC
;The result in the ACC is “90” and the carry bit C is “0”. This represents the
;decimal number “ -10”
A0h, C
F0h, C
0)
0)
CP80S54/56
90h)
10h)
10h)
20h)
Rev0.1 Nov 30, 2005
P.22/CP80S54/S56

Related parts for CP80S54E