Hello and welcome! In my previous post Basics of Microcontrollers, we came across some of the elementary concepts and how a microcontroller based development process goes. In this post, we will see what are the things you need to get started with a MCU.
All the things you need can be categorized into two:
To get started, we must have something upon which we can work, in other words, hardware. We will be requiring the following hardware for our purpose:
- PC / Mac (preferably PC)
- In-System Programmer (ISP)
- Target Board (MCU Development Board)
- Lastly, a MCU!
PC / Mac
We need a PC / Mac as we will be writing, editing, compiling and debugging the code here! The PC requirements are not too much. Any decent PC / laptop will do.
Target Board (MCU Development Board)
A MCU cannot function on its own. It’s not like you go to the market, buy a MCU and it starts working! You need a PCB along with an appropriate circuit to make it work. There will be slot where the MCU will fit in. It also has slots for other accessory drivers, ICs, pins’ outlet of GPIO pins, etc. These PCBs are called Target Boards (or MCU Development Boards). Don’t worry too much about it, there are many readymade boards available. But don’t go and buy any random board. You need to consider the type of ISP and MCU (discussed next) and then choose one according to your requirement and budget.
Here, I am providing few links from where you can get a MCU development board:
In-System Programmer (ISP)
You have your PC at one end (with your hex file ready to be transferred to the MCU) and you have your MCU Development Board at another end. How will you transfer the hex file? For this we need another hardware called the In-System Programmer (ISP). This device programs the MCU by burning the hex file into the flash memory of the MCU. ISP is of three types:
- Parallel Programmer- Here, data is transferred through the parallel port (printer port) of the PC. Technically, the parallel port is called DB25 port. A DB25 connector is shown below.
- Serial Programmer- Here, data is transferred through the serial port of the PC. Technically, the serial port is called DB9 port. A DB9 connector is shown below.
- USB Programmer- Here, data is transferred through the USB 2.0 port of the PC. A USB connector is shown below.
In some MCU Development boards, there is an inbuilt ISP. In this case, you won’t need any extra hardware for that. You can also get ISP from the links mentioned in the previous topic.
Selecting a MCU to work upon may be the biggest hurdle that you might face while getting started. There are more than 150 IC manufacturers which manufacture MCUs, and each one of them have more than 100 different models in their account. So, which one to choose?
On the basis of popularity, there are three series of MCUs. They are 8051 (by Intel), PIC (by Microchip) and AVR (by Atmel). 8051 is the oldest of the three, and hence quite popular, but lacks several new features and registers. And AVR is the newest of the three with the most recent architecture.
The following factors may help you choose the MCU you want to work upon.
- Cost – A cheap MCU is always preferred. PIC microcontrollers are comparatively cheaper than AVR microcontrollers.
- Speed – Speed of execution also matters. Typically, an AVR is much faster than a PIC, about 3-4 times faster!
- Ease of use – AVR is much more user friendly and easier to use than PIC.
- RISC / CISC – There are two different categories of architecture. Let’s talk in layman’s terms. In Reduced Intruction Chip Set (RISC) architecture, less amount of instructions will result in more output, whereas in Complex Instruction Chip Set (CISC) architecture, more amount of instructions will result in less output. In other words, to do a particular job, RISC requires lesser number of instructions than CISC. AVR, PIC, etc are based on RISC architecture whereas Intel 8051, Motorola 68000, etc are based on CISC architecture.
- Free ‘C’ Compiler – The best part of an AVR is that the C compiler is available for free, and that too by Atmel! Many other manufacturers do not provide with a compliler or a proprietary premium software, which we need to buy.
- Durability – Practically, it has been found that a PIC MCU is more durable than AVR MCU.
So, choose any MCU you want. I work with AVR and MSP430 (by Texas Instruments) microcontrollers, whereas you may prefer something else. It all depends upon your choice. But still, most of the posts in this blog will be covered using AVR ATMEGA32 (datasheet) MCU. However, they can easily be transformed for any AVR device.
Some of the popular AVR MCUs are:
- ATTiny 85/2313
- ATMega 8/16/32/168
P.S. For your information, MSP430 is a Mixed Signal Processing MCU by Texas Instruments. It is famous for low cost and low power applications. MSP430 series consume the lowest power of all the MCUs!
- Talking about AVR MCUs, any platform (Windows/Linux/Mac) will do. There are different compilers available for different OS.
- Next, choose the language in which you want to program your MCU. C is preferred over BASIC as it is more organized and gives you the power to do substantially more! Apart from this, C is a language which (ideally speaking) every engineer knows! And its ubiquitous. However, you can also use BASIC, I won’t force you to use C .
- Next, choose a compiler. For BASIC programmers, the best compiler is BASCOM. For C programmers, best compiler is AVR Studio. CodeVisionAVR is another popular software, but it’s not free.
- And at last, you need a programmer software. Well, to speak of it, most of the compilers (including AVR Studio, CodeVisionAVR and BASCOM) have an inbuilt programmer. But I prefer to use a separate one
So with this, you are ready to work with a microcontroller. Since I use AVR, my upcoming posts will be related to AVR and its programming. For those who use other MCUs, I am sorry that I won’t be of much help, but still I will help you get the solution to your problem (as the basic concept is the same, irrespective of the MCU used).
Thank you for reading this post. I’ll be awaiting your comments!