Here are two different visual representations of the ADC trigger. The long line indicates a alternating state between two samples (this lets me measure the correct 400Hz on the scope easier). The two waveforms are the SIN and COS output from the Differential Resolver.


The image with the dots indicates when the ATmega will pull the ADC during run-time. ADCtrigger (dot) happens 2125 microseconds after zero crossing of the 400Hz reference.

Below is a code snippet that shows the INT port config and the interrupt handler with the fixed time offset.
/* Configure Zero Crossing Counter */
MCUCSR |= !_BV(ISC2);
GICR |= _BV(INT2);
GIFR |= _BV(INTF2);
/*
* INTERRUPT HANDLING
*/
ISR(INT2_vect) {
freqCounter++;
_delay_us( 2125 );
/* Toggle port PA0 .. which is the LSB on PORTA */
PORTA ^= 0x01;
_delay_us( 30 );
PORTA ^= 0x01;
}






