Texas Instruments MSP430x1xx User Manual page 104

Texas instruments modules and peripherals user's guide
Table of Contents

Advertisement

Instruction Set
SWPB
Swap bytes
Syntax
SWPB
Operation
Bits 15 to 8 <−> bits 7 to 0
Description
The destination operand high and low bytes are exchanged as shown in
Figure 3−18.
Status Bits
Status bits are not affected.
Mode Bits
OSCOFF, CPUOFF, and GIE are not affected.
Figure 3−18. Destination Operand Byte Swap
Example
MOV
SWPB
Example
The value in R5 is multiplied by 256. The result is stored in R5,R4.
SWPB
MOV
BIC
BIC
RISC 16−Bit CPU
3-68
dst
15
#040BFh,R7
R7
R5
R5,R4
#0FF00h,R5
#00FFh,R4
8
7
; 0100000010111111 −> R7
; 1011111101000000 in R7
;
;Copy the swapped value to R4
;Correct the result
;Correct the result
0

Advertisement

Table of Contents
loading

Table of Contents