a name problem? oh and it says that it cant find SoR_Utils.h unless I use the makefile from the photovore $50 bot filesalso whenever I try to compile my own prog I get this error "../LED_blinking.c: error: SoR_Utils.h: No such file or directory"I think it might have something to do this

Use this code to get the effect you are looking for... then when compiling it make sure you set your frequency to 1MHz not 16 Htz... This code will work for really any AVR micro.... I used it on an atmega 328p with other cool stuff for the Led also like different flash patterns... (in addition try upgrading AVR studio, and are you using vista?)

// Frequency number needed by the delay function.// The chip is factory set to run on internal// oscillator at 1 MHz so the value is 1000000UL#define F_CPU 1000000UL

#include <avr/io.h>#include <util/delay.h>

// Number of frames in the animation#define FRAMES 8

// The animation sequence array.// All the values are in binary for easy// reading (1 = LED on / 0 = LED off)// The rightmost bit is PB0 and the leftmost// bit after '0b' is PB4.// -> 0b[4][3][2][1][0]char animation[FRAMES] ={0b00001,0b00010,0b00100,0b01000,0b10000,0b01000,0b00100,0b00010};

int main(void){DDRB = 0x1F; // PB0-PB4 outputPORTB = 0x00; // Set all pins lowint i;while(1){// Loop through all the frames in the animationfor(i=0 ; i<FRAMES ; i++){// Write the value from the array to the portPORTB = animation[i];// Wait 100 ms before going to the next frame_delay_ms(100);}}return 0;}

« Last Edit: July 13, 2009, 06:59:40 PM by kpmcgurk »

Logged

some people are just Born smart, but some people have to work for it, and those are the people who succeed.

I use a external 16mhz crystaloh and keyword NOOB. How would I set up the program, do I need a external makefile?also, if I dont use the photovore makefile, I get this, for by tones of errors because of it.../LED_blinking.c:1:23: error: SoR_Utils.h: No such file or directory

EDIT: Stupid error by me... the code that I gave you is for B ports but you are using D ports... Change my code where is uses B to D..... Its that simple, and then my friend you will have blinking leds!!! (I hope )

« Last Edit: July 14, 2009, 04:44:42 PM by kpmcgurk »

Logged

some people are just Born smart, but some people have to work for it, and those are the people who succeed.

EDIT: I think I edited it correctly, still no luck. Idea! lets see if its a problem with my computer, because the only program that has worked on it so far was one done by someone on another computer (he just sent me the hex file). kpmcgurk, compile your prog, and post the hex file. If it works then, then I got a computer (or settings) problem.Just remember to edit it for ports PD0 - PD4

// Frequency number needed by the delay function.// The chip is factory set to run on internal// oscillator at 1 MHz so the value is 1000000UL#define F_CPU 1000000UL

#include <avr/io.h>#include <util/delay.h>

// Number of frames in the animation#define FRAMES 8

// The animation sequence array.// All the values are in binary for easy// reading (1 = LED on / 0 = LED off)// The rightmost bit is PB0 and the leftmost// bit after '0b' is PB4.// -> 0b[4][3][2][1][0]char animation[FRAMES] ={0b00001,0b00010,0b00100,0b01000,0b10000,0b01000,0b00100,0b00010};

int main(void){DDRD = 0x1F; // PB0-PB4 outputPORTD = 0x00; // Set all pins lowint i;while(1){// Loop through all the frames in the animationfor(i=0 ; i<FRAMES ; i++){// Write the value from the array to the portPORTD = animation[i];// Wait 100 ms before going to the next frame_delay_ms(100);}}return 0;}

Just as a quick test try setting your delay to a larger number. 20 times as large. If you see the "animation" pattern as a result, then it is likely a clock setting. The xtal on the bare-bones board, like the Arduino, is 16 MHz.

is set to 1 Mhz still and so the program thinks that your MCU is running at 1Mhz... but in reality it is really running at 16Mhz making the program run 16X faster.... your program is running alright, but just so fast that you can not tell the difference in the LED's blinking... (I am crossing my fingers now)

Logged

some people are just Born smart, but some people have to work for it, and those are the people who succeed.