Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   New C18 3.0+ Compatible FRC Code (http://www.chiefdelphi.com/forums/showthread.php?t=60377)

TimeOut 07-01-2008 22:52

Re: New C18 3.0+ Compatible FRC Code
 
Just grabbed both 2.4 versions and opened them up with MPLAB 7.62. I only had two issues.

1) The ifi_frc_8722_25.lib file was being displayed as "Not Found" even though it was in the root directory of the project along with all the other files. I just removed the "Not Found" version and added it back in the project.

2) Error during linking saying that the CLIB.LIB wasn't found. It was looking in c:\program files\mplab\mcc18\lib instead of c:\mcc18\lib. Very likely a configuration mistake on my part here. I just went in to the project properties and added the correct library path.

Compiled and linked without any errors.

Nice work Kevin.

Sean

Kevin Watson 07-01-2008 23:14

Re: New C18 3.0+ Compatible FRC Code
 
1 Attachment(s)
Quote:

Originally Posted by sumadin (Post 671429)
Kevin,

In the gyro.h file there are definitions for several different gyros. However, the new KoP gyro is not one of them. Do you think you will be able to add a set of constants for it next time you rebuild?

Thanks.

I just verified the 2008 KOP gyro is 12.5 mV per degree/second, which is the same as the ADXRS150. The datasheet is attached.

-Kevin

Guy Davidson 07-01-2008 23:52

Re: New C18 3.0+ Compatible FRC Code
 
Quote:

Originally Posted by Kevin Watson (Post 671911)
I just verified the 2008 KOP gyro is 12.5 mV per degree/second, which is the same as the ADXRS150. The datasheet is attached.

-Kevin

Thank you very much. I'll hopefully be able to provide gyro and encoder code feedback soon.

DemonYawgmoth 08-01-2008 17:21

Re: New C18 3.0+ Compatible FRC Code
 
I've finally been able to compile the 3.1 code, so I started looking over it. It seems that it's a lot cleaner than the past few years' code, but I'm used to those, so I've got a few questions. In the past few years we just put our processing of inputs on the joysticks in Default_Routine(). (This is probably not the best way to have done it, but oh well) I'm assuming we should put all of this code such as using the buttons and stuff into Teleop()? Thanks for the help, great code!

-Arty

Lafleur 08-01-2008 22:35

Re: New C18 3.0+ Compatible FRC Code
 
Kevin:

In your beta code 3 you have two definition for timer 4, one in the timers.c with its ISR in interrupts.c and a 2nd in the adc.c code again with its ISR...

this maybe confusing for user...

thanks...

ps: there are a few typo still in ADC code, ie label is timer 2, but your code is timer 4...

billbo911 08-01-2008 22:59

Re: New C18 3.0+ Compatible FRC Code
 
I just spoke with the programming team tonight. We had to decide between EasyC Pro, MPLAB and IFI default code and the newer MPLAB and compiler with Kevin's new build.
I am happy to say, 2073 will be stretching their skills and using the new code and compiler.:D

Now I have a dilemma.
The team does not have access to a laptop, plenty of computers, but no laptop. So, they will have nothing to take with them to competition. I will not be able to join them at our regional either because of a previously arranged vacation in Hawaii. :yikes:
I do have a laptop I am willing to let them borrow, but it currently has my personal copy of MPLAB 7.2 and C18 v2.4 on it that I use with my personal Vex kit. I prefer not to uninstall it if I can avoid it. So, the question is, can MPLAB's 7.2 and 8.1, and C18's v2.4 and v3.1 co-reside on the same system?

Kevin Watson 08-01-2008 23:02

Re: New C18 3.0+ Compatible FRC Code
 
Quote:

Originally Posted by Lafleur (Post 672940)
Kevin:

In your beta code 3 you have two definition for timer 4, one in the timers.c with its ISR in interrupts.c and a 2nd in the adc.c code again with its ISR...

this maybe confusing for user......

There's a method to my madness (honest). The new scheme standardizes the ISR names across different code modules to make it easier for me to write code that just drops into someone's project without them having to enter the ISR code directly into their code. The downside is that they need to enable two #defines instead of one (see comments at the top of ifi_frc.h, timers.h and interrupts.h). There is also the possibility that two ISRs with the same name will be enabled, but the compiler will complain. I have another solution that uses linked-list ISRs and self modifying code, but I decided it might become a support nightmare, so I'm not going to release it.

Quote:

Originally Posted by Lafleur (Post 672940)
ps: there are a few typo still in ADC code, ie label is timer 2, but your code is timer 4...

Thanks. I'll go code splunking and fix 'em

-Kevin

Kevin Watson 08-01-2008 23:08

Re: New C18 3.0+ Compatible FRC Code
 
Quote:

Originally Posted by DemonYawgmoth (Post 672580)
I'm assuming we should put all of this code such as using the buttons and stuff into Teleop()?

Yep. You can also call IFI's old default_routine(), which has been moved to ifi_code.c.

-Kevin

Kevin Watson 08-01-2008 23:24

Re: New C18 3.0+ Compatible FRC Code
 
Quote:

Originally Posted by billbo911 (Post 672987)
I do have a laptop I am willing to let them borrow, but it currently has my personal copy of MPLAB 7.2 and C18 v2.4 on it that I use with my personal Vex kit. I prefer not to uninstall it if I can avoid it. So, the question is, can MPLAB's 7.2 and 8.1, and C18's v2.4 and v3.1 co-reside on the same system?

I installed 2.4 and then made a copy of the entire mcc18 directory. I then applied the 3.10 upgrade to the original 2.4 directory. Now I can use both compilers and all I have to do is make sure the correct directory is named "mcc18" at build time (thanks go to Mark at IFI for pointing this out to me).

-Kevin

billbo911 09-01-2008 01:38

Re: New C18 3.0+ Compatible FRC Code
 
Quote:

Originally Posted by Kevin Watson (Post 673032)
I installed 2.4 and then made a copy of the entire mcc18 directory. I then applied the 3.10 upgrade to the original 2.4 directory. Now I can use both compilers and all I have to do is make sure the correct directory is named "mcc18" at build time (thanks go to Mark at IFI for pointing this out to me).

-Kevin


Excellent! Got it running!!
Next question. You currently have 3 versions for 3.0: Basic, Basic + Gyro, Basic + encoders.
To add the encoders to the basic + gyro, do I just add the encoder.h/c files to the project? Then follow your instructions for adding your encoder code from an earlier build, like 2007's ifi_encoder.zip?

Kevin Watson 09-01-2008 02:23

Re: New C18 3.0+ Compatible FRC Code
 
Quote:

Originally Posted by billbo911 (Post 673126)
To add the encoders to the basic + gyro, do I just add the encoder.h/c files to the project? Then follow your instructions for adding your encoder code from an earlier build, like 2007's ifi_encoder.zip?

It should be a matter of:
1) Adding encoder.c/.h to the project.
2) Putting #include "encoder.h" at the top of each source file where any encoder functions will be called.
3) Calling the encoder initialization function(s) from teleop.c/Initialization().
4) Enable the individual encoder channels at the top of encoder.h.
5) Assign the encoder phase b signals to digital inputs at the top of encoder.h.
6) Enable the interrupt(s) associated with each enabled encoder channel at the top of ifi_frc.h.
7) Make sure there are no conflicting ISRs enabled at the top of interrupts.h.
8) Compile and test.

-Kevin

eugenebrooks 09-01-2008 03:32

Re: New C18 3.0+ Compatible FRC Code
 
Kevin,

Did anything turn up on your inspection of the provided
code with respect to a possible source of the 8.3 volt bug?

With all the interrupts we will have flying this year,
we are sweating it, although we will get a good six
weeks to see if it surfaces again.

Eugene

Kevin Watson 09-01-2008 10:25

Re: New C18 3.0+ Compatible FRC Code
 
Quote:

Originally Posted by eugenebrooks (Post 673159)
Kevin,

Did anything turn up on your inspection of the provided
code with respect to a possible source of the 8.3 volt bug?

With all the interrupts we will have flying this year,
we are sweating it, although we will get a good six
weeks to see if it surfaces again.

Eugene

While testing the new library code, I discovered that I could induce the 8.3 volt bug pretty reliably (I had never seen it before), and more importantly, eliminate it by initializing the entire RAM array to zero at boot time (something the C18 startup code does not do and IFI only partially does). I need to get in with a hardware debugger to see what's going on, but I haven't had time to build the custom cable I need to use the internal debugging header. I hope to get to it sometime in the next week.

If it's of any interest, I did notice the new code and compiler seem to handle high interrupt loads better than with the 2.4 compiler. I setup my ADC code to sample at 6400Hz (each sample generates an interrupt) while generating a few hundred more interrupts/sec with a encoder. The RC had no problems sending a bunch of telemetry using printf() under the load.

-Kevin

Guy Davidson 09-01-2008 10:33

Re: New C18 3.0+ Compatible FRC Code
 
Quote:

Originally Posted by billbo911 (Post 673126)
Excellent! Got it running!!
Next question. You currently have 3 versions for 3.0: Basic, Basic + Gyro, Basic + encoders.
To add the encoders to the basic + gyro, do I just add the encoder.h/c files to the project? Then follow your instructions for adding your encoder code from an earlier build, like 2007's ifi_encoder.zip?

Although Kevin already responded, I felt I should say how I did it. I found a freeware diff utility for windows and compared the two folders, and I used that to see the changes and add one to the other. It worked pretty flawlessly and also helped me integrate the two test teleop() routines.

DemonYawgmoth 09-01-2008 11:22

Re: New C18 3.0+ Compatible FRC Code
 
Quote:

Originally Posted by Kevin Watson (Post 673005)
Yep. You can also call IFI's old default_routine(), which has been moved to ifi_code.c.

-Kevin

Awesome, thanks a lot Kevin!


All times are GMT -5. The time now is 14:27.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi