PIC vs AVR: Which Microcontroller to choose for your Application

embedded

ByAbhiemanyu Pandit 0

PIC vs AVR Which Microcontroller to choose for your Application

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 for your project.

 

Start with Project Requirement

Gather all information about your project to be started before starting to choose any microcontroller. It is very important that the information should be gathered as much as possible as this would play an important role in choosing the right microcontroller.

  • Gather information of project such as Size of Project
  • Number of Peripherals and Sensors Used
  • Power Requirement
  • Budget of Project
  • Interfaces Requirement (like USB, SPI, I2C, UART etc),
  • Make a Basic Hardware Block Diagram,)
  • List down how many GPIO is needed
  • Analog to Digital Inputs (ADCs)
  • PWMs
  • Select the Right Architecture Needed i.e. (8-bit, 16-bit, 32-bit)
  • Recognise Memory Requirement of project (RAM, Flash etc)

 

Look at the Featured Parameters

When all the information is gathered, then it is a right time to choose the microcontroller. In this article the two competing microcontroller brand PIC and AVR will be compared on variety of parameters. Depending upon the need of project to compare the two, look at the following parameters such as,

  • 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.

The most of the parameters are similar in both PIC and AVR but there are some parameters that surely differ when compared.

 

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.

Conclusion is that the PIC has surely got the advanced interfaces than AVR.

 

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.

Ateml Studio vs MPLABX

 

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.

 

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.

It is regardless to say that whoever wins, but in almost all branch of engineering, there is no word such as “best” whereas the “Most Appropriate for Application” is well suited phrase. It all depends on the requirements of a particular product, development method and manufacturing process. So depending on project, one can choose well suited microcontroller out of PIC and AVR.

Get Our Weekly Newsletter!

Subscribe below to receive most popular news, articles and DIY projects from Circuit Digest

Comments

Log in or register to post Comment