I was wondering if there is a task spit function in easy c. i want to have two seperate loop function run and terminate independently of each other is this possible? and if so how? plz help we have a competion really soon and wihtout this we have no atonomous!
Unfortunately, under normal circumstances the processor in the Vex controller cannot multi task. But, you could use a timer to run two loops concurrently.
void Autonomous ( unsigned long ulTime )
{
unsigned long Timer1;
StartTimer ( 1 ) ;
// You cannot use a "WAIT" statement with this setup it will stall the loop
// You can create additional timers with a user code block StartTimer ( 2 )
// and GetTimer ( 2 )
while ( 1 )
{
Timer1 = GetTimer ( 1 ) ;
if ( Timer1 >0 && Timer1 < 10 ) // Loop1
{
}
else if ( Timer1 > 11 && Timer1 <21 ) // Loop2
{
}
else if ( Timer1 > 22 )
{
PresetTimer ( 1 , 0 ) ;
}
}
}