View Single Post
  #11   Spotlight this post!  
Unread 16-01-2007, 15:02
Ultima Ultima is offline
Registered User
FRC #0369
 
Join Date: Oct 2005
Location: Brooklyn, NY
Posts: 26
Ultima will become famous soon enough
Re: Gear Tooth Sensor

Our code looks something like this for Encoder 1 and 2

void Encoder_1_Int_Handler(void)
{
// Encoder 1's phase a signal just transitioned from zero to one, causing
// this interrupt service routine to be called. We know that the encoder
// just rotated one count or "tick" so now check the logical state of the
// phase b signal to determine which way the the encoder shaft rotated.
if(ENCODER_1_PHASE_B_PIN == 0)
{
Encoder_1_Count += ENCODER_1_TICK_DELTA;
}
}

#endif

#ifdef ENABLE_ENCODER_2

Would this work or not?

P.S. If I take away the #ifdef ENABLE_ENCODER_3 from the correct intrrupt would that correctly disable ENCODERS 3 -6. If not was would be the correct way for doing this.

Last edited by Ultima : 16-01-2007 at 15:34. Reason: Clarification