Thread: sleep()
View Single Post
  #13   Spotlight this post!  
Unread 22-02-2004, 18:56
KenWittlief KenWittlief is offline
.
no team
Team Role: Engineer
 
Join Date: Mar 2003
Location: Rochester, NY
Posts: 4,213
KenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond repute
Re: sleep()

Quote:
Note that if you were using this as a timer, it would be different at different battery charges as the controller would run slower.
?!?!?!?!

the microprocessor runs on 5V, regulated from the 12 or 7.2V batteries - and the timing is controlled by a crystal that doesnt care what the battery voltages are

the execution of uP instruction cycles will be dead accurate repeatable, no matter what the state of your battery is, until the battery drops far enough to cause a reset.

I think the people that are contemplating wait states, for loops, do loops or while loops in their code really need to get the default users manaul and get a grasp on how this SW runs

the program takes in inputs from the operator
then it does your processing
then it outputs the results of your processing to the victors and spikes

those three major tasks repeat continiously - you DONT want to pause or stop or put timing delays in your processing area - you want the code to continue to run and loop as fast as it can

so if you are waiting for something to happen, and it hasnt happend yet, then do nothing and check again on the next 'pass' of the SW.

Putting wait states or delays in your code is one of the surest ways to make the controller lock up, and set all your outputs to 'off' - when this happens your bot will go dead and you will have a very expensive, very fancy statue sitting on the field infront of 3000 people.