在线时间5 小时
UID1188783
注册时间2008-3-4
NXP金币0
该用户从未签到
新手上路

- 积分
- 46
- 最后登录
- 1970-1-1
|
本帖最后由 FSL_TICS_ZP 于 2014-10-11 17:06 编辑
isr.H内定义了:extern void lptmr_isr(void);
#undef VECTOR_044
#define VECTOR_044 lptmr_isr
uint32 lptmr_incr;
void lptmr_isr(void)
{
lptmr_incr++;
LPTMR0_CSR |= LPTMR_CSR_TCF_MASK; // write 1 to TCF to clear the LPT timer compare flag
}
初始化:
void lptmr_init(int count, int clock_source)
{
SIM_SCGC5 |= SIM_SCGC5_LPTMR_MASK;
LPTMR0_PSR = ( LPTMR_PSR_PRESCALE(0) // 0000 is div 2
| LPTMR_PSR_PBYP_MASK // LPO feeds directly to LPT
| LPTMR_PSR_PCS(clock_source)) ; // use the choice of clock
if (clock_source== 0)
printf("\n LPTMR Clock source is the MCGIRCLK \n\r");
if (clock_source== 1)
printf("\n LPTMR Clock source is the LPOCLK \n\r");
if (clock_source== 2)
printf("\n LPTMR Clock source is the ERCLK32 \n\r");
if (clock_source== 3)
printf("\n LPTMR Clock source is the OSCERCLK \n\r");
LPTMR0_CMR = LPTMR_CMR_COMPARE(count); //Set compare value
LPTMR0_CSR =( LPTMR_CSR_TCF_MASK // Clear any pending interrupt
| LPTMR_CSR_TIE_MASK // LPT interrupt enabled
| LPTMR_CSR_TPS(0) //TMR pin select
|!LPTMR_CSR_TPP_MASK //TMR Pin polarity
|!LPTMR_CSR_TFC_MASK // Timer Free running counter is reset whenever TMR counter equals compare
|!LPTMR_CSR_TMS_MASK //LPTMR0 as Timer
);
LPTMR0_CSR |= LPTMR_CSR_TEN_MASK; //Turn on LPT and start counting
enable_irq(28);
}
主程序:
main()
{
lptmr_init(1000, LPTMR_USE_LPOCLK);
while(1);
}
然后,串口会连续不断的输出:
****default_isr entered on vector 4194348*****
有时候是连续不断输出:
****default_isr entered on vector 44*****
不知道为什么。
就算我的中断服务程序没配置对,也应该是间隔1秒了输出,但实际上是连续不断的输出。求解???
|
|