View Full Version : Max Encoder/Interrupt Frequency?
We are going to be using three encoders, two for position control (on the drive wheels) and one for speed control. We expect the motor that we need speed control on to be going a max of about 2500 RPM. We are using the 63K encoders that should handle this speed, but I'm concerned about the interrupt speed on the processor.
Are we going to overwhelm the processor? If the processor is at 10MHz, 2000RPM with a 64 PPR encoder is a little over 2100 interrupts per second. That doesn't seem to bad, but we don't have first handle knowledge like some others.
Add in some positioning encoders, and is this going to work?
Thanks for the advice.
...Duane
Matt Adams
23-01-2006, 01:42
Have you considered use of a tachometer instead?
It will provide a feedback voltage proportional to the speed. This could eliminate all your worries. :)
Matt
Eldarion
23-01-2006, 02:09
We are going to be using three encoders, two for position control (on the drive wheels) and one for speed control. We expect the motor that we need speed control on to be going a max of about 2500 RPM. We are using the 63K encoders that should handle this speed, but I'm concerned about the interrupt speed on the processor.
Are we going to overwhelm the processor? If the processor is at 10MHz, 2000RPM with a 64 PPR encoder is a little over 2100 interrupts per second. That doesn't seem to bad, but we don't have first handle knowledge like some others.
Add in some positioning encoders, and is this going to work?
Thanks for the advice.
...Duane
Why do you need 64 PPR encoders on the shooting wheel? Just use a disk with a couple of holes drilled in it and a break-beam detector.
Oh and by the way, the controller will handle a few thousand pulses per second in quadrature; that should be much higher without quadrature, as you just have to increment a counter. And I think the proccessor is running at 40MHz, not 10MHz.
Just my 2 cents... :)
Mark McLeod
23-01-2006, 09:00
We usually design for under 10,000 interrupts per second (5K last year), but we have tested with more at free wheeling speeds.
It isn't just the speed of the processor but the efficiency of your fast loop code and what else you attempt to do in there that will determine your limit. In extreme cases if your slow loop is so bloated that it pushes 26ms, then you'll be seriously impacted.
I'd measure the time of your fast loop with an internal timer or with a scope attached to a digital output that you reverse every loop. The loop times will vary based on the semi-random combinations of high/low interrupts, etc. I'd take the slowest time measured and cut that by 50% or more as a safety factor to determine your maximum acceptable interrupts per second.
If you're real ambitious you can even model the interrupts you will be adding by including some extra processing delay equivalent to the rate you choose to design for.
I'd also measure again after you implement to be sure you're still within your self imposed spec. as regards loop time.
We are going to be using three encoders, two for position control (on the drive wheels) and one for speed control. We expect the motor that we need speed control on to be going a max of about 2500 RPM. We are using the 63K encoders that should handle this speed, but I'm concerned about the interrupt speed on the processor.
Are we going to overwhelm the processor? If the processor is at 10MHz, 2000RPM with a 64 PPR encoder is a little over 2100 interrupts per second. That doesn't seem to bad, but we don't have first handle knowledge like some others.
Add in some positioning encoders, and is this going to work?
Thanks for the advice.
...Duane
This should work fine. I decided to torture-test our current software setup: Camera, Gyro, and six encoders (we won't use all of them), and some reasonably intensive trig functions. Wiring up one encoder to all six encoder channels and spinning it with a high-speed drill, the code could keep up with it until just under 1600 pulses per second. Dropping this to just the first two encoders (which don't share an interrupt line), it can do at least 6000 pulses second (as fast as my drill went). So I don't think you'll have problems.
Astronouth7303
23-01-2006, 20:43
10MHz = 10,000,000 cycles / second
40MHz * 1 instruction / 4 cycles = 10,000,000 instructions / second
I think that may be a little excessive, yes.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.