Quick Start Guide to Microcontrollers
First off I will assume that you know what a microcontroller is (if not
http://en.wikipedia.org/wiki/Microcontrollers
for the definition or see the links at the end of the article).
There are many types of microcontrollers to choose from and this can make starting out very difficult, so I aim to give a good overview of what there is and how to get going.
Most microcontrollers need hardware programmers and are usually programmed in assembly language (which is very close to machine code), if you do not fancy having a go at the steep learning curve that is programming in assembler then your first port of call should be the microcontroller derivatives. The BasicStamp, Picaxe and OOPic are basically pre-programmed microcontrollers which are much easier to develop with and to physically program. The table bellow shows a comparison of a PIC (a standard microcontroller from Microchip), a BS2e-IC (a BasicStamp), an OOPic and a 28X (a Picaxe). They are of similar physical size and show what you can expect to be able to do with them.
My personal favourite is the Picaxe range. The BasicStamp and OOPic are extremly good, but for me the Picaxe has more scope for development. The actual unit is a pre-programmed PIC microcontroller (see Fig. 1). There is no extra hardware onboard and the programming circuit is made up from a few readily available components. As the chip is a pre-programmed PIC later on you can easily upgrade to a proper PIC if you need more power in the application. (Although the method of programming a Picaxe does not normally work for a PIC unless special firmware is used)
So what do you get for the £6 a 28X Picaxe costs you? Well up to 4 ADC’s, 9-17 outputs, 0-12 inputs and 128bytes of EEPROM storage as well as i2c communications, polled interrupts, built in serial communications and excellent technical support via their forums at www.rev-ed.co.uk/picaxe/forum/
. The down side? You only get 600 lines of code to play with, this sounds a lot but when you compare it with the 4,000 lines a mid range BasicStamp will give you it is very small. The reason for this lack of space is that the Picaxe firmware and the user code are stored onboard rather than on external EEPROM chips. Saving space and money, they are the cheapest out of the three mentioned.
Schematic 1 shows a circuit that uses a Picaxe as you can see the download circuit is made using 3 components, this just uses a standard serial connection to the PC although a ‘special’ cable with a stereo type audio connector on the end can be used as it is much easier to connect than a standard Sub-‘D’ connector, or even a Molex.
Okay, so what about normal PIC’s? Well to start with you will need a programmer; there are many to choose from and there is a wide range available from www.sparkfun.com
(they do deliver to the UK) and some kits are avaliable from www.quasarelectronics.com
. After that you will need a PIC to program and a copy of MPLAB, the assembler programming suite provided by Microchip. Developing software for PIC microcontrollers can be complicated but there is a comprehensive set of tutorials at
www.winpicprog.co.uk
- so check it out!
If you are a C programmer, or know a small amount of C then you may wish to consider using a C compiler to program your PIC. I would suggest the C2C compiler, or the BoostC compiler which (at time of writing) is still in Public Beta mode but it is a very, very easy to use compiler with a great support forum. They can both be downloaded from www.picant.com and they are very competativly priced compared to other PIC C Compilers at well under £100.
Well that’s about it, you should have no excuse not to get started :D
Related Links