View Single Post
  #1   Spotlight this post!  
Unread 10-03-2007, 01:35
qnetjoe qnetjoe is offline
Registered User
AKA: Joe Daily
no team
Team Role: Engineer
 
Join Date: Jan 2007
Rookie Year: 2003
Location: Austin
Posts: 51
qnetjoe is on a distinguished road
Send a message via AIM to qnetjoe Send a message via MSN to qnetjoe Send a message via Yahoo to qnetjoe
Encoder Help with VEX and MPLAB

Greetings,

I am trying to set up some reference encoder for my team. We are using MPLAB with Vex Controller.

Is there a way that I can get the interrupt to be triggered on the raising or falling edge of the resulting encoder square wave?

Right now my code (below) just looks to see if the signal is high (0) or low (1), but if the encoder happens to stop when the signal is high , the encoder count just runs.

Code:
if(rc_dig_int1)
{
encoder1++;
PORTBbits.RB2=0; //Set Interrupt = 0
}
Thanks