8-bit PIC® MCU Enhanced Mid-Range Architectural Overview

Last modified by Microchip on 2024/01/23 22:40

Microchip 8-bit MCU Families

8bit family

The PIC®16F1xxx Enhanced Mid-Range 8-bit PIC MCU family spans a wide array of memory sizes and I/O pins.
This page presents the key architectural features of the PIC16F1xxx family of MCUs. Links are provided on this page to the technical details needed to implement applications on the enhanced mid-range PIC MCU family.

Back to top

Harvard Architecture

Enhanced mid-range PIC MCUs use a dual-bus Harvard Architecture.

Back to top

Instruction Bus

Program instructions are fed into the ALU from FLASH program memory via the 14-bit instruction bus. On every instruction clock cycle, one 14-bit program word is read into the ALU.

Back to top

Data Bus

An 8-bit data bus connects the ALU to the data memory. During each instruction, the ALU can read data from the data memory, modify the data, then write the data back to memory.

Back to top

Instruction Pipelining

This PIC has dual-bus architecture, which provides for a two-stage instruction pipeline. On each clock cycle, two instruction phases execute:

  1. The next instruction is fetched from program memory.
  2. The current instruction is executed and reads/modifies/writes data memory (if needed).

Back to top

Memory Mapped Peripherals

A closer look at the data memory shows the registers controlling the peripherals and the I/O ports accessed by reading or writing to specific data memory addresses. This mapping of peripherals to the memory address greatly simplifies learning how to program this PIC MCU.

Back to top

Orthogonal Instruction Set

These PIC MCUs each have 49 instructions. Instructions directly accessing data memory addresses execute in one instruction cycle. Instructions that cause a change in the program counter (BRA, GOTO, RETURN, CALL, etc.) take two instruction cycles to execute.

By mapping the I/O and peripheral registers to memory addresses, PIC MCUs do not need special instructions for I/O operations to set peripheral registers. Writing to an I/O port or configuring a peripheral is a simple "write-to-a-memory-location." Reading the value of an input pin, ADC result register, or timer is a simple "read-off-a-memory-location." By using a small number of orthogonal instructions, enhanced mid-range PIC MCUs are easy to program, use less silicon to build, and consume less power.

Back to top

Flexible Clocking Options (Up to 32 MHz)

Selected by the PIC MCU's configuration bits, the system clock has the following properties:

  • Optional source - Internal oscillator or external circuitry
  • Flexible speed options - Up to 32 MHz
  • Two-speed start-up - Allow system to run initialization software while the external oscillator is stabilizing
  • Clock Switching - Switch between external and internal clock sources via software
  • Fail-Safe Clock Monitor - Switch to internal oscillator in the event of an external clock failure

Back to top

Digital I/O

Almost every pin on the Enhance Mid-Range PIC MCU can be used as a digital input or output pin. Digital Pins share these attributes:

  • Monitor Digital Inputs
  • Control Digital Devices
  • Internal Weak Pull-ups
  • Multiplexed with Peripherals
  • High Drive capability (up to 25 mA sink/source on many I/O pins)
  • Direct single-cycle bit manipulation
  • 4 kV ESD protection diodes

At Reset:

  • Digital Pins revert to input (Hi-Z)
  • Analog Capable pins revert to analog

Back to top

Typical Digital Pin Structure

Five registers control the operation of the digital pin. These 8-bit registers control eight pins of a PORT. Using the registers TRISX, PORTx, LATx, WPUx, and ANSEL, the program can:

  • Configure the pin as an input or output TRISx
  • Read an input pin (or all eight PORT pins) PORTx
  • Output a 1 or 0 to a pin LATx
  • Enable or disable the internal pull-up resistor WPUx
  • Determine if analog capable pins operate in analog or in digital mode ANSEL

Back to top

Multiplexed Pins

In addition to being configured as digital I/Os, pins on enhanced mid-range PIC MCUs can have several possible functions. The pin diagram on the datasheet shows the options for each pin. At start-up, the program has the option of configuring the pins.

Back to top

Advanced Peripherals

In addition to digital I/O, enhanced mid-range PIC MCU family members have an assortment of advanced peripherals. These peripherals include peripherals for data conversion, communication, and signal conditioning.

Back to top


Enhanced mid-range PIC MCUs utilize a single vector pre-emptive interrupt structure.

Each peripheral on the PIC is capable of generating an interrupt request. When an interrupt request occurs and interrupts for the requesting device are enabled, an interrupt will occur.

The PIC uses a 16-level hardware stack to store the current content of the PC when an interrupt occurs. The program context is saved in shadow registers and control is passed to program memory address 0x04.

Back to top

Interrupt Service Routine (ISR)

You are responsible for writing the code to service the interrupt and placing the code at address 0x04. This ISR determines the source of the interrupt, then performs the necessary task to service the interrupting peripheral. An ISR's final instruction is the Return From Interrupt (RETFIE) instruction.

Back to top

Automatic Context Saving

The following registers are saved to a single-level shadow register set in the event of an interrupt:

  • W
  • BSR
  • FSR

When the ISR executes the RETFIE instruction, these registers are restored to the pre-interrupt value.

Back to top

Single Level Interrupt Pre-emption

When an interrupt occurs the Global Interrupt Enable bit (GIE) in the status register is disabled. This prevents an interrupt from being pre-empted by another interrupt.

Upon executing a RETFIE, the state of the GIE control bit is restored to its pre-interrupt value.

Back to top

What Happens at System Start-up (RESET)

There are several sources of a RESET on the enhanced mid-range PIC MCU. The RESET sources common to almost all applications are the Power On Reset (POR) and Brown-Out Reset (BOR) due to a sagging power supply voltage (i.e., brown-out). There are several other methods for resetting the MCU including Watchdog timeout and directly accessing the MCLR pin.

Back to top

Program Counter is Set to 0x00

After a RESET the instruction located at address 0 is the first instruction executed. You are responsible for placing the code into this address to boot-up the PIC MCU. Microchip's MPLAB® XC8 compiler will insert the appropriate instructions to start up the PIC and transfer control to main. Assembly-level programmers will have to write the code to initialize the PIC and jump past the interrupt vector located at address 0x04.

Back to top

All Special Function Registers are set to a Default Value

The datasheet for each enhanced mid-range PIC MCU shows the values which the registers contain at RESET.

sample register

Back to top