Go to Post Leave FIRST? That's an option? =) - treffk [more]
Home
Go Back   Chief Delphi > Technical > Electrical
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 03-02-2008, 18:14
Kilroy0846 Kilroy0846 is offline
Registered User
FRC #2139
 
Join Date: Jan 2007
Location: Las Vegas
Posts: 28
Kilroy0846 is an unknown quantity at this point
Random GTS output

We have coded the gear tooth sensor correctly (at least according to what everything says). They are wired correctly too but we get inaccurate and random readings from them.

We have the sensors placed correctly, approx. 1mm away, and it senses to gear but it seems to be random. No pattern has been found to how it reads the pulses so we can't even work around that.

Has anybody else had this issue or are we just doing something wrong?
  #2   Spotlight this post!  
Unread 03-02-2008, 18:19
bilal1219's Avatar
bilal1219 bilal1219 is offline
Registered User
AKA: Bilal
FRC #1219 (Iron Eagles)
Team Role: Alumni
 
Join Date: Feb 2006
Rookie Year: 2004
Location: Canada
Posts: 56
bilal1219 is an unknown quantity at this point
Re: Random GTS output

well, we are encountering the similiar problem, We also connected everything right, and connected the snsor in Digital INput 1,also the code is fine.but when you run the code, The terminal window gives 0 values from E1 to E6.But cant find the problem

Thanx a lot.

Bilal Shahid
Team 1219.
__________________


<a href="http://www.thebluealliance.net/tbatv/team.php?team=1219" style="border: 0"><img src="http://www.thebluealliance.net/tbatv/teambadge/gen/1219/FF3300/0066FF/teambadge.png" alt="Team 1219" /></a>

Robots Might Lose But Teams Never Do
  #3   Spotlight this post!  
Unread 04-02-2008, 08:41
matrixrobotics matrixrobotics is offline
Registered User
FRC #0179 (Children of the Swamp)
Team Role: Engineer
 
Join Date: Dec 2007
Rookie Year: 2003
Location: FL
Posts: 4
matrixrobotics is an unknown quantity at this point
Re: Random GTS output

Do you have a good backup battery plugged in when you are doing these tests? The GTS use both the 12 VDC from the main battery and the 5 VDC from the digital input. We made this mistake last weekend and found that one GTS seemed to work fine with no backup battery while the second would not.

Charlie
  #4   Spotlight this post!  
Unread 04-02-2008, 09:14
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Random GTS output

Quote:
Originally Posted by Kilroy0846 View Post
We have coded the gear tooth sensor correctly (at least according to what everything says)...
What code are you using to read the sensor? You claim it's correct, but it would help if we could verify that for ourselves.

Can you observe the GTS output directly using an oscilloscope? Doing that could either point to or rule out hardware problems.
  #5   Spotlight this post!  
Unread 04-02-2008, 13:03
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
Re: Random GTS output

Our Team is using the IFI Default Code and have the counter in user_routines_fast.c. We have the Gear Tooth Sensor plugged into rc_dig_in01 and are using the interrupt code that comes with the user_routines_fast.c default code.

Code:
#pragma code
#pragma interruptlow InterruptHandlerLow save=PROD /* You may want to save additional symbols. */

void InterruptHandlerLow ()     
{                               
  unsigned char int_byte;       
  if (INTCON3bits.INT2IF && INTCON3bits.INT2IE)       /* The INT2 pin is RB2/DIG I/O 1. */
  { 
    INTCON3bits.INT2IF = 0;
  }
  else if (INTCON3bits.INT3IF && INTCON3bits.INT3IE)  /* The INT3 pin is RB3/DIG I/O 2. */
  {
    INTCON3bits.INT3IF = 0;
  }
  else if (INTCONbits.RBIF && INTCONbits.RBIE)  /* DIG I/O 3-6 (RB4, RB5, RB6, or RB7) changed. */
  {
    int_byte = PORTB;          /* You must read or write to PORTB */
    INTCONbits.RBIF = 0;     /*     and clear the interrupt flag         */
  }                                        /*     to clear the interrupt condition.  */
  else
  { 
    CheckUartInts();    /* For Dynamic Debug Tool or buffered printf features. */
  }
}
Our Counter Code is:

Code:
if (rc_dig_in01 >0) {
counter = counter + 1;
}

Last edited by compwiz2008 : 04-02-2008 at 13:05. Reason: Added Counter Code
  #6   Spotlight this post!  
Unread 04-02-2008, 13:29
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Random GTS output

Quote:
Originally Posted by compwiz2008 View Post
Our Team is using the IFI Default Code and have the counter in user_routines_fast.c. We have the Gear Tooth Sensor plugged into rc_dig_in01 and are using the interrupt code that comes with the user_routines_fast.c default code.
Thanks for showing us your code. As I feared, it confirms that you aren't doing it correctly.

Note that the default interrupt handler doesn't do anything except clear the interrupt when your GTS sends its pulse:
Code:
  if (INTCON3bits.INT2IF && INTCON3bits.INT2IE)       /* The INT2 pin is RB2/DIG I/O 1. */
  { 
    INTCON3bits.INT2IF = 0;
  }
You'll need to add a line in there to increment your counter.
Quote:
Our Counter Code is:

Code:
if (rc_dig_in01 >0) {
counter = counter + 1;
}
The input pulse from the GTS is very short. You'll not be able to catch it reliably that way. You have to put the counter increment into the interrupt service routine.

Look at Kevin Watson's encoder support files ( http://www.kevin.org/frc ) to see an example of how to initialize the interrupt, update the counter value, and read the value while protecting it from being changed in the middle of being read.
  #7   Spotlight this post!  
Unread 05-02-2008, 17:33
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
Re: Random GTS output

What part of kevin's code do I actually need? It looks to me that I need everything in encoder.c, the interrupts in ifi_frc.c, and ADC.c from kevin's files, which I don't even understand why I need that one. We're trying to use IFI's default code and want to make the encoder code as simple as possible. could anyone please give us some code that works with IFI's Default Code
  #8   Spotlight this post!  
Unread 05-02-2008, 22:00
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Random GTS output

If you want to use the Gear Tooth Sensor with the IFI default code, it will probably be easiest to follow the detailed directions from Kevin Watson's encoder support code. To start with, select an unused digital input for the Phase B signal. Later, once you've verified that it works, you can investigate changing the interrupt service routine to remove the Phase B test entirely.
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
GTS strange behavior iwdu15 Programming 6 01-02-2007 18:46
GTS Counting gnirts Programming 13 21-04-2006 21:15
GTS code Problems caderader Programming 8 13-02-2006 19:23
How random is random???? archiver 1999 0 23-06-2002 21:59


All times are GMT -5. The time now is 21:03.

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