View Single Post
  #6   Spotlight this post!  
Unread 28-01-2007, 18:11
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: Determining pulse width for the GTS?

Quote:
Originally Posted by Uberbots View Post
im pretty sure that this is a fairly simple topic... but i cant figure it out.
What i am looking at is Kevin's encoder code and trying to determine the interrupt routines i would need to measure a pulse width from the Gear Tooth Sensor. This is kind of important because i need to know direction, and looking at the specs for the GTS i can see that a CW tick has a pulse width of 45 us, and CCW has 90 us.

I know how i would detect a tick, but how would i detect the pulse width?
Well, I have good news and I have bad news. Being a glass half-full kinda guy, good news first: I wrote some code last year to do exactly what you describe. Here's a link: http://kevin.org/frc/gts.zip. The bad news is that capturing both edges of the shorter pulse is pretty hard considering the amount of interrupt latency involved. I suspect that you could modify the code to infer that the shorter pulse occured, you just won't be able to measure it.

Quote:
Originally Posted by Uberbots View Post
EDIT: some new realizations by me tell me that the PWM pins can be configured as inputs for measuring signals like this...
Yeah, CCP capture mode would work well, but unfortuanetly the FRC robot controller has non-defeatable output buffers on those pins. If you have a EDU-RC around, PWM 1 through 4 can be configured as an input and map to CCP pins.

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