#include "avr/io.h"
int main ( )
{
	unsigned int t;
	DDRA = 0xFF;	
	DDRB = 0xFF;	
	PORTD = 0xFF;	
	TCCR1A = 0;	
	TCCR1B = 0x41; 
	while ((TIFR&(1<<ICF1)) == 0);
	t = ICR1;
	TIFR = (1<<ICF1);	
	while ((TIFR&(1<<ICF1)) == 0);
	t = ICR1 - t;
	PORTA = t;		
	PORTB = t>>8;	
	while (1);
	return 0;
}