|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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;
}
Last edited by Tom Bottiglieri : 13-02-2005 at 14:47. |
|
#2
|
||||
|
||||
|
Re: Processing pre-set Interrupts
Quote:
-Kevin |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |