|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools |
Rating:
|
Display Modes |
|
#331
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
will the encoder code work with the US Digital E4P-250-250 encoder which is built-in on the Andy Mark Super Shifter transmission? also what kind of output should u expect from the encoder and the gyro?
|
|
#332
|
|||||
|
|||||
|
Re: New C18 3.0+ Compatible FRC Code
The E4P is a standard quadrature encoder. I can assure you that it works perfectly with Kevin's encoder library for the standard IFI code, and I have very high confidence that it will work just as perfectly with his new framework.
|
|
#333
|
|||
|
|||
|
Re: New C18 3.0+ Compatible FRC Code
Having the same problem with the new code as someone mentioned before.
When I build the project with Initialize_ADC() uncommented, it builds fine but encounters a code error. When I build the project with ENABLE_TIMER_4 defined in timers.h, the linker encounters the error: Error - symbol 'Timer_4_ISR' has multiple definitions. I have tried commenting out the definition for Timer_4_ISR() in timers.c (because it does nothing) but we get back to the code error. Also, ENABLE_TIMER_4 is defined in ifi_frc.h. Using a 2007 RC, MCC18 3.10; Thanks! -James Last edited by JHale : 31-01-2008 at 21:56. |
|
#334
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
per Kevin's read-me
2) Enable the timer 4 interrupt service routine in ifi_frc.h 3) Make sure timer 4 is disabled at the top of timers.h. |
|
#335
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
I've written replacement code for IFI's Get_Analog_Value() function. It's now included with both builds of the new code on my website. You can also just grab the files and drop then into your project.
-Kevin |
|
#336
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
So, per your documentation, to use your 'quickie' adc code, you shouldn't run them with the gyro code, right?
|
|
#337
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
-Kevin |
|
#338
|
|||
|
|||
|
Re: New C18 3.0+ Compatible FRC Code
I have gotten Timer0 to work as a clock for the code. A few misadventures (like not putting the initialize function in the Initialization.c in Teleop.c), but actually is very easy to implement in the new code with the prescaling.
I have not gotten the encoder 3 and 4 to work. no error messages, but get_encoderX_count always comes back 0. any ideas? |
|
#339
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
I'm thinking about password protecting the project zip files with a password that's something like read_the_readme.txt_file_before_doing_anything .-Kevin Last edited by Kevin Watson : 06-02-2008 at 19:55. |
|
#340
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Okay, I'm having a little more trouble... I'm trying to get some potentiometers working on our robot, so I read the readme and did everything it told me to do:
Quote:
Quote:
Quote:
Update: I may have fixed it, but I'm unsure... Instead of Get_Analog_Value(rc_ana_in01), I used Get_ADC_Result(1). Will this work? I'm not going to be able to try this on our robot until Saturday as I'm going out of town for the next 2 days. Last edited by RyanN : 06-02-2008 at 21:14. |
|
#341
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
liftpos = Get_Analog_Value(1); or liftpos = Quick_ADC(1); Of course you'd probably want to #define these values in a header file and then the code would look like this: // this goes at the top of the source file or in a header file like robot.h #define ARM_ELBOW_POT 1 // analog input one #define ARM_WRIST_POT 2 // analog input two unsigned int elbow_pot; unsigned int wrist_pot; elbow_pot = quick_adc(ARM_ELBOW_POT); wrist_pot = quick_adc(ARM_WRIST_POT); Because it's simpler, I would use quick_adc() if you're only using potentiometers on your 'bot. -Kevin |
|
#342
|
|||
|
|||
|
Re: New C18 3.0+ Compatible FRC Code
We are using Kevin's code to read the gyro and control our steering. Our steering is connected to a 10K linear pot. We are reading the pot with get_ADC_value and feeding it to a PID function. The intent is to have servo controlled steering.
We are having a lot of trouble getting the servo to respond properly. We are working on tuning our PID loop and having some success. Here is my question: We are calling the PID routine in Default_Routine so it executes very 26.2 ms. Should we be calling it in a fast loop? |
|
#343
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Thanks again for the help. I found out why the quick_adc.c and quick_adc.h were not working... Even though I said add files to project, it never did copy them to the project folder, like I expected it would... Still getting used to MPLAB. It compiled without any error (just the way I like it
) and I'm going to try it out hopefully Saturday. |
|
#344
|
|||
|
|||
|
Re: New C18 3.0+ Compatible FRC Code
We had the enables in the IFI_FRC.h. The problem was in the format of the print statement (note to others- output from encoders is a long integer). The encoders were working just fine. Sometimes it really is just dumb stuff. (Thank you Kevin for being patient)
|
|
#345
|
|||
|
|||
|
Re: New C18 3.0+ Compatible FRC Code
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 ?? |
![]() |
| 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 |