Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/02/06 06:46
Read: times


 
#117579 - please say what is better PIC or AVR?
Responding to: ???'s previous message
I find this article in the web
Now please say what is better PIC or AVR?
please don't say it is depend all to application.


Ways in which PICs are better than AVRs
Instruction set/architecture (for Assembler users)
PIC good : Small instruction set means you can literally learn it in a day. Skip instructions can often simplify flow-control.

AVR bad : highly nonorthogonal instruction set - many operations can only be done on certain registers. Relative branch range can force code to be arranged in a non-logical order. No immediate XOR instruction. Illogical mixture of skip and branch flow-control instructions (Now if only they'd made STATUS one of the registers you could do skips on....!).

Clocks etc.

Recent Pics (12Fxxx etc.) have more accurate calibrated RC oscillators.

Watchdog wakeup from sleep continues after SLEEP instruction - on AVR it causes a reset, which can complicate things.

Power consumption
PICs have much lower power consumption at 5V

Interrupts

Interrupt latency is constant - if you set up a regular timer interrupt on a PIC, it will occur at exactly the same interval every time. On the AVR you will get at least one cycle jitter.

ADC
Much faster conversion speed than AVR

I/O and bit-twiddly things
I/Os are the same as other file registers, so operations other than bit set/clear operations take less work - bits can be toggled using XORWF, multiple bits can be set or cleared simultaneously using ANDWF or IORWF, and you can do neat tricks like using an output port as a shift-register for really fast pattern generation. The latter is not often useful, but does allow neat stuff like video generation.

I/O ports have much better drive capability - the output high level is easily capable of providing a few milliamps without significant voltage drop - useful for directly powering up peripheral devices (e.g. opamps) on demand for power-saving.

PIC can wake up from sleep on short pulses and edges. Counters are asynchronous and can count while part is in sleep, and count faster than the CPU clock. AVR cannot wake on edges (Except the few parts that have wake on pin-change), and level-triggered interrupts must be asserted until the chip wakes up and the clock starts otherwise the part will go back to sleep.

Configuring AVR reset pin as I/O disables in-circuit programming. On PICs the reset pin can be configured as an input without disabling serial programming, provided whatever is connected to it allows for the 12.5v programming voltage.

Availability
Microchip have always had a policy of short leadtimes, and there have never been significant shortages of released parts. Atmel have had some very bad times in the past - their wide product range means that AVRs are a small part of their overall business, so other markets can take priority over AVRs for production capacity. Microchip now has a fast-turnaround test cell to produce devices at short notice (with a price premium).
Microchip parts tend to be more easily available, especially in small quantities.

Microchip keep old parts available for long after they have been superceded. You can still buy PIC16C54XT's, despite now being on their fourth revision. Atmel have far fewer parts, yet have obsoleted more of them - e.g. the 90S4414 has been obsoleted twice (90S8515, now ATMega8515).

Devtools, programming, production etc.
PIC good :
One full-ICE platform (ICE2000) for all parts - Several variants of AVR ICEs for different parts, despite much fewer parts..!
All device configuration including internal eeprom initialisation is contained in one hex file.

AVR bad :
Device configuration etc. is a complete mess - there is no standard file formet to contain flash, eeprom and the many device config fuses, which can be a nightmare when transferring designs to production. There are 3rd party programmers that do this but this is something that should be defined by the manufacturer.
Calibration of internal RC osc on many parts (e.g. tiny26, mega16) is unnecessarily complex - for other than the default 1MHz rate, cal data has to be read from a special area by the programmer, then programmed into flash or eeprom so the application code can get at it to write to the osc cal register. This means that the application code and programming process need to have knowledge of each other, which can be a problem when a design goes to production.


Ways in which AVRs are better than PICs.
Instruction set/architecture

AVR good : Add with carry, and compare with carry simplify multiple precision arithmetic. Good range of conditional branches.

PIC bad : Unconventional mnemonic names.. Only one pointer for indirection. Inefficient lookup tables. No add/subtract with carry, small stack. Paged architecture becomes a real pain on larger projetcs, although the PIC18 architecture addresses (pun intended!) many of the issues.

Clocks etc.
Wider range of RC oscillator speeds. PLL high-frequency IO clock on some parts for high-speed captre etc.

More instructions per oscillator clock, but as most instructions take 2 cycles, and more instructions are often necessary for IO intensive tasks, this advantage is 2:1 at best. Most embedded apps are not especially throughput-dependent. Also, crystals and resonators get bigger and harder to get much below about 3MHz, so the speed advantage over a 4MHz PIC can often not be a major issue.

Watchdog can be turned off by software.

Power consumption
Brownout detector on recent parts has much lower consumption than the PIC one, which is often useless for battery-powered apps.

UART
TX and RX can be enabled seperately - useful for multi-processor comms on a common bus. High baudrates are possible from low clock frequencies.

Interrupts
Vectored interrupts are more efficient where there are multiple interrupt sources, and registers can be reserved for interrupt-only use to speed up context save for low latency,

ADC
Some parts have differential inputs and a x20 gain amp, although the latter is so noisy (on the tiny26 at least) it reduces effective number of bits to 8.
Internal voltage reference - accuracy not great but often useful, even if only for measuring battery voltage.
I/O
Seperate PORT and PIN registers avoid read-modify-write issues with capacitively loaded pins. (Although has any AVR user never spent time wondering why their input port isn't working because they used PORTx instead of PINx...? ).

Devtools, programming, production etc.
JTAG-ICE Mk.II is really fast and very like a real ICE! Debugwire looks very interesting, using the reset pin only. PIC in-circuit debugger uses 2 pins, (however the large variety of PICs available means there is usually another part you can use for debugging).


List of 57 messages in thread
TopicAuthorDate
PIC or AVR?            01/01/70 00:00      
   Unanswerable!            01/01/70 00:00      
   Definatlely AVR            01/01/70 00:00      
      Microchip aren't going broke!            01/01/70 00:00      
         Here comapines donot force PIC            01/01/70 00:00      
      How single minded can anyone be            01/01/70 00:00      
         Remember what I said about spelling?            01/01/70 00:00      
            unsafe at any speed            01/01/70 00:00      
               OK ... but what does it mean?            01/01/70 00:00      
                  Usage is the word            01/01/70 00:00      
                  usage?            01/01/70 00:00      
                     usafe = usage            01/01/70 00:00      
                        you took it right            01/01/70 00:00      
            Typing mistakes            01/01/70 00:00      
         ye nafareh pisheh ghazi rafti            01/01/70 00:00      
            a total contradiction            01/01/70 00:00      
      Noisy Application!            01/01/70 00:00      
         re noise            01/01/70 00:00      
         AVR Vs PIC !            01/01/70 00:00      
   I will vote avr            01/01/70 00:00      
      Not I!            01/01/70 00:00      
         so ...            01/01/70 00:00      
            that is what NASA said, too.            01/01/70 00:00      
   AVR            01/01/70 00:00      
   talking of alternatives            01/01/70 00:00      
      Not very well ... ...            01/01/70 00:00      
   neither and both            01/01/70 00:00      
   How about the PDP-8            01/01/70 00:00      
      down memeory lane            01/01/70 00:00      
   pic magazine            01/01/70 00:00      
      Everyday Practical Electronics.            01/01/70 00:00      
   definitley not PIC or DSPIC            01/01/70 00:00      
      The ICD is Not an emulator            01/01/70 00:00      
         Atmel fix everything? In dreams maybe.            01/01/70 00:00      
            Atmel = New Microsoft?            01/01/70 00:00      
               you did not highlight            01/01/70 00:00      
                  it's cheap? available in piles?            01/01/70 00:00      
                  You have piles too?            01/01/70 00:00      
                     excuse me?            01/01/70 00:00      
                        Piles            01/01/70 00:00      
                           Sh**!            01/01/70 00:00      
                              I think it is an older term            01/01/70 00:00      
                              I hope the embarassment did not make you            01/01/70 00:00      
                                 OK, heaps, or perhaps...            01/01/70 00:00      
                                    internal memory is not restricted to 'co            01/01/70 00:00      
                                       OK so where would you draw the line            01/01/70 00:00      
                                          somewhere hereabouts            01/01/70 00:00      
                                             I guess it's easier for us old-timers            01/01/70 00:00      
   please say what is better PIC or AVR?            01/01/70 00:00      
      nothing is BETTER            01/01/70 00:00      
         Good point!            01/01/70 00:00      
      What is better for you?            01/01/70 00:00      
         I'll select AVR!            01/01/70 00:00      
            Experience            01/01/70 00:00      
      it's still pure male cow manure            01/01/70 00:00      
      It is a religious issue            01/01/70 00:00      
   AVR            01/01/70 00:00      

Back to Subject List