Bigger picture (introduction)

Chip choice

There is a vast number of different microcontroller models out there. Here I will concentrate on the rather cool AVR ATMEGA8 and ATMEGA16 chips, priced at 3.50 and 8.00 euro. A smaller alternative is the ATtiny45. But this list is far from exhaustive. I will go into some of their capabilities later.

Bigger picture

Let's get you used to a few concepts.

A microcontroller is a little IC chip as you know it, with a lot of pins (e.g. 28 or 40, or even just 8). Inside sits something like a miniature version of your PC. The cool thing is that you can program it in C and/or in assembler, to take input or send output through its pins.

Once programmed, the chip is autonomous and the program will start running whenever the chip is connected to a power supply. The microcontrollers discussed here also have EEPROM memory, meaning they can keep data even if the power is off.

What can you do with it? You can switch LEDs on and off, you can read input from a `keyboard', you can control devices in real-time, make serial communication, have an operating system on it (I am told), lots of things.

board_and_isp.jpg This is the oldschool interpretation of an ISP cable and a programmer board. The board hosts an ATMEGA8 which is driven by a 4 MHz oscillator. The transistors on the right are driving an old train station clock (not shown).

 

Zooming in

I recommend any GNU/linux as a basis for programming.

I am introducing you to programming an Atmel ATMEGA microcontroller (ATMEGA8, ATMEGA16, ...).

A homemade In-System Programmer (ISP) is described. I use the PC's *parallel* port to do the *serial* type of AVR programming.

I use GNU's toolchain (for the `avr' target) to compile the chip's programs from C source code.

I use the avrdude program to load code up to the chip.

[Next section]
login 2012-12-16 21:03