OK now that you have learned all about how programming works in theory, its time to determine what sort of programmer is going to work best for you
Comments? Suggestions? Post to the forum!
There are easily a dozen programmers out there, I'll cover the 4 major types:
- Simple/Basic/Bitbang programmers
- ISP smart programmers
- Development boards
- No-programmer (Bootloader)
Simple programmers are very inexpensive and very simple. They connect to a serial port or parallel port directly and then the computer software twiddles the port to send data to the chips.
A parallel port programmer looks something like this:
It plugs into the parallel (printer) port of a computer
You can see the silver part plugs into the parallel port, and then theres a cable that plugs into a 10-pin ISP header
A serial port programmer looks something like this:
Very similar to the parallel port programmer, but plugs into the serial port
Some have a buffer chip to disconnect the programming pins when the chip is running so that it can use the programming pins for other things. Without a buffer you may have to remove the programmer after the chip has been programmed.
I suggest these for people who are just starting out and are doing very simple stuff but strongly suggest a quick upgrade to a smart ISP programmer or development board.
Pros: Ultra cheap ($10-$20), easy to understand, because the software does everything there's no risk of 'programmer incompatibility or upgrades'
Cons: Requires a PC with the ports, Macs can't use these, if you're working on high voltages (more than 5V) you could zap your port, multiple standards for programmer interface.
You can buy such programmers in the adafruit webshop.
These programmers plug into the serial port or USB port, and have more brains than bitbang programmers. They are also more likely to work, and have some nice features.
The most common programmer is the AVRISP and the AVRISPv2. Both look something like this:
Photo courtesy EvilMadScientistLabs
There's a jack on one end for a cable and the 6-pin and/or 10-pin cable comes out the other. The AVRISP v1 had a serial port jack and the v2 has USB. The v1 has both cables, the v2 has only 6-pin.
AVRISPv2's are available from Digikey.com or Mouser.com for $36 or so
I really liked the v1 but it was discontinued and the v2 doesn't support 10-pin cables so I designed my own programmer called the USBtinyISP, you can build it from a kit for about $20. Read more about it here.
There's a lot more ISP designs out there, many homemade.
There are dozens of development boards out there all slightly different, so I'll cover the two that are the most popular (and fairly inexpensive) and are officially endorsed by Atmel.
The first is the STK500, which for $80 is quite a beast. It supports pretty much every chip Atmel makes with all the various sockets. It has buttons, LEDs, an adjustable clockspeed oscillator, etc. This programmer is supported by AVRStudio, which is Atmel's programming envirionment. Since it is the 'defacto' programmer, the programming method it uses to talk to the computer (Called the STK500 protocol) is also a standard. Its got a bit of a learning curve but lots of people use it. You can buy it from Digikey or Mouser.
The nice thing about it is you get a huge dev board, it has sockets for all the chips, as well as a programmer. The sad part is that it only has a serial port so you'll need a USB serial converter.
The second is the AVR Dragon which is an emulator as well as a programmer. It is used more like an ISP than a development board, it has connectors for both 6 and 10 pin headers.
I havent had much play-time with it but people say its nice, and its only $50 Note that there are no sockets for the chips.
In recent years, microcontroller designers have added the capability for the chip to program its own flash (often called self-programming). What this means is that a program burned on a microcontroller can actually change its own program. In most cases this is not a good idea, a program can overwrite itself, damage itself, and/or cause the microcontroller to freak out. However, in certain cases this can be a benefit.
Take, for example, a small program that is burned into the chip that can communicate with a computer through a USB or serial cable and allow the computer to download new firmware without the use of a programmer.When you 'update the firmware' on your MP3 player or cell phone, this is whats happening.
For example, Arduino use a bootloader that is programmed into the chip at the Arduino factory. The bootloader is protected so that it can't overwrite itself. To upload code to the Arduino, you use the Arduino software which is smart enough to recognize when an Arduino is connected.
Bootloaders are great, but you need a ISP programmer to put the bootloader on the chip the first time if you're buying the chip from Digikey or Mouser. Its a bit of a chicken-and-egg problem.
Bootloaders also don't let you modify the fuses (discussed later) and they take up a portion of the flash memory so uploaded programmers must be smaller.
In general bootloaders are great for starting out with but I find its important to have some way to program the chip so that you can put the bootloader on and maybe modify the bootloader or fuses.
I won't be using bootloaders in these examples, but will assume you have an ISP programmer as they are more universal. Later on, you can always add your own bootloader.