Extended Instructions
4-124
16-Bit MSP430X CPU
DADDX.A
Add source address-word and carry decimally to destination address-word
DADDX[.W]
Add source word and carry decimally to destination word
DADDX.B
Add source byte and carry decimally to destination byte
Syntax
DADDX.A
src,dst
DADDX
src,dst or DADDX.W src,dst
DADDX.B
src,dst
Operation
src + dst + C
→
dst (decimally)
Description
The source operand and the destination operand are treated as two (.B), four
(.W), or five (.A) binary coded decimals (BCD) with positive signs. The source
operand and the carry bit C are added decimally to the destination operand.
The source operand is not affected. The previous contents of the destination
are lost. The result is not defined for non-BCD numbers. Both operands may
be located in the full address space.
Status Bits
N:
Set if MSB of result is 1 (address-word > 79999h, word > 7999h,
byte > 79h), reset if MSB is 0.
Z:
Set if result is zero, reset otherwise.
C:
Set if the BCD result is too large (address-word > 99999h,
word > 9999h, byte > 99h), reset otherwise.
V: Undefined.
Mode Bits
OSCOFF, CPUOFF, and GIE are not affected.
Example
Decimal 10 is added to the 20-bit BCD counter DECCNTR located in two
words.
DADDX.A
#10h,&DECCNTR ; Add 10 to 20-bit BCD counter
Example
The eight-digit BCD number contained in 20-bit addresses BCD and BCD+2 is
added decimally to an eight-digit BCD number contained in R4 and R5
(BCD+2 and R5 contain the MSDs).
CLRC
; Clear carry
DADDX.W
BCD,R4
; Add LSDs
DADDX.W
BCD+2,R5
; Add MSDs with carry
JC
OVERFLOW
; Result >99999999: go to error routine
...
;
Result ok
Example
The two-digit BCD number contained in 20-bit address BCD is added
decimally to a two-digit BCD number contained in R4.
CLRC
; Clear carry
DADDX.B
BCD,R4
; Add BCD to R4 decimally.
; R4: 000ddh
Summary of Contents for MSP430x4xx Family
Page 1: ...MSP430x4xx Family 2007 Mixed Signal Products User s Guide SLAU056G ...
Page 2: ......
Page 6: ...vi ...
Page 114: ...3 76 RISC 16 Bit CPU ...
Page 304: ...5 20 FLL Clock Module ...
Page 340: ...7 8 Supply Voltage Supervisor ...
Page 348: ...8 8 16 Bit Hardware Multiplier ...
Page 372: ...9 24 32 Bit Hardware Multiplier ...
Page 400: ...10 28 DMA Controller ...
Page 428: ...13 10 Basic Timer1 ...
Page 466: ...15 24 Timer_A ...
Page 522: ...17 30 USART Peripheral Interface UART Mode ...
Page 544: ...18 22 USART Peripheral Interface SPI Mode ...
Page 672: ...23 12 Comparator_A ...
Page 692: ...24 20 LCD Controller ...
Page 746: ...26 28 ADC12 ...