#include #ifndef TFLG1_TOF_MASK #define TFLG1_T0F_MASK 0x80 #endif unsigned char overflow = 0; void main(void) { DDRB = 0xFF; TSCR1 = 0x80; TSCR2 = 0x00; while(1) { TFLG2 = 0x80; while (!(TFLG2 & TFLG2_TOF_MASK)); overflow = overflow + 1; PORTB = overflow; } }