智能车制作
标题:
PIT定时出现个莫名其妙的问题
[打印本页]
作者:
xxll220088
时间:
2012-3-1 08:40
标题:
PIT定时出现个莫名其妙的问题
本帖最后由 xxll220088 于 2012-3-1 08:43 编辑
mc9xs128的板子,用PLL超频到64M,用PIT 设置1ms 定时中断,按说这个2个寄存器应该这样没错,可是这样设置后就看不到激光扫描了,单步运行的话,还是会亮,反而我把640改成6400,才能看见激光扫描。帮忙看看?
PITMTLD0 = 100-1; // 1ms
PITLD0 = 640-1;
PIT代码:
void PIT_Init(void) {
PITCFLMT = 0x00;
PITCE = 0x01; // choose channel 0
PITMUX = 0; // choose micro timer0
PITMTLD0 = 100-1; // 1ms
PITLD0 = 3200-1;
PITINTE = 0x01; // enable channel0
PITCFLMT = 0x80 ;
}
复制代码
PLL代码:
void PLL_Init(void) {
CLKSEL = 0x00;
PLLCTL_PLLON = 1;
SYNR = (0xC0 | 0x07);
REFDV = (0x80 | 0x01); //fvc0=2*16*8/2=128
POSTDIV = 0x00; //BUS clock=pllclock=1/2*fvco=64mhz;
_asm(nop);
_asm(nop);
_asm(nop);
_asm(nop);
while ( CRGFLG_LOCK != 1)
;
CLKSEL_PLLSEL = 1;
}
复制代码
欢迎光临 智能车制作 (http://dns.znczz.com/)
Powered by Discuz! X3.2