Home Projects AVR Programming Guides Electrical Fundamentals Insteon Saving Electricity

Recent Updates

EasyGrow Greenhouse
Follow our adventure of assembling an 8x12 EasyGrow Greenhouse.
AVR Programming Guides
We have some nice AVR code samples to share. Lots of AVR goodies like timers, interrupts, and pin I/O for the beginner.
Watts Tables
Use these tables to help you determine how much various items in your house cost you by the day, month, and year.
Saving Electricity
A list of a variety of ways to help you save money by learning how much it costs to run things.
What is a Kilowatt Hour
Saving money on your electric bill starts with understanding what a kilowatt hour is.
How To Measure Watts
Learn a variety of ways to measure watts in your house.
Read Your Power Meter
By reading your power meter you can get a good idea of how much various electrical devices cost you.
Electronics Fundamentals
Learn some basic electronics fundamentals and see if you enjoy the field of electronics.














Download Compiled AVR Code To Chip

STK500 Jumper Setup

If you are just stumbling on this page, you might want to check out the entire series of AVR related programming guides here.

ISP Header

Make sure that you have the STK500 user guide on hand. It describes in detail all of the steps that we will describe here. You can find a copy of it on the Atmel website, direct link is here.

Since the ATMega32 gets socketed in A3 on the STK500, an A3 is a pink colored socket, this means that you must connect a 6 pin jumper from ISP6PIN to SPROG3.

Serial Cable

You also need a serial connection to the serial port on the STK500 labeled as RS232 CTRL. If you computer does not have a serial port, then you can use a USB to serial converter. We use Trendnet TU-S9 for this purpose and have never had a problem with them.

Ready To Program

Make sure that you have your ATmega32 socketed in the correct socket, the serial cable connected, and the ISP jumper installed. Apply power to the STK500 and the power light should turn red. When everything is setup correctly, this is what your STK500 should look like.

AVRStudio Setup

Fire up AVRStudio and compile your project. If you are following these guides then your project should already be compiled. Click the black CON button on the AVRStudio button bar, and you should see the Select AVR Programmer dialog box. Pick STK500 and the correct serial port like this:

After you click Connect you should see a new dialog box called STK500 in ISP mode with ATmega32.

Inside the frame called Flash click the button with 3 dots on it to browse for the .hex file created when you compiled. It should be in the default subdirectory of where your project is located. Then click the Program button to flash the .hex file into the AVR's flash memory.

If you do not have some sample code to flash into your chip, check out our AVR Port Output Using C guide.

After the code is completed flashing into the AVR, the STK500 will reset your chip and it should start executing the code that you downloaded.

If you just downloaded the code from the previous guide, then the LEDs should light up in an alternating pattern.

If The LEDs Do Not Turn On

The most likely cause of the LEDs not turning on is that the cable between PORTA and LEDS is not connected correctly.

If that is not the case, then the next most likely cause is that the AVR chip is not getting the correct clock. There are 3 ways to clock a chip in the STK500:

  • Use the internal clock of the chip you are programming. This is the default behavior of a new AVR from the factory.
  • Use the synthesized clock of the STK500
  • Use a crystal inserted into the STK500 crystal socket

Bitwise Operations

It's time to move on to bitwise operations. Our next guide shows you how to manipulate bits in the AVR, and introduces some very handy macros.

Or head back to our index of AVR Guides here.

Efundies.com - Making Electronics Fun
 
Wednesday, 19-Jun-2013 21:24:54 PDT