Go to Post Personally, I'm really not jealous of any good team in FIRST. I'm happy for them, and take a page out of their books to see how we can better impact our students in the future. - waialua359 [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Spotlight this post!  
Unread 15-01-2006, 13:43
Joe Hershberger Joe Hershberger is offline
National Instruments
AKA: jhersh
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 1997
Location: Austin, TX
Posts: 148
Joe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to all
Lightbulb Re: Gear tooth sensor vs. Optical Encoders

Quote:
Originally Posted by Avarik
Alright, thanks! That was very helpful.

I set these sensors up with interrupts, right? Or is that not possible with the analog inputs..?

And can someone point me to the documentation please?
The interrupts on the analog inputs only tells you when the analog conversion is complete. That will not help you for measuring the GTS.

You want to use an External Interrupt. Several of the digital lines are wired to external interrupts on the user processor. When you configure these interrupts, you specify which edge you want to be active. If you leave this configuration alone, then you will receive one interrupt for each pulse and you can measure the speed from the GTS with a timer.

If you are interested in measuring the direction as well, you can add an instruction in your Interrupt Service Routine (ISR) to switch the active edge. This way when the signal changes again, you will get another interrupt. In this case, you will get 2 interrupts per pulse from the sensor.

You can use the timer and some integer math to measure the time between the rising and falling edge to allow you to determine the direction of the gear, then you can also measure the time between one rising edge and the next to determine the speed of the gear.

To time the events, you can simply setup a counter to a speed that will not overflow for the measurements you'd like to make, but that also will give you good resolution. Each time you get an interrupt, save the value in the counter. Also, before saving it, subtract the last timer value that was saved from the current timer value. This will give you the change in time. Save that as well. You can then use the numbers elsewhere in your code to compute the speed. If you want to compute direction as well, the you'll need to store two old values.

Best of luck!
-Joe
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
VEX Optical Shaft encoders in FRC sanddrag FIRST Tech Challenge 8 04-10-2005 07:52
Hollow Shaft optical encoders magical hands Control System 2 24-03-2005 09:12
Accelerometer vs Gear Tooth Sensors zdeswarte Electrical 4 22-01-2005 15:35
gears Michael Leicht Inventor 12 16-09-2004 10:52
Coupling the drill motor with out the 15 tooth gear Chopper_Dave Motors 1 17-01-2004 01:06


All times are GMT -5. The time now is 01:33.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi