Why I Pick PIC

pic18People often despair at me for constantly raving on about how great Microchip PIC microcontrollers are, and how much better than everyone else they are.

While I completely agree that each microcontroller has its place in the world, I have yet to find a situation where Microchip don't have a microcontroller which is at least as good as the competition at fulfilling a role, whilst at the same time providing just so much more in the mix as well.

So, I thought I would look at the Arduino UNO's heart and soul, the ATMega328P - a chip that everyone on the Arduino forums thinks is the best micrcontroller, and the only microcontroller you will ever need. I figured I would try and find other microcontrollers from other manufacturers that matched it as closely as possible and compare them - in an objective manner.

After much hunting through product lists from both Microchip and TI I found two suitable matches. The basic criteria:

  1. Must be in a DIP package.
  2. Must try and at least match the Flash and RAM specifications. If possible.

I found an admirable match in the Microchip PIC18 range, with the PIC18F25K80 chip - same package as the ATMega328P, with pretty much the same spec. However, TI failed me miserably. So, I have the best I could find in a DIP package from them - the MSP430G2533. A pretty poor comparison that chip, but all I could find.

So, I looked at the basic facilities that each chip provides, and scoring each one on a comparison with the two other chips.

Where there are three different values, red is the worst, yellow is the middle value, and green is the best value. If there are only 2 distinct values, then it's red for the worst, and green for the best. If they're all the same, they're all yellow. Red specifications score 1 point, yellow 2 points, and green 3 points.

MCUCompare s

A few notes on the findings. Firstly the distinction between RISC and Harvard Architecture. Yes, RISC may be perceived as a faster system than any other. Well, in some senses that is true. Yes, it is fast at performing instructions, as each instruction is very light weight and doesn't take much power to execute. However, you have to execute more of them. Harvard Architecture, however, adds extra efficiency. The instruction set is about as light as RISC (some chips have just 14 instructions), but where a RISC system has a single bus that communicates with everything - flash, RAM, peripherals, etc, the Harvard system has two busses - an instruction bus and a data bus. This means that whilst it is spending time getting instructions from slow flash memory, it can at the same time be getting data from RAM. No waiting for the flash read to finish before you can do the RAM read. That makes a considerable improvement in speed.

Secondly is the use of "shared peripherals". These are where you have a single internal peripheral providing multiple functions, such as the MSSP in the PIC18, which provides both the I²C and SPI interfaces. This means that you can use one or the other but not both.

So anyway, looking at that table, you can clearly see why it is that I think that the ATMega328P is:

  • Over priced - It's the most expensive of the three, and while it may not have as poor a specification as the TI offering, it certainly falls below the equivalent (and cheaper) PIC on specifications.
  • Under specified - It just doesn't do as much as the PIC. The peripherals are of a lower grade (only 6 channels of 10-bit ADC, compared with 8 channels of 12-bit!), and there just aren't as many of them.

I am sure that, when the Arduino was first conceived that the Atmel chips were cutting edge and the best there were in the price range. Well, the world has moved on, but the Atmel Arduino die-hards are still stuck in the past. They're clinging to the old microcontroller purely because it's the one they've always used, and they seem to have a very blinkered approach to the rest of the microcontroller world. They refuse to even consider the possibility of using a microcontroller that's by anyone other than Atmel.

Horses for courses? Well, the ATMega328P is an old nag that should be minced down and put in a Findus lasagne.

Posted: 4 years 2 weeks ago by W4GNS #13038
W4GNS's Avatar
Thanks Matt, for the time consuming comparison. The Atmel fanboys claim the AVR is cheaper, which I could never understand.
For example a (8 bit)atMega1284P 40 pin PDIP is $8.14 at Mouser. Most, if not all PIC's are well under that cost. A quick look says most 40 pin PIC's are under $4.00 with a couple going as high as $6.00
Posted: 4 years 2 weeks ago by majenko #13041
majenko's Avatar
For that price you can get the top of the range PIC32MX795F512L - there is no better pic.

True, it's a 100 pin TQFP, not 40 pin DIP, but that's the price you pay for such a high end microcontroller.

And yes, I know I'm preaching to the converted (or is that perverted?)
Posted: 4 years 1 week ago by lespic #13039
lespic's Avatar
Matt Your right, I started with an RCA1802 micro back in the 70's then moved on to Z80 also had a look at 8051,and others, but my hobby really took off with PIC's , prefer asm to code so MPLAB fits very well.
Posted: 4 years 1 week ago by majenko #13040
majenko's Avatar
Matt Your right, I started with an RCA1802 micro back in the 70's then moved on to Z80 also had a look at 8051,and others, but my hobby really took off with PIC's , prefer asm to code so MPLAB fits very well.
Yay! A man after my own heart! Well, you can't have it, it's safely locked away in a bank vault in Switzerland.

I have a Z80 and an 8051 (actually an 80C320 - the same but faster) tucked away in one of my chip boxes. Been meaning to make my own computer out of the Z80 - something to run CP/M. Never got round to it though.

I prefer C myself - too lazy to use ASM. I know it, but I don't use it unless I have to. I have SDCC (Small Device C Compiler) for my "aged" work - supports Z80, 8051, etc.
Posted: 4 years 1 week ago by jmessina #13042
jmessina's Avatar
A couple of comments...

- both devices are RISC-based and use a Harvard architechture (separate program and data memory). The instruction sets are fairly similar, not like a RISC vs CISC. Seems like a wash to me.

- While the PIC clock may be faster, in general, the AVR is four times as fast as a PIC. Many ATMega instructions execute in a single cycle, while the PIC requires four clocks. A 20MHz ATMega is ~20MIPS, a 20MHz PIC18 is ~5MIPS. Even bumping it up to 64MHz only gets you 16MIPS.

Some winning AVR features
- linear data memory (no bank select paging)
- more general purpose registers (not just WREG)
- individual interrupt vectors
- peripheral features tend to be better (MUCH better in most cases)

Personally, the problem with the Arduino isn't the AVR, it's the fact that it's an Arduino.
Posted: 4 years 1 week ago by majenko #13043
majenko's Avatar
Interestingly, in all my time dismantling and salvaging components from real consumer and industrial electronics, the only Atmel chips I have ever come across are serial EEPROM chips - never an Atmel MCU (except in the Arduino). Plenty of PICs - I dismantled an HP inkjet printer with 3 of them in once - some 8051s, and strange intel things, but never an Atmel.

I think if it weren't for the Arduino and their serial EEPROM chips, Atmel wouldn't have much of a market to play in...
Posted: 4 years 1 week ago by W4GNS #13036
W4GNS's Avatar
My thoughts if I remember correctly is, that Atmel targets the automotive industry heavily. I went to Wikipedia to confirm this. Wikipedia claims Atmel is an American company, but I seem to recall Atmel being a Norwegian company, with offices in the states. So I'm uncertain how accurate Wikipedia is on anything related to Atmel.
Posted: 4 years 1 week ago by Jon Chandler #13037
Jon Chandler's Avatar
I think the question of "best" is a lot like Coke vs. Pepsi - it's largely what you're used to with no real differences.

The best microprocessor is one that lets you accomplish the job at hand. The best micro depends not just on the hardware but on the programming language, programmer and other tools involved in making the system work.
Posted: 4 years 1 week ago by jmessina #13033
jmessina's Avatar
I didn't mean to start a "who's best" war... that's a losing topic.

>I think if it weren't for the Arduino and their serial EEPROM chips, Atmel wouldn't have much of a market to play in...

Could well be, Matt. I don't have a clue what their 8-bit mcu market share's like these days. I know for the longest time folks complained about availability, but that's been a while ago now.

As Jon says, the best is the one that works.
Posted: 4 years 1 week ago by jpnorair #13059
jpnorair's Avatar
Notes on MSP430:

1. MSP430 is a classic CISC architecture that usually has double the code efficiency of PIC. TI says it is a RISC in the marketing, but that is crazy. I have no idea why they do.

2. MSP430 implements PWM through the Timer peripheral. The 14-pin DIP exposes 2 independent Timers, one with 1 channel and the other with 2 channels. Therefore, 3 PWM channels. They are multiplexed onto 8 pins, so the engineer has a lot of flexibility in the board design as far as which pin needs to have the PWM.

3. Code on the MSP430 tends to run much faster than on AVR or PIC, so you can run the MSP at lower frequency and use less power.

4. MSP430 has the most efficient sleep modes, therefore it applications it uses a small fraction of the power of AVR or PIC.

The major deficiency of the MSP430G2553 is the small RAM content, but otherwise it is a superior piece of technology than is AVR or PIC. If TI decides to move more of the MSP430 line down-market due to competitive pressure from Cortex-M in the up-market MCU segment, it will be a powerful competitor to AVR and PIC, and it should be seriously considered for any design that might presently use AVR or PIC.

Forum Activity

Member Access