设置定时器及脉冲累加器有很多寄存器要设置的,你可以参看下面的程序。但具体参数要你自己来定:
void ECT_Init(void){ ICPAR &= ~1; PACN0 = 0; TSCR1 &= ~0x70; DLYCT = 0; ICSYS &= 0xF7; ICOVW &= ~1; TCTL4 = (TCTL4 & (~2))| 1; TIOS &= ~1; CRGINT &= ~0x12; RDRIV &= ~93; TIE &= ~1; /* Disable interrupt by edge detector */ ICPAR = 1; /* Enable pulse accumulator */ }
[此贴子已经被strongchen于2007-4-29 11:06:15编辑过] |