Go to Post i met ANDY BAKER and D.J... they are awesome! - Arefin Bari [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

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 28-08-2006, 17:11
6600gt's Avatar
6600gt 6600gt is offline
Registered User
AKA: Lohit
FRC #0226 (Hammerhead)
Team Role: Alumni
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Troy, MI
Posts: 221
6600gt is a jewel in the rough6600gt is a jewel in the rough6600gt is a jewel in the rough
main.c

in the main.c

Quote:
while (1) /* This loop will repeat indefinitely. */
{
#ifdef _SIMULATOR
statusflag.NEW_SPI_DATA = 1;
#endif

if (statusflag.NEW_SPI_DATA) /* 26.2ms loop area */
{ /* I'm slow! I only execute every 26.2ms because */
/* that's how fast the Master uP gives me data. */


Process_Data_From_Master_uP(); /* You edit this in user_routines.c */


if (autonomous_mode) /* DO NOT CHANGE! */
{
User_Autonomous_Code(); /* You edit this in user_routines_fast.c */
}


}
Process_Data_From_Local_IO(); /* You edit this in user_routines_fast.c */
/* I'm fast! I execute during every loop.*/
} /* while (1) */
shouldn't it be

if(autonomous_mode)
{
User_Autonomous_Code();
}
else
{
Process_Data_From_Master_uP();
}

otherwise it will be executing Process_Data_From_Master_uP() and then User_Autonomous_Code() in auton, every loop, thus eating up a lot of processor time.

Last edited by 6600gt : 28-08-2006 at 17:17.
  #2   Spotlight this post!  
Unread 28-08-2006, 17:24
Donut Donut is offline
The Arizona Mentor
AKA: Andrew
FRC #2662 (RoboKrew)
Team Role: Engineer
 
Join Date: Mar 2005
Rookie Year: 2004
Location: Goodyear, AZ
Posts: 1,307
Donut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond repute
Re: main.c

If you take a look at User_Autonomous_Code() in user_routines_fast.c, you'll notice that there is a loop inside the funciton that the controller will not leave until autonomous is over. So no, it shouldn't be since the program can't return to execute Process_Data_From_Master_uP() until autonomous has ended.
__________________
FRC Team 498 (Peoria, AZ), Student: 2004 - 2007
FRC Team 498 (Peoria, AZ), Mentor: 2008 - 2011
FRC Team 167 (Iowa City, IA), Mentor: 2012 - 2014
FRC Team 2662 (Tolleson, AZ), Mentor: 2014 - Present
  #3   Spotlight this post!  
Unread 28-08-2006, 21:29
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: main.c

It's also worth mentioning that getdata() isn't called (and the autonomous flag set) until Process_Data_From_Master_uP() is called. Personally, this is a bug to me. Of course, I've also changed that layout anyway, so it doesn't bug me.
  #4   Spotlight this post!  
Unread 29-08-2006, 02:19
6600gt's Avatar
6600gt 6600gt is offline
Registered User
AKA: Lohit
FRC #0226 (Hammerhead)
Team Role: Alumni
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Troy, MI
Posts: 221
6600gt is a jewel in the rough6600gt is a jewel in the rough6600gt is a jewel in the rough
Re: main.c

whoops...I missed the while loop in user_routines_fast.c...

Anyway, thanks for letting me know
Closed Thread


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
Rewriting main loop Max Lobovsky Programming 4 04-01-2005 18:35
Editing Main.c Astronouth7303 Programming 22 20-02-2004 16:45
Main Circuit Breaker Yan Wang Electrical 6 20-02-2003 10:23
Main Stage archiver 2001 3 24-06-2002 03:06
main driver Kaitlin Palmer Off-Season Events 0 09-04-2002 21:26


All times are GMT -5. The time now is 23:02.

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