Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Interrupt Trouble (http://www.chiefdelphi.com/forums/showthread.php?t=64453)

Sykan 18-02-2008 10:44

Interrupt Trouble
 
i've been testing my encoders and encoder 1 doesn't count intill the other encoder has something to count

i donno but it doesn't seem that interrupt 1 is called intill interrupt 2 is called and vis versa.

any ideas?

Thank you, in Advanced

Kevin Sevcik 18-02-2008 11:04

Re: Interrupt Trouble
 
Are you using MPLAB or EasyC? Are you using Kevin Watson's encoder code? Can you post your interrupt handler code? We need some more information before we can make intelligent suggestions. Offhand, I can suggest that your interrupt handler isn't correct in some fashion, you've forgotten to enable interrupts on the encoder pin, you've plugged the encoder into the wrong place, your encoder simply isn't working properly or isn't sending strong enough signals.... Unless you want to spend the day running down every single random idea we can toss out, please post more info about what's connected where physically, and what your program actually is.

Sykan 18-02-2008 11:53

Re: Interrupt Trouble
 
The Encoders are connected to Port 1 and 2 of digital input.
i'm Using Kevins Code with Mplab

Sense i'm using the KOP Encoder i've changed the Interrupt handler to
if (pwm16 >= 127){
Encoder_1_Count += ENCODER_1_TICK_DELTA;
}
else {
Encoder_1_Count -= ENCODER_1_TICK_DELTA;
}
for both oh/course with the correct corresponding Motor and Encoder Count.

i've Enabled the Int in the ifi_frc.h, the Encoder.h and the Initialize_Encoder_1(); in the teleop.c

I haven't Changed anything else

Kevin Watson 18-02-2008 13:02

Re: Interrupt Trouble
 
Quote:

Originally Posted by Sykan (Post 701520)
i've been testing my encoders and encoder 1 doesn't count intill the other encoder has something to count

i donno but it doesn't seem that interrupt 1 is called intill interrupt 2 is called and vis versa.

any ideas?

Thank you, in Advanced

I'll look at your code if you zip it up and send it to me.

-Kevin

Kevin Watson 18-02-2008 15:51

Re: Interrupt Trouble
 
Quote:

Originally Posted by Sykan (Post 701520)
i've been testing my encoders and encoder 1 doesn't count intill the other encoder has something to count

i donno but it doesn't seem that interrupt 1 is called intill interrupt 2 is called and vis versa.

any ideas?

Thank you, in Advanced

Having had a quick look at your code, nothing jumps out. What exactly is malfunctioning?

-Kevin

Kevin Sevcik 18-02-2008 16:07

Re: Interrupt Trouble
 
I'm kind of curious if he's updating pwm16 atomically so it's guaranteed to be in a valid state in the ISR. If he's left the default routine in and then updates it later in the routine he could get some odd effects every 26.2ms or so.... Also, there' always doing a clean build in case something's gone haywire.

tern540degrees 18-02-2008 16:44

Re: Interrupt Trouble
 
We figured it out. The signal was grounded through the frame. Thanks for all of the help.


All times are GMT -5. The time now is 00:55.

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