8-bit PIC® Microcontroller Device Families

Last modified by Microchip on 2023/11/09 09:12

The MPLAB® XC8 C Compiler documentation and support materials often state that a compiler feature might only be available for a particular device family. Since the device part number is not a good indicator of its family, a little fact-finding might be necessary to determine if that feature will be available for your project. This article lists the different families currently recognized by the XC8 compiler, describes the device attributes of these families that affect code generation, and shows you how to definitively determine the device family for a given part number.

Microchip produces many 8-bit PIC® microcontrollers, which are currently grouped into the Baseline, Mid-range, or PIC18 families. These families represent devices with instruction sizes of 12-, 14-, and 16-bits, respectively. While the PIC18 device part numbers are easy to place into their family, the other devices can be tricky. A common misconception is that part names beginning with PIC12 are Baseline, and those beginning with PIC16 are Mid-range; however, that is not always correct. The PIC12F1501, for example, is actually in the Mid-range family, and the PIC16F526 is Baseline.

The XC8 compiler further subdivides these three families, based on device features such as instruction set, memory configuration, or available modules. Some compiler features are only available for a particular family, or even a subdivision of that family. When you are choosing a device, this might affect your design and the efficiency of your program, so how can you tell which family a device belongs to?

If you have the MPLAB X IDE installed, you can open the DeviceArchitecture.html file, located in the <ide install dir>/docs directory, to determine the basic family grouping of each device. However, to see the subgrouping, you can check the MPLAB XC8 device INI files that specify device-specific information to the compiler. If you are using MPLAB XC8 v2.10 or higher, there is one INI file for each device and these are located in the <xc8 install dir>/pic/dat/ini directory. If you are using an earlier compiler, there are two INI files, one for PIC18 devices, called picc-18.ini, and the other called picc.ini, for all other devices. These can be found in the <xc8 install dir>/pic/dat directory.

Changing values inside INI files can be detrimental, so first make copies of these files for you to explore.

Regardless of the compiler version, the INI file content is similar. If you want to determine the family for a PIC16F1934 part, for example, open either 16f1934.ini (for compiler versions 2.10 or later) or picc.ini (for earlier compiler versions). Search for the device name in square brackets. This will be followed by an entry called ARCH.

[16F1934]
ARCH=PIC14E

In this example, PIC14E is the designator used by the compiler to represent the family. The following table shows all the designators and what features distinguish the devices they represent.

DesignatorFamily groupInstruction size and device featuresExample device
PIC12Baseline12-bit16F526
PIC12EEnhanced Baseline12-bit, enhanced instructions12F529T39A
PIC12IEEnhanced Baseline12-bit, enhanced instructions, interrupts16F527
PIC14Mid-range14-bit12F617
PIC14EEnhanced Mid-range14-bit, enhanced instructions16F1503
PIC14EXEnhanced Mid-range14-bit, enhanced instructions, extended data16F15356
PIC18PIC1816-bit18F46K22
PIC18XVPIC1816-bit, extended data, vectored interrupts18F46K42

Here are the benefits of these device features when using XC8; however, note that there may be other device features associated with a family that is not classified by the compiler.

Enhanced Baseline devices with the enhanced instructions include the movlb instruction, which allows for fast bank switching and hence improved code efficiency. These devices might also have an unbanked region of memory that is not common across all data banks.

Baseline devices with interrupts implement interrupt hardware and allow interrupt functions to be defined in C code. Other baseline devices do not support interrupts.

Mid-range devices with the enhanced instructions have several additional instructions that can indirectly access data more efficiently, thus allowing a software (reentrant) stack to be used by functions, and allowing linear (non-banked) access to objects larger than a bank in size.

Enhanced Mid-range devices with extended data have 64 banks of data memory, ideal for projects that require large amounts of RAM.

PIC18 devices with vectored interrupts allow for faster interrupt response by letting you define individual interrupt functions dedicated to one interrupt source.