Author Topic: Axon - Timer640.h ...Need Admin's Help !  (Read 1548 times)

0 Members and 1 Guest are viewing this topic.

Offline Hasan999Topic starter

  • Full Member
  • ***
  • Posts: 75
  • Helpful? 1
Axon - Timer640.h ...Need Admin's Help !
« on: December 30, 2009, 06:19:45 PM »
After a long time dealing with the "undefined reference" problem (including Axon.elf error) ...this is where I could reach..

I am using Axon_Source_012309 Source code with new Timer640.c/h files [i.e. i can see Timer640_old.c/h] - which apparently Admin made to fix the same errors of "undefined reference" etc that occurs while I use Timers !.

(btw, Axon.elf not found error still occurs when i #include "timer640.c" - what should I do?)

But anyway, now, when I added the Axon_Source_012309 Source code, with new Timer640 files (also attached) I got errors in Axon.c because of initializing Timers functions are different ! (that Admin used in the old and new Timer640.h)

For example: by default we have (in Axon.c):


But none of them (the functions or arguement variable etc) match the new Timer640.h ...

so I tried this and it didn't give me any error:


but I don't know much about it... does that Initialize it? ..if not, what would be the code for initializing the timers...?

Last thing:  All the examples of Timers etc.. does not work..

For example, (to start the timer, and after 5 seconds run the servo) I'm using:

long time=timer0GetOverflowCount()*255+TCNT0;

while(time<5) ;

for(uint16_t i=0; i<10; i++){

No compiling errors, but it doesn't work !!

Please help me create Timers !...

Thanks !

Offline rgcustodio

  • Robot Overlord
  • ****
  • Posts: 217
  • Helpful? 0
  • Use "Search" and ye might find answers!
Re: Axon - Timer640.h ...Need Admin's Help !
« Reply #1 on: December 30, 2009, 08:05:09 PM »
IMHO this code will never work.

Code: [Select]
1:  long time=timer0GetOverflowCount()*255+TCNT0;
2:  timer0Init();
3:  reset_timer_0();
5:  while(time<5) ;
7:  for(uint16_t i=0; i<10; i++){
8:  servo(PORTA,7,700);}

assuming all of the H/W initialization was properly performed. The value of time is never updated.
In line 1 you assign a value to time.
In line 5 you check the value, if the assigned value in line 1 was greater than 5 the code in line 7 and 8 get a chance to execute.
BUT if the value assigned to time is less than 5 the loop enters an infinite loop, because time will always be less than 5 as there is no code to update the value of time.

The best thing one can do when it's raining is to let it rain. - H. W. Longfellow

understanding is the path to enlightenment

Offline Hasan999Topic starter

  • Full Member
  • ***
  • Posts: 75
  • Helpful? 1
Re: Axon - Timer640.h ...Need Admin's Help !
« Reply #2 on: December 31, 2009, 07:04:57 AM »
ohh.... I thought that will enable the timer CLOCK !..

but how to do that?? ... how can I "start" the stop-watch and perform tasks at different times ?

Please help - thanks !!

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,696
  • Helpful? 173
    • Society of Robots
Re: Axon - Timer640.h ...Need Admin's Help !
« Reply #3 on: January 05, 2010, 01:13:55 AM »
I recommend just using the latest code version. There were some timer name changes made, so thats probably causing the initialization issues.


Get Your Ad Here