Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
stavfot
PostPosted: Jan 26, 2012 - 09:44 PM
Wannabe


Joined: Dec 15, 2011
Posts: 93


yes i understand what you are talking about, but i am sure that you really know if this game program can run in my stk or not... is it so bad to tell me if is possible to run some way this program to my stk?

just tell me that and after that i will try to do what you say /to start piece by piece
 
 View user's profile Send private message  
Reply with quote Back to top
LDEVRIES
PostPosted: Jan 26, 2012 - 09:59 PM
Raving lunatic


Joined: May 04, 2007
Posts: 3529
Location: Geelong Australia, Home of the "Cats"

OK, "Your MCU has plenty of power to run the lightweight program"!

Quote:
unfortunately the game still does not run..

what might be the problem?

is the code to "heavy" for that cpu?

or what else could the problem be?

Lots of things actually! We are not like your professor , we are taking it one step at a time.

Is the heartbeat LED flashing in your game program? Y/N?
Show your program with the heartbeat program incorporated!

_________________
Charles Darwin, Lord Kelvin & Murphy are always lurking about!
Lee -.-
(If you haven't already done so, edit your PostNuke profile and let let us know where you are, what you do & what your interests are.)


Last edited by LDEVRIES on Jan 26, 2012 - 10:09 PM; edited 1 time in total
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
indianajones11
PostPosted: Jan 26, 2012 - 10:08 PM
Raving lunatic


Joined: Nov 28, 2004
Posts: 3551
Location: San Diego, Ca

OP wrote:
i also wrote this program in avr studio 4

stavfot wrote:
yes i understand what you are talking about, but i am sure that you really know if this game program can run in my stk or not... is it so bad to tell me if is possible to run some way this program to my stk?

just tell me that and after that i will try to do what you say /to start piece by piece
YOU wrote the program . How could you write SO MUCH code and yet not know how to load it using the STK500 ?? When you wrote all this code , what did you use to program into a uC, if not the stk500 ? If you really did do all that code, then what's the problem getting it into WHATEVER using WHICHEVER ?!

WHY ask people if something can be loaded...and WHY not just try loading the program ? WHY do you have to ask first...here or anywhere ? So you wrote this "game" some time ago and are only just now getting around to "debugging" it.

People tell you to take small steps ( s.s. ) and you change directions( pjts. ) . Help you get a heartbeat going and advise you to do s.s. again and you focus on loading of a program ( something you've shown that you can already do ) and on NOTHING to do with debugging in s.s.

This thread is the true game . Total windup... Very Happy

_________________
1) Studio 4.18 build 716 (SP3)
2) WinAvr 20100110
3) PN, all on Doze XP... For Now
A) Avr Dragon ver. 1
B) Avr MKII ISP, 2009 model
C) MKII JTAGICE ver. 1


Last edited by indianajones11 on Jan 26, 2012 - 10:30 PM; edited 2 times in total
 
 View user's profile Send private message  
Reply with quote Back to top
stavfot
PostPosted: Jan 26, 2012 - 10:24 PM
Wannabe


Joined: Dec 15, 2011
Posts: 93


mrs indiana jones do you really think that if the game was running i would asking here to find the reason why not running? or you just think that i cant install the code in avr? to create a code is one thing but to make it run in stk is another...
 
 View user's profile Send private message  
Reply with quote Back to top
bobgardner
PostPosted: Jan 26, 2012 - 11:54 PM
10k+ Postman


Joined: Sep 04, 2002
Posts: 21248
Location: Orlando Florida

Go ahead and post the latest version once again. Seems like you should at least get to the first flashall at startup.

_________________
Imagecraft compiler user
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
JohanEkdahl
PostPosted: Jan 27, 2012 - 05:09 AM
10k+ Postman


Joined: Mar 27, 2002
Posts: 18506
Location: Lund, Sweden

Again, and for the last time: The true amazing thing is that you wrote that entire game program in one shot without testing it piece by piece. Take a look around you. Inspect most any engineering project you can find, and note that it goes in small steps, testing for every step etc etc.

This is what you need to do.

I won't say anything about the specific game code you've posted here, but in general there should be enough capabilities of your AVR and the STK-500 to run a game of that sort.

Now that several people told you that - start over. Cut the existing game code to pieces. Aim for something like 10 lines of code doing a subtask. Test those lines, making sure they do what you intended. You might have to write another ten lines of code just to test them, and you might have to throw those ten lines of code out again, but it will be worth it in the long run.
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
LDEVRIES
PostPosted: Jan 27, 2012 - 07:26 AM
Raving lunatic


Joined: May 04, 2007
Posts: 3529
Location: Geelong Australia, Home of the "Cats"

stavfot
I have trouble coming to grips with that you wrote that program for several reasons. Please forgive me if I am wrong.
(PS I have been a lecturer and have maked plenty of assignments & exam papers so I have sixth sense Wink )
1. The level of programming seems toi be at a much highere level than what I perceive your experience to be.
2. The identation & documentation seems very good, something that I never would expect for a student/beginner.
3. The program uses pointers & pointer variables, something that beginners avoid like the proverbial plague.
4. A person who writes code like that would/should have sufficient knowledge to debug the code.
5. It seems starnge that you would use
Code:
#define F_CPU 20000000UL // 20 MHz

whenyour MCU does not use a 20 Mhz. clock source. Furthermore only a very small number of 8 bit AVR's run at 20 Mhz.
6. The documentation in the code starts sentences with capital letters in the correct places, something that none of your posts do. The difference stands out like canine testicles!

Perhaps this is a misunderstanding because of language differences, but can you clarify if you actually wrote the code or not? We will then have a better understanding of your capabilities which makes it easier to help you.
If it is not your code, you should start with something much simpler, especially when you start using pointers.

_________________
Charles Darwin, Lord Kelvin & Murphy are always lurking about!
Lee -.-
(If you haven't already done so, edit your PostNuke profile and let let us know where you are, what you do & what your interests are.)
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
bobgardner
PostPosted: Jan 27, 2012 - 12:38 PM
10k+ Postman


Joined: Sep 04, 2002
Posts: 21248
Location: Orlando Florida

I assume the listing posted on page 7 of the thread is an old version, before we got the delay(ms) and the clock rate sorted out. I asked him to post the latest and greatest version that he is compiling so we can see if he fixed those bits correctly. Looks like the program should execute the first case in the switch and do the flashall(10,3) even if it drives into a ditch after that.

_________________
Imagecraft compiler user
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
JohanEkdahl
PostPosted: Jan 27, 2012 - 12:52 PM
10k+ Postman


Joined: Mar 27, 2002
Posts: 18506
Location: Lund, Sweden

To it's like the OP is trying to drive amotorbike blindfolded and sitting reversed, while hardly having been on a motocycle at all before.

He's saying "just check and tell me why I'm constantly failing riding the bike this way".

I'm telling him that he needs to start with a pedaled trike.

I say this with all ue respect for the OP, bu tI hope he is strting to understand where he is, and what he needs to do.

He has a naïve view of how software is developed, and needs to form realistic goals and get used to a stepwise-refinement methodology.

I still refuse to discuss two hundred lines of AVR C code that has never ever run correctly - in a smaller reincarnation or not.
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
stavfot
PostPosted: Jan 27, 2012 - 02:36 PM
Wannabe


Joined: Dec 15, 2011
Posts: 93


what a pointer is? it is a value in a register that shows a specific address in the memory of the

what is there for? just for not "eating" unnecessary memory with out a reason. for example if we have a table of integers defined in a specific place of our memory and in the program ,for example in a method (function), we need to use that table we have 2 options. 1) to insert that table as is ,which means that we have to copy it again in another place of our available memory (it takes memory and time to do so), or just to use a pointer to the address that the table starts in memory , so we dont have to copy the whole table again and thus we get away without memory cost and spending more time...

that is the pointers. for all the other things that mr ldevries refers i have to say that i am just new to avr and rompotic systems , but not with the programming..

as for the lines of the code i have to say that even if more than 200 lines its still a simple code..

for any difference between programming for a pc program and programing for an avr there i admit that i copied the relative lines of code (f_cpu 20kh for example) with out knowing about my cpu specs... i thought that since old kind of micro cpu's would all have the same specs..

so simple as that..

in addition , i have to say that even if i had copied the whole code that would not be so weird since ,as you know ,in programming nothing is prototype...

when use libraries you copy...

do you really think that i dont know how to programming?

i came here in this forum just because i am not used with avr ways and i thought that i would find experienced people who are keen in helping other new users like me to learn and do things fast.

Code:
for(int i=0; i<10 i++)
         for(int j=0; j<10 j++)
             for(int k=0; k<10 k++)   
                cin>>pin[i][j][k];


use that simple program to enter values to a cubic squared table, you can define it as int or double or float or char or even string(using the according library)

but even if i had copied this or any other code that would mean that i dont know programming?
no since i can understand the code and i could do it also bu my self.

i hope you will understand me and help me with my specific problem.
 
 View user's profile Send private message  
Reply with quote Back to top
stavfot
PostPosted: Jan 27, 2012 - 02:46 PM
Wannabe


Joined: Dec 15, 2011
Posts: 93


my real problem is that i dont want and i dont have to spend money for making all these projects.

that is why i dont just bought a atmega324p so as to run the program and i am just trying to find out if i can come to life this game program by using atmega8515..

and another present for you. the following code:

do{.....}while(condition)
for exampe:
do{i++}while(i<10)
and
while(i<10){i++}
those two lines have a specific difference
in the first one the program going to enter in the while at least once,even if the terms of the condition will not met.

in the second the program might not going in the while not even once if the terms of the condition will not met.
 
 View user's profile Send private message  
Reply with quote Back to top
JohanEkdahl
PostPosted: Jan 27, 2012 - 02:58 PM
10k+ Postman


Joined: Mar 27, 2002
Posts: 18506
Location: Lund, Sweden

Quote:

do you really think that i dont know how to programming?

Regarding C programming you do have some way to go, yes:
Quote:

what a pointer is?
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
JohanEkdahl
PostPosted: Jan 27, 2012 - 03:04 PM
10k+ Postman


Joined: Mar 27, 2002
Posts: 18506
Location: Lund, Sweden

Quote:

i thought that i would find experienced people who are keen in helping other new users like me to learn and do things fast

OK, I am defitively out then. I rather like to help people learn to do things good. Mind you, this often means fast, but not always.

Still, IMO the fast way to get things done is still to take many small steps instead of attempting one giant leap. If you think that one giant leap will take you to the goal faster, then you are wrong (again IMO).

With that I wish you all the luck. Honestly! It's just that it is obvious that your wishes and my opinions are not at all compatible.
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
bobgardner
PostPosted: Jan 27, 2012 - 03:19 PM
10k+ Postman


Joined: Sep 04, 2002
Posts: 21248
Location: Orlando Florida

I have looked at the game program, and if you have edited it to fix the fcpu speed and the delays, it seems like it should compile and run. It flashes the leds when it starts according to the program. Go ahead and show us the latest version.

_________________
Imagecraft compiler user
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
stavfot
PostPosted: Jan 27, 2012 - 04:18 PM
Wannabe


Joined: Dec 15, 2011
Posts: 93


that is the updated according to your advises that are respectfully and gladly acceptable.

but it still ,while no errors at all during the whole procedure , when installed in the stk there is no game... no response except for the standard lights (power supply light ect).

i hope i you finally let me know what is wrong with it.

thanks in advance.

i respect you all.


Code:
// If clock speed isn't set in the project settings then it is set here
#ifndef F_CPU
    #define F_CPU    3686400UL //20000000UL  20 MHz
#endif
 
// Include some useful libraries
#include <stdlib.h>
#include <avr/io.h>
#include <util/delay.h>
 
 
/*
 * These constants are used to control overall game state
 * We could just use numbers instead, but this is far cleaner
 */
#define STATE_STARTUP 0x01
#define STATE_BEGIN 0x02
#define STATE_DISPLAY 0x04
#define STATE_INPUT 0x08
 
 
/*
 * These variables are used for game state management
 */
unsigned int patternLength = 3; // the length of the starting pattern
unsigned int patternDelay = 60; // how long each light is shown for (ebala to const)
unsigned int patternInterval = 10; // how long between each light   (ebala to const)
unsigned int* pattern; // a pointer to an array to hold the pattern
unsigned int* input; // a pointer to an array to hold user input
unsigned int inputPos = 0; // the pattern position expected next
unsigned int inputStarted = 0; // 0/1 value to indicate whether input has started
 
unsigned int currentLevel = 1; // Level counter (used for multiplier calculations)
unsigned int currentState = STATE_STARTUP; // The default state
unsigned int timerExceeded = 0; // A counter
 
unsigned int waitingPin = 0; // A variable to track the 'chaser' effect pin
 
unsigned int pins[8]; // An array to hold the pin bits (see initPins())
 
 
/*
 * These constants control game behaviour and timing
 *
 * They can safely be changed without breaking the program,
 * though it may become unplayable if extreme values are chosen.
 */
#define DECREASE_DELAY_MULTIPLIER 1 // Decrease delay every n levels
#define DECREASE_DELAY_AMOUNT 1 // Amount to decrease by
#define INCREASE_LENGTH_MULTIPLIER 3 // Increase pattern length every n levels
#define INCREASE_LENGTH_AMOUNT 1 // Amount to increase by
 
#define HIGH_PRECISION_COUNTER_LIMIT 50000
#define LOW_PRECISION_COUNTER_FAIL_ON_NO_INPUT 20
#define LOW_PRECISION_COUNTER_FAIL_ON_INPUT_THEN_TIMEOUT 100
 
void mydelay_ms(int n) {
  while(n--) {
   _delay_ms(1);
  }
}
 
void dellms(void){
 mydelay_ms(1);
 }


// Initialise the array of pins
void initPins()
{
    /*
        These are already defined elsewhere but for this program
        it's easier if we keep the values in an array
    */
    pins[0] = 0x01; // 1
    pins[1] = 0x02; // 2
    pins[2] = 0x04; // 4
    pins[3] = 0x08; // 8
    pins[4] = 0x10; // 16
    pins[5] = 0x20; // 32
    pins[6] = 0x40; // 64
    pins[7] = 0x80; // 128
}
 
// Flashes all 8 LEDs for ms duration and repeat times
void flashAll(int ms, int repeat ) 
{
    int i;
    for( i = 0; i < repeat; i++ )
    {
        // Switch on all PORTB pins
        PORTB = 0x00;
//while (ms--){
//dellms();
//}
        mydelay_ms(ms);
        // And switch them all off again
        PORTB = 0xFF;
//while(ms--){
//dellms();
//}
       mydelay_ms(ms);
    }
}
 
// Flashes 4 LEDs (alternating nibbles) for ms duration and repeat times
void flashAlt(int const ms, int const repeat)  //edv ekana allagh prosthesa ta 2 const
{
    int i;
    for( i = 0; i < repeat; i++ )
    {
        // Switch on only half of the pins
        PORTB = pins[0] + pins[1] + pins[2] + pins[3];
        mydelay_ms(ms);
        // Switch on only the other half
        PORTB = pins[4] + pins[5] + pins[6] + pins[7];
        mydelay_ms(ms);
        // And switch them all off again
        PORTB = 0xFF;
    }
}
 
// Increases the level number and possibly adds to the difficulty
void nextLevel()
{
    currentLevel++;
    if(currentLevel % DECREASE_DELAY_MULTIPLIER == 0) patternDelay -= DECREASE_DELAY_AMOUNT;
    if(currentLevel % INCREASE_LENGTH_MULTIPLIER == 0) patternLength += INCREASE_LENGTH_AMOUNT;
    if(patternDelay < 0) patternDelay = 0;
}
 
// Clear the pattern (generated and user-input)
void resetPattern()
{
    free(pattern);
    free(input);
 
    inputPos = 0;
 
    pattern = NULL;
    input = NULL;
}
 
// Called when the user inputs an incorrect pattern (or on timeout)
void incorrectPattern()
{
    mydelay_ms(50);
    flashAlt(7, 3);
    mydelay_ms(40);
 
    resetPattern();
}
 
// Called when the user inputs the correct pattern
void correctPattern()
{
    mydelay_ms(50);
    flashAll(7, 3);
    mydelay_ms(40);
 
    resetPattern();
    nextLevel();
}
 
// Generates a new pattern
void generatePattern()
{
    int i;
    int LOW = 0;
    int HIGH = 7; 
   
    // Create two arrays of the correct size
    pattern = (unsigned int*) malloc(patternLength*sizeof(unsigned int));
    input = (unsigned int*) malloc(patternLength*sizeof(unsigned int));
 
    // Generate some random numbers
    srand(TCNT1); // TCNT1 is from the timer to create a 'random' seed
    for(i = 0; i < patternLength; i++)
    {
        pattern[i] = rand() % (HIGH - LOW + 1) + LOW;
    }
}
 
// Displays the pattern to the user
void displayPattern()
{
    int i;
 
    PORTB = 0xFF; // clear the display
 
    // A short pause before we start
    mydelay_ms(50);
    // Flash all the pins to indicate pattern start
    flashAll(10, 1);
    mydelay_ms(40);
 
    // Display the pattern
    for(i = 0; i < patternLength; i++)
    {
        PORTB = ~pins[pattern[i]]; // switch on the selected pin
        mydelay_ms(patternDelay);
        PORTB = 0xFF; // switch off all pins
        mydelay_ms(patternInterval);
    }
   
    // Flash all the pins to indicate pattern end
    mydelay_ms(50);
    flashAll(10, 1);
 
    // And another short pause before we end
    /*
        Note: Everyone whose tried it so far cant wait to start
        entering the pattern after the flashAll signal...
        However - including a short delay here seems to distract
        the user as they consciously wait for the chaser
        sequence to start, and so this extra delay unintentionally
        makes the game more difficult.
    */
    mydelay_ms(40);
 
    timerExceeded = 0; // Reset the timer exceeded counter
    inputStarted = 0; // reset the input flag
    waitingPin = 0; // make the chaser restart from the beginning
}
 
void displayChaser()
{
    // Very simple chaser effect:
    // loop through 0-7, switch on the pin, delay
    PORTB = ~pins[waitingPin];
    waitingPin++; if(waitingPin > 7) waitingPin=0;
    mydelay_ms(5);
}
 
/*
 * The main program entry point
 * Note: we must NEVER return from main() - if we do the program
 * will end and the user is forced to reset the board (either
 * by pressing reset or by disconnecting the power supply)
 */
int main(void)
{
    unsigned char i; // A temporary variable to hold the input pin values
   
    initPins(); // Initialise the pin array
 
    // Set all port B pins as output (data direction register B, set bit to 1 for OUTPUT)
    DDRB=0xFF;
    // Set all port D pins as input (data direction register D, set bit to 0 for INPUT)
    // Note: not really required, this is the default
    DDRD=0x00;
 
    // Setup a timer
    TCCR1B |= (1 << CS10); // Sets the CS10 bit (use Fcpu as speed)
 
    // Clear port B (switch off all leds, even though they already should be)
    PORTB = 0xFF;
 
    while(1)
    {
        // Read the current PIND state
        // Note: we're copying it here so even if the user lets go
        // of the button during a delay we don't lose any data
        i = PIND;
 
        switch(currentState) {
            case STATE_STARTUP:
                // Flash a few times to say "hello"
                flashAll(10, 3);
 
                // Wait a moment
                mydelay_ms(50);
 
                // Switch state to begin
                currentState = STATE_BEGIN;
                break;
            case STATE_BEGIN:
                // Check if any of the pins are pressed
                if( i != 0xFF )
                {
                    // Highlight the selected pin - only done here for consistency
                    // since we've done it on the pattern input chaser
                    PORTB = i;
                    // Wait a moment
                    mydelay_ms(40);
                    // Go to Display
                    waitingPin = 0;
                    currentState = STATE_DISPLAY;
                } else {
                    // display the 'waiting' chaser
                    displayChaser();
                }
                break;
            case STATE_DISPLAY:
                // generate and display pattern
                if(pattern == NULL) {
                    generatePattern();
                }
                displayPattern();             
 
                // Go to input state
                currentState = STATE_INPUT;
                TCNT1 = 0; // Set the timer back to 0
                break;
            case STATE_INPUT:
 
                // The timer isn't big enough - we'll use a second counter
                if(TCNT1 >= HIGH_PRECISION_COUNTER_LIMIT) {
                    timerExceeded++;
                    TCNT1 = 0;
                }
                if( (timerExceeded >= LOW_PRECISION_COUNTER_FAIL_ON_NO_INPUT && inputStarted == 0)
                    || timerExceeded >= LOW_PRECISION_COUNTER_FAIL_ON_INPUT_THEN_TIMEOUT ) {
                    // If the second counter reaches determined max we'll force the user to lose
                    incorrectPattern();
                    currentState = STATE_DISPLAY;
                    break;
                }
 
                // Check if any of the pins are pressed
                if( i != 0xFF )
                {
                    // 'Highlight' the selected pin
                    if(inputStarted == 0) inputStarted = 1;
                    PORTB = i;
 
                    // Check if the pin matches the next pin in the pattern
                    if(~i & pins[pattern[inputPos]]) {
                        // The right button was pressed
                        input[inputPos] = pattern[inputPos];
                        inputPos++;
                       
                        if(inputPos >= patternLength) {
                            // The sequence was finished correctly
                            correctPattern();
                            currentState = STATE_DISPLAY;
                            break;
                        }
                    } else {                   
                        // The wrong button was pressed
                        incorrectPattern();
                        currentState = STATE_DISPLAY;
                        break;
                    }
 
                    mydelay_ms(50);
                }
 
                // Display 'waiting' chaser (to show user can press buttons)
                displayChaser();
 
                break;
        }
    }
   
    return 0;
}
 
 View user's profile Send private message  
Reply with quote Back to top
bobgardner
PostPosted: Jan 27, 2012 - 04:56 PM
10k+ Postman


Joined: Sep 04, 2002
Posts: 21248
Location: Orlando Florida

Now I see there is a malloc in generate pattern. Maybe one of the gcc experts will tell us if we have to include some specal h file or other command to link in the malloc routines, or maybe we could just change those two lines to use an array rather than allocating them on the heap?

_________________
Imagecraft compiler user
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
jpmargis
PostPosted: Jan 27, 2012 - 06:06 PM
Rookie


Joined: Oct 07, 2010
Posts: 34
Location: San Dimas, CA

In the interest of full disclosure, the code posted by stavfot originally came from http://www.swcoder.co.uk/
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Jan 27, 2012 - 06:31 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62207
Location: (using avr-gcc in) Finchingfield, Essex, England

Quote:

Maybe one of the gcc experts will tell us if we have to include some specal h file or other command to link in the malloc routines,

malloc() is given in K&R and mandated by the C standard. It should work the same on ALL compilers. AS K&R tells you it's <stdlib.h> (which OP's code, that we now know is not OP's code, uses).

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
stavfot
PostPosted: Jan 27, 2012 - 07:43 PM
Wannabe


Joined: Dec 15, 2011
Posts: 93


so what people? ok this code is not mine that is certain but what is the difference?

you really think that i cant create a code like this? of i can not understand the code?

the problem remains the same . and the same question. why does not this game code run in my stk500

aa by the way thanks a lot to mr informer jpmargis you would be a good informer in the police or when ever...
maybe he is from greece . you know there were a team in my class that took exactly this project and by using this exact code they made a project that they also present it as theirs ... so it would not be possible to me to take the same project since the rule sais that every project must be different. on the other hand, i have already lost the lesson..

i just want to learn about programming avr so as to be ready for the next year.

so will you help me or not?
 
 View user's profile Send private message  
Reply with quote Back to top
georges80
PostPosted: Jan 27, 2012 - 08:42 PM
Hangaround


Joined: Jul 25, 2004
Posts: 201
Location: Sunnyvale, CA

You need to learn about debugging first...

If the statement
PORTB = 0x0;
should light all your LEDs, then where you have
while(1) {
in your main routine, put

PORTB = 0x0;
while(1)
;

while(1) {

This should light all the LEDs and stop there. If the LEDs don't light up, then at least you know that something is wrong in your initialisation, compilation switches, flashing of the firmware, connections etc etc...

Debugging is an art that YOU need to learn. As folk on this train wreck thread have pointed out multiple times, take SMALL step and debug/check EACH SMALL SECTION.

Learning is best done by DOING/FAILING/FIXING, each step can be slow and painful and you will not forget what you've learned the hard way. The amount of time you've spent so far on this thread arguing could have been spent writing small sections of code and testing each one.

I suppose some folk just want that silver platter handed to them.

cheers,
george.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits