View Single Post
  #6   Spotlight this post!  
Unread 20-07-2007, 11:11
John Gutmann John Gutmann is offline
I'm right here
AKA: sparksandtabs
FRC #0340 (GRR)
Team Role: Mechanical
 
Join Date: Feb 2005
Rookie Year: 2004
Location: rochester
Posts: 804
John Gutmann has a brilliant futureJohn Gutmann has a brilliant futureJohn Gutmann has a brilliant futureJohn Gutmann has a brilliant futureJohn Gutmann has a brilliant futureJohn Gutmann has a brilliant futureJohn Gutmann has a brilliant futureJohn Gutmann has a brilliant futureJohn Gutmann has a brilliant futureJohn Gutmann has a brilliant futureJohn Gutmann has a brilliant future
Send a message via AIM to John Gutmann Send a message via MSN to John Gutmann Send a message via Yahoo to John Gutmann
Re: Gear encoder code

Perhaps you should be asking for the theory so you can write your own code and learn more. But Since I am a nice guy who has some time on his hands I will spoon feed it to you.

Basically what you want to do with the GTS is either sense your speed or your relative movement.

Go look at the data sheet for the robot controller and see which pin is the external interrupt, you will hook the signal pin of the GTS to that. Now what happens with the GTS is any time the gear tooth comes within range of the GTS the magnetic field changes and the sensors lets you read that change as a binary 1 or 0. ( I don't know all the specifics, I have never actually used one). The interrupt pin of the robot controller when triggered litterally interrupts the code to enter into a interupt service routine. Inside the interrupt service routine you need to have as little code as possible so not to bog down your processor. When I code something like this all I put in the ISR (interupt service routine) is an increment statement. Then in the main loop I put the code to manipulate the incremented variable. By manipulate I mean measure time between increments, # of increments, distance calculations, etc. This is the exact same process I use for an encoder. The 2 are basically the same when it comes to programming.

Just tell me if I left anything out.

-John