Go to Post ummm who is John V Neun....? - Korbin [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

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 31-01-2008, 17:57
compwiz2008's Avatar
compwiz2008 compwiz2008 is offline
Registered User
FRC #2139
 
Join Date: Nov 2007
Location: Las Vegas, Nevada
Posts: 11
compwiz2008 is an unknown quantity at this point
Coding the Gear Tooth Sensor

We need help with the code to the sensor. We have tried many things but cannot get it to function. If you can help it is greatly appreciated.

This is our code

if (rc_dig_in05 > 0) {
counter = counter + 1;
}
printf("counter %d", counter);

And it still won't count.

p.s. Please show us some code.

Last edited by compwiz2008 : 31-01-2008 at 17:59.
  #2   Spotlight this post!  
Unread 31-01-2008, 18:17
Jon Stratis's Avatar
Jon Stratis Jon Stratis is offline
Mentor, LRI, MN RPC
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 3,815
Jon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond repute
Re: Coding the Gear Tooth Sensor

First, a question - do you have digital_io_05 set as an input? if not, that may be part of your problem...

Next, i would highly recommend using Kevin Watson's encoder code (see the sticky at the top of the forum) for doing the gear tooth sensors. It needs a small amount of modification, but not much, and it sets up the GTS as interrupts, which help ensure you won't miss information. If your code above is in the main user part of your code, the line will only execute once every 26.2ms, which may or may not fall on a pulse from the GTS. an Interrupt, however, will force the code to be called to increment the counter every time the input changes from a 0 to a 1, so you shouldn't miss any information from the GTS.
  #3   Spotlight this post!  
Unread 31-01-2008, 19:52
timville's Avatar
timville timville is offline
Registered User
AKA: Timothy Friez
FRC #1185 (X-Bots)
Team Role: Alumni
 
Join Date: Mar 2007
Rookie Year: 2003
Location: Pittsburgh
Posts: 18
timville is an unknown quantity at this point
Send a message via AIM to timville
Re: Coding the Gear Tooth Sensor

Try ROBOTC... it takes care of handling the encoders as interrupts without any additional coding and is easier to use than MPLab!
__________________
2003 - Rookie All-Stars Awards - #1185 (Pittsburgh)
2004-2008 FIRST Volunteer - Ref/Head Ref (Pittsburgh)
2002-2007 FIRST Lego League Volunteer - Head Ref (Pittsburgh)
  #4   Spotlight this post!  
Unread 01-02-2008, 15:17
xrabohrok's Avatar
xrabohrok xrabohrok is offline
hunter of errors
FRC #1208 (The Metool Brigade)
Team Role: Programmer
 
Join Date: Jan 2006
Location: O'Fallon
Posts: 62
xrabohrok is an unknown quantity at this point
Re: Coding the Gear Tooth Sensor

When you say "Doesn't count", do you mean the output displays only zero, or some other crazyness?
__________________
"It's programming's fault" may be a viable excuse for just about everything, except the robot falling apart.

It will 'cause it can!

constants aren't. variables won't.
Closed Thread


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
Gear Tooth Sensor Maria*61806* Electrical 0 30-01-2008 09:07
Gear Tooth Sensor Zoom Programming 46 22-01-2008 08:05
How do you wire the gear tooth sensor? 1594code Electrical 5 12-01-2008 16:24
Quick question regarding the gear tooth sensor... Brad Voracek Electrical 3 12-01-2007 01:07
Mounting the Gear Tooth Sensor??? blue_crew Electrical 3 09-02-2006 13:53


All times are GMT -5. The time now is 19:13.

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