Personal comparison between PICs and AVRs

Discussion in 'Embedded Systems and Microcontrollers' started by mik3, Jul 16, 2009.

  1. mik3

    Thread Starter Senior Member

    Feb 4, 2008
    4,846
    63
    Many threats are opened to discuss this subject, PICs vs AVRs.

    I have used both 8-bit PICs and AVRs and from personal tests I can say that AVRs are superior to PICs because they don't divide the clock by 4 while PICs do.

    The test was a pin being driven high and low with no delay between the high and low instructions. Both uC were clocked at 8 MHz.

    The AVR (ATMega8) pin was switching at 2 MHz. This is because the instructions (assembly) which were needed to perform this action needed 4 clock cycles to be executed (check ATMega8 datasheet for execution cycles).

    The PIC (16F819) pin was switching at 500 kHz. The one reason is that the instructions needed 4 clock cycles (PIC16F819 datasheet) to be executed and the other is that the clock is divided by 4.

    Thus, it is seen that AVRs are faster than PICs at the 8-bit level referring to their instruction execution cycle because for the same instructions (compared in the datasheets) both families need the same cycles per instruction and because AVR does not divide the clock.

    AVRs have a larger instruction set than PICs ans thus they need less code to perform a task.However, most of the instructions (not included in the PICs instruction list) need more than one cycle to be executed and thus balances their total execution program speed comparing with PICs (if PICs didn't divide the clock and were like AVRs).

    This doesn't mean they are not faster because if they had both the same instruction list AVR would be faster because it doesn't divide the clock by 4.

    According the 16-bit and 32-bit versions, PICs don't divide the clock and I think they have the same program execution speed.
     
  2. millwood

    Guest

    that's a valid *performance* comparison to the extent that all you want to do with your mcu is to turn the ports on and off.

    the further you move away from that, the less applicable such a comparison is.
     
  3. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    1,758
    98
    If it's MIPs you want there are some very fast PICs available and are about the same price as some 16F PICs.

    The 24H can hit 40MIPs kinda overkill for flasing an LED.
     
  4. nanovate

    Distinguished Member

    May 7, 2007
    665
    1
    This is a 16-bit part with a different core and architecture than the PIC12/16 and PIC18. That part is better compared with the ATXMega series from Atmel which is 32 MIPS (has 8-bit core with 16-bit enhancements). BTW Silabs has a 100 MIPS 8051.
     
  5. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    1,758
    98
    Another nice PIC feature is one inexpensive tool (PICkit 2) can program & debug almost all modern PICs.

    All in all it's personal preference. It's like comparing apples to oranges.
     
  6. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    Among the most attractive features of the AVR series of microcontrollers for me is the free software development tools. The powerful full-featured IDE for assembly language development is called AVRSTUDIO4 and can be downloaded for free from www.atmel.com. The C-compiler add-in to the AVRSTUDIO4 IDE is called WINAVR and it can be downloaded for free from www.sourceforge.net.

    These tools support code development in assembly language or C-language for almost all of the AVR microcontrollers.

    hgmjr
     
    Last edited: Jul 17, 2009
  7. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    1,758
    98
    PIC vs AVR debates are pointless and endless and has been discussed adnaseum on the web before. There is no right answer. You might as well start a debate on what's the best color.
     
  8. mik3

    Thread Starter Senior Member

    Feb 4, 2008
    4,846
    63
    The correct answer is that there is not a best family of microcontrollers. The most suitable choice depends on the application.
     
  9. Metalfan1185

    Active Member

    Sep 12, 2008
    146
    0
    Im sold on the AVR chips,

    Cmon, $6 for an ATMega328 with a pre-installed bootloader, plus a free development IDE, and a great forum of pros that are geniuses when it comes to this stuff...


    I use 2 Arduino's with 328 chips and they work extremely well. and learning C isn't as bad as i thought it was going to be.

    I wanted to try a PIC because you can program them with BASIC but I dont have the cash for one. the few iv'e seen are pretty expensive (like, $120). And even so, if i could afford one, i could buy about 20 AVR chips for the same price!
     
  10. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    1,758
    98
    What PIC is $120? They tend to be around the same price as any other microcontroller.
     
  11. millwood

    Guest

    that must be for a gold-plated, and diamond-studded one of a kind mcu.
     
  12. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    1,758
    98
    I think the old RCA1802 was $100 and it was Silicon on Sapphire.
     
  13. sissow2

    Member

    Jul 14, 2009
    16
    0
    i may be mistaken, but isnt there a way to override that behavior?

    And i have never heard of a pic that cost $120. maybe you are thinking of a bulk order of 50 of them?
     
  14. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    1,758
    98
    The ancient 10F thru 16F do not have PLLs so they are stuck with a /4 clock. Their modern replacement the 18F have a 4x PLLs (and some have more complex PLL's like the USB PICs)
    My favorite funky PLL is the one found in the 24HJ12GP20x

    it has 3 stages.
    / 2 to 33
    x 2 to 513
    / 2, 4 or 8

    That's thousands of combinations.
     
  15. millwood

    Guest

    regardless of how they multiple up the pll, they all divid up the frequency by four to get to a system clock.

    at least for the non-dspic types.
     
  16. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    1,758
    98
    True, plus the 24 series is /2
     
  17. millwood

    Guest

    comparisons of any mcus on "speed" alone are (almost?) always meaningless.

    for the hobbyests, any mcu is typically too fast. how many mips does it take to blink an led? :)

    many times, I chose mcus for irrational reasons: because it is fun to learn a new mcu, or I want to try out a new dev board, or a new IDE, etc.

    very rarely, the speed is at or near the top of my list of reasons to use a mcu. to me, the programming environment and availability of user support / code base are far more important.

    I am sure similar considerations exist for commercial developers, aside from corporate commitment / strategies / existing code base / etc.
     
  18. nanovate

    Distinguished Member

    May 7, 2007
    665
    1
    cost cost cost do not forget cost ;)

    One good thing (or bad depending on your perspective) about Microchip is that they have not End-of-Life'd any of their PICs. So yes that OTP PIC16C54 from years ago is still available for purchase.
     
  19. jp0304

    New Member

    Mar 11, 2009
    7
    0
    hi everybody,
    I'm programming in BASIC Bascom (AVR) from nearly the first version. I did professional job with it : Pilot of HF generator for radar, and so on...
    before I used PC104 for the same job!

    I did it fast , easely and with an incredible good forum to assist me.
    the upgrade of version are free of charge,
    The AVR are very similar one to another. from the Tiny25 to the mega256

    Funny, a friend of mine works with Pic OTP for small use but with AVR for large application.:)
    I think it is very nice to have the both on the market;)
    But my choice is done!

    JP
     
  20. mik3

    Thread Starter Senior Member

    Feb 4, 2008
    4,846
    63
    I agree with that because as I get involved more in microcontrollers I find out that each company offers different features for their microcontrollers and the choice is made upon the application. Also, I started this threat and said that AVR is faster than PIC because AVR does not divide the clock by 4. Now, I can say that this is true only for 8-bit microcontrollers. For more powerful microcontrollers the processing speed (MIPS) are more or less the same for both AVR and PIC.
     
Loading...