avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] newbie trying to get at90s8515 to work on breadboard


From: Chris Donovan
Subject: [avr-gcc-list] newbie trying to get at90s8515 to work on breadboard
Date: Sat, 8 Jan 2005 18:01:22 +1100

Hello,

        I am trying to get an at90s8515 to work on a breadboard.  Basically I
have an atstk500 and the chip(at90s8515) works just fine on that board
but when I move it to a breadboard I can't get it to work correctly. 
The C code for it is below.  portb0-7 are being used to
activate/de-activate the LED's on the stk500 board, and they work just
fine when the chip is inserted into the stk500.

        I have connected pin 40(vcc) to the +9V supply(tried 5-9V) with misc
resistance to lower it to 5V.  When I connect up portb0 on the
breadboard to the +LED terminal, it does not work as expected.  It
just keeps the LED on all the time instead of blinking like it should. 
If I connect pin20 to the  the 9V it doesn't activate the LED at all,
and the LED just stays off.

        I tried getting my multimeter out and duplicating the voltages on the
breadboard but it just doesn't work and I am not really electrically
inclined yet(I have to look up ohm's law still), so I may have stuffed
things up perhaps.

        I really haven't the slightest clue of why it isn't working but I am
thinking perhaps I need to connect more pins on the breadboard to more
things?  I am more than happy to answer any questions I just need a
little help to get this thing going(first microcontroller project).

Not sure if this is enough info but I am happy to give more detail if
need be.

Thanks in Advance,

Chris-



#include <avr/io.h>

typedef unsigned char  u08;

u08 led, iled, i, j, k, l, dir, run, count;

int main( void )
{

  outp(0xff,DDRB);      // All of PortB
  count=1;
  led = 1;
  iled=led+1;
  dir = 7;                      // Direction (1 = 0-7 && 0 = 7-0)

  for (;;) {
    outp(-iled, PORTB);
    for_loop();
    if (dir == 7) {
      led<<=1;
      iled=led+1;
    } else if (dir == 0) {
      led>>=1;
      iled=led+1;
    }
    if (count == 7) {
      dir = 0;
      count++;
    } else if (count == 14) {
      led = 1;
      iled=led+1;
      dir = 7;
      count = 1;
    } else {
      count++;
    }
  }
}

int for_loop() {
  run = 40;
  for (i=0;i<run;i++)
    for (j=0;j<run;j++)
      for (k=0;k<run;k++)
        l++;
}


reply via email to

[Prev in Thread] Current Thread [Next in Thread]