Lessons
2012 Microchip Technology Inc. DS41628B-page 57
3.5.5 New Instructions
3.5.5.1 BOTH
3.5.5.1.1 swapf
This allows nibbles to be switched. A nibble consists of four bits and a byte contains
two nibbles. For example:
EXAMPLE 3-19:
ADC is performed. ADRESH is full with ADC result of b'10100011’.
EXAMPLE 3-20:
FIGURE 3-3: SWAPF DIAGRAM
TABLE 3-18: NEW INSTRUCTIONS FOR BOTH DEVICES
Instruction English Purpose
SWAPF Swapf WREG with register Swap nibbles
TABLE 3-19: BEFORE SWAPF
Registers Value
WREG B’01100110’
TABLE 3-20: BEFORE SWAPF
Registers Value
ADRESH B’10100011’
TABLE 3-21: AFTER SWAPF
Registers After swapf
WREG B’0011-1010’
ADRESH B’1010-0011’
swapf ADRESH, w ; now perform the swapf and save in WREG, leaving
ADRESH intact
ADRESH
WREG
1 0 1 0 0 0 1 1
1 0 1 00 0 1 1