I've been struggling with this problem for a while and I'm just not getting it.
ATmega328P @ 16MHz, 5V
I'm receiving a pulse on the ICP1 line and I want to have the ability to turn the Input Capture unit on and off.
In my main method I have:
TCCR1B |= (1 << ICES1); DDRB |= (1 << PB0); PORTB |= (1 << PB0);
then in my Run method I have:
// Set port to input DDRB &= (0 << PB0); // Configure no prescale TCCR1B |= (1 << CS10); // Enable Input Capture Interrupt TIMSK1 |= (1 << ICIE1);
then in my Stop method I have;
// Enable Input Capture Interrupt TIMSK1 &= (0 << ICIE1); // Stop clock TCCR1B &= (0 << CS10); // Set port to output DDRB |= (1 << PB0);
Any help appreciated!