Assembler
AVR assembly language is very simple, with lots of instructions and the ability to use all 32 registers
(more or less) as accumulator. They also have 3 16-bit pointer registers that simplify addressing and
word operations.
PIC, especially 16F, assembler is vile, with everything forced to operate through the accumulator. They also
make you use bank switching all the time to access all the Special Function Registers. Although MPLAB includes macros
to simplify bank switching, it is a tedious waste of time. The worst aspect
though is the lack of branch instructions, just skip and GOTO, which forces you into convoluted structures and
spaghetti code.
PIC18F series are much better, although still limited to one accumulator. At least they have got rid of (most)
bank switching and included a lot more instructions (70+ instead of 35), with branches and push/pop instructions.
Verdict: Although PIC18F are much better, AVR still wins.
Other features
On price, especially in low volume, they are pretty much the same. Availability of both is
usually good but AVR can have periods of long lead times, so for critical production, PIC is
better unless you create delivery schedules. Each is available in a variety of packages.
Microchip bring out far more versions (constantly), which is both good and bad - trying to
keep up is difficult but you can get exactly the chip you need. Latest versions of both
AVR and PIC are very low power (for battery use) and have a wide voltage range. Speed of
operation is also now very similar. PIC clocks and timers are more accurate.
Microchip have integrated fuse data into their hex file format, so fuses can be set in code.
This makes it much easier to transfer projects to production, so a plus for the PIC.
Atmel Studio 7 has added Production ELF Files, which include flash, EEPROM and fuse data in one file.
ELF files are generally for emulators and a lot of programmers can't read them. All Kanda AVR ISP
can load ELF files. Otherwise, there is a free utility that can convert these ELF fuiles into Intel Hex files.
See
How to Create Production ELF Files Kanda blog post for more information on them, in new window.
Target Connectors
With target connectors, Atmel have defined 6 and 10-way ISP interfaces, which everyone uses, whereas
Microchip haven't, so PIC programmers have to come with flying leads or RJ11 connectors. RJ11 sockets
are enormous which makes them difficult to fit on your circuit.
Although Atmel were consistantly using first 10-way (5 x 2) then 6-way (3 x2) interfaces, their latest tools,
such as AVR ICE, have changed to 10-way 1.27mm (0.05 inch) connectors. These are nice and small but much more
expensive than standard 2.54mm (0.1") sockets. Only the expensive versions of AVR ICE come with any adapters, with
the basic version, you are on your own!
For advanced features, such as integrated USB, CAN and Ethernet, PIC wins hands down, as Atmel
have never really got their act together with these features. On the other hand, you can always
use external chips, such as FTDI USB to serial chips, Microchip Ethernet controllers or Philips CAN chips.
Low Voltage Operation
Both AVR and PIC have been improved for low voltage operation as battery powered products become more common.
AVR microcontrollers are better suited to low voltage operation than the older PIC16F and PIC18F microcontrollers
because these PIC families use a chip erase method that needs at least 4.5V to operate. Below 4.5V, PIC
programmers have to use row erase algorithm which cannot erase a locked device. Therefore, in order to run
at 3V and use code protection, the PIC ICSP circuit has to be made 5V tolerent so that the programmer can
supply above 4.5V for bulk erase. This is quite easily done with protection diodes but it is often forgotten
Later PIC18F microcontrollers, such as PIC18FxxJxx and PIC18FxxKxx and the latest PIC16F1xxx are much better for low voltage operation
and J series only operate below 3.3V, so may be a better choice. AVR microcontrollers have also improved and the
latest P (pico-power) variants such as ATmega328P are extremely low power. The very latest ATtiny1634 also has
improved sleep modes to reduce power consumption when brownout is used, fairly vital with battery operated circuits.
Although the AVR has been improved over the years, they are still basically the same. PIC on the other hand, especially
PIC16F, have been completely transformed. Most of the code etc available on the web still refers to old PIC16F877 but
this is basically obsolete and the latest PIC 16F devices like PIC16F1789 or PIC16F1939 eat them for breakfast - faster,
cheaper, more memory and lower power. Our MICRO-X PIC training kit uses PIC16F1789 because it is so much better
than older 16F series chips.
Conclusion
PIC and AVR are both excellent devices for developing cheap and efficient projects. AVR is probably an easier
platform on which to learn the basics from scratch. Both have good support networks (forums, code examples etc),
Microchip have now taken over Atmel and now makes both PIC and AVR. They seem to be running both side by side quite happily
and are unlikely to do anything drastic.
It boils down to what your aim is - there are more robot projects out there using PIC for example. What
do you colleagues use, or your company or college, is probably as important a consideration as any other.
In the end, it doesn't matter all that much because learning microcontrollers is like
learning a foreign language - once you have learnt one, learning another is much easier, especially in C.
PIC and AVR Training Kits