Go to Post The only teams who have no chance of winning are those who believe they can't win. To quote the greatest athlete of our generation: "Limits like fears are often just an illusion." -- Michael Jordan - Karthik [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 22-01-2007, 09:12
Japper's Avatar
Japper Japper is offline
Registered User
FRC #3692 (RocknRobots)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Rutland Wisconsin
Posts: 147
Japper has a spectacular aura aboutJapper has a spectacular aura about
2007 IFI default code question

In the IFI 2007 default code main.c , there is a condition statement (see below) where if _SIMULATOR is defined then
statusflag.NEW_SPI_DATA is set to 1 and the slow loop (which execute every 26.2ms) is used., otherwise
it is never entered.

It is my assumption that because _SIMULATOR is defined in the default.h header file that this slow loop
will always be executed.

Why would you not want to use the slow loop (and remove the definition in the header file)?

Here is the code:
============
void main (void)
{
#ifdef UNCHANGEABLE_DEFINITION_AREA
IFI_Initialization (); /* DO NOT CHANGE! */
#endif

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

statusflag.NEW_SPI_DATA = 0; /* DO NOT CHANGE! */

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) */
} /* END of Main */
===========
  #2   Spotlight this post!  
Unread 22-01-2007, 10:21
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: 2007 IFI default code question

_SIMULATOR should only be #defined if you plan to run your code using the simulator. I don't see a default.h file. I see one named ifi_default.h, but that file doesn't define _SIMULATOR. Typically it isn't defined in a file at all, instead being passed to the processor on the command line.

The statusflag structure is filled in automatically by the communication with the master processor. It will signal a new data packet each time the OI sends values over the radio or the tether connection, about 40 times per second. The slow loop will run once each time that happens. If you're using the simulator to run the code, there is no OI communication, and the compiler needs to pretend it's getting data so you can test out your slow loop.
  #3   Spotlight this post!  
Unread 22-01-2007, 12:58
Japper's Avatar
Japper Japper is offline
Registered User
FRC #3692 (RocknRobots)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Rutland Wisconsin
Posts: 147
Japper has a spectacular aura aboutJapper has a spectacular aura about
Re: 2007 IFI default code question

Thanks for the info...

And yes you are right the correct name for the header file is ifi_default.h
-My incorrect typing...

I didn't know that The statusflag structure is filled in automatically by the communication with the master processor and so I wasn't sure how or it the user_routines.c was being accessed.

Is there any any description of this workings of this software available for those of us that are not as familiar with it?

It looks quite basic but any additional information helps with the learning curve...


Thanks again for you help!
  #4   Spotlight this post!  
Unread 22-01-2007, 22:53
Japper's Avatar
Japper Japper is offline
Registered User
FRC #3692 (RocknRobots)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Rutland Wisconsin
Posts: 147
Japper has a spectacular aura aboutJapper has a spectacular aura about
Re: 2007 IFI default code question

I was playing around with the default code tonight and now I am really confused...

there is a section that is set up for 1 joystick control and I tried this but it did not work as I expected. The comments stated that I need to connect one wheel to PWM_13 or PWM_14 and the other wheel to PWM_15 or PWM_16 but what I found to work was to connect one wheel to PWM_01 and the other wheel to PWM_13.

What line of code is actually outputing the PWM value to the PWM outputs?

Please advise.

Thanks
  #5   Spotlight this post!  
Unread 22-01-2007, 23:23
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: 2007 IFI default code question

Quote:
Originally Posted by Japper View Post
Is there any any description of this workings of this software available for those of us that are not as familiar with it?
You'll probably find a lot of what you want to know here:

http://www.ifirobotics.com/docs/lega...e-2004-1-7.pdf
http://www.ifirobotics.com/docs/lega...2-apr-2004.pdf

They were written for the 2004 system, but are still applicable this year.
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
Problems with Kevin's 2007 default code bruss6 Programming 8 19-01-2007 15:42
2007 Default Code? Binome Programming 52 11-01-2007 14:27
New IFI Default/User and Master Code Alex698 Programming 6 28-02-2006 23:04
Question about Solenoid and default code waialua359 Control System 4 21-01-2006 18:21
navigate and default code newbie question alan koch Programming 2 17-02-2004 22:25


All times are GMT -5. The time now is 10: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