Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Interrupts per second (http://www.chiefdelphi.com/forums/showthread.php?t=60015)

RyanCahoon 11-12-2007 04:58

Interrupts per second
 
Hello everyone,

I've been looking around the forums and have seen several posts but I haven't seen a definite answer. My team is designing a robot and we want to put encoders on it. Questions arose concerning the fact that encoders we have are 100 clicks/revolution, and we are planning on having the wheels turning at .7 - 1 rev/second, meaning 700 to 1000 clicks per second of the encoders * 2 sides. We were wondering, can the RC handle 2000 interrupts a second, in addition to whatever it takes to run the camera and essentially the default code?

Thanks,
--Ryan

Mike Betts 11-12-2007 07:22

Re: Interrupts per second
 
Ryan,

It all depends on how many (and which kind of) instructions are being executed in the interrupt.

Here is a good discussion on the time required to service the interrupt before your code even gets to run.

In general, keep the code short and 2000 interrupts per second should not be an issue.

Mike

tseres 11-12-2007 08:24

Re: Interrupts per second
 
it should be fine, but if it isn't, banebots (just google it) has an encoder click reducer

Kevin Sevcik 11-12-2007 09:50

Re: Interrupts per second
 
Just remember that 2000 interrupts per second is going to start running the risk of stretching PWM pulses on PWM13-16 if you're using the standard IFI Generate_PWMs() code. If you have any interest in using these PWMs, you'll probably want to transition to the CCP-based PWM generation code on Kevin Watson's site.

RyanCahoon 11-12-2007 14:19

Re: Interrupts per second
 
We're not using PWM13-16 and it's just going to be a counter on the encoder interrupts so it sounds like it will work. Thanks for the help!

--Ryan

artdutra04 12-12-2007 00:57

Re: Interrupts per second
 
If you are worried about processor overload from using too many interrupts in your program, you can also gear the encoders slower so you'll have less pulses per second. You'll start losing accuracy, but if you gear them slower by a 3:1 reduction you'll still have 33.3 pulses per revolution.

On a six inch wheel, that's an accuracy of about 0.56 inches per pulse. This should be more than sufficient for drive train applications, since that's within the tolerances of a FIRST playing field.


All times are GMT -5. The time now is 07:02.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi