| Burn Baby Burn :: Programming your Microcontroller! |
| Monday, 30 May 2005 | |
There are usually alot of questions on the forum regarding how to program microcontrollers.
It was the same with me.I just coulnd't figure out how these guys "Burned!" a program onto
a chip,as easy as I burned discs.Read more..[**This article is a generalised method of programming Flash controllers**] Well,I've been doing it for a long time now and heres how it's done... You will need the following 3 things to execute this mission. I'll be taking an example of the Microchip PIC series. The same is applicable to all other microcontrollers with Flash 1>Get yourself a chip,for example,a PIC16f84a,which has around 1Kb of Flash memory. "Flash" means you can erase your current program and load a new program in and you can do this a 1000 times!....wish they made CD RWs like tht 2>A Programmer.This is the hardware that programs/writes/burns the pogram into the chip.It comes with it's own software to download stuff onto the chip 3>A Software that compiles or converts your program written in C/Assembly into a HEX file. For a PIC theres MPLAB[a free software from Microchip],Hitec C,CCS compiler.. Startup your software. Write your program with whatever your comfortable with..either C or Assembly. Take for instance you code in Assembly(in MPLAB),which will look somewhat like the stuff below: Lets call it TEST.ASM ![]() Once your done writing your program,you have got to convert it into a language that can be understood by the microcontroller. This conversion process is known as "compiling". ![]() When you click on the compile button,here's what happens to your program. :020000040000FA Looks like crap ,doesn't it? Its known as a HEX file Call it TEST.HEX.You don't need to save it,it's automatically generated by the software and stored in the directory your working in. Step 2> Now you got to dump that inellgible file into your microcontroller. Here's where your Programmer comes in. You may either build your own programmer,which is very easy ,or purchase one. For the PIC there's Microchip's PICSTART Plus,free programmers on the net like the JDM programmer,ELCheapo,TAIT,WISP..etc which come with their own softwares to load the program into the chip. heres what you do: ...1>start up the software.Some of them autodetect the hardware present.If it doesnt,check your connections and your programmer circuit ...2>mount your chip onto the programmer. ...3>Browse to the file you want to load.In our case ,browse to TEST.HEX ...4>Remember to select the Chip you are going to program.Microchip ,for eg,has tons of chips. So select PIC16f84A as used in this example ...5>Now all you got to do is click "BURN!",the same way you burn discs,the only disadvantage being that you can't select the "write speed" .The burn time ranges from a few seconds to a minute,depending upon the size of your program and the chip.
THAT'S It!..an executable program on your micro..kewl! Step 3> Now all you go to do is remove your chip from the programmer and load it to your experimental or target board ,where your application runs. The above method is one way to program your micro.There are other ways too like ICSP(in-Circuit Programming) and Bootloaders I work with a bootloader at present,which makes a programmer's life easier...maybe my next writeup.. . |
| < Prev | Next > |
|---|
Serial Parser 
There are usually alot of questions on the forum regarding how to program microcontrollers.
It was the same with me.I just coulnd't figure out how these guys "Burned!" a program onto
a chip,as easy as I burned discs.

.The burn time ranges from a few seconds to a minute,depending upon the size of your program and the chip.