STK300 Newbie

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

I am totally new AVR's and have sourced a STK300 development kit.
At this stage I have had nothing other than frustration.
Does anyone have a "Hello World" type program with bullet proof (read idiot proof) instructions??
Any help would be greatly appreciated.

admin's test signature
 

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

Are you using C.

If so I can help you with the STK as I use this for 90% of my developments

Patrick

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

Hi!

There are more requests like this further down in the forum...

The easiest way to begin (I was there only a year ago), is to play around with the buttons and LEDs of your starter kit. Most users make a "LED chaser" like the one in the supercar Kit in Knight Rider (totally understandable if you've seen the show, totally not if you haven't. No matter :) )

If you're using Assembly, the following code is a starter. You must always start by including the bit definitions for your device. This enables the assembler to understand you when you write things like "PORTD". This is just a memory location, and there's a file called def.inc that takes care of the link between names and locations. In your case, it's probably called "m103def.inc" because you have an ATmega103 in your starter kit.

Then the ports. They have three registers:

- DDRx: The data direction register of port x. '1' means output, '0' means input
- PINx: The actual input pins of port x (when using input)
- PORTx: The data register of a port (when using output)

You must also know that these registers are I/O registers, and you can therefore not use the immediate commands like ldi directly on them. Instead, you must load a value into a general purpose register, and then use the in/out commands to access the I/O registers, as in the example below. It's a VERY simple example, and I'm sure you'll get bored of it soon, but if you just need a starter, maybe it's okay?

Corinthian :)

.include "m103def.inc" ;include bit definitions

ldi r16, 0xff
ldi r17, 0x00
out DDRB, r16 ;set portB (LEDs) to output
out DDRD, r17 ;set portD (buttons) to input

loop_eternal:
in r16, PIND ;read contents of buttons
out PORTB, r16 ;write the same content to LEDs
rjmp loop_eternal ;eternally

P.S: There's more sample code at this link:

http://www.avr-forum.com/program...

But that's the only good thing there's to say about AVR-forum. This site is SO much better! :)

admin's test signature