#include #ifndef TFLG1_C6F_MASK #define TFLG1_C6F_MASK 0x40 #endif unsigned int Tcount; void main(void) { DDRA = 0xFF; DDRB = 0xFF; TSCR1 = 0x90; TSCR2 = 0x00; TIOS = TIOS & ~0x40; TCTL3 = 0x10; while(1) { while (!(TFLG1 & TFLG1_C6F_MASK)); TFLG1 = TFLG1 | TFLG1_C6F_MASK; Tcount = TC6; PORTB = Tcount & 0x00FF; PORTA = ((Tcount & 0xFF00) >> 8); } }