Go to Post When you start thinking of FIRST as a robotic building contest you have left the pavement and you are in deep weeds. - KenWittlief [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 28-03-2007, 22:22
lightning_blast lightning_blast is offline
Registered User
FRC #1814
 
Join Date: Feb 2006
Location: Canada
Posts: 15
lightning_blast is an unknown quantity at this point
Timer Question

Hi, our incredible plans to create an autonomous mode has failed (once again ) and im thinking we will have to rely on timers again. Last year, we used EasyC, but this year we're using MPLab. We have the idea of having a timer based on the number of loops. We believe each loop is 26.2 ms, so can we take this number and loop it xx times and increasing a counter each loop until it reaches the specific time?

example, we want to move 5 seconds forward
5s = 5000ms = 190 loops.

static int timer = 0;
**move forward**;
if (timer <190)
timer = timer +1 ;
if (timer >=190)
**stop**;

Thanks!!
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Timer questions Rick TYler Programming 3 12-02-2006 19:24
Quick Timer Question et1337 Programming 3 02-02-2006 15:19
Accelerometer Timer Question psquared Programming 3 12-02-2005 01:34
timer omega Programming 3 30-03-2004 18:52
Timer Preview Nate Smith General Forum 2 05-03-2003 12:25


All times are GMT -5. The time now is 19:43.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi