Go to Post To anyone who is discouraged about their team, don't let yourself get down. I've seen my team go from having a robot that barely moved (and I'm not kidding, we had keys falling out of gearboxes) to this year with a robot that is ACTUALLY GOING TO WORK. Don't lose hope, stick with FIRST! - ZipTie3182 [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 13-02-2005, 14:44
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,187
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Processing pre-set Interrupts

I am having troubles with my encoder. It is a 128 ppr encoder, and at close to maximum shaft RPM, I start to get bad readings from it. I figured this was from the RC trying to process too many interrupts per second, so I know I need decrease the ppr of the encoder.

The way I thought I could do this was by including a true/false check statement in the InterruptHandlerLow() function that would only call the Encoder Handler Function every other time that interrput happened. I tried doing this with if's and switch statements, but neither worked. I still got 128 ticks per revolution.

Heres a sample of the code I am using.
Code:
unsigned char loops=0;

void InterruptHandlerLow()     
{     
     if(loops==0)
     { 
         if (INTCON3bits.INT2IF && INTCON3bits.INT2IE) // left encoder interrupt?
		{ 
			INTCON3bits.INT2IF = 0; // clear the interrupt flag [91]
			Left_Encoder_Int_Handler(); // call the left encoder interrupt handler (in encoder.c)
		}
          loops=1;
     }
     else loops=0;
}
Any ideas?

Last edited by Tom Bottiglieri : 13-02-2005 at 14:47.
  #2   Spotlight this post!  
Unread 13-02-2005, 15:41
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: Processing pre-set Interrupts

Quote:
Originally Posted by Tom Bottiglieri
I am having troubles with my encoder. It is a 128 ppr encoder, and at close to maximum shaft RPM, I start to get bad readings from it. I figured this was from the RC trying to process too many interrupts per second, so I know I need decrease the ppr of the encoder.

The way I thought I could do this was by including a true/false check statement in the InterruptHandlerLow() function that would only call the Encoder Handler Function every other time that interrput happened. I tried doing this with if's and switch statements, but neither worked. I still got 128 ticks per revolution.

Heres a sample of the code I am using.
Code:
unsigned char loops=0;
 
void InterruptHandlerLow() 
{ 
if(loops==0)
{ 
if (INTCON3bits.INT2IF && INTCON3bits.INT2IE) // left encoder interrupt?
		{ 
			INTCON3bits.INT2IF = 0; // clear the interrupt flag [91]
			Left_Encoder_Int_Handler(); // call the left encoder interrupt handler (in encoder.c)
		}
loops=1;
}
else loops=0;
}
Any ideas?
Check the magical Encoder FAQ for a possible answer.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
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
FYI about using PWM 13-16 with interrupts cabbagekid2 Programming 6 22-01-2005 00:54
Parallel processing for 3dmax mnkysp6353 General Forum 9 06-05-2004 10:26
Problem with interrupts on the PIC Mike Betts Programming 7 16-12-2003 21:26
Pre -Inspection and IMPORTANT Notes. Mike Martus Off-Season Events 1 07-11-2001 03:19


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

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