智能车制作
标题:
求教定时器时间计算
[打印本页]
作者:
zzzzzz19881201
时间:
2010-6-11 11:47
标题:
求教定时器时间计算
void SetBusCLK_32M(void)
{
CLKSEL=0X00; //disengage PLL to system
PLLCTL_PLLON=1; //turn on PLL
SYNR=3;
REFDV=1; //pllclock=2*osc*(1+SYNR)/(1+REFDV)=64MHz;
_asm(nop); //BUS CLOCK=32M
_asm(nop);
while(!(CRGFLG_LOCK==1)); //when pll is steady ,then use it;
CLKSEL_PLLSEL =1; //engage PLL to system;
}
void ect_init(void)
{
PACTL=0x50;
PACNT=0x0000; // 脉冲累加器清零
TSCR1 = 0x80; //定时器使能
//TSCR2 = 0x13; //8分频,允许中断
TSCR2 = 0x16; //64分频,允许中断
TIE=0x02; //TIE=0x01;
TCNT = 0xffff- 100000;
TCTL2=0x00; //定时器与输出引脚断开
TIOS= 0x0f;
TC1 = 0xffff; //TC0 = 0xffff;
TFLG1=0xff; //TFLG1=0x01;
asm cli ;
}
定时器时间是多少???公式是???????
欢迎光临 智能车制作 (http://111.231.132.190/)
Powered by Discuz! X3.2