Go to Post I WANT to see teams succeed. - Steve W [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 10-01-2008, 08:26
Roni2230 Roni2230 is offline
Registered User
FRC #2230
 
Join Date: Jan 2007
Location: Israel
Posts: 3
Roni2230 is an unknown quantity at this point
Re: the main code

Thank YOU every one.
But what is the spin per sec?
I think its 62...
I am not sure...

Thank YOU from Israel!!
  #2   Spotlight this post!  
Unread 10-01-2008, 10:44
dcbrown dcbrown is offline
Registered User
AKA: Bud
no team
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Hollis,NH
Posts: 236
dcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud of
Re: the main code

The main while(1){} in the default code without any user changes is executed about 830,000 times a second. Once you start adding your own code then it will get slower.[1]

The inner loop via the new spi data check is executed at most ~38 times per second (new data from the operator interface is available every 26.2ms).

The best thing to do would be to read some of the documentation at the ifirobotics site on the structure of the main loop.

And while it is true you can get the red light of death if you make your program execution path too long -- there is an easy way to avoid this ala EasyC/WPILIB. Namely you move the getdata/putdata into an event routine that is run during the system clock interrupt. Then it doesn't matter how long your program execution path is unless you really do something nasty to hang the processor so it won't service interrupts.

[1] the default code path is roughly 12 instruction cycles long but this doesn't account for the background global interrupt routine that is handling the SPI bus transfers of data between the master and user processors, nor the Process_Data_From_Master_uP routine that is executed 38 times per second, so maybe it has an average code path length of 20 instruction cycles in the default code and it only runs 500,000 times per second.
  #3   Spotlight this post!  
Unread 10-01-2008, 12:14
ay2b's Avatar
ay2b ay2b is offline
Registered User
AKA: Andy
FRC #2928
Team Role: Mentor
 
Join Date: Mar 2004
Rookie Year: 1994
Location: Seattle, WA
Posts: 211
ay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant future
Re: the main code

Quote:
Originally Posted by Roni2230 View Post
Thank YOU every one.
But what is the spin per sec?
I think its 62...
I am not sure...
This depends on how much code you have. If the spin() loop is empty, it will get called thousands of times. If it does a lot of calculations, it might only get called tens of times. If you are processing lots of interrupts, that will also slow down the spin() loop.
__________________

2011 - SD Quarterfinalists (980), LA Quarterfinalists (980)
2010 - LA (2404) Finalists (980), AZ Motorola Quality (980)
2009 - LA Semifinalists (980); Las Vegas Quarterfinalists (980); SD (2404); IRI #1 Seed, Finalist (980)
2008 - SD Quarterfinalists (980), LA Champions (980), LA Rookie Inspiration Award (2404); CalGames Finalists
2007 - So.Cal Finalists (980), SD Quarterfinalists (980); CalGames Finalists
2006 - So.Cal Regional Champion (4), Toronto Judge's Award Day 1 (4)
2005 - SVR Champions, Delphi "Driving Tomorrow's Technology" (980); AZ Xerox Creativity (980); So.Cal Finalists, RadioShack Innovation in Control (980); Championship Archimedes Division Semifinalists; IRI Finalists (980)
2004 - So.Cal Regional Champions, Leadership in Controls (980); AZ GM Industrial Design (980); Championship Galileo Division #2 Seed; IRI Champions
2003 - PNW Semi-finalists (488)
2002 - PNW Finalists (488)
2000 - X-bot / 488 - Mentor / Founder
1994 - Sunny Delight - Driver - champion
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
changing main.c 3dude_2231 Programming 15 21-02-2007 01:54
main.c 6600gt Programming 3 29-08-2006 02:19
Editing Main.c Astronouth7303 Programming 22 20-02-2004 16:45
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:10.

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