
THE 8051 MICROCONTROLLER: THE PROGRAMMER’S PERSPECTIVE 519
iv) RRC A: Rotate right through carry
e A register is shifted right and the carry bit is moved to D7, while D0 moves into
the carry. See Figure 13.20.
v) SWAP A: is is a special instruction where the lower and upper nibbles of A are
swapped. See Figure 13.21.
Example 13.16
Read in data from port 0. Only the upper four bits of this data is needed. Take the upper
four bits and send it as an output nibble to the lower four bits of port 1.
Solution
ORG 0
MOV P0,#0FFH ;make P0 an input port
MOV A,P0 ;move the content of Port0 to A
ANL A,#0F0H ;mask the lower nibble of A
SWAP ...