PIC Microcontroller Tutorial : Introduction, Basics & Architecture
Close or Esc Key

Arduino Projects   |   Raspberry Pi   |   Electronic Circuits   |   AVR   |   PIC   |   8051   |   Electronic Projects

PIC Microcontroller

Written By: 

Nikhil Agnihotri


The microcontrollers played revolutionary role in embedded industry after the invention of Intel 8051. The steady and progressive research in this field gave the industry more efficient, high-performance and low-power consumption microcontrollers. The AVR, PIC and ARM are the prime examples. The new age microcontrollers are getting smarter and richer by including latest communication protocols like USB, I2C, SPI, Ethernet, CAN etc.  

PIC microcontrollers
 PIC Microcontroller
Fig. 1: An Image Of Pic Microcontroller
The PIC microcontroller was developed by General Instruments in 1975. PIC was developed when Microelectronics Division of General Instruments was testing its 16-bit CPU CP1600. Although the CP1600 was a good CPU but it had low I/O performance. The PIC controller was used to offload the I/O the tasks from CPU to improve the overall performance of the system.
In 1985, General Instruments converted their Microelectronics Division to Microchip Technology. PIC stands for Peripheral Interface Controller. The General Instruments used the acronyms Programmable Interface Controller and Programmable Intelligent Computer for the initial PICs (PIC1640 and PIC1650).
In 1993, Microchip Technology launched the 8-bit PIC16C84 with EEPROM which could be programmed using serial programming method. The improved version of PIC16C84 with flash memory (PIC18F84 and PIC18F84A) hit the market in 1998.
Since 1998, Microchip Technology continuously developed new high performance microcontrollers with new complex architecture and enhanced in-built peripherals. PIC microcontroller is based on Harvard architecture. At present PIC microcontrollers are widely used for industrial purpose due to its high performance ability at low power consumption. It is also very famous among hobbyists due to moderate cost and easy availability of its supporting software and hardware tools like compilers, simulators, debuggers etc. The 8-bit PIC microcontroller is divided into following four categories on the basis of internal architecture:
1. Base Line PIC
2. Mid-Range PIC
3. Enhanced Mid-Range PIC
4. PIC18
1. Base Line PIC
Base Line PICs are the least complex PIC microcontrollers. These microcontrollers work on 12-bit instruction architecture which means that the word size of instruction sets are of 12 bits for these controllers. These are smallest and cheapest PICs, available with 6 to 40 pin packaging.  The small size and low cost of Base Line PIC replaced the traditional ICs like 555, logic gates etc. in industries.
2. Mid-Range PIC
Mid-Range PICs are based on 14-bit instruction architecture and are able to work up to 20 MHz speed. These controllers are available with 8 to 64 pin packaging. These microcontrollers are available with different peripherals like ADC, PWM, Op-Amps and different communication protocols like USART, SPI, I2C (TWI), etc. which make them widely usable microcontrollers not only for industry but for hobbyists as well.

Development Contd.

3. Enhanced Mid-Range PIC
These controllers are enhanced version of Mid-Range core. This range of controllers provides additional performance, greater flash memory and high speed at very low power consumption. This range of PIC also includes multiple peripherals and supports protocols like USART, SPI, I2C and so on.
4. PIC18
PIC18 range is based on 16-bit instruction architecture incorporating advanced RISC architecture which makes it highest performer among the all 8-bit PIC families. The PIC18 range is integrated with new age communication protocols like USB, CAN, LIN, Ethernet (TCP/IP protocol) to communicate with local and/or internet based networks. This range also supports the connectivity of Human Interface Devices like touch panels etc.


The following table compares the above four categories: 
Base Line
Enhanced Mid-Range
No. of Pins
Program Memory
Up to 3 KB
Up to 14 KB
Up to 28 KB
Up to 128 KB
Data Memory
Up to 134 Bytes
Up to 368 Bytes
Up to 1.5 KB
Up to 4 KB
Instruction Length
No. of instruction set
Up to 16 MIPS
• Comparator
• 8-bit ADC
• Data Memory
•Internal Oscillator
In addition of baseline
·   SPI
·   I2C
·   UART
·   PWM
·   10-bit ADC
·   OP-Amps
In addition of Mid-range
·   High Performance
·   Multiple communication peripherals
In addition of Enhanced Mid-range
• Ethernet
• 12-bit ADC
PIC10,PIC12, PIC16
PIC12, PIC16
Fig. 2: Table Showing Comparison On Basis Of Internal Architecture
 *MIPS stand for Millions of Instructions per Second
Besides 8-bit microcontrollers, Microchip also manufactures 16-bit and 32-bit microcontrollers. Recently Microchip developed XLP (Extreme Low Power) series microcontrollers which are based on NanoWatt technology. These controllers draw current in order of nanoamperes(nA).
Memory variations:
The PIC microcontrollers are available with different memory options which are mask ROM, EPROM and flash memory. They are denoted with different symbols as given in the following table:
Memory Type
Mask ROM
Flash memory
 Fig. 3: Memory Variation In PIC Microcontroller
PIC microcontrollers are also available with extended voltage ranges which reduce the frequency range. The operating voltage range of these PICs is 2.0-6.0 volts. The letter ‘L’ is included in controller’s name to denote extended voltage range controllers. For example, PIC16LFxxx (Operating voltage 2.0-6.0 volts).
The following section covers the PIC architecture in further detail. PIC18 series has been selected for the study because it is enhanced series of 8-bit PIC microcontroller. In this series, PIC18F4550 has been chosen to describe the architecture and other features due its moderate complexity.


PIC microcontrollers are based on advanced RISC architecture. RISC stands for Reduced Instruction Set Computing. In this architecture, the instruction set of hardware gets reduced which increases the execution rate (speed) of system.
PIC microcontrollers follow Harvard architecture for internal data transfer. In Harvard architecture there are two separate memories for program and data. These two memories are accessed through different buses for data communication between memories and CPU core. This architecture improves the speed of system over Von Neumann architecture in which program and data are fetched from the same memory using the same bus. PIC18 series controllers are based on 16-bit instruction set.
The question may arise that if PIC18 are called 8-bit microcontrollers, then what about them being based on 16-bit instructions set. ‘PIC18 is an 8-bit microcontroller’ this statement means that the CPU core can receive/transmit or process a maximum of 8-bit data at a time. On the other hand the statement ‘PIC18 microcontrollers are based on 16-bit instruction set’ means that the assembly instruction sets are of 16-bit.
The data memory is interfaced with 8-bit bus and program memory is interfaced with 16-bit bus as depicted in the following figurePIC Microcontroller Memory
Fig. 4: Simple Block Diagram Of CPU Interfacing With Data And Program Memory In PIC

PIC18 Harvard Architecture 

PIC microcontroller contains an 8-bit ALU (Arithmetic Logic Unit) and an 8-bit Working Register (Accumulator). There are different GPRs (General Purpose Registers) and SFRs (Special Function Registers) in a PIC microcontroller. The overall system performs 8-bit arithmetic and logic functions. These functions usually need one or two operands. One of the operands is stored in WREG (Accumulator) and the other one is stored in GPR/SFR. The two data is processed by ALU and stored in WREG or other registers.
PIC18 Harvard Architecture
Fig. 5: Simple Block Diagram Of Data Processing in PIC18 Harvard 
The above process occurs in a single machine cycle. In PIC microcontroller, a single machine cycle consists of 4 oscillation periods. Thus an instruction needs 4 clock periods to be executed. This makes it faster than other 8051 microcontrollers.
Early processors and controllers could fetch or execute a single instruction in a unit of time. The PIC microcontrollers are able to fetch and execute the instructions in the same unit of time thus increasing their instruction throughput. This technique is known as instruction pipelining where the processing of instructions is split into a number of independent steps.
 Instruction Pipelining - PIC Microcontroller
Fig. 6: Diagram Showing Instruction Pipelining Technique In PIC

Features and Peripherals

The PIC18F consists of the following features and peripherals.
·         C Compiler Optimized Architecture with Optional Extended Instruction Set
·         100,000 Erase/Write Cycle Enhanced Flash
·         Program Memory Typical
·         1,000,000 Erase/Write Cycle Data EEPROM Memory Typical
·         Flexible oscillator option
o    Four Crystal modes, including High-Precision PLL for USB
o    Two External Clock modes, Up to 48 MHz
o    Internal Oscillator: 8 user-selectable frequencies, from 31 kHz to 8 MHz
o    Dual Oscillator Options allow Microcontroller and USB module to Run at different Clock Speeds
The PIC18F4550 microcontroller consists of following peripherals:
·         I/O Ports: PIC18F4550 have 5 (PORTA, PORTB, PORTC, PORTD and PORTE) 8-bit input-output ports. PortB & PortD have 8 I/O pins each. Although other three ports are 8-bit ports but they do not have eight I/O pins. Although the 8-bit input and output are given to these ports, but the pins which do not exist, are masked internally.
 ·         Memory: PIC18F4550 consists of three different memory sections: 
1.      Flash Memory: Flash memory is used to store the program downloaded by a user on to the microcontroller. Flash memory is non-volatile, i.e., it retains the program even after the power is cut-off. PIC18F4550 has 32KB of Flash Memory.
2.      EEPROM: This is also a nonvolatile memory which is used to store data like values of certain variables. PIC18F4550 has 256 Bytes of EEPROM.
3.      SRAM: Static Random Access Memory is the volatile memory of the microcontroller, i.e., it loses its data as soon as the power is cut off. PIC18F4550 is equipped with 2 KB of internal SRAM.

·         Oscillator: The PIC18F series has flexible clock options. An external clock of up to 48 MHz can be applied to this series. These controllers also consist of an internal oscillator which provides eight selectable frequency options varying from 31 KHz to 8 MHz.


 ·         8x8 Multiplier: The PIC18F4550 includes an 8 x 8 multiplier hardware. This hardware performs the multiplications in single machine cycle. This gives higher computational throughput and reduces operation cycle & code length.

·         ADC Interface: PIC18F4550 is equipped with 13 ADC (Analog to Digital Converter) channels of 10-bits resolution. ADC reads the analog input, for example, a sensor input and converts it into digital value that can be understood by the microcontroller.
·         Timers/Counters: PIC18F4550 has four timer/counters. There is one 8-bit timer and the remaining timers have option to select 8 or 16 bit mode. Timers are useful for generating precision actions, for example, creating precise time delays between two operations.
·         Interrupts: PIC18F4550 consists of three external interrupts sources. There are 20 internal interrupts which are associated with different peripherals like USART, ADC, Timers, and so on.
·         EUSART: Enhanced USART (Universal Synchronous and Asynchronous Serial Receiver and Transmitter) module is full-duplex asynchronous system. It can also be configured as half-duplex synchronous system. The Enhanced USART has the feature for automatic baud rate detection and calibration, automatic wake-up on Sync Break reception and 12-bit Break character transmit. These features make it ideally suited for use in Local Interconnect Network bus (LIN bus) systems.
·         ICSP and ICD: PIC18F series controllers have In Circuit Serial Programming facility to program the Flash Memory which can be programmed without removing the IC from the circuit. ICD (In Circuit Debugger) allows for hardware debugging of the controller while it is in the application circuit.
·         SPI: PIC18F supports 3-wire SPI communication between two devices on a common clock source. The data rate of SPI is more than that of USART.
·         I2C: PIC18F supports Two Wire Interface (TWI) or I2C communication between two devices. It can work as both Master and Slave devic.
·         USB: PIC18F supports full-speed USB with different clock options.



too lengthlyy...but good

hello awesome post added your RSS.

Respected sir,

         your website is very very useful for me. i search lot of site for embedded c coding , that sites given but not perfect . in other words not easy to understood .

  but your site is great.


  one more suggestion i need help for pic 16f877a  projects i have lot of difficulties to access can u help me .


                                                    thank you sir

gud info....




Beyond the book knowledge.........

i want 2 work on data loging by microcontroller... i thing the information of this website will be very helpfull to me.........


your website is very goodsmileythanks


hi sir,


           Thank u very much for ur website .... really it s very useful to me. then sir i need some of the simple projects using pic16f877a because  i am doing my final year project using pic ly.. if u send me the details about pic16f877a  using simple projects, its may be very helpful to me.


its ok..





sir what is the diffference b/w PIC microcontoller and normal 8051 ?

PIC  has internal ADC, 3 Timers,20Mhz clk frequency &  8k flash memory but 8051 has 2 Timers,12mhz clock frequency,4k rom memory, etc...

any body please help me with a link or website showing the comparison of 8051,pic,avr&arm controller archictecture,pin diagram and special features.

I have a  isp low cost pic programmer.

this programmer can be used to burn tthe microcontroller PIC18F4550.i have generated the hex file by microC IDE.



            PLEASE REPLY




i want low end picprgrammer


really a gud One....

its really a useful one ...................


  I am Sourov Hossain, a student of EEE. In my last year 1st project I want to make a PIC  Microcontroller control circuit. Where the Microcontroller would be interface from PC through USB. But I can not make a USB interface program for  Microcontroller. so I request you, please help me if you can, by giving a program or any document.

thank you very much! Realy usefull



Precious information in an excellent way..

Thank You very much for the site

sir, i want to know that which compiler you have use for PIC programming.  


Is it possible to control 3 stepper motors using PIC microcontroller.



hi sir,'
am new to this forum

i know well about usart and spi

i need know about can protocol.

please help me sir

thank you