PIC16(L)F1615/9
14/20-Pin, 8-Bit Flash Microcontroller
Description
PIC16(L)F1615/9 microcontrollers deliver on-chip features that are unique to the design for embedded control of small
motors and general purpose applications in 14/20-pin count packages. Features like 10-bit A/D, CCP, 24-bit SMT and
Zero-Cross Detection offer an excellent solution to the variety of applications. The product family also has a CRC+
memory scan and Windowed WDT to support safety-critical systems in home appliances, white goods and other end
equipment.
Core Features
Digital Peripherals
• C Compiler Optimized RISC Architecture
• Only 49 Instructions
• Operating Speed:
- DC – 32 MHz clock input
- 125 ns minimum instruction cycle
• Interrupt Capability
• 16-Level Deep Hardware Stack
• One 8-Bit Timer
• Four 16-bit Timers
• Low Current Power-on Reset (POR)
• Configurable Power-up Timer (PWRT)
• Brown-out Reset (BOR) with Selectable Trip Point
• Windowed Watchdog Timer (WWDT):
- Variable prescaler selection
- Variable window size selection
- All sources configurable in hardware or
software
• Configurable Logic Cell (CLC):
- Four CLCs
- Integrated combinational and sequential logic
• Complementary Waveform Generator (CWG):
- Rising and falling edge dead-band control
- Full-bridge, half-bridge, 1-channel drive
- Multiple signal sources
• Two Capture/Compare/PWM (CCP) modules
• PWM: Two 10-bit Pulse-Width Modulators
• Two Signal Measurement Timers (SMT):
- 24-bit timer/counter with prescaler
- Multiple gate and clock inputs
• Angular Timer:
- Single pulse
- Multiple pulses with missing pulse recovery
• 8-Bit Timers (TMR2+HLT/4/6):
- Up to 3 Timer2/4/6 with Hardware Limit Timer
(HLT)
- Monitors Fault Conditions: Stall, Stop, etc.
- Multiple modes
- 8-bit timer/counter with prescaler
- 8-bit period register and postscaler
- Asynchronous H/W Reset sources
• Math Accelerator with Proportional-IntegralDerivative (PID):
- Four operation modes
- Add and multiply
- Simple multiplier
- Multiply and Accumulate
- Programmable PID controller
• Cyclic Redundancy Check with Memory Scan
(CRC/SCAN):
- Software configurable
• Serial Communications:
- Enhanced USART (EUSART)
- SPI, I2C, RS-232, RS-485, LIN compatible
- Auto-Baud Detect, Auto-Wake-up on start
Memory
•
•
•
•
8 KW Flash Program Memory
1024 Bytes Data SRAM
Direct, Indirect and Relative Addressing modes
High-Endurance Flash Data Memory (HEF):
- 128 B of nonvolatile data storage
- 100K erase/write cycles
Operating Characteristics
• Operating Voltage Range:
- 1.8V to 3.6V (PIC16LF1615/9)
- 2.3V to 5.5V (PIC16F1615/9)
• Temperature Range:
- Industrial: -40°C to 85°C
- Extended: -40°C to 125°C
eXtreme Low-Power (XLP) Features
• Sleep mode: 50 nA @ 1.8V, typical
• Watchdog Timer: 500 nA @ 1.8V, typical
• Operating Current:
- 8 uA @ 32 kHz, 1.8V, typical
- 32 uA/MHz @ 1.8V, typical
2014-2017 Microchip Technology Inc.
DS40001770D-page 1
PIC16(L)F1615/9
• Up to 17 I/O Pins and One Input-only Pin:
- Individually programmable pull-ups
- Slew rate control
- Interrupt-on-change with edge-select
- Two High Current Drive pins
• Peripheral Pin Select (PPS):
- Enables pin mapping of digital I/O
Intelligent Analog Peripherals
• 10-Bit Analog-to-Digital Converter (ADC):
- Up to 12 external channels
- Conversion available during Sleep
• Two Comparators (COMP):
- Low-Power/High-Speed mode
- Up to three external inverting inputs
- Fixed Voltage Reference at non-inverting
input(s)
- Comparator outputs externally accessible
• 8-Bit Digital-to-Analog Converter (DAC):
- 8-bit resolution, rail-to-rail
- Positive Reference Selection
• Voltage Reference:
- Fixed Voltage Reference (FVR): 1.024V,
2.048V and 4.096V output levels
• Zero-Cross Detect (ZCD):
- Detect when AC signal on pin crosses
ground
• Two High-Current Drive Pins:
- 100mA @ 5V
2014-2017 Microchip Technology Inc.
Clocking Structure
• 16 MHz Internal Oscillator:
- ±1% at calibration
- Selectable frequency range from 32 MHz to
31 kHz
• 31 kHz Low-Power Internal Oscillator
• 4x Phase-Locked Loop (PLL):
- For up to 32 MHz internal operation
• External Oscillator Block with:
- Three external clock modes up to 32 MHz
- One crystal resonator mode up to 32 MHz
• Fail-Safe Clock Monitor:
- Allows for safe shutdown if peripheral clock
stops
• Two-Speed Oscillator Start-up
• Oscillator Start-up Timer (OST)
DS40001770D-page 2
Program Memory Flash
(W)
Program Memory Flash
(kB)
Data SRAM
(bytes)
High Endurance Flash
(bytes)
I/O Pins
8-bit Timer with HLT
16-bit Timer
Angular Timer
Windowed Watchdog
Timer
24-bit SMT
Comparators
10-bit ADC (ch)
Zero-Cross Detect
CCP/10-bit PWM
CWG
CLC
CRC with Memory Scan
Math Accelerator with PID
High-Current I/O 100mA
PPS
EUSART
I2C/SPI
PIC12/16(L)F161X FAMILY TYPES
Data Sheet Index
2014-2017 Microchip Technology Inc.
TABLE 1:
PIC12(L)F1612
(A)
2048
3.5
256
256
6
4
1
0
Y
1
1
4
1
2/0
1
0
Y
0
0
N
0
0
PIC16(L)F1613
(A)
2048
3.5
256
256
12
4
1
0
Y
2
2
8
1
2/0
1
0
Y
0
0
N
0
0
PIC16(L)F1614
(B)
4096
7
512
128
12
4
3
1
Y
2
2
8
1
2/2
1
2
Y
1
2
Y
1
1
PIC16(L)F1615
(C)
8192
14
1024
1024
12
4
3
1
Y
2
2
8
1
2/2
1
4
Y
1
2
Y
1
1
PIC16(L)F1618
(B)
4096
7
512
128
18
4
3
1
Y
2
2
12
1
2/2
1
2
Y
1
2
Y
1
1
PIC16(L)F1619
(C)
8192
14
1024
1024
18
4
3
1
Y
2
2
12
1
2/2
1
4
Y
1
2
Y
1
1
Device
Note 1:
Debugging Methods: (I) – Integrated on Chip; E – using Emulation Product
Data Sheet Index:
A.
DS40001737
PIC12(L)F1612/16(L)F1613 Data Sheet, 8/14-Pin, 8-bit Flash Microcontrollers
B.
DS40001769
PIC16(L)F1614/8 Data Sheet, 14/20-Pin, 8-bit Flash Microcontrollers
C.
DS40001770
PIC16(L)F1615/9 Data Sheet, 14/20-Pin, 8-bit Flash Microcontrollers
For other small form-factor package availability and marking information, please visit
http://www.microchip.com/packaging or contact your local sales office.
DS40001770D-page 3
PIC16(L)F1615/9
Note:
PIC16(L)F1615/9
TABLE 2:
PACKAGES
Packages
PIC16(L)F1615
PIC16(L)F1619
Note:
PDIP
SOIC
DFN
UDFN
TSSOP
QFN
UQFN
SSOP
Pin details are subject to change.
PIN DIAGRAMS
14-pin PDIP, SOIOC, TSSOP
1
14
RA5
RA4
2
13
VSS
RA0/ICSPDAT
3
4
12
RA1/ICSPCLK
MCLR/VPP/RA3
11
RA2
RC5
5
10
RC0
RC4
6
9
RC1
RC3
7
8
RC2
VDD
NC
NC
Vss
16-pin UQFN
PIC16(L)F1615
VDD
16 15 14 13
1
12
16
11
)
(L
2
C
PI
3
10
F1
61
4
5
RA5
RA4
RA3/MCLR/VPP
RC5
6 7
8
RC4
RC3
RC2
RC1
5
9
RA0
RA1
RA2
RC0
20-pin PDIP, SOIC, SSOP
1
20
VSS
RA5
2
19
RA0
RA1
MCLR/VPP/RA3
3
4
18
17
RA2
RC5
5
16
RC0
RC4
6
15
RC1
RC3
7
14
RC2
RC6
8
13
RB4
RC7
9
12
RB5
RB7
10
11
RB6
RA4
2014-2017 Microchip Technology Inc.
PIC16(L)F1619
VDD
DS40001770D-page 4
PIC16(L)F1615/9
RA4
RA5
VDD
Vss
RA0
20-pin QFN, UQFN
L)
F1
16
(
1
2
3
4
5
PI
C
RA3/MCLR/VPP
RC5
RC4
RC3
RC6
61
9
20 19 18 17 16
15
14
13
12
11
RA1
RA2
RC0
RC1
RC2
RC7
RB7
RB6
RB5
RB4
6 7 8 9 10
2014-2017 Microchip Technology Inc.
DS40001770D-page 5
Reference
Comparator
Timers
CCP
CWG
ZCD
CLC
EUSART
SMT
Angular Timer
MSSP
PWM
High Current I/O
Interrupt
Pull-up
Basic
RA0
13
12
AN0
DAC1OUT1
C1IN+
—
—
—
—
—
—
—
—
—
—
—
IOC
Y
ICSPDAT
RA1
12
11
AN1
VREF+
C1IN0C2IN0-
—
—
—
—
—
—
—
—
—
—
—
IOC
Y
ICSPCLK
RA2
11
10
AN2
—
—
T0CKI(1)
—
CWG1IN(1)
ZCD1IN
—
—
—
—
—
—
—
INT
IOC
Y
—
RA3
4
3
—
—
—
T6IN(1)
—
—
—
—
—
SMTWIN2(1)
—
—
—
—
IOC
Y
MCLR/VPP
RA4
3
2
AN3
—
—
(1)
—
—
—
—
—
SMTSIG1(1)
—
—
—
—
IOC
Y
CLKOUT
RA5
2
1
—
—
—
T1CKI(1)
T2IN(1)
—
—
—
—
—
SMTWIN1(1)
—
—
—
—
IOC
Y
CLKIN
RC0
10
9
AN4
—
C2IN+
T5CKI(1)
—
—
—
—
—
—
—
SCK(1,3)
—
—
IOC
Y
—
RC1
9
8
AN5
—
C1IN1C2IN1-
T4IN(1)
—
—
—
—
—
RC2
8
7
AN6
—
C1IN2C2IN2-
—
—
—
—
—
—
RC3
7
6
AN7
—
C1IN3C2IN3-
T5G(1)
CCP2(1)
—
—
CLCIN0(1)
RC4
6
5
—
—
—
T3G(1)
—
—
—
RC5
5
4
—
—
—
T1G
(1)
T3CKI
CCP1
(1)
(1)
—
SDI
—
—
IOC
Y
—
—
—
—
—
—
IOC
Y
—
—
—
ATCC1(1)
SS(1)
—
—
IOC
Y
—
CLCIN1(1)
CK(1)
—
ATCC2(1)
—
—
HIC4
IOC
Y
—
—
ATIN(1)
(1)
—
—
HIC5
IOC
Y
—
—
—
—
RX(1,3)
SMTSIG2
(1)
ATCC3
VDD
1
16
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
VDD
VSS
14
13
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
VSS
—
—
—
—
C1OUT
—
CCP1
CWG1A
DT(3)
—
—
SDO
PWM3OUT
—
—
—
—
DS40001770D-page 6
OUT(2)
Note
1:
2:
3:
ZCD1OUT CLC1OUT
—
—
—
—
C2OUT
—
CCP2
CWG1B
—
CLC2OUT
CK
—
—
SCK(3)
PWM4OUT
—
—
—
—
—
—
—
—
—
—
—
CWG1C
—
—
TX
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
CWG1D
—
—
—
—
—
—
—
—
—
—
—
Default peripheral input. Input can be moved to any other pin with the PPS input selection registers.
All pin outputs default to PORT latch data. Any pin can be selected as a digital peripheral output with the PPS output selection registers.
These peripheral functions are bidirectional. The output pin selections must be the same as the input pin selections.
PIC16(L)F1615/9
I/O
A/D
14/16-PIN ALLOCATION TABLE (PIC16(L)F1615)
16-Pin UQFN
TABLE 3:
14-Pin PDIP, SOIC, TSSOP
2014-2017 Microchip Technology Inc.
PIN ALLOCATION TABLES
A/D
Reference
Timers
CCP
CWG
ZCD
CLC
EUSART
SMT
Angular Timer
MSSP
PWM
High Current I/O
Interrupt
Pull-up
19
16
AN0
DAC1OUT
C1IN+
—
—
—
—
—
—
—
—
—
—
—
IOC
Y
ICSPDAT
RA1
18
15
AN1
VREF+
C1IN0C2IN0-
—
—
—
—
—
—
—
—
—
—
—
IOC
Y
ICSPCLK
RA2
17
14
AN2
—
—
T0CKI(1)
—
CWG1IN(1)
ZCD1IN
—
—
—
—
—
—
—
INT
IOC
Y
—
RA3
4
1
—
—
—
T6IN(1)
—
—
—
—
—
SMTWIN2(1)
—
—
—
—
IOC
Y
MCLR
VPP
RA4
3
20
AN3
—
—
T1G(1)
—
—
—
—
—
SMTSIG1(1)
—
—
—
—
IOC
Y
CLKOUT
RA5
2
19
—
—
—
T1CKI(1)
T2IN(1)
—
—
—
CLCIN3(1)
—
SMTWIN1(1)
—
—
—
—
IOC
Y
CLKIN
RB4
13
10
AN10
—
—
—
—
—
—
—
—
—
—
SDI(1)
—
—
IOC
Y
—
—
—
—
—
—
IOC
Y
—
Y
—
12
9
AN11
—
—
—
—
—
—
—
RB6
11
8
—
—
—
—
—
—
—
—
—
—
—
SCK(1,3)
—
—
IOC
RB7
10
7
—
—
—
—
—
—
—
—
CK(1)
—
—
—
—
—
IOC
Y
—
RC0
16
13
AN4
—
C2IN+
—
—
—
—
—
—
—
—
—
—
IOC
Y
—
RC1
15
12
AN5
—
C1IN1C2IN1-
T4IN(1)
—
—
—
CLCIN2(2)
—
SMTSIG2(1)
—
—
—
—
IOC
Y
—
RC2
14
11
AN6
—
C1IN2C2IN2-
—
—
—
—
—
—
—
—
—
—
—
IOC
Y
—
RC3
7
4
AN7
—
C1IN3C2IN3-
T5G(1)
CCP2(1)
—
—
CLCIN0(1)
—
—
ATCC(1)
—
—
—
IOC
Y
—
RC4
6
3
—
—
—
T3G(1)
—
—
—
CLCIN1(1)
—
—
—
—
—
HIC4
IOC
Y
—
RC5
5
2
—
—
—
T3CKI(1)
CCP1(1)
—
—
—
—
—
ATIN(1)
—
—
HIC5
IOC
Y
—
RC6
8
5
AN8
—
—
—
—
—
—
—
—
—
—
SS(1)
—
—
IOC
Y
—
RC7
9
6
AN9
—
—
—
—
—
—
—
—
—
—
—
—
—
IOC
Y
—
VDD
1
18
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
VSS
20
17
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
Note
1:
2:
3:
T5CKI
Default peripheral input. Input can be moved to any other pin with the PPS input selection registers.
All pin outputs default to PORT latch data. Any pin can be selected as a digital peripheral output with the PPS output selection registers.
These peripheral functions are bidirectional. The output pin selections must be the same as the input pin selections.
PIC16(L)F1615/9
DS40001770D-page 7
RB5
(1)
RX
(1,3)
Basic
20-Pin UQFN
RA0
Comparator
20-Pin PDIP, SOIC, SSOP
20-PIN ALLOCATION TABLE (PIC16(L)F1619)
I/O
2014-2017 Microchip Technology Inc.
TABLE 4:
Note
1:
2:
3:
Reference
Comparator
Timers
CCP
CWG
ZCD
CLC
EUSART
MSSP
PWM
High Current I/O
Interrupt
Pull-up
Basic
—
—
—
C1OUT
—
CCP1
CWG1A
ZCD1OUT
CLC1OUT
DT(3)
—
—
SDO
PWM3OUT
—
—
—
—
—
—
—
—
C2OUT
—
CCP2
CWG1B
—
CLC2OUT
CK
—
—
SCK(3)
PWM4OUT
—
—
—
—
—
—
—
—
—
—
—
CWG1C
—
CLC3OUT
TX
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
CWG1D
—
CLC4OUT
—
—
—
—
—
—
—
—
—
Angular Timer
A/D
—
SMT
20-Pin UQFN
OUT(2)
20-PIN ALLOCATION TABLE (PIC16(L)F1619)
20-Pin PDIP, SOIC, SSOP
I/O
2014-2017 Microchip Technology Inc.
TABLE 4:
Default peripheral input. Input can be moved to any other pin with the PPS input selection registers.
All pin outputs default to PORT latch data. Any pin can be selected as a digital peripheral output with the PPS output selection registers.
These peripheral functions are bidirectional. The output pin selections must be the same as the input pin selections.
PIC16(L)F1615/9
DS40001770D-page 8
PIC16(L)F1615/9
TABLE OF CONTENTS
Device Overview ................................................................................................................................................................................. 11
Enhanced Mid-Range CPU ................................................................................................................................................................. 19
Memory Organization .......................................................................................................................................................................... 21
Device Configuration ........................................................................................................................................................................... 66
Oscillator Module ................................................................................................................................................................................ 73
Resets ................................................................................................................................................................................................. 84
Interrupts ............................................................................................................................................................................................. 92
Power-Down Mode (Sleep) ............................................................................................................................................................... 109
Windowed Watchdog Timer (WDT) .................................................................................................................................................. 112
Flash Program Memory Control ........................................................................................................................................................ 120
Cyclic Redundancy Check (CRC) Module ........................................................................................................................................ 136
I/O Ports ............................................................................................................................................................................................ 148
Peripheral Pin Select (PPS) Module ................................................................................................................................................. 170
Interrupt-On-Change ......................................................................................................................................................................... 178
Fixed Voltage Reference (FVR) ........................................................................................................................................................ 184
Temperature Indicator Module .......................................................................................................................................................... 187
Analog-to-Digital Converter (ADC) Module ....................................................................................................................................... 189
8-bit Digital-to-Analog Converter (DAC1) Module ............................................................................................................................. 203
Comparator Module .......................................................................................................................................................................... 207
Zero-Cross Detection (ZCD) Module ................................................................................................................................................ 215
Timer0 Module .................................................................................................................................................................................. 221
Timer1/3/5 Module with Gate Control ............................................................................................................................................... 224
Timer2/4/6 Module ............................................................................................................................................................................ 235
Master Synchronous Serial Port (MSSP) Module ............................................................................................................................. 260
Enhanced Universal Synchronous Asynchronous Receiver Transmitter (EUSART) ........................................................................ 313
Capture/Compare/PWM Modules ..................................................................................................................................................... 345
Pulse-Width Modulation (PWM) Module ........................................................................................................................................... 359
Complementary Waveform Generator (CWG) Module ..................................................................................................................... 365
Signal Measurement Timer (SMT) .................................................................................................................................................... 391
Configurable Logic Cell (CLC) .......................................................................................................................................................... 437
Angular Timer (AT) Module ............................................................................................................................................................... 451
Math Accelerator with Proportional-Integral-Derivative (PID) Module ............................................................................................... 480
In-Circuit Serial Programming™ (ICSP™) ........................................................................................................................................ 496
Instruction Set Summary ................................................................................................................................................................... 498
Electrical Specifications .................................................................................................................................................................... 512
DC and AC Characteristics Graphs and Charts ................................................................................................................................ 536
Development Support ....................................................................................................................................................................... 555
Packaging Information ...................................................................................................................................................................... 559
Data Sheet Revision History ............................................................................................................................................................. 583
2014-2017 Microchip Technology Inc.
DS40001770D-page 9
PIC16(L)F1615/9
TO OUR VALUED CUSTOMERS
It is our intention to provide our valued customers with the best documentation possible to ensure successful use of your Microchip
products. To this end, we will continue to improve our publications to better suit your needs. Our publications will be refined and
enhanced as new volumes and updates are introduced.
If you have any questions or comments regarding this publication, please contact the Marketing Communications Department via
E-mail at docerrors@microchip.com or fax the Reader Response Form in the back of this data sheet to (480) 792-4150. We
welcome your feedback.
Most Current Data Sheet
To obtain the most up-to-date version of this data sheet, please register at our Worldwide Website at:
http://www.microchip.com
You can determine the version of a data sheet by examining its literature number found on the bottom outside corner of any page.
The last character of the literature number is the version number, (e.g., DS30000A is version A of document DS30000).
Errata
An errata sheet, describing minor operational differences from the data sheet and recommended workarounds, may exist for current
devices. As device/documentation issues become known to us, we will publish an errata sheet. The errata will specify the revision
of silicon and revision of document to which it applies.
To determine if an errata sheet exists for a particular device, please check with one of the following:
• Microchip’s Worldwide Website; http://www.microchip.com
• Your local Microchip sales office (see last page)
When contacting a sales office, please specify which device, revision of silicon and data sheet (include literature number) you are
using.
Customer Notification System
Register on our website at www.microchip.com to receive the most current information on all of our products.
2014-2017 Microchip Technology Inc.
DS40001770D-page 10
PIC16(L)F1615/9
DEVICE OVERVIEW
TABLE 1-1:
DEVICE PERIPHERAL
SUMMARY
Peripheral
PIC16(L)F1619
The PIC16(L)F1615/9 are described within this data
sheet. The block diagram of these devices are shown in
Figure 1-1, the available peripherals are shown in
Table 1-1, and the pin out descriptions are shown in
Tables 1-2 and 1-3.
PIC16(L)F1615
1.0
Analog-to-Digital Converter (ADC)
●
●
Complementary Wave Generator (CWG)
●
●
Cyclic Redundancy Check (CRC)
●
●
Digital-to-Analog Converter (DAC)
●
●
Enhanced Universal
Synchronous/Asynchronous
Receiver/Transmitter (EUSART)
●
●
Fixed Voltage Reference (FVR)
●
●
Temperature Indicator
●
●
Windowed Watchdog Timer (WDT)
●
●
Zero-Cross Detection (ZCD)
●
●
CCP1
●
●
CCP2
●
●
C1
●
●
C2
●
●
CLC1
●
●
CLC2
●
●
CLC3
●
●
CLC4
●
●
MSSP1
●
●
PWM3
●
●
PWM4
●
●
SMT1
●
●
SMT2
●
●
Timer0
●
●
Timer1
●
●
Timer2
●
●
Timer3
●
●
Timer4
●
●
Timer5
●
●
Timer6
●
●
Capture/Compare/PWM (CCP) Modules
Comparators
Configurable Logic Cell (CLC)
Master Synchronous Serial Ports
Pulse-Width Modulator (PWM)
Signal Measurement Timer (SMT)
Timers
2014-2017 Microchip Technology Inc.
DS40001770D-page 11
PIC16(L)F1615/9
1.1
1.1.1
Register and Bit Naming
Conventions
REGISTER NAMES
When there are multiple instances of the same
peripheral in a device, the peripheral control registers
will be depicted as the concatenation of a peripheral
identifier, peripheral instance, and control identifier.
The control registers section will show just one
instance of all the register names with an ‘x’ in the place
of the peripheral instance number. This naming
convention may also be applied to peripherals when
there is only one instance of that peripheral in the
device to maintain compatibility with other devices in
the family that contain more than one.
1.1.2
BIT NAMES
There are two variants for bit names:
• Short name: Bit function abbreviation
• Long name: Peripheral abbreviation + short name
1.1.2.1
Short Bit Names
Short bit names are an abbreviation for the bit function.
For example, some peripherals are enabled with the
EN bit. The bit names shown in the registers are the
short name variant.
Short bit names are useful when accessing bits in C
programs. The general format for accessing bits by the
short name is RegisterNamebits.ShortName. For
example, the enable bit, EN, in the COG1CON0 register can be set in C programs with the instruction
COG1CON0bits.EN = 1.
Short names are generally not useful in assembly
programs because the same name may be used by
different peripherals in different bit positions. When this
occurs, during the include file generation, all instances
of that short bit name are appended with an underscore
plus the name of the register in which the bit resides to
avoid naming contentions.
1.1.2.2
Long Bit Names
Long bit names are constructed by adding a peripheral
abbreviation prefix to the short name. The prefix is
unique to the peripheral, thereby making every long bit
name unique. The long bit name for the COG1 enable
bit is the COG1 prefix, G1, appended with the enable
bit short name, EN, resulting in the unique bit name
G1EN.
Long bit names are useful in both C and assembly programs. For example, in C the COG1CON0 enable bit
can be set with the G1EN = 1 instruction. In assembly,
this bit can be set with the BSF COG1CON0,G1EN
instruction.
2014-2017 Microchip Technology Inc.
1.1.2.3
Bit Fields
Bit fields are two or more adjacent bits in the same
register. Bit fields adhere only to the short bit naming
convention. For example, the three Least Significant
bits of the COG1CON0 register contain the mode
control bits. The short name for this field is MD. There
is no long bit name variant. Bit field access is only
possible in C programs. The following example
demonstrates a C program instruction for setting the
COG1 to the Push-Pull mode:
COG1CON0bits.MD = 0x5;
Individual bits in a bit field can also be accessed with
long and short bit names. Each bit is the field name
appended with the number of the bit position within the
field. For example, the Most Significant mode bit has
the short bit name MD2 and the long bit name is
G1MD2. The following two examples demonstrate
assembly program sequences for setting the COG1 to
Push-Pull mode:
Example 1:
MOVLW
ANDWF
MOVLW
IORWF
~(1