This post will help you understand the basics of Microcontrollers and also will guide you in selecting a controller and their development tools.
What is the difference between a Microprocessor (MP) and a Microcontroller(MC)?
A MP such as Intel’s Pentium used in your computer contains no RAM,no ROM,no I/O ports on the chip itself.All these should be added externally as peripherals.
A Microcontroller embeds all these together in a single chip.The fixed amount of on chip ROM,RAM,timers and I/O ports makes MCs ideal for many applications in which cost and space are critical.
Very often you may come across following names while looking for a microcontroller.
INTEL8051 ATMEL AVR PIC ARM RENESAS
In 1981 Intel Corporation introduced an 8 bit microcontroller called the 8051.It was referred as a System on a chip as it had 128 bytes of RAM, 4K bytes of ROM, 2 timers,one serial port and four ports of 8bit wide each , all on a single chip.This triggered the era of embedded technology.
As 8051 became widely popular , Intel allowed other manufacturers to make and market any flavor of the 8051 provided their instruction set is compatible to that of 8051.So , if you write a program for one , it will run on any of them regardless of the manufacturer.
Other members of the 8051 family are 8052 and the 8031.The 8052 has an extra 128bytes(total 256bytes) of RAM and 3 timers.The 8031 is a ROM-less version of 8051.
CISC and RISC
8051 is CISC -Complex Instruction Set Computer .
Pronounced sisk, and stands for complex instruction set computer. Most personal computers, use a CISC architecture, in which the CPU supports as many as two hundred instructions. An alternative architecture, used by many workstations and also some personal computers, is RISC (reduced instruction set computer), which supports fewer instructions.
Today’s MCs are all RISCs.
For e.g Atmel 89c51 is a RISC – Reduced Instruction Set Computer .
Types of Memories
RAM is Random Access Memory used for storing data.It is capable of both Read and Write.It is a Volatile memory ,meaning the data will be erased when power is off.
ROM as the name indicates is a Read Only Memory and is used to store System programs you write.It is a Non-Volatile memory ,meaning the data remains in memory even when the power is off.
FLASH is a semiconductor memory and enjoys the best of both worlds.It can be written to, as well as read from and its data is not lost when power goes away.USB pen drives are of this type. Flash memories are widely used in today’s MPs.
The memory architecture used in embedded system is called Harvard architecture. In this the system program is stored in the non volatile Flash memory(used as ROM) and the data is stored in the static RAM.The architecture used in PCs is called Princeton where a single memory holds both program and data.
As already mentioned ,various manufacturers offer 8051 flavor.
ATMEL has a rich portfolio of microcontrollers based on 8051 instruction set.Developers can choose from 8 to 32 bits.
AT89c51, AT89c52, AT89c2051, AT89s51, At89s52 are widely present in the market.
89V51RD2 of Philips make is also popular.
To program a MC one has to write assembly language program on any suitable platform which supports 8051 ALP.Then by compiling this file he has to generate an object file .At last by running this object will generate Hex equivalent file which is downloaded into 89c51. Intel format Hex filescan only be loaded to a Microcontroller’s flash memory.
Assembly language is not so popular in industry.Embedded C is widely used to program microcontrollers.Most of the embedded programs are created in a PC as they provide rich set of tools and platform. A cross compileris a compiler capable of creating executable code for a platform other than the one on which the compiler is run. Cross compiler tools are used to generate hex files for embedded system.
Micro vision KEILis one such a cross compiler which provides Integrated Development Environment (IDE) to develop programs for 8051 family controllers.
Flash Magicis used for programming NXP (Philips) flash microcontrollers
KEILprovides the platform to write the assembly language programs of many kind of controllers in standard C language.When you compile the program it will generate hex file that can be directly loaded into target controller.KEIL supports a wide range of controllers from Atmel,Dallas,Maxim,Philips,Samsung.
Go to download page www.keil.com/download/product/
From the list of different packages select C51 for 8051devices like ATMEL 89c51,89s51,89c52,89s52, etc..
C251 for all 80251 devices
MDK-ARM for Cortex & ARM devices
C166 for c166,xc166 & xc2000 MCUs
Click C51 & provide your name , address,email to get download link for the file c51v903.exe which is a 53mb download.It is only a Lite version,an evaluation tool with Limitations. Compiler,linker,assembler & debugger are limited to 2 kbytes of object code(source code may be of any size) . Programs that generate more than 2kb of object code will not compile ,assemble or link.
AVR was developed by Atmel corporation in 1996. AVR stands for Advanced Virtual RISC
(Reduced Instruction Set Computer).
AVR microcontrollers are available in 3 categories
Tiny AVR— for simple applications,small in size ,upto 8kB memory.
e.g AT tiny 4 is an 8pin,8 bit AVR with 512 bytes of flash
AT tiny 26 is a 20pin, 8 bit AVR WITH 2KB flash
Mega AVR–for moderate /complex applications,higher no. of peripherals,upto 256kB memory.
e.g AT mega 16 –AT stands for Atmel manufacturer ,mega stands for the type of AVR and 16 stands for 16 KB flash program memory
AT mega 16L L means operating frequency range is 0 to 8Mhz. No L means operating frequency range is 0 to 16Mhz.
XMega AVR– for commercial applications which require larger program memory & high speed.
8 bit AVRs are 4 times faster than 8bit PICs.
AT 32 UC3 A0128is a recently launched 32 bit AVR microcontroller with 128 KB flash memory .
The Development environment is provided by AVR Studio (version 5at the time of this writing Aug.2011).It includes Visual studio shell 2010 and .NET4.0.
Atmel AVR Studio 5 is the Integrated Development Environment (IDE) for developing and debugging embedded Atmel AVR applications. The AVR Studio 5 IDE gives you a seamless and easy-to-use environment to write, build, and debug your C/C++ and assembler code.
AVR Studio 5 supports ALL AVR microcontrollers. Now you can bring all your 8– and 32-bit AVR projects into one, easy-to-use environment.
Register your name and email at http://www.atmel.com/dyn/products/tools_card.asp?tool_id=17212&source=avr_5_studio_overview
and be prepared for a bulky download of 600MB of AVR Studio5.
You no longer have to install a separate compiler or tool chain. AVR Studio 5 includes a C compiler, assembler and a simulator, and interfaces seamlessly with in-system debuggers and programmers to make code development easier.
The AVR Studio 5 editor simplifies code editing and lets you code more efficiently. Type a few letters of a symbol, and AVR Studio 5 will display a list of suggestions, just like intellisense in Visual studio.
PIC is a family of Harvard architecture microcontrollers made by Microchip Technology . The name PIC initially referred to “Peripheral Interface Controller“.
PICs are popular with both industrial developers and hobbyists alike due to their low cost, wide availability, large user base, extensive collection of application notes, availability of low cost or free development tools, and serial programming (and re-programming with flash memory) capability.
In circuit programming & debugging PicKit units are available at low cost.Wide range of interfaces Usb,Usart,Ethernet,Psp,Pwm,SPI,etc, are supported.
PIC16F84, PIC16F72, PIC16F676, PIC16F877A, PIC18F458 are some of the popular PICs.
Microchip provides a freeware IDE package called MPLAB which includes an assembler,linker,software simulator & debugger.They also sell C compilers for pic18 & dsPic which integrates with MPLAB. Lite version of HITECH C compilerwith limitations is free with MPLAB.Pro version of Hitech C compiler cost nearly $1000.
MPLAB IDE v8.76 can be downloaded from http://www.microchip.com
3rd party C compilers can be integrated to MPLAB. PICBasic is one such compiler from www.melabs.com. It can turn your English like BASIC programs into machine language that can be fused into PIC MCU.You don’t have to learn Assembler or C program.Pro versions come with a price tag of $250.
Microchip has also introduced Digital Signal Controllers (DSC) which is a hybrid of microcontrollers & Digital Signal Processors (DSP) . dsPIC30F is a 30 Mhz 16 bit DSC ,which can be selected for Motor control applications,Smps,Speech & communication applications.
Microchips 16 bit microcontrollers are called dsPICwhich feature a set of 16 working registers & fully support a stack in RAM,.
PIC32 MX family is of 32 bit controllers with a largest Flash memory of 512 kb,cached processor,execution from RAM allowed & real time trace.
Microchip has migrated its MPLAB integrated development environment (IDE) onto the open-source Java-based ‘NetBeans IDE’, allowing it to run on Linux and Mac OS as well as Windows.
The MPLAB X IDEis the new graphical, integrated debugging tool set for all of Microchip’s 8-bit, 16-bit and 32-bit MCUs and digital signal controllers, and memory devices. It includes a feature-rich editor, source-level debugger, project manager, software simulator, and supports Microchip’s popular hardware tools, such as the MPLAB ICD 3 in-circuit debugger, PICkit 3, and MPLAB PM3 programmer. Based on the open-source NetBeans platform, MPLAB X runs on Windows OS, MAC OS and Linux, supports many third-party tools, and is compatible with many NetBeans plug-ins.
The 220MB latest X IDE (still in Beta) can be downloaded from the following link
Advanced RISC Machines Ltd. controllers are extensively used in Mobile phones & multimedia players.
ARM Cortex Embedded processors perform upto 2 Giga Hz frequency enabling next generation of Mobile internet devices.
ARM is the industry leader provider of 32 bit embedded processors.ARM also develops processors for FPGA fabrics (Field Programmable Gate Array).
The latest Android mobile phones use ARM processors.
For e.g. Samsung Galaxy S Android phone uses 1 Ghz ARM CortexA8 processor.
Apple iPhonesuse ARM processors,eventhough Apple provides no official info regarding the processor used.
Getting started with a new ARM project is made simple with the comprehensive set of new features in the ARM Workbench IDE.
Renesas is a Japanese semiconductor manufacturer NEC.
R8C , H8S , H8SX , R32C ,SuperH are the family of Renesas chips in the market.
Renesas Flash Development ToolKit (FDT4.07 is the latest) is the dedicated flash programming software .
Download it from http://am.renesas.com/products/tools/ after registration.
It is only an evaluation software and is not free.
ARDUINO & AMICUSare open source hardware development platforms.Arduino is to AVR as AMICUS is to PIC.ATMEL’s rival Microchip offers a open source platform called AMICUS18.
More on these and about programming MCs in future posts…….