|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools |
Rating:
|
Display Modes |
|
#301
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Julan,
Did you define the number of channels in the adc.h file? Kevin, The code runs fine if called ifi_frc.hex.....if I change the project in the same subdirectory with all the same files, I get a stuck programming mode light. So I won't every change the name, but I'd still like to know why this hapens!! Jon |
|
#302
|
|||
|
|||
|
Re: New C18 3.0+ Compatible FRC Code
Yes I Did
|
|
#303
|
|||
|
|||
|
Variables Change randomly
PLEASE I CANNOT TAKE THIS ANYMORE
Any functions I create return seemingly random numbers for example I put the function unsigned int Motor_Limit (int motor) { static unsigned int lmnewmotor; if(motor >= 254) { lmnewmotor = 254; } if(motor <= 0) { lmnewmotor = 0; } } In ifi_code.c and a prototype in ifi_code.h. I call it with motor1 = Motor_Limit((int) motor1); where motor1 is a pwm value that may be invalid. IT ALWAYS RETURNS 1919!!!! WHYYYYYYYYYY Is this a bug, I have the sensors version and kevin's site said that it was relatively bug free. We have a demo tomorrow and whenever I try to run my code the robot goes int a spasm. |
|
#304
|
|||||
|
|||||
|
Re: Variables Change randomly
How do you know what the return value is? I once spent hours trying to debug a routine that seemed to be returning the wrong value, only to discover that the error was in the line of code that prints the value.
But upon further inspection, the problem with your code is rather obvious to someone who hasn't been staring at it for hours. You merely forgot to return the newly computed value. ![]() Last edited by Alan Anderson : 26-01-2008 at 20:07. |
|
#305
|
|||
|
|||
|
I cannot adequately express my frustration with myself and the people here who I asked to check this for error. Thank you for pointing out that I DIDNT HAVE IT RETURN ANYTHING AAAAAAAAAAAAA
![]() |
|
#306
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
I looked at the link that was provided for a version of C18 other than 3.15 but couldn't find it. Can someone point to me where it is? >.< Any help appreciated.
-- Hank |
|
#307
|
||||||
|
||||||
|
Re: New C18 3.0+ Compatible FRC Code
The link in the first post for C18 has both 3.10 and 3.15.
|
|
#308
|
||||||
|
||||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
|
|
#309
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
Okay, so yesterday I modified the code to gain more headroom (ADXRS150 w/ default settings rolls over in just over five revolutions) and implemented a scheme where complete revolutions are detected, counted, and then subtracted from the total angle. In this way the number of revolutions is accounted for separately from the angle. The downside is that the code is somewhat bloated and convoluted. I guess I'd like to keep the status quo with additonal headroom and dump the loop counting code, but I'd like to get some feedback on what teams want. -Kevin |
|
#310
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
As for feedback; Honestly, currently we don't have a need to keep track of heading for up to five revolutions. In fact, this year we will really only be expecting the code to track up to one and a half revolutions. So, as it is now, it will work just fine. On another note, I am curious as to the outcome of the question/observation PhilBot had when he posted this" Quote:
|
|
#311
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
return((int)(((((long)gyro_rate * GYRO_SENSITIVITY * 5L) / ADC_RANGE)) * GYRO_CAL_FACTOR)); -Kevin |
|
#312
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
Thanks again Kevin. Your work is appreciated more than I can express. Last edited by billbo911 : 27-01-2008 at 23:37. |
|
#313
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
And here is some code to remap gyro values to the standard format
rev = temp_gyro_angle/3600; if (temp_gyro_angle < 0) { gyro = temp_gyro_angle - (3600*(rev)); if (gyro < 1800) { gyro+= 3600; } } if (temp_gyro_angle > 0) { gyro = temp_gyro_angle - (3600*(rev)); if (gyro > 1800) { gyro-= 3600; } } if (gyro > 1800) { gyro -= 3600; } |
|
#314
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
We are trying to compile and down load the base 3.0 code using MPLab IDE 7.62 and the Upgrade version of C18 compiler to 3.10. We tried downloading to the 2006 and 2007 controllers (8722). However, we are getting a code error and the program light is flashing rapidly.
My question is a) can the 3.0 code work in the 2006/2007 controllers? If so, then what other situation may cause the program error to light and program light to blink rapidly? Edited: Found the problem. I had forgotten to uncomment the defines in ifi_frc.h; but I had uncommented everything else in the rest of the code. No error messages during the build, but immediately after the the download the controller was crashing. Also, Kevin, thanks for the great work on the code this year. D. Sean Kelly Toltechs #499 MPLab IDE 7.62 C18-Compiler 3.10 Last edited by TimeOut : 28-01-2008 at 21:27. |
|
#315
|
|||
|
|||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
I'd like to add my thanks for the great work on the new framework. We use the 8520 for small groups prototyping code. I know you are working on a set of code that will work for all controllers, but I was wondering if the message you have in adc.c: * This version will only work with PIC18F8722 based robot * controllers. You should use version 0.3 of this software * with a PIC18F8520 based robot controller. is still valid. And if so, how would I go about getting version 0.3 of the adc.[ch]? Thanks! |
![]() |
| 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 |