what are the advantages of using atmega32 than other microcontrollers ? is it better than pic and arm,8051 ?
It depends.. Firstly you have to know what you want from the microprocessor.
In general:
PIC:
- Old architecture. This means it's either expensive or slow
- Targets only low end market (< few Mhz)
- There's a lot of code written for it
ARM
- Scalable
- Fast/cheap
Atmega is somewhere in between
Well, it isn't easy to answer. It mostly depends on what you used before. If you are already AVR user, then it's good to use. On the other hand you can find PICs with similar capabilities, so I'd say it's mostly personal preference. I think that most ARMs are more capable than atmega32 series. If you want good advice, tell us what you plan to use it for.
AVRs have flat memory model and have free development tools and cheap development hardware is available for them.
I don't know enough about 8051 to comment.
Oh and if you're thinking about original atmega32, I'd say it's a bad idea. It's going to be deprecated soon, so you may want to consider newer models from the atmega32 series.
At this end of the spectrum, there are only really two factors that make much difference. First, in smaller quantities, the only thing that matters at all is which architecture suits your development needs best. If you are already familiar with PIC, there's not much point in learning avr, or visa versa. Pick an architecture that you like, then sort through the options on that architecture to see which model is up to your particular needs.
In quantity (say, 20 or more units), you might benefit by choosing just the right platform that precisely matches your devices' needs, to keep costs as low as possible.
In general, Pic and avr platforms are good for simple, single function devices, where as arm is used in cases where you need a full OS stack like QNX or Linux for things like TCP or real time with OS services.
Advantages
- Still runs on 5V, so legacy 5V stuff interfaces cleaner
- Even though its 5V capable, newer parts can run to 1.8V. This wide range is very rare.
- Nice instruction set, very good instruction throughput compared to other processors (HCS08, PIC12/16/18).
- High quality GCC port (no proprietary crappy compilers!)
- "PA" variants have good sleep mode capabilities, in micro-amps.
- Well rounded peripheral set
- QTouch capability
Disadvantages
- Still 8 bit. An ARM is a 16/32bit workhorse, and will push a good amount more data around, at much higher clocks, than any 8bit.
- Cost. Can be expensive compared to HCS08 or other bargain 8bit processors.
- GCC toolchain has quirks, like the split memory model and limited 16bit pointers.
- Atmel is not the best supplier on the planet (at least they're not Maxim...)
In short, they are a very clean and easy to work with 8bit microcontroller.
An 8051 is legacy: the tools are passable, the architecture is bizarre (idata? xdata? non-reentrant functions in most compilers by default?).
PIC before PIC24 is also bizarre (register banking) and poor clock->instruction throughput. There is no first-class open source C compiler either.
PIC32 is competing with ARM7TDMI and ARM Cortex-M3, based on an adapted MIPS core, and has a GCC port (not main-lined).
AVR32 is competing with Cortex-M3, and offers a pretty good value, especially in the low power area.
MSP430 is the king for ultra low power devices, and has a passable GCC port (if you're not targeting 430X).
HCS08 is very inexpensive, but poor instruction throughput. Peripherals vary quite a bit.
ARM used to be a higher cost entry point, but with the introduction of the Cortex-M3 architecture, the price has been dropping compared to an 8bit. For example, the LPC13xx series is comparable to a ATMega32 in many ways. Luminary (TI) has quite an impressive peripheral set.
I find the PIC family (before the mips version) to have the most painful instruction set of all, which means assembler is the language of choice if you want to conserve space, get performance, have control, etc. The 8051 is a little less painful, more registers, but still takes a handful of instructions to do anything useful (meaning you cannot compare these to other chips from a mhz perspective). I like avr in many ways, they embrace the homebrew and developer community, or if not directly there is a much better family of developers out there compared to the competition. I dont like the instruction set, but it is decades ahead of the pic and 8051. I like the msp430 instruction set quite a bit, it is one of the best instruction sets for teaching assembler, TI is not as developer friendly though, it can be a struggle. the ez430 was on the right path but the goodfet is better as you dont have it failing to work every other kernel version. msp430 and arm have the best instructions sets as far as I am concerned which leads to both good assembler and good compiler tools. You can find pay for tools for all of the above and certaily for 8051, msp430, and arm free tools (msp430 and arm can use gcc, 8051 cannot, look for sdcc). For now mspgcc4.sf.net and code sourcery are the place for gcc based tools for msp430 and arm. llvm supports both, I was able to get llvm 27 to beat the latest gcc in a dhrystone test, but that is one test, llvm trails behind in performance but is improving. as far as finding and creating free cross compilers I see llvm already as the easiest to get and use and going forward it will hopefully only get better. sadly the msp430 port for llvm was a look what I can do in an afternoon power point presentation and not a serious port.
My answer is that it depends on what you are doing, and I recommend you try all of them. These days the eval boards are in the sub $50 range and some in the sub $30 range. Even within the arm family (ST, atmel, stellaris, lpc, etc) there is a wide veriety of features and quirks that you will only find if you try them. avoid the lpcexpresso, mbed2, and stm32 primers. avoid lpc in general and avoid cortex-m3 in general until you have cut your teeth on an arm7. Look at sparkfun for olimex and other boards. although it is probably lpc the armmite pro and arduino pro are good choices. the ez430 is a good msp430 start, and I dont remember who is making 8051 stuff, renasys (sp?), 8051s are not all created equal, the register space varies from one to another and you have to prepare for that. I would probably look for an 8051 simulator if you want to play with the 8051.
I see avr and definitely arm continuing to dominate, I would like to see the msp430 be used for things other than just super low power. With arm, avr, and msp430 you can use and get used to gcc tools now and in the future, which has a lot of benefits even if gcc isnt the best compiler in the world, it is by far the best supported compiler. I would avoid proprietary compilers and tools. I would look for devices that have non-proprietary programming interfaces that are field programmable, jtag is good, but for example the new swd jtag on cortex-m3 is bad. ti msp was hurt by this but some hacking has resolved this, at least for now. I really dont have much good to say about pic and wont try. A big thing to look for is glue logic, does the part or family have the spi or i2c or whatever bus you want to use, do you need an internal pull up or wired or input? some chips just dont have that option and you have to add external hardware. do you need an interrupt, with conditioning? ARM tends to win on this because it is a core used by many so each arm vendor puts its own I/O out there so you can still live in the arm world and have many choices, avr and msp are going to be very limited by comparison. With ARM the tools are going to be state of the art, ARM is the most used processor right now. avr and msp are special project add ons, less widely supported and fragile. Although arm is low power compared to intel on a sbc or computer platform, it is likely not as low power as an avr or msp. You really need to look at your project and pick the right processor for the job, I wouldnt and dont limit myself to one family. With as cheap as the eval boards are, and almost all can use free tools, it is just a matter of putting in a few nights or weekends in to learn each. I suggest learning more than one avr, and learning more than one micro.
If you want the widest choice of peripherals, performance, price-point, software and tool support, and suppliers it would be hard to beat an ARM Cortex-M3 based part.
But addressing your question directly the whole AVR range has a consistent architecture and common peripheral set from the Tiny to the Mega (not AVR32 however which is entirely different). This is the significant difference with PIC where when moving up the range( PIC10, 12, 16, 18, 24, 32), you get different peripheral designs, different instruction sets, and need to invest in different compilers and debug hardware.
The instruction set for AVR was designed for efficient C code compilation (again unlike PIC).
8051 is an architecture originally introduced by Intel decades ago, but now used as the core for 8 bit devices from a number of vendors. It has some clever tricks such as efficient multitasking context switches via its 8 duplicated register banks, and a block of bit addressable memory, but has a quirky memory architecture and limited address range (like most 8 bit devices). Great for small well targeted devices, but not truly general purpose.
ARM Cortex-M3 essentially replaces ARM7TDMI, and is a cleaner design with well thought out architecture. It requires minimal assembler start-up code and even ISRs and vector tables can be coded in C directly without any weird compiler extensions or assembler entry/exit code. Its bitbanding technique allows all memory and peripherals to be atomically bit addressable, which is useful for fast I/O and safe multithreading. Basically it is designed to allow C or C++ code at the system level without non-standard compiler extensions. It is of course a 32 bit architecture, so does not have the resource or arithmetic limitations of 8 bit devices. Prices for low-end parts compete with higher performance 8 bit devices, and blow most 16 bit devices out of the water (making 16 bit almost obsolete).
One other key thing to remember is that PIC and AVR are from single vendors, while 8051 and ARM are licensed cores. Each licensee adds their own peripheral set, so there is no commonality between vendors on peripherals, so device driver code needs porting when switching vendors, and you need to ensure the part has the peripherals you need. If you design your device layer well, this is seldom much of a problem.