PIC18C242 MICROCHIP [Microchip Technology], PIC18C242 Datasheet - Page 229

no-image

PIC18C242

Manufacturer Part Number
PIC18C242
Description
High-Performance Microcontrollers with 10-Bit A/D
Manufacturer
MICROCHIP [Microchip Technology]
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
PIC18C242-I/SO
Manufacturer:
MICROCHIP
Quantity:
2 000
Part Number:
PIC18C242/JW
Manufacturer:
NS
Quantity:
10
SUBWFB
Syntax:
Operands:
Operation:
Status Affected:
Encoding:
Description:
Words:
Cycles:
Q Cycle Activity:
7/99 Microchip Technology Inc.
Decode
Q1
register ’f’
Subtract WREG from f with
Borrow
[ label ] SUBWFB f,d,a
0
d
a
(f) – (WREG) – (C)
N,OV, C, DC, Z
Subtract WREG and the carry flag
(borrow) from register 'f' (2’s com-
plement method). If 'd' is 0, the
result is stored in WREG. If 'd' is
1, the result is stored back in reg-
ister 'f' (default). If ’a’ is 0, the
Access Bank will be selected,
overriding the BSR value. If ’a’ is
1, then the bank will be selected
as per the BSR value (default).
1
1
Read
Q2
0101
f
[0,1]
[0,1]
255
10da
Process
Data
Q3
ffff
dest
destination
Write to
Q4
ffff
Preliminary
SUBWFB
Example 1:
Example2:
Example3:
Before Instruction
After Instruction
Before Instruction
After Instruction
Before Instruction
After Instruction
REG
WREG
C
REG
WREG
C
Z
N
REG
WREG
C
REG
WREG
C
Z
N
REG
WREG
C
REG
comp]
WREG
C
Z
N
SUBWFBREG, 0, 0
SUBWFBREG, 1, 0
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
Subtract WREG from f with
Borrow (cont’d)
SUBWFB
0x19
0x0D
1
0x0C
0x0D
1
0
0
0x1B
0x1A
0
0x1B
0x00
1
1
0
0x03
0x0E
1
0xF5
0x0E
0
0
1
PIC18CXX2
; result is positive
; result is zero
; result is negative
REG, 1, 0
(0001 1011)
(0000 1101)
(1111 0100) [2’s
(0000 1101)
DS39026B-page 229
(0001 1001)
(0000 1101)
(0000 1011)
(0000 1101)
(0001 1011)
(0001 1010)
(0000 0011)

Related parts for PIC18C242