Go to Post Pneumonoultramicroscopicsilicovolcanoconiosis. Be careful. - Ether [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 Rating: Thread Rating: 5 votes, 5.00 average. Display Modes
  #346   Spotlight this post!  
Unread 08-02-2008, 01:48
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: New C18 3.0+ Compatible FRC Code

Quote:
Originally Posted by sfs View Post
I just tried to build the ifi_frc_sensor project with MPLAB IDE v7.20 and C18 2.4 (had to use the project wizard to create new mcp/mcw files, as I was unable to open the ones that came with). After updating the ifi_frc.h header file to define the proper compiler macro (USE_C18_24), I now am getting these errors:

timers.c:72:Error [1205] unknown member 'PSA' in '__tag_216'
timers.c:72:Error [1131] type mismatch in assignment

Apparently the header file mcc18\p18f8722.h defines T0CON bit 3 as T0PS3, but the timers.c file references it as 'PSA' instead. Should the code read:

#ifdef USE_C18_24
T0CONbits.T0PS3 = 1;
#else
T0CONbits.PSA = 1;
#endif

??
Looks like another bug in their header file. Your options are to replace the 2.4 p18f8722.h with the 2.44 version in the Documentation folder included with my code, or you can update your compiler to 2.44, which is the same version I use. Here's the link to the secret copy I keep on my website: http://kevin.org/frc/c18_244_update.zip.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #347   Spotlight this post!  
Unread 08-02-2008, 17:31
sfs sfs is offline
Software Engineer
AKA: Steve Siirila
FRC #2220 (Blue Twilight)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2006
Location: Eagan, MN
Posts: 28
sfs is an unknown quantity at this point
Re: New C18 3.0+ Compatible FRC Code

How many folks out there are using this code with MPLAB IDE v7.20 and MPLAB C18 2.4? I noticed a comment in encoder.h as follows:

This version is compatible with Microchip C18 3.0+ only

Is this still true?
  #348   Spotlight this post!  
Unread 08-02-2008, 17:36
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: New C18 3.0+ Compatible FRC Code

Quote:
Originally Posted by sfs View Post
How many folks out there are using this code with MPLAB IDE v7.20 and MPLAB C18 2.4? I noticed a comment in encoder.h as follows:

This version is compatible with Microchip C18 3.0+ only

Is this still true?
Ugh. Um, I guess I was a knucklehead and forgot to delete that comment. The code works file with 2.4.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #349   Spotlight this post!  
Unread 08-02-2008, 20:21
sfs sfs is offline
Software Engineer
AKA: Steve Siirila
FRC #2220 (Blue Twilight)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2006
Location: Eagan, MN
Posts: 28
sfs is an unknown quantity at this point
Re: New C18 3.0+ Compatible FRC Code

That's what I had guessed, thanks for clarification. Note that this comment also appears in at least one other file as well (interrupts.h), possibly others, too.
  #350   Spotlight this post!  
Unread 08-02-2008, 22:01
David Doerr's Avatar
David Doerr David Doerr is offline
Registered User
FRC #4478 (Materia Oscura)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2002
Location: Milford, Michigan, USA
Posts: 75
David Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud of
Re: New C18 3.0+ Compatible FRC Code

Another ADC and Gyro question

We want to use the gyro as well as other analog sensors. It appears that using Process_Gyro_Data() in Teleop_Spin(), for example, will check for ADC result count, read the ADC gyro channel only and then reset the ADC result count without reading any other ADC channels. Is that a problem?

The 2007 Process_Gyro_Data() didn't check for ADC result count or do a reset inside the function, so we read our other channels just after Process_Gyro_Data() and before the reset.

Where should ADC channels for our other sensors be read? Do they need to be read in the fast loop at the same time as the gyro channel is read? (Should we insert more Get_Analog_Result()s in Process_Gyro_Data to read the other channels?)

We're using pots with a PID to control steering etc., and ultrasonic sensors.

Thanks...
  #351   Spotlight this post!  
Unread 08-02-2008, 22:27
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: New C18 3.0+ Compatible FRC Code

Quote:
Originally Posted by David Doerr View Post
We want to use the gyro as well as other analog sensors. It appears that using Process_Gyro_Data() in Teleop_Spin(), for example, will check for ADC result count, read the ADC gyro channel only and then reset the ADC result count without reading any other ADC channels. Is that a problem?
Yes it is. I would modify Process_Gyro_Data() to not reset the the ADC result count, but make sure it does get reset after processing all your other sensor data. I think I'll modify Process_Gyro_Data() to accept a TRUE/FALSE parameter to determine how it behaves in this regard. Thanks for catching another knuckleheaded mistake on my part <grin>.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #352   Spotlight this post!  
Unread 09-02-2008, 07:20
ldeffenb ldeffenb is offline
Registered User
AKA: Lynn Deffenbaugh (Mr)
None #0386 (Team Voltage 386)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Florida
Posts: 75
ldeffenb has a spectacular aura aboutldeffenb has a spectacular aura aboutldeffenb has a spectacular aura about
Send a message via ICQ to ldeffenb Send a message via AIM to ldeffenb Send a message via Yahoo to ldeffenb
Re: New C18 3.0+ Compatible FRC Code

Quote:
Originally Posted by Kevin Watson View Post
Yes it is. I would modify Process_Gyro_Data() to not reset the the ADC result count, but make sure it does get reset after processing all your other sensor data.
We've already done this, but why the recommendation to "reset after processing...other...data"? We simply remember the last count and make sure it has changed before processing more data. That way we are sure to be processing fresh stuff and don't need to tie it all together to get a reset when everyone has had their chance at the latest readings....

Lynn (D) - Team Voltage 386 Software
  #353   Spotlight this post!  
Unread 09-02-2008, 07:26
ldeffenb ldeffenb is offline
Registered User
AKA: Lynn Deffenbaugh (Mr)
None #0386 (Team Voltage 386)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Florida
Posts: 75
ldeffenb has a spectacular aura aboutldeffenb has a spectacular aura aboutldeffenb has a spectacular aura about
Send a message via ICQ to ldeffenb Send a message via AIM to ldeffenb Send a message via Yahoo to ldeffenb
Re: New C18 3.0+ Compatible FRC Code

And I've been remiss in sending "Thanks" to Kevin, but our software group is LOVING the new code format. It is much more understandable than the earlier default code.

One change we've made is to add a few "always" functions. We hooked them in to the main program and they're called "Always_Spin", "Always_Before", and "Always_After". They get called regardless of the current operating mode. The *_Before and *_After routine get called before and after the invocations of the mode's command packet processing routine.

We did this after we found ourselves adding the same invocations to Disabled_Spin, Teleop_Spin, and Autonomous_Spin for the third time. Always_Spin makes it easy.

Always_After is a handy place to get a last chance to reverse any PWM values for opposing drive motors without having to remember to do it everywhere else. Positive logic rules with the ability to override it for reality where necessary. (Robots shouldn't go forwards when you set PWMs to 0, but when mechanical mounts opposing motors and controls wants red to red to positive consistency, it falls to software to make it all work right).

Lynn (D) - Team Voltage 386 Software
  #354   Spotlight this post!  
Unread 09-02-2008, 12:41
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: New C18 3.0+ Compatible FRC Code

Quote:
Originally Posted by ldeffenb View Post
We've already done this, but why the recommendation to "reset after processing...other...data"? We simply remember the last count and make sure it has changed before processing more data. That way we are sure to be processing fresh stuff and don't need to tie it all together to get a reset when everyone has had their chance at the latest readings....

Lynn (D) - Team Voltage 386 Software
Yes, this works too, but keep in mind that the value returned by ADC_Result_Count will roll over at some point, so make sure to use the != operator instead of > in your test (I know you know this Lynn; I'm just mentioning this so others won't make a mistake).

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #355   Spotlight this post!  
Unread 09-02-2008, 14:06
mandrews281 mandrews281 is offline
Registered User
FRC #0281
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Greenville SC
Posts: 83
mandrews281 is a splendid one to beholdmandrews281 is a splendid one to beholdmandrews281 is a splendid one to beholdmandrews281 is a splendid one to beholdmandrews281 is a splendid one to beholdmandrews281 is a splendid one to beholdmandrews281 is a splendid one to behold
Re: New C18 3.0+ Compatible FRC Code

I'm having trouble with the Gyro bias calculation in the code posted on 2/2. If I use the previous code (without the circular buffer), I get a gyro bias of ~2080. With the newer code, I get a gyro bias of ~1660. This make the code think the gyro is spinning continuously. Is there an OBO (off by one) error lurking somewhere? Is anyone else having problems with the updated code?
  #356   Spotlight this post!  
Unread 09-02-2008, 16:27
3dude_2231's Avatar
3dude_2231 3dude_2231 is offline
no one messes with a Thingy =|
AKA: Menscher,Ran Menscher =]
FRC #2231 (Onyxtronix)
Team Role: Leadership
 
Join Date: Feb 2007
Rookie Year: 2007
Location: Shoham, Israel
Posts: 233
3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough
Send a message via MSN to 3dude_2231
Re: New C18 3.0+ Compatible FRC Code

btw
I had a problem, I was trying to declare a variable in "interrupts.c",
and use it also in "autonomous.c,"
no matter what i've tried, it didn't work
(nope, trying to redeclare it as an extern in the header didn't work either),

strangely enough, after wasting an hour like an idiot ,
I've declared it in autonomous.c and it worked like a charm.

incredibly weird..
__________________
Redefining the word "Rookie". (for 2 years now..)


Israeli Off Season Games: WINNERS!
check out this cool project I'm into..

  #357   Spotlight this post!  
Unread 09-02-2008, 19:38
Lafleur Lafleur is offline
Registered User
AKA: Tom Lafleur
FRC #0812
Team Role: Engineer
 
Join Date: Dec 2007
Rookie Year: 2006
Location: San Diego
Posts: 34
Lafleur will become famous soon enoughLafleur will become famous soon enough
Re: New C18 3.0+ Compatible FRC Code

Kevin

What is the difference in master code from the 2007 controller and the 2008 controller... is there a procedure to update a 2007 controller to the current master code?? I understand that the hardware is 100% the same...

thanks...
  #358   Spotlight this post!  
Unread 09-02-2008, 20:12
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: New C18 3.0+ Compatible FRC Code

Quote:
Originally Posted by Lafleur View Post
Kevin

What is the difference in master code from the 2007 controller and the 2008 controller... is there a procedure to update a 2007 controller to the current master code?? I understand that the hardware is 100% the same...

thanks...
There is no difference in the hardware or firmware between the 2007 and 2008 robot controllers. The latest revision of the master firmware is version 15, available here:

http://www.ifirobotics.com/docs/frc-master-ver15.zip

You use the IFI loader to send it to the robot controller (the boot loader intercepts it and sends it to the master).

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #359   Spotlight this post!  
Unread 09-02-2008, 21:27
ldeffenb ldeffenb is offline
Registered User
AKA: Lynn Deffenbaugh (Mr)
None #0386 (Team Voltage 386)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Florida
Posts: 75
ldeffenb has a spectacular aura aboutldeffenb has a spectacular aura aboutldeffenb has a spectacular aura about
Send a message via ICQ to ldeffenb Send a message via AIM to ldeffenb Send a message via Yahoo to ldeffenb
Re: New C18 3.0+ Compatible FRC Code

Kevin,

We just uncovered (and fixed) a potential gotcha in the invocation of Teleop_Init() from main. We tried to access the current state of the OI inputs from there and they weren't available!

We found that the Getdata() call was occurring AFTER the Teleop_Init(). We moved it BEFORE the if(teleop_init_flag) test and it corrected our problem.

On further inspection as I'm writing this, the same issue would plague the other two *_Init() invocations. Simply moving the Getdata call will make the current OI data available to those functions.

Lynn (D) - Team Voltage 386 Software
  #360   Spotlight this post!  
Unread 09-02-2008, 22:35
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: New C18 3.0+ Compatible FRC Code

Quote:
Originally Posted by ldeffenb View Post
Kevin,

We just uncovered (and fixed) a potential gotcha in the invocation of Teleop_Init() from main. We tried to access the current state of the OI inputs from there and they weren't available!

We found that the Getdata() call was occurring AFTER the Teleop_Init(). We moved it BEFORE the if(teleop_init_flag) test and it corrected our problem.

On further inspection as I'm writing this, the same issue would plague the other two *_Init() invocations. Simply moving the Getdata call will make the current OI data available to those functions.

Lynn (D) - Team Voltage 386 Software
Hmmm... I'll have a look at it later tonight.

Edit: I'll change it when I make the changes mentioned above, but I don't see where this could cause a ploblem as the OI data from the previous Getdata() should be valid. What problem were you having?

-Kevin

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org

Last edited by Kevin Watson : 09-02-2008 at 23:59.
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
Does the camera code suits to all versions of MPLAB and C18? razer Programming 3 04-01-2007 14:50
Trying to follow C18 interrupt context code... dcbrown Programming 5 21-12-2006 09:01
Error w/ FRC code JamesBrown Programming 2 08-01-2005 16:17
Programming code Fix FRC Ferazel2001 Programming 6 08-02-2004 02:46
FRC default code hedgehogger Programming 2 21-01-2004 18:41


All times are GMT -5. The time now is 13:56.

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