Newbie (Again) Trouble with stk500 [SOLVED]

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi. A few years ago, I had been making a little progress with learning to program avr mcu's - was still a rank newbie. But life forced me to put it aside. I recently decided to try and pick up where I left off, but am having trouble. :oops:

I am trying to use my stk500 and avr studio 4.18 to program an atmega16 to make the LEDs on the stk500 light up - should be exceedingly simple, but I am able to make it work....

Here is the code I am using:

/*
 * led_2y.c
 *
 * Created: 4/10/2013 4:11:54 AM
 *  Author: Russ Hintze
 */ 

#include 

int main(void)
{
  // Set Port B pins as all outputs
  DDRB = 0xff;

  // Set all Port B pins as HIGH
  PORTB = 0xff;

  return 1;
}

When I compile the code I get no errors and no warnings, and things seem to work correctly in the simulator. When I program the Atmega16, AVR studio indicates that the programing was successful. I am pretty sure that I have the 10-pin cable properly connection Port B and the LEDs...but none of the LEDS light? :?

Note, I also tried this with an Atmega8 (using both AVR Studio 4.18 and Atmel Studio 6) with the same results.

Any help would be appreciated. Thanks!

Russ

Last Edited: Wed. Apr 10, 2013 - 12:07 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The LEDs on the STK500 are driven active low. Try

PORTB = 0x00;

instead of 0xff, and it should work. Here's the schematic:

I tend to post off-topic replies when I've noticed some interesting detail.
Feel free to stop me.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Bingo!

Now that you mention that, I do remember reading that at some point.:oops:

Between Atmel Studio 6, AVR Studio 4.18, the Atmega 8, the Atmega 16 and online research, I must have spent >15 hours trying to get this to work!

Thank you very much, Biffi.

Russ