View Single Post
  #6   Spotlight this post!  
Unread 31-01-2005, 17:06
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Kevin's Navigation Script Working for Your Team?

Quote:
Originally Posted by cabbagekid2
Would changing the code to make the encoders interrupt on both a change in A or B fix this problem? Or would this cause the microcontroller to interrupt too often?
Two things than can easily be done are: 1) Capture the state of the phase-B signal earlier in the ISR, and 2) use a D-type flip-flop to capture the state of the phase-B signal as the phase-A signal transitions from low to high. You can do this by wiring the phase-A signal to the flip-flop's clock input and to the interrupt input. Wire the phase-B signal to the flip-flop's D input and connect the flip-flop's Q output to the phase-B input on the robot controller. Option one will get you perhaps an extra microsecond or two. Option two will give you a much more significant increase.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org