View Single Post
Old 08-30-2013, 12:03 PM   #20 (permalink)
t vago
MPGuino Supporter
t vago's Avatar
Join Date: Oct 2010
Location: Cedar Rapids, IA
Posts: 1,766

The Karen-Mobile - '05 Dodge Magnum SXT
Team Dodge
90 day: 26.72 mpg (US)

Fiat Dakota - '00 Dodge Dakota SLT RWD Quad Cab
90 day: 16.67 mpg (US)

The Red Sled - '01 Dodge Durango SLT 4WD
90 day: 16.96 mpg (US)
Thanks: 799
Thanked 681 Times in 437 Posts
Originally Posted by nickdigger View Post
Did you have to do any debouncing-type of trick for this? I tried switching to the CHANGE trigger, and wondered if it failed because the level hadn't yet fully risen to "high" when the int fired.
Nope. All I had to do was to be able to read pin D, and act on it.

	uint8_t injDir = (PIND ^ injDirection) & (1 << PIND2);

	if (injDir) { // handle fuel injector opening event


	} else { // handle fuel injector closing event


injDirection is a volatile uint8_t which is set to either 0x00 or 0xFF, depending on the state of the injector edge trigger flag parameter.

Originally Posted by nickdigger View Post
I think the space savings was only about 80 bytes, by combining the interrupts, but potentially the free pin could be more valuable.
Indeed. Every little bit helps, and that interrupt pin is now freed up for other things.
The Fiat Dakota

The Karen-mobile

The Red Sled
  Reply With Quote