View Single Post
  #9   Spotlight this post!  
Unread 23-02-2004, 15:14
seanwitte seanwitte is offline
Registered User
None #0116
Team Role: Engineer
 
Join Date: Nov 2002
Location: Herndon, VA
Posts: 378
seanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant future
Send a message via AIM to seanwitte
Re: Big Question concerning Interrupt Pins 3-6

Quote:
Originally Posted by mightywombat
I'm still struggling with how to figure direction.... Any help?
I'm assuming you have an ISR coded already. Connect the signal pin not connected to the interrupt and ground to the signal and ground pins on digital input number 8. Your ISR will look like this:
Code:
volatile signed int distance = 0;

void Int_1_Handler()
{
	//check the other encoder channel. you may have
	//to switch the comparison value to 1 depending on
	//the configuration.
	if (rc_dig_in08 == 0)
	{
		distance++;
	}
	else
	{
		distance--;	
	}
}