AVR Programming Tutorial: Downloading Programs

0. Make sure you've installed the necessary software.
Windows: WinAVR
Important Note for people running Windows: on Windows you will also have to install the driver for the USB programmer. If the driver does not successfully install automatically after you plug in the programmer, try downloading the latest libusb driver from here
Unfortunately Windows 7 does not support the USB programmer we will be using, so if you have a machine with Windows 7 you should use the Mac computer in the high-low tech lab to do your programming.
-For windows Vista 64, you need to first install AVR Studio 4. then install WinAVR 20100110. Then, download msys-1.0-vista64.zip msys-1.0-vista.zip and put that into your winavr/utils/bin directory (before to archive the old version of msys-2.0.dll. then things should compile.
1. Get your materials together.
2. Download some code.
3. Open up a terminal window, a window that allows you to type out commands to send to your computer.
On a PC, go the the Start menu and select Run. Then type cmd in the text box that pops up.
4. Navigate to the code folder within the NewTextilesAVR folder or "directory".
The cd stands for "change directory".
5. Plug in your programmer and attach your circuit to your computer.

The first important thing to know is how to orient the chip to the diagram. We need to know which way is up. If you look closely at the chip you will see a small dot in one corner. This dot indicates the top of the chip. When you match your chip to the diagram, the dot should be in the upper left hand corner of the chip. Like so:

The diagram also shows the different functions of each leg of the ATtiny13 chip. To program the chip--to tell it what to do--we need to attach certain legs to our programmer.
Clip the programmer to your circuit, attaching the labeled alligator clips to the appropriate legs of the chip. Refer to the diagram above and follow the traces of your circuit. We need to attach + (also called "VCC" or "power" and usually colored red), - (also called "GND" or "ground" and usually colored black), RESET, MOSI, MISO, and SCK. Use the round piece of plexiglass to support your circuit. Here is a photograph that shows what the physical attachment should look like.

IF YOUR CHIP IS GETTING HOT AFTER YOU ATTACH IT, UNPLUG EVERYTHING IMMEDIATELY. THIS MEANS YOU HAVE A SHORT & YOU'RE FRYING YOUR CHIP & MAYBE THE PROGRAMMER TOO.
6. Program your chip.
If all goes well, the LED on your fabric circuit should begin to blink.
7. Open the blink.c program file.
Now we're ready to start writing our own program...