Go to Post Inspiration is created by a vision and is reinforced with success. - rourke [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
  #331   Spotlight this post!  
Unread 30-01-2008, 23:24
SuspectZero's Avatar
SuspectZero SuspectZero is offline
2254 Team President
FRC #2254 (Twisted Transistors)
Team Role: Leadership
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Mississauga, Ontario
Posts: 16
SuspectZero is an unknown quantity at this point
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?
__________________

Team 2254: Twisted Transistors
2007 FRC: Placed 18th in Regionals
2008 FRC: TBD
  #332   Spotlight this post!  
Unread 31-01-2008, 00:24
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: New C18 3.0+ Compatible FRC Code

Quote:
Originally Posted by SuspectZero View Post
will the encoder code work with the US Digital E4P-250-250 encoder which is built-in on the Andy Mark Super Shifter transmission?
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   Spotlight this post!  
Unread 31-01-2008, 21:52
JHale JHale is offline
Registered User
no team
 
Join Date: Feb 2007
Rookie Year: 2008
Location: Nowhere
Posts: 14
JHale is an unknown quantity at this point
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   Spotlight this post!  
Unread 31-01-2008, 22:48
Jon236's Avatar
Jon236 Jon236 is offline
Registered User
AKA: Jon Mittelman
FRC #2648 (Infinite Loop)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2000
Location: Windsor, Maine
Posts: 741
Jon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond repute
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.
__________________
Jon Mittelman

Senior Judge Advisor New England & Israel 2014-2015
Infinite Loop Mentor 2011-2015
TechnoTicks Mentor 2000-2011
Championship Chairman's Award 2009 Team236 TechnoTicks
Judge 2010-2015 Championships
Senior Judge Advisor New England District Championship 2014-2015
Judge Advisor Tel Aviv Regional 2007-2015
Judge Advisor Pine Tree Regional 2013
Maine Regional Planning Committee
New England District Planning Committee
Lead Inspector Microsoft Tel Aviv Regional 2006-2008
Judge & Lead Inspector GM/Technion Tel Aviv Regional 2006
Judge UTC Hartford Regional 2006
  #335   Spotlight this post!  
Unread 03-02-2008, 12:38
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

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
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #336   Spotlight this post!  
Unread 03-02-2008, 14:06
Jon236's Avatar
Jon236 Jon236 is offline
Registered User
AKA: Jon Mittelman
FRC #2648 (Infinite Loop)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2000
Location: Windsor, Maine
Posts: 741
Jon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond repute
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?
__________________
Jon Mittelman

Senior Judge Advisor New England & Israel 2014-2015
Infinite Loop Mentor 2011-2015
TechnoTicks Mentor 2000-2011
Championship Chairman's Award 2009 Team236 TechnoTicks
Judge 2010-2015 Championships
Senior Judge Advisor New England District Championship 2014-2015
Judge Advisor Tel Aviv Regional 2007-2015
Judge Advisor Pine Tree Regional 2013
Maine Regional Planning Committee
New England District Planning Committee
Lead Inspector Microsoft Tel Aviv Regional 2006-2008
Judge & Lead Inspector GM/Technion Tel Aviv Regional 2006
Judge UTC Hartford Regional 2006
  #337   Spotlight this post!  
Unread 03-02-2008, 14:21
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 Jon236 View Post
So, per your documentation, to use your 'quickie' adc code, you shouldn't run them with the gyro code, right?
No, you shouldn't as they'll interfere with each other. You can always just increase the number of analog channels sampled by the adc.c code when using the gyro.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #338   Spotlight this post!  
Unread 06-02-2008, 19:18
Code Monkey Code Monkey is offline
Registered User
FRC #1622
 
Join Date: Dec 2007
Location: San Diego
Posts: 10
Code Monkey is an unknown quantity at this point
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   Spotlight this post!  
Unread 06-02-2008, 19:52
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 Code Monkey View Post
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?
If it builds with no error messages it's probably because you didn't enable the call to the encoder ISRs at the top of ifi_frc.h.

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
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org

Last edited by Kevin Watson : 06-02-2008 at 19:55.
  #340   Spotlight this post!  
Unread 06-02-2008, 20:43
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
no team
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Austin, TX
Posts: 1,128
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
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:
My comments are in all capitals.
FROM README.TXT

By default the analog to digital and gyro software is disabled.
Perform these steps to get your gyro working:

1) Enable the Initialize_ADC() and Initialize_Gyro() functions in
teleop.c/Initialization(). CHECK, REMOVED THE // BEFORE INITIALIZE_ADC(), LEFT THE GYRO ALONE
2) Enable the timer 4 interrupt service routine in ifi_frc.h CHECK
3) Make sure timer 4 is disabled at the top of timers.h. CHECK, THE // WERE ALREADY THERE, NO CHANGE
4) Depending on the operating modes you will be using the gyro,
place calls to the Process_Gyro_Data() function in the disabled.c/
Disabled_Spin(), autonomous.c/Autonomous_Spin() and/or teleop.c/
Teleop_Spin() functions. DID NOT DO, NOT USING GYRO
5) Add gyro bias calibration code that will execute before you
use your gyro. Example calibration code has been placed in
disabled.c/Disabled() that can be used for the competition (this
requires that you use a mode dongle to emulate the field
controller, which will put you in disabled mode for a period of
time before transitioning to autonomous mode). For testing
purposes you can also use the example code in teleop.c/Teleop()
to make sure your gyro is working. DID NOT DO, NOT USING GYRO
6) Follow the instructions in adc_readme.txt, adc.h, gyro_readme.txt,
and gyro.h for information related to installation and calibration
of your gyro. CHECK, SEE BELOW

FROM ADC_README:

Usage notes:

1) A #include statement for the adc.h header file must be
included at the beginning of each source file that calls the
functions in adc.c. The statement should look like this:
#include "adc.h". ALREADY INCLUDED IN TELEOP.C, CHECK

2) Define the number of analog channels that you'd like this
software to track by opening adc.h and following the embedded
instructions above #define NUM_ADC_CHANNELS. CHANGED THE NUMBER FROM 1 TO 2 SINCE WE'RE USING 2 POTENTIOMETERS, CHECK

3) For advanced users, analog channels can be oversampled to
decrease noise and gain resolution in your analog measurements.
The oversampling ratio can be changed from the default x4
by commenting-out the line #define ADC_SAMPLES_PER_UPDATE_4
found in adc.h and then removing the // from in front of one
of the other options. Measurement range and resolution can be
determined from this table: I'M NOT ADVANCED, SO I LEFT THIS ALONE

ADC Samples Effective
Averaged Bits of Measurement Voltage
Per Update Resolution Range Per Bit
___________ __________ ___________ _________
1 10 0-1023 4.88 mV
2 10 0-1023 4.88 mV
4 11 0-2047 2.44 mV
8 11 0-2047 2.44 mV
16 12 0-4095 1.22 mV
32 12 0-4095 1.22 mV
64 13 0-8191 610 uV
128 13 0-8191 610 uV
256 14 0-16383 305 uV


4) Finally, pick the master sample rate by selecting one
of the available rates found in adc.h. The update rate can
be determined using this formula:

Update Rate =
Sample Rate / (Samples Per Update * Number Of Channels)
LOOKS LIKE YOU HAVE ALREADY DONE THIS USING THIS FORMULA, CHECK
I think I have done everything I needed to do, but when I try to build, it says
Quote:
C:\Robot Code\2008\ifi_frc_sensor_30\teleop.c:256:Error [1105] symbol 'ADC_CH0' has not been defined
Here is where it is saying this...
Quote:
liftpos = Get_Analog_Value(rc_ana_in01);
I also tried the quick_adc, but I was having trouble, so I went back to this...

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.
__________________
Taking a break from mentoring for a few years. (Is that allowed?!?)

Controls Mentor
@rnazaretian

Previous teams:
Team Fusion, FRC 364
Garnet Squadron, FRC 4901

Last edited by RyanN : 06-02-2008 at 21:14.
  #341   Spotlight this post!  
Unread 06-02-2008, 21:16
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 RyanN View Post
I also tried the quick_adc, but I was having trouble, so I went back to this...
You just use a number from 1 to 16 to select the ADC channel. As an example:

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
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #342   Spotlight this post!  
Unread 06-02-2008, 21:53
emersont49 emersont49 is offline
Mentor
#1098
 
Join Date: Sep 2004
Location: Fenton, Missouri
Posts: 34
emersont49 is a glorious beacon of lightemersont49 is a glorious beacon of lightemersont49 is a glorious beacon of lightemersont49 is a glorious beacon of lightemersont49 is a glorious beacon of lightemersont49 is a glorious beacon of light
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?
__________________
Tim Emerson
  #343   Spotlight this post!  
Unread 06-02-2008, 22:21
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
no team
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Austin, TX
Posts: 1,128
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
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.
__________________
Taking a break from mentoring for a few years. (Is that allowed?!?)

Controls Mentor
@rnazaretian

Previous teams:
Team Fusion, FRC 364
Garnet Squadron, FRC 4901
  #344   Spotlight this post!  
Unread 07-02-2008, 14:24
Code Monkey Code Monkey is offline
Registered User
FRC #1622
 
Join Date: Dec 2007
Location: San Diego
Posts: 10
Code Monkey is an unknown quantity at this point
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   Spotlight this post!  
Unread 08-02-2008, 01:12
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

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

??
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:49.

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