Searching this forum I was directed to http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=50106, which discusses timing.
I am unable to get the the first full routine example to function correctly...
Here is the code example (with Serial coms added)
#include <avr/io.h>
void setup() // run once, when the sketch starts
{
Serial.begin(9600);
}
void loop() // run over and over again
{
DDRB |= (1 << 0); // Set LED as output
TCCR1B |= (1 << CS10); // Set up timer
for(;;){
//Serial.println(TCNT1,DEC);
// Check timer value in if statement, true when count matches 1/20 of a second
if (TCNT1 >= 50000)
{
Serial.println(TCNT1,DEC);
PORTB ^= (1 << 0); // Toggle the LED
TCNT1=0;
}
}
}
" if (TCNT1 >= 50000) " never becomes true as far as I can tell.