View Single Post
  #10   Spotlight this post!  
Unread 19-02-2004, 11:57
shsdragon shsdragon is offline
Registered User
#1345
Team Role: Programmer
 
Join Date: Jan 2004
Location: Florida
Posts: 8
shsdragon is on a distinguished road
Send a message via AIM to shsdragon Send a message via Yahoo to shsdragon
Re: Programming Help

{
static long timeCounter = 0; //this will count the number of 26.2ms ticks that have passed

while (autonomous_mode) /* DO NOT CHANGE! */
{
if (statusflag.NEW_SPI_DATA) /* 26.2ms loop area */
{
Getdata(&rxdata); /* DO NOT DELETE, or you will be stuck here forever! */

if(timeCounter <= 115) //3 seconds / 26.2ms = 114.5
{
pwm13 = pwm15 = 30;
}
else if(timeCounter <= 134) //we'll give the relays about .5 seconds to switch
{
pwm13 = pwm15 = 0;
relay1_fwd = relay2_fwd = 1;
}
else
{
//put stuff to do after the other things here
//you can also add more else-if statements to time other things
}

Putdata(&txdata); /* DO NOT DELETE, or you will get no PWM outputs! */
timeCounter++; //add one to the tick count
}
}
}

this should work fine - hope it helps!


mmy motoors don't move
__________________
[/font][color=Red]Jearvon Dharrie