You are on page 1of 17

PIC vs

AVR: Which Microcontroller to choose

comparison
PIC16 or Atmega
PIC Microcontroller  AVR Microcontroller

When it comes to choosing microcontroller, it is really a confusing task as there are various
microcontrollers available in the market with same specifications. So every parameter becomes
important when it comes to selecting a microcontroller. Here we are comparing two most
commonly used Microcontroller- PIC Microcontroller and AVR Microcontroller. Here they are
compared on various levels which will be helpful in selecting microcontroller
Featured Parameters

•Frequency: Speed at which the microcontroller will operate.


•Number of I/O pins : Required ports and pins
•RAM: All the variables and arrays declared(DATA) in most MCUs
•Flash Memory: Whatever code you write goes here after compiling
•Advanced Interfaces: Advanced interfaces such as USB, CAN and Ethernet.
•Working Voltage: Working voltage of MCU such as 5V, 3.3V or Low voltage.
•Target Connectors: The connectors for ease of circuit design and size.
  8051 PIC AVR ARM

Bus width 8-bit for standard core 8/16/32-bit 8/32-bit 32-bit mostly also available in 64-bit

UART, USART, LIN, I2C, SPI, CAN, USB,


PIC, UART, USART, LIN, CAN, Ethernet, UART, USART, SPI, I2C, (special purpose
Communication Protocols UART, USART,SPI,I2C Ethernet, I2S, DSP, SAI (serial audio
SPI, I2S AVR support CAN, USB, Ethernet)
interface), IrDA

Speed 12 Clock/instruction cycle 4 Clock/instruction cycle 1 clock/  instruction cycle 1 clock/ instruction cycle

Memory ROM, SRAM, FLASH SRAM, FLASH Flash, SRAM, EEPROM Flash, SDRAM, EEPROM

ISA CLSC Some feature of RISC RISC RISC

Memory Architecture Von Neumann architecture Harvard architecture Modified Modified Harvard architecture
Working Voltage

With more battery operated products, the PIC and AVR have managed to improve for the low-voltage
operations. AVR are better known for low-voltage operation than the older PIC series such as PIC16F
and PIC18F because these PIC series used chip-erased method that need at least 4.5V to operate, and
below 4.5V PIC programmers have to use row-erase algorithm which cannot erase locked device.
However this is not the case in AVR.
AVR has improved and launched the latest P (pico-power) variants such as ATmega328P which are
extremely low-power. Also the current ATtiny1634 has improved and comes with sleep modes to
reduce power consumption when brownout is used which is very useful in battery powered devices.
The conclusion is that AVR were focused on low-voltage previously but PIC now has been
transformed for the low-voltage operation and has launched some products based on picPower.
Target Connectors

Target connectors are very important when it comes to design and development. AVR has defined
6 and 10-way ISP interfaces, which makes it easy to use whereas PIC doesn’t have it, so PIC
programmers comes with flying leads or RJ11 sockets which are difficult to fit in the circuit.
Conclusion is that the AVR has made it simple in terms of circuit design and development with the
target connectors whereas PIC still needs to rectify this.
Advanced Interfaces

In terms of advanced interfaces, then the PIC is surely the option as it has got their act with
advanced features such as USB, CAN and Ethernet which is not the case in AVR. However one can
use external chips, such as FTDI USB to serial chips, Microchip Ethernet controllers or Philips CAN
chips.
Development Environment

Other than this there are important features which makes both the microcontroller
different from each other. The ease of development environment is very important.
Below are some important parameters which will explain the ease of development
environment:

•Development IDE
•C Compilers
•Assemblers
Development IDE

Both PIC and AVR comes with their own development IDEs. PIC development is done on MPLAB
X, which is known to be the stable and simple IDE compare to AVR’s Atmel Studio7 which is of
large 750MB size and is a bit clunky with more add-on features which makes it difficult and
complicated for newbie electronic hobbyists
The PIC can be programmed through the microchip tools PicKit3 and MPLAB X. The 
AVR is programmed through using tools such as JTAGICE and AtmelStudio7. However the
users are switching to the older versions of AVR Studio such as 4.18 with service pack3 as it
runs much faster and has basic features for development.

The conclusion is that the PIC MPLAB X is a bit faster and user friendly than AtmelStudio7.
  AVR’s Atmel Studio7  MPLAB X
C Compilers
Both PIC and AVR comes with XC8 and WINAVR C Compilers respectively. The PIC has bought
out Hi-tech and have launched their own compiler XC8. This is completely integrated into MPLAB
X and functions well. But WINAVR is ANSI C based on GCC compiler which makes it easy to port
code and use standard libraries. The free 4KB limited version of IAR C Compiler gives a flavour of
professional compilers that costs much. Since the AVR is designed for C in the beginning, the
code output is small and fast.
The PIC has many features that make it well compared to AVR but it’s code becomes larger
because of the structure of the PIC. The paid version are available with more optimisation
however the free version is not well optimised.
The conclusion is that WINAVR is good and fast in terms of compilers than PIC XC8.
Assemblers
With three 16-bit pointer registers that simplify addressing and word operations,
the AVR assembly language is very easy with lots of instructions and the ability
to use all 32 registers as accumulator. Whereas PIC assembler is not that well
with everything forced to operate through the accumulator, forces to use bank
switching all the time to access all the Special Function Registers. Although
MPLAB includes macros to simplify bank switching but it’s tedious and time
consuming.
Also the lack of branch instructions, just skip and GOTO, which forces into
convoluted structures and a bit confusing code. The PIC series has some
microcontroller series much faster but again limited to one accumulator.
Conclusion is that, although some of PIC microcontrollers are faster but AVR is
better to work on in terms of assemblers.
Price and Availability

Talking in terms of the price, then both PIC and AVR are much similar. Both are
available in mostly same price. In terms of availability then the PIC has managed to
deliver the products in stipulated time compare to the AVR as Microchip always had
policy of short lead times. Atmel had some difficult times as their wide product range
means AVRs are small part of their business, so other markets can take priority over
AVRs for production capacity. So it is advisable to use PIC in terms of delivery
schedules whereas AVR can be critical for production. Microchip parts tend to be
more easily available especially in small quantities.
Other Features
Both PIC and AVR are available in variety of packages. The PIC rolls out more
versions than AVR. This version roll-out can have pros and cons depending upon
the applications like more versions create confusion in selecting the proper
model but at the same time it provides better flexibility. Latest version of both
PIC and AVR are very low-powered and operate in variety of voltage range. PIC
clocks and timers are more accurate but in terms of speed the PIC and AVR is
very much same.
Atmel Studio 7 has added Production ELF Files, which includes EEPROM, Flash
and fuse data in one file. Whereas AVR has integrated fuse data into their hex file
format so fuse can be set in code. This enables the transfer of project to
production easier for PIC.
Conclusion

PIC and AVR both are excellent low-cost devices which are not only be used
in industries but also a popular choice among students and hobbyists. Both
are widely used and have good networks (forums, code examples) with active
online presence. Both have good community reach and support and both are
available in wide sizes and form factor with core independent peripherals.
Microchip have taken over Atmel and now takes care both AVR and PIC. At
the end, it is well understood that learning microcontroller is like learning
programming languages, as learning another will be much easier once you
have learnt one
Questions

You might also like