View Single Post
  #10   Spotlight this post!  
Unread 03-05-2008, 18:43
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is online now
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,721
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: Automatic counter-Encoder

Quote:
Originally Posted by Phalanx View Post
If you want to avoid using interrupts, you could place Kevin Sevcik's code sample in Process_Data_From_Local_IO() within user_routines_fast(). It may give you more accurate readings if you really need that.

I've never had any issue with any mechanical switch generating spurious interrupts, but that has only been my experience. I find with higher quality components that becomes less an issue.
Mechanical switches are pretty notorious for bouncing, but typically under light switching force, so the contacts only slowly make contact and the resistance of the connection fluctuates a bit. You can account for this with some debounce logic in the fast loop as well, by checking to make sure the last two or three samples of the input are the same.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter