View Single Post
  #5   Spotlight this post!  
Unread 17-01-2005, 21:56
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: Code violation

Quote:
Originally Posted by Mike Betts
Pickle,


Use the Hall sensor as a digital input and interrupt on the rising edge.

I strongly suggest that you use Kevin Watson's RC encoder example as a guide. Just eliminate the part where he looks at the quadrature input to determine direction.
Instead of looking at the encoder phase-b signal, you could look at the motor's commanded direction and increment/decrement the counters as necessary. One problem that comes to mind, though, is what is sometimes the robot won't have a commanded direction when the interrupt fires off. You may be able to get around this by keeping track of the last commanded direction in a state variable.

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