|
|
|
#1
|
||||
|
||||
|
New C18 3.0+ Compatible FRC Code
I've created C18 3.0+ compatible code and libraries for the IFI FRC robot controller. At this point the code is pretty solid and free of bugs. If interested, the code can be found here:
http://kevin.org/frc Remember this is experimental code, so please do me (and everyone else who might use this code) a favor and let me know if you run into any bugs. Thanks. 1/6/08 Edit: You need MPLAB 7.21 or greater to use the 3.0+ compiler. You can download the latest version here: http://www.microchip.com/stellent/id...&part=SW007002 The student and upgrade versions of C18 3.10 (don't use 3.15) are here: http://www.microchip.com/stellent/id...&part=SW006011 -Kevin Last edited by Kevin Watson : 20-01-2008 at 00:00. |
|
#2
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Kevin,
I like the layout....a lot cleaner than the present code template. Had a little problem compiling: Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8722 "ifi_frc.c" -fo="ifi_frc.o" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa- C:\dev\ifi_frc_beta\ifi_frc.c:249:Warning [2002] unknown pragma 'tmpdata' C:\dev\ifi_frc_beta\ifi_frc.c:250:Error [1020] unexpected input following 'interrupt' C:\dev\ifi_frc_beta\ifi_frc.c:357:Warning [2002] unknown pragma 'tmpdata' Suggestions? |
|
#3
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
I do like the layout better than the code from years past. A little less cryptic in function definitions, and file names. Although I do not know what the Disable_spin(), Autonomous_Spin(), and Teleop_Spin() are and what they would be used for.
Are their equivalents be Process_Data_From_Local_IO() just split up into different places?? Also I do like the addition of the check of the state to reset the outputs. Shouldn't this stop situations where you can only get one autonomous run from each hard reset? I cannot confirm or deny any bugs on a compile. I have neither mplab nor mcc18 and only have a mac ![]() |
|
#4
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
Quote:
-Kevin |
|
#5
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Is there any advantage to using the 3.0+ compiler?
|
|
#6
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Kevin,
I really like the structure of this code. It is MUCH cleaner and easier to follow. It will definitely help in teaching our newer programmers how to code specifically for FRC. I really like the use of the *_Spin functions. They make following and understanding the code and how it operates much easier, not only for new programmers, but also for relative Noobs to coding, like myself. I see you are also taking advantage of the 3.0+ interrupt optimization capabilities. As we write ISR's will it be necessary to modify the way you are excluding the ".tmpdata" Code:
"#pragma tmpdata low_isr_tmpdata
#pragma interruptlow Interrupt_Handler_Low nosave=section(".tmpdata")"
PS. I am really interested in making this code work with Vex if possible. I know this is a ways down the road, but it looks like it may just work. I'll keep you posted. I will wait to start down that road until the issues you pointed out are cleaned up first. Last edited by billbo911 : 26-12-2007 at 14:32. |
|
#7
|
|||
|
|||
|
Re: New C18 3.0+ Compatible FRC Code
Thanks Kevin! The code is much cleaner and better documented than what ifi gives. The interrupts setup will be a great help to a lot of teams I am sure.
BTW, I have an updated version of my makefile to build this code if anyone is interested. http://team997.org/files/software/Makefile_ifi_frc |
|
#8
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Overall I really like to layout of the code. It looks a lot more intuitive than the IFI stuff.
I really like that the serial port, interrupts, timers, and PWMs, are already intgrated. That should save some time during the season. The only issue I've got is the x_Spin functions. It seems to me that most of the code that I would run there would be the same regardless of the current mode. I believe that I would modify it to call just one function, and use the mode flags to change the few things that are different. EDIT: I haven't compiled it yet, since I don't want to mess up my main dev box. Tonight I'm going to setup a VM with c18 3.15. I'll post if I have any issues then. Last edited by EHaskins : 26-12-2007 at 15:07. |
|
#9
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
The more I read this code, the better I like it. I see you have included many of your "updated" functions as part of the base code. Thank you!!
I did note a couple things that may be a problem, but I am not certain because I am no expert when it comes to coding. I noticed a couple "#include" statement for files that do not exist. For example, in "ifi_code.c" is a call to include "adc.h" and <delay.h>. I'm not clear on the differences when the "<xxxx>" is used, but it sure would be nice to have your "adc" code included. Just my $.02 |
|
#10
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
I'm sure I'm just being stupid or something like that, but whenever I try to open the workspace I get a "Unable to open the workspace because the format of the workspace file has changed" error followed by "A lock violation has occurred". I can open the individual *.c and *.h files just fine.
Anyway, I've only just started looking through this and it already looks awesome! I really like the timer setup and interrupt handling setup. Last year I did some interrupt and timer stuff and it could get rather confusing; this will be great for our new, inexperienced programmers to get into interrupts without quite as much trouble. It is almost like if you took the logical layout and ease of coding interrupts from WPIlib and combined them with the lower level control of IFI's code. Great work, Kevin! |
|
#11
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
I just setup a clean virtual machine with Windows XP Professional sp2. I ran Windows Update, installed MPLab 8.0, and installed C18 3.15 Student Edition.
Here are the errors I'm getting: MPLAB C18 v3.15 (demo) Copyright 1999-2005 Microchip Technology Inc. Days remaining until demo becomes feature limited: 60 C:\Documents and Settings\Eric Haskins\Desktop\ifi_frc_beta\ifi_frc_beta\ifi_code .c:31:Error [1105] symbol 'ADC_VREFPLUS_VDD' has not been defined C:\Documents and Settings\Eric Haskins\Desktop\ifi_frc_beta\ifi_frc_beta\ifi_code .c:31:Error [1105] symbol 'ADC_VREFMINUS_VSS' has not been defined Halting build on first failure as requested. BUILD FAILED: Wed Dec 26 19:25:06 2007 What did I forget? EDIT: I moved it to a shallower directory, but it still returns that error. EDIT: I uploaded a file with the output from the compiler. Last edited by EHaskins : 26-12-2007 at 20:47. |
|
#12
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
Honestly, I don't think you did anything wrong. I believe a file or two were left out of the zip. If you'll notice, at the top of ifi_code.c is a "#include adc.h", that file is not included in the .zip. |
|
#13
|
||||||
|
||||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
C:MCC18\h for Include Path C:MCC18\lib for Library Path |
|
#14
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
You forgot to read the readme.txt file
.Microchip messed up the adc.h file in the latest release. Either fall back to 3.10 (using the handy link I provided above) or just comment out the offending code as it is not needed and I will be replacing it in the near future anyway. -Kevin |
|
#15
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
-Kevin |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |