智能车制作
标题:
PIT
[打印本页]
作者:
zyj
时间:
2012-5-23 09:53
标题:
PIT
void PIT_Init(void)//定时中断初始化函数 1ms定时中断设置
{
PITCFLMT_PITE=0; //定时中断通道 关
//PITCE=0X00;
PITINTE_PINTE0=1;
PITMUX_PMUX0=0;
PITMTLD0=200-1; //微时基 8位用于设置PIT模块中的8位计数器初值,以实现24位的计数。设定值为0到255范围?PMUX = 0时使用PITMTLD0
PITLD0=200-1; //定时器 16位 time-out period = (PITMTLD + 1) * (PITLD + 1) / fBUS.
PITCE_PCE0=1;
PITMTLD1=200-1;
PITMUX_PMUX2=1;
PITINTE_PINTE2=1;
PITLD2=200-1;
PITCE_PCE2=1;
PITCFLMT_PITE=1;
}
哪里错误了
作者:
451506709
时间:
2012-5-23 18:43
void PIT_Init(void) //5 ms
{
PITCFLMT_PITE=0; //disable PIT
PITCE_PCE0=1; //enable timer channel 0
//PITCE_PCE1=1;
PITMTLD0=100-1; //time base 240 clock cycles ,it's 0.1M Hz
//PITMTLD1=250-1;
PITMUX_PMUX0=0; // ch0 connected to micro timer 0
//PITMUX_PMUX1=1;
PITLD0=3200-1; //INTVERAL micro time bases
//PITLD1=8000-1;
PITINTE_PINTE0=1; //enable interupt channel 0
//PITINTE_PINTE1=1;
PITCFLMT_PITE=1; //enable PIT
}
void PIT_init(void) //1ms
{
//脉冲pt7初始化
PACTL = 0x40; //脉冲计数 下降沿
PACNT = 0x0000; // Pulse Accumulators Count Registers (PACNT
PITCFLMT_PITE=0; //定时中断通道0关
PITCE_PCE0=1; //定时器通道0使能
PITMTLD0=8-1; //8位定时器初值设定,8分频,在64MHzBusClock下,为8MHz。即0.125us
PITLD0=8000-1; //16位定时器初值设定。PITTIME*0.125uS 8000*0.125 =1ms即1mS中断一次
PITINTE_PINTE0=1;//定时器中断通道0中断使能
PITCFLMT_PITE=1; //定时器通道0使能
}
作者:
zyj
时间:
2012-5-23 21:20
451506709 发表于 2012-5-23 18:43
void PIT_Init(void) //5 ms
{
PITCFLMT_PITE=0; //disable PIT
怎么能都用一个通道0呢?
欢迎光临 智能车制作 (http://dns.znczz.com/)
Powered by Discuz! X3.2