The 8051 Microcontroller and Embedded

(lily) #1
Department of Computer Scien

ce and Information Engineering

National Cheng Kung University, TAIWAN
HANEL
ROTATE INSTRUCTIONAND DATA
SERIALIZATION

SWAP(cont’)


(a) Find the contents of register A in the following code.(b) In the absence of a SWAP instruction, how would you
exchange the nibbles? Write a simple program to show the process.
Solution:(a)


MOV A,#72H ;A = 72HSWAP A ;A = 27H
(b)

MOV A,#72H ;A = 0111 0010RL A ;A = 0111 0010RL A ;A = 0111 0010RL A ;A = 0111 0010RL A ;A = 0111 0010
Free download pdf