Go to Post User error is not the manufacturer's fault. - AdamHeard [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 Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 09-10-2006, 14:53
cprogrammer's Avatar
cprogrammer cprogrammer is offline
Registered User
FRC #1595 (Gremlins)
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 2005
Location: Washington
Posts: 42
cprogrammer will become famous soon enoughcprogrammer will become famous soon enough
Interupts/sec

I am looking at putting encoders on the robot next year. The main question I am wondering is what is the maximum interrupts per sec the encoder.c can handel.
  #2   Spotlight this post!  
Unread 09-10-2006, 15:02
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,186
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: Interupts/sec

It's all relative to what you are doing. Encoder.c isnt actually doing much work except for initializing the interrupt to detect on a rising edge and holding the interrupt handler. It really all depends on what else you are doing in the code. If you are running default code, you will be able to service more interrupts without over budgeting your time period to report back to the master processor. Likewise, if your code is fairly complex your ability to service a ton of interrupts will be brought down. We ran into this problem last year with encoder interrupts, serial interrupts, and a full field navigation system running on the RC at all times. We ended up putting a switch on the robot to turn serial on and off because our robot would reset about 5 times per match.

I guess think of it as a pizza. Half of the pizza's toppings can be interrupts, half can be regular routines. You don't have to eat the whole pizza (processing time), but you certainly can't eat more than you have been given.
  #3   Spotlight this post!  
Unread 09-10-2006, 15:39
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,673
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
Re: Interupts/sec

Also remember that the tighter your interrupt handler and other code is, the more interrupts you'll be able to handle. If you're only using Encoder 1 and 2, you can excise all the code for Encoders 3-6 and save yourself 5 branches and a bit of extra code in the interrupt handler. Ditto the serial ports. Basically, dump anything in your code that's not serving any purpose.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
  #4   Spotlight this post!  
Unread 09-10-2006, 16:19
Matt Krass's Avatar
Matt Krass Matt Krass is offline
"Old" and Cranky. Get off my lawn!
AKA: Dark Ages
FRC #0263 (Sachem Aftershock)
Team Role: Mentor
 
Join Date: Oct 2002
Rookie Year: 2002
Location: Long Island, NY
Posts: 1,187
Matt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond repute
Send a message via AIM to Matt Krass
Re: Interupts/sec

Quote:
Originally Posted by Kevin Sevcik
Also remember that the tighter your interrupt handler and other code is, the more interrupts you'll be able to handle. If you're only using Encoder 1 and 2, you can excise all the code for Encoders 3-6 and save yourself 5 branches and a bit of extra code in the interrupt handler. Ditto the serial ports. Basically, dump anything in your code that's not serving any purpose.
And by dump he means comment out in case you end up needng it later. For stuff thats going to be perma-commented I like to use #ifdefs

Code:
#ifdef IWANTINT3TO6
...interrupt 3-6 and such code...
#endif
So now later if you want to enable them, at the top of your file, just put
Code:
#define IWANTINT3TO6
I find it useful to convert the default code in to a series of modules that can be 'enabled' by #define's.
__________________
Matt Krass
If I suggest something to try and fix a problem, and you don't understand what I mean, please PM me!

I'm a FIRST relic of sorts, I remember when we used PBASIC and we got CH Flightsticks in the KoP. In my day we didn't have motorized carts, we pushed our robots uphill, both ways! (Houston 2003!)
  #5   Spotlight this post!  
Unread 09-10-2006, 19:38
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,673
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
Re: Interupts/sec

Matt,

Kevin already has most of his code disabled with #ifdef's. It's just trickier to get rid of all the if-elses that way, and you have to make sure you don't accidentally enable those interrupts elsewhere and...

Sometimes it's easier to just decide what you need from the beginning, and really mean it, rather than to have snippets of possibly, maybe useful commented-out code everywhere in your program that do nothing but get in the way and confuse the syntax highlighter. I always advise the programming team to get rid of the vast majority of the default code and its default port mappings, if only to prevent odd things from happening when a PWM cable is plugged in the wrong place.

I'm sure keeping code makes sense when you're first developing your program, but you really should be able to pare things down to what you're actually using for competition code. Unless of course your game plan is to integrate 2 wheel encoders for navigation into your robot on practice day.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
  #6   Spotlight this post!  
Unread 09-10-2006, 19:48
AdamHeard's Avatar
AdamHeard AdamHeard is offline
Lead Mentor
FRC #0973 (Greybots)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2004
Location: Atascadero
Posts: 5,506
AdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond repute
Send a message via AIM to AdamHeard
Re: Interupts/sec

Quote:
Originally Posted by Kevin Sevcik
Matt,

Kevin already has most of his code disabled with #ifdef's. It's just trickier to get rid of all the if-elses that way, and you have to make sure you don't accidentally enable those interrupts elsewhere and...

Sometimes it's easier to just decide what you need from the beginning, and really mean it, rather than to have snippets of possibly, maybe useful commented-out code everywhere in your program that do nothing but get in the way and confuse the syntax highlighter. I always advise the programming team to get rid of the vast majority of the default code and its default port mappings, if only to prevent odd things from happening when a PWM cable is plugged in the wrong place.

I'm sure keeping code makes sense when you're first developing your program, but you really should be able to pare things down to what you're actually using for competition code. Unless of course your game plan is to integrate 2 wheel encoders for navigation into your robot on practice day.
We do things similarly. We keep things commented like he mentioned, but when it comes close to the final code we start to get rid of all of those things.
  #7   Spotlight this post!  
Unread 09-10-2006, 21:35
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: Interupts/sec

Heck I mean I used an 18F series part similar to the one in the first controller to run two stepper motors independently at different speeds up to 12.5KHz... granted I used the ECCP3 and ECCP2 peripherals on-chip.

Need any help, just hit me up.

-Q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
  #8   Spotlight this post!  
Unread 11-10-2006, 13:54
yongkimleng yongkimleng is offline
deus ex programmeur
AKA: James Yong
FTC #0747
Team Role: Mentor
 
Join Date: Aug 2006
Rookie Year: 2004
Location: Singapore, West
Posts: 134
yongkimleng is a jewel in the roughyongkimleng is a jewel in the roughyongkimleng is a jewel in the rough
Send a message via MSN to yongkimleng
Re: Interupts/sec

Quote:
Originally Posted by Qbranch
Heck I mean I used an 18F series part similar to the one in the first controller to run two stepper motors independently at different speeds up to 12.5KHz... granted I used the ECCP3 and ECCP2 peripherals on-chip.

Need any help, just hit me up.

-Q
been reading alot of datasheet.. but i was wondring, what ARE ECCP/CPP ports for? tried to understand and read that ECCP can do things like H-bridge motor controller..
__________________
| jamesyong.net |
FVC2007, FTC2008
  #9   Spotlight this post!  
Unread 12-10-2006, 12:46
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: Interupts/sec

ECCP/CCP means Capture/Compare, the pins are triggers off the compares. They are only active if you set them up the right way.

You can use these to create very very accurate frequencies, and can set up to trigger off of a falling edge to create duty cycles. Just read some app notes and the manual, I think you'll understand it. Took me a while, but now that I know, I don't think i'll ever go back to overflow timers again.

With the ECCPs i've made a two axis motion controller based on the 18F8722, while also doing guidance as well as motivation. Once the die issues are fixed this winter, the 8722's HPC Explorer will be my favorite development board to run robots off of.

-Q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
  #10   Spotlight this post!  
Unread 10-10-2006, 22:41
duane's Avatar
duane duane is offline
Registered User
FRC #0701 (RoboVikes)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2003
Location: Vacaville
Posts: 98
duane is an unknown quantity at this point
Send a message via AIM to duane
Re: Interupts/sec

Quote:
Originally Posted by cromat44
We do things similarly. We keep things commented like he mentioned, but when it comes close to the final code we start to get rid of all of those things.
This is also what a source code control system is for. An SCCS system like subversion let's you check-in changes to your code as you go. This records the history of your changes as you go along. This allows you to go back to previous versions and see what was changed so you can bring back those things you really didn't mean to remove.

...Duane
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
Interupts on Vex in MPLab Andrew Schreiber FIRST Tech Challenge 1 24-05-2006 08:32
Interupts on the Pic18 Andrew Schreiber Programming 10 21-01-2006 22:54
Interupts? Validius Programming 6 11-01-2006 18:29
10 FT/SEC Limit matt111 Rumor Mill 3 09-01-2004 17:16
10 sec Human Player Question? BBFIRSTCHICK Rules/Strategy 14 05-01-2003 11:26


All times are GMT -5. The time now is 01:31.

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