PIC16C84 Microchip Technology, PIC16C84 Datasheet - Page 65

no-image

PIC16C84

Manufacturer Part Number
PIC16C84
Description
8 BIT CMOS EEPROM MICROCONTROLLERS
Manufacturer
Microchip Technology
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
PIC16C84-04/SO
Manufacturer:
MICROCHIP/微芯
Quantity:
20 000
www.DataSheet4U.com
SUBWF
Syntax:
Operands:
Operation:
Status Affected: C, DC, Z
Encoding:
Description:
Words:
Cycles:
Q Cycle Activity:
Example 1:
Example 2:
Example 3:
1998 Microchip Technology Inc.
Subtract W from f
[ label ]
0
d
(f) - (W)
Subtract (2’s complement method) W reg-
ister from register 'f'. If 'd' is 0 the result is
stored in the W register. If 'd' is 1 the
result is stored back in register 'f'.
1
1
SUBWF
Before Instruction
After Instruction
Before Instruction
After Instruction
Before Instruction
After Instruction
Decode
Q1
00
f
[0,1]
REG1
W
C
Z
REG1
W
C
Z
REG1
W
C
Z
REG1
W
C
Z
REG1
W
C
Z
REG1
W
C
Z
127
register 'f'
SUBWF f,d
destination)
0010
Read
Q2
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
3
2
?
?
1
2
1; result is positive
0
2
2
?
?
0
2
1; result is zero
1
1
2
?
?
0xFF
2
0; result is negative
0
REG1,1
Process
dfff
data
Q3
destination
Write to
ffff
Q4
SWAPF
Syntax:
Operands:
Operation:
Status Affected:
Encoding:
Description:
Words:
Cycles:
Q Cycle Activity:
Example
TRIS
Operands:
Syntax:
Operation:
Status Affected: None
Encoding:
Description:
Words:
Cycles:
Example
Swap Nibbles in f
[ label ] SWAPF f,d
0
d
(f<3:0>)
(f<7:4>)
None
The upper and lower nibbles of register
'f' are exchanged. If 'd' is 0 the result is
placed in W register. If 'd' is 1 the result
is placed in register 'f'.
1
1
Before Instruction
After Instruction
Load TRIS Register
[ label ]
5
(W)
The instruction is supported for code
compatibility with the PIC16C5X prod-
ucts. Since TRIS registers are read-
able and writable, the user can directly
address them.
1
1
SWAPF REG,
Decode
To maintain upward compatibility
with future PIC16CXX products,
Q1
00
00
f
f
[0,1]
do not use this instruction.
127
7
TRIS register f;
TRIS
PIC16C84
register 'f'
REG1
REG1
W
0000
1110
(destination<7:4>),
(destination<3:0>)
Read
Q2
DS30445C-page 65
f
0
0110
Process
dfff
=
=
=
data
Q3
0xA5
0xA5
0x5A
destination
0fff
ffff
Write to
Q4

Related parts for PIC16C84