go_away

Author Topic: Cannot get Delay function to work; causes crash  (Read 873 times)

0 Members and 1 Guest are viewing this topic.

Offline WGhost9Topic starter

  • Beginner
  • *
  • Posts: 2
  • Helpful? 0
Cannot get Delay function to work; causes crash
« on: July 04, 2009, 02:43:46 PM »
Hello everyone, I am trying to get the axon baord to talk to a ps2 controller like in the tutorial offered by this site. When I try to run the code provided, I am told that the timer0Init() and the timer2Init() are undefined references, so I have commented them out as well as the timer resets. This may have caused the problem. The problem I am having is that when I execute the code, the axon board freezes on the line:
       delay_ms(1);
I have verified this with rprintf() statements.

I was hoping someone could explain to me why the axon would freeze at this line and why the the timerInits  where unrecognized by the code.

Thanks very much.


Offline Luke

  • Jr. Member
  • **
  • Posts: 7
  • Helpful? 0
Re: Cannot get Delay function to work; causes crash
« Reply #1 on: July 09, 2009, 02:53:58 PM »
delay_ms() uses timer0. If you do not properly set up timer 0, delay_ms will look like it never returns. The error you get from trying to call timer0Init and timer2Init seem to be the root problem (as it looks like you guessed already).

The unrecognized symbol error is caused by the compiler not being able to find the function in any of the source files it is compiling (in reality it's looking in all the object files) or in any of the libraries it is linking against. If I remember correctly, those functions are in timer640.[ch].

You should make sure you include the proper header files, your Makefile has the proper source files in it, and the files are in the same working directory as your project. There can be other causes of the error as well, but these are the most common.

I hope that helps.

 


Get Your Ad Here