I've programmed both, though, not a PIC for many years now... PICs are just weird.
The AVR is a pretty typical Harvard RISC: 32 registers, memory load/store, direct/indirect jumps, stack pointer pointing at ram, etc. It's still 8/16 bit, so some pairs of 8 bit registers work like 16 bit registers.
The PIC has one accumulator register; ram is a set of (manually selected) register banks. Instructions operate on the accumulator and an operand in the selected bank. The stack is totallyseparate from other RAM, so it's fixed size (8 maybe?) and can only be used with call/return.
I don't want to be judgmental; there's certainly some strange virtues to PIC, like the lack of any real state to save/restore on ISR entry/exit; but they really just don't fit my mental concept of a CPU.
Exercise for the reader: Given the stack and register bank selection, which one of these has better C compilers?
(Still, if you're learning something new, gamble is right: ARM is the future.)
PIC is clearly designed for non-C assembly code, with all global variables. Its ancient.
PIC32 is actually a MIPS core (sorta, kinda, maybe). It actually uses GCC to compile (good luck on compiling your own GCC though). However, there isn't much appeal with CM3 now on the scene.
PIC24, the 16bit PIC variant, is much imporved in this respect. You have 16 working registers (though one of these is used for the stack), four of these are shadowed for fast store/restore (eg, so the registers can be used in an interrupt handler), memory is directly accessible (most instructions can operate on both memory and registers equally) and the instruction set is very simple and regular.
I have not used it with C (I have so far written my code in PIC assembly), but they claim the instruction set is very compiler friendly and at a guess, I'd say they're right since the memory access is very regular and most instructions also come in convenient three-operand forms.
I'm not sure if the instruction set for the PIC24 is basically a 16bit variant of the PIC32 (have not looked into these in detail yet), but from the code samples I've seen, it seems to be. So PIC24, like PIC32, seems to be a RISC-based core.
I actually like the PIC24. Besides the painful lack of (assembly) documentation outside the datasheet and various reference manuals (I guess nobody programs them in assembly these days? I suppose the same problem probably exists for other newish microcontorllers too?), it is very nice and easy to work with. The assembly language is very simple and easy to use. But, since the Cortex-M3 is similarly priced, but is faster (~100MHz vs 40MHz for a PIC24H), is 32bit, has a ton of features and peripheral support, its hard to choose PIC over these. I will probably look into switching to CM3 for my next project.
Seriously, Cortex-M3 microcontrollers are much more powerful than any AVR or PIC at the same price, with roughly the same level of complexity as a high-end PIC/AVR.
ARM already dominates high-end embedded systems, and is quickly penetrating the low end. Atmel and Microchip both see the writing on the wall; control of Atmel's ARM line was a major factor in Microchip's failed hostile takeover bid for Atmel several years ago. If you have any professional interest in embedded systems, it may be a better bet to invest time in ARM rather than an 8-bit architecture.
There are a few arguments left in favor of PIC/AVR: ultra low power consumption, pin count, and price for the low-end chips, DIL package availability, and support for hobbyists in the forums. I'm not sure a difference of $1/unit and a few uW/MHz is relevant for hobbyists, and the Arduino is probably a better solution for people who aren't comfortable working with SMD. (Which honestly isn't that hard, anyway...)
How do the low-end ARM devices compare to 16bit and 32bit AVR and PIC offerings?
Recently, I have been doing a lot of development for both the (8bit) AT90USB162 and the (16bit) PIC24HJ. The PIC24HJ range of 16bit PIC microcontrollers packs an awesome punch at 40 MIPS, has mostly 1-cycle instructions and two hardware SPI peripherals (which, for me, is important. On the other hand, the AT90USB162 only has one). I have been interested in ARM, though, so am wondering if it would be worth switching before I become to reliant on other microcontrollers.
ARM is awesome. Specially the low end Cortex chips.
However, for hobbyists these chips are not that easy. None of them come in DIP packaging so instead of simply soldering them in a simple prototype board or sticking them in a breadboard you will have to find SMD adapters or create your own PCB.
Some of them come in DIL packaging (at least the little ones). The architecture has a GCC port and two free-as-in-small-glasses-of-beer commercial IDEs. The assembly language is bearable. The cheapest development board (with single-stepping debugger support) is $4.30.
Have they sorted out the Mac support? I have one and haven't been able to get the toolchain to communicate with my MacPro. and no way am I booting into Linux just to push firmware.
"PIC vs. AVR" means two different things depending on your context. The intelligent context is discussing which family best suits somebody new to microcontrollers (which thankfully is what this link is about). The moronic context is entrenched hobbyists arguing about why the family they chose is superior.
Anybody who reads this headline and already understands what the acronyms mean is probably going to assume it's the latter.
The time stamp from the webpage is "May 17, 2011 20:07"!
But if it is outdated a PIC-AVR-ARM update would be interesting. Personally I used all three, but prefer nowadays PIC because of the wide-ranging PIC24&dsPIC and Microchips great stacks offering.
This article manages to mention just about every insignificant detail (who cares about the crappy IDEs they ship with?) and almost none of the actual properties of the chip!
You would expect at the very least memory comparisons, clock speeds, and power consumptions. Maybe a mention of timers, ADCs, UARTs, etc.
I think it concentrated more on the aspects of how pleasant each is to use. The analysis was light on the technical side because ladyada targets more hobbyists (like myself :D ) and prototype creation rather than people that want to create a product that will be manufactured, reproduced and distributed on a large scale.
Though I haven't used PIC personally though, I have used AVR before, and found it quite pleasant and flexible, though in all fairness I can't compare it to PIC. I will say though that there seems to be more resources and documentation on PIC than AVR (I bough a really good book on embedded devices that was based on PIC, and though the examples were helpful universally, they were targeting the PIC crowd specifically.)
You'd think so.... I have no idea why the embedded world is so into what IDE they can use. Too many hardware engineers turned firmware engineers wanting an easy solution?
I know that a lot of people hate Arduinos, but I like the flexibility of prototyping on an Arduino, moving the same code to a raw ATmega328, and then (for teeny projects) maybe port to an ATtiny for cost and space savings.
One thing that Lady Ada forgets to mention is that Microchip is working on MPLAB-X. A cross-platform version of their MPLAB IDE. I've used it on both Windows and OS X and it works well.
It runs on Wind, OSX and Linux.
This might be their way to get back into AVR territory. At least when it comes to hobbyists/makers.
[+] [-] eck|14 years ago|reply
The AVR is a pretty typical Harvard RISC: 32 registers, memory load/store, direct/indirect jumps, stack pointer pointing at ram, etc. It's still 8/16 bit, so some pairs of 8 bit registers work like 16 bit registers.
The PIC has one accumulator register; ram is a set of (manually selected) register banks. Instructions operate on the accumulator and an operand in the selected bank. The stack is totally separate from other RAM, so it's fixed size (8 maybe?) and can only be used with call/return.
I don't want to be judgmental; there's certainly some strange virtues to PIC, like the lack of any real state to save/restore on ISR entry/exit; but they really just don't fit my mental concept of a CPU.
Exercise for the reader: Given the stack and register bank selection, which one of these has better C compilers?
(Still, if you're learning something new, gamble is right: ARM is the future.)
[+] [-] theatrus2|14 years ago|reply
PIC32 is actually a MIPS core (sorta, kinda, maybe). It actually uses GCC to compile (good luck on compiling your own GCC though). However, there isn't much appeal with CM3 now on the scene.
[+] [-] dkersten|14 years ago|reply
I have not used it with C (I have so far written my code in PIC assembly), but they claim the instruction set is very compiler friendly and at a guess, I'd say they're right since the memory access is very regular and most instructions also come in convenient three-operand forms.
I'm not sure if the instruction set for the PIC24 is basically a 16bit variant of the PIC32 (have not looked into these in detail yet), but from the code samples I've seen, it seems to be. So PIC24, like PIC32, seems to be a RISC-based core.
I actually like the PIC24. Besides the painful lack of (assembly) documentation outside the datasheet and various reference manuals (I guess nobody programs them in assembly these days? I suppose the same problem probably exists for other newish microcontorllers too?), it is very nice and easy to work with. The assembly language is very simple and easy to use. But, since the Cortex-M3 is similarly priced, but is faster (~100MHz vs 40MHz for a PIC24H), is 32bit, has a ton of features and peripheral support, its hard to choose PIC over these. I will probably look into switching to CM3 for my next project.
[+] [-] gamble|14 years ago|reply
Seriously, Cortex-M3 microcontrollers are much more powerful than any AVR or PIC at the same price, with roughly the same level of complexity as a high-end PIC/AVR.
ARM already dominates high-end embedded systems, and is quickly penetrating the low end. Atmel and Microchip both see the writing on the wall; control of Atmel's ARM line was a major factor in Microchip's failed hostile takeover bid for Atmel several years ago. If you have any professional interest in embedded systems, it may be a better bet to invest time in ARM rather than an 8-bit architecture.
There are a few arguments left in favor of PIC/AVR: ultra low power consumption, pin count, and price for the low-end chips, DIL package availability, and support for hobbyists in the forums. I'm not sure a difference of $1/unit and a few uW/MHz is relevant for hobbyists, and the Arduino is probably a better solution for people who aren't comfortable working with SMD. (Which honestly isn't that hard, anyway...)
[+] [-] dkersten|14 years ago|reply
Recently, I have been doing a lot of development for both the (8bit) AT90USB162 and the (16bit) PIC24HJ. The PIC24HJ range of 16bit PIC microcontrollers packs an awesome punch at 40 MIPS, has mostly 1-cycle instructions and two hardware SPI peripherals (which, for me, is important. On the other hand, the AT90USB162 only has one). I have been interested in ARM, though, so am wondering if it would be worth switching before I become to reliant on other microcontrollers.
[+] [-] st3fan|14 years ago|reply
However, for hobbyists these chips are not that easy. None of them come in DIP packaging so instead of simply soldering them in a simple prototype board or sticking them in a breadboard you will have to find SMD adapters or create your own PCB.
That is where AVR and PIC win big time.
[+] [-] joshu|14 years ago|reply
[+] [-] limmeau|14 years ago|reply
Some of them come in DIL packaging (at least the little ones). The architecture has a GCC port and two free-as-in-small-glasses-of-beer commercial IDEs. The assembly language is bearable. The cheapest development board (with single-stepping debugger support) is $4.30.
[+] [-] yardie|14 years ago|reply
[+] [-] srik|14 years ago|reply
[+] [-] chrisjsmith|14 years ago|reply
For those people who use a Mac, just fire up Parallels/Bootcamp and Windows - it works fine and won't kill you (honestly).
[+] [-] flashingleds|14 years ago|reply
Anybody who reads this headline and already understands what the acronyms mean is probably going to assume it's the latter.
[+] [-] asciilifeform|14 years ago|reply
On the PIC, I get the feeling of being "master of all I survey." The instruction set and system architecture fit in a magazine-sized booklet.
The AVR, on the other hand, is a ball of goo, quite like the x86.
[+] [-] ladyada|14 years ago|reply
please do not take it seriously at this point, its completely outdated
[+] [-] eande|14 years ago|reply
But if it is outdated a PIC-AVR-ARM update would be interesting. Personally I used all three, but prefer nowadays PIC because of the wide-ranging PIC24&dsPIC and Microchips great stacks offering.
[+] [-] Palomides|14 years ago|reply
[+] [-] swalberg|14 years ago|reply
[+] [-] phirephly|14 years ago|reply
[+] [-] rcfox|14 years ago|reply
You would expect at the very least memory comparisons, clock speeds, and power consumptions. Maybe a mention of timers, ADCs, UARTs, etc.
[+] [-] chamakits|14 years ago|reply
Though I haven't used PIC personally though, I have used AVR before, and found it quite pleasant and flexible, though in all fairness I can't compare it to PIC. I will say though that there seems to be more resources and documentation on PIC than AVR (I bough a really good book on embedded devices that was based on PIC, and though the examples were helpful universally, they were targeting the PIC crowd specifically.)
[+] [-] theatrus2|14 years ago|reply
[+] [-] guan|14 years ago|reply
[+] [-] st3fan|14 years ago|reply
It runs on Wind, OSX and Linux.
This might be their way to get back into AVR territory. At least when it comes to hobbyists/makers.
[+] [-] samic|14 years ago|reply
[deleted]