Re: Encoder velocity....
What does the value "mills" represent?
Is it the time between encoder marks?
What PIC are you using?
Does it have internal timers?
If so you could use an interrupt to start the timer at each mark on the encoder and then check the timer on the next interrupt.
or if you don't need your PIC to do something else while waiting for the next mark you could start incrementing a counter variable when you detect the first mark and then stop incrementing on the next mark and see what the value is. Or if the encoder is going to stop dead at the end of travel you could turn off the motor if the count reaches a high enough value to indicate it has stopped or slowed.
Dwight
These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.
Bookmarks