Showing posts with label AVRISP-U. Show all posts
Showing posts with label AVRISP-U. Show all posts

Thursday, March 1, 2012

STK 200: First Program (LED Blink)

For this program, you should already have AVR Studio 5 and AVRISP-U installed on your computer. If you don't, visit my previous post Getting Started Programming Guide (link). This is a simple program which simply makes the built-in LEDs to blink. I'm going to use C for this program because the code looks really simple. The assembly version is not really difficult either but we'll keep it simple for now. Note that AVR Studio 5 has a built-in C compiler. You might remember for AVR Studio 4, you had to download AVR GCC and integrate it. If you downloaded AVR Studio 5, you already have the C compiler.

What will the program do? If you look at the STK 200, there is a row of 10 LEDs numbered from 0 to 7 then "ISP" and "ON." These are the built-in LEDs. Our program will make the LEDs numbered from 0 to 7 blink on and off at a rate perceptible to the human eye. In microcontroller terms, this means physically connecting the LEDs to PORTB and sending alternating HIGH/LOW signals to PORTB. Note that is all output - no input. If you don't know what PORTB is, check my Basic Layout Guide (link).

Step 1 - Create a new project: Go ahead and open AVR Studio 5. From the startup screen, go to File>New>Project... and you should see a New Project dialog box. At the top left of the dialog box, select the C templates and then choose "C Executable Project" in the middle of the screen. At the bottom, fill in "blink" as the name and this should automatically fill the solution name field with the same text. Also, make sure that the "Create directory for solution" box is checked. This checkbox will not affect your code at all, but it will keep your AVRStudio folder better organized. Look at the picture below and make sure your screen looks the same:
STK 200: New Project Dialog Box

Friday, February 17, 2012

STK 200: Getting Started Programming Guide

To start programming the STK 200, you need to download some software. Namely, you need AVR Studio and AVRISP-U. I talked about the basic layout of the board in a previous post (link), so check that out if some of the terms I am using are unfamiliar. I broke the process into three steps below.

Step 1 - Download AVR Studio 5: I started programming with AVR Studio 4, but if you are starting today, you might as well start with the new AVR Studio 5 release. The program is built using the Microsoft Visual Studio Shell (VSS) so the user interface is very similar to Visual Studio. I suppose this can be a good thing for those who like Visual Studio and a bad thing for those who don't. Overall, it seems to have a lot of convenient features such as IntelliSense and debugging interface.

So to get the software, go to the AVR Studio 5 page (link) from Atmel and download the software package you need. I recommend downloading the package that includes VSS and .NET 4.0. The software is completely free but you do have to fill out a registration form. The installer is pretty big (the one including VSS and .NET is over 600 MB).
STK 200: AVR Studio 5

Saturday, June 4, 2011

STK 200 - blinky lights

* update: I wrote a revised version of this guide using AVR Studio 5. It uses the same code but I added new photos and wording. Check it out: STK 200: First Program (LED Blink)

As I mentioned previously, I was initially frustrated when I tried to program the STK 200 from Kanda because of the lack of documentation. So I thought it would be helpful to post some of my experiences. To start off, I'll explain the way I loaded a super simple, blinky lights program.

So lets assume you just got the kit in the mail and you have not done any AVR programming in the past. Lets start by installing some software. Go to the Atmel website and download AVR Studio 4 (you will have to register but it is free). Atmel released AVR Studio 5 beta in March 2011 but as of now I still use AVR Studio 4 because of the extensive support for it. Next go to the Kanda website and download their AVRISP-U software. Finally, we need AVR GCC (C Compiler). So you can check out the WinAVR website for a link to the download page or just go the WinAVR sourceforge page and find the latest stable release.

So what do we actually want our program to do? Our objective is to simply cause the built-in LEDs to blink. If you look at the kit, there is a row of 10 LEDs numbered from 0 to 7 then "ISP" and "ON." Looking along the edge of the board, there is a row of "PORTS" and across from "PORTB" there is a 10 pin header named "LED'S". We need to connect PORTB to the LED header using the supplied ribbon cable. I marked the two locations on the picture below:
STK 200: LED Layout