Thread: Delay Function
View Single Post
  #1   Spotlight this post!  
Unread 28-02-2007, 17:54
Anime-niac_2.9's Avatar
Anime-niac_2.9 Anime-niac_2.9 is offline
Japanese-crap freak(NOTE AVATAR)
AKA: Alex Abenoja, A-Squared, & Anime
FRC #0599 (Robodox)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Northridge, California
Posts: 88
Anime-niac_2.9 will become famous soon enough
Re: Delay Function

i've thought about it before, and it turns out something like bear24rw's idea.

Code:
int counter=0;

void User_Autonomous_Code(void)
{
  static unsigned int i;
  const float delay = 100;
  int counter, int limit=(delay*1000)*26.4;

  for(counter=0, counter<limit, counter++)
  {
  }
}
not necessarilly a function, but the interrupt code here (the for loop) should work. all you have to do if place the for loop whereever you want it
__________________
THE ROBODOX FORUM

Reading: Suzumiya Haruhi no Yuutsu by Tanigawa Nagaru
Religion: Haruhiism