Periodic Interrupt Timer Problem

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Periodic Interrupt Timer Problem

568 次查看
Pogo
Contributor III

I've create three PIT, the folloing list is their setting.

 

PITCFLMT_PITFRZ = 1;PITMTLD0 = 79;PITMTLD1 = 159;PITCE_PCE0        = 1;PITMUX_PMUX0   = 0;PITINTE_PINTE0  = 1;//time-out period = (PITMTLDx+1)*(PITLD+1)/fBus = 80*5000/40M = 0.01s = 10ms PITLD0= 4999;PPITTF_PTF0      = 1;PITCE_PCE1      = 1;PITMUX_PMUX1 = 0;PITINTE_PINTE1 = 1;PITLD1               = 499;           //time-out period = (PITMTLDx+1)*(PITLD+1)/fBus = 80*500/40M = 0.001s = 1ms PITTF_PTF1       = 1; PITCE_PCE2      = 1;PITMUX_PMUX2 = 0;PITINTE_PINTE2 = 1;PITLD2= 49999;              //time-out period = (PITMTLDx+1)*(PITLD+1)/fBus = 80*50000/40M = 0.1s = 100msPITTF_PTF2      = 1;#pragma CODE_SEG __NEAR_SEG NON_BANKEDvoid interrupt ISR_PIT0_Scheduler(void){    MeasureTask(); PITTF_PTF0 = 1;}void interrupt ISR_PIT1_Scheduler(void){    SendQueue(); PITTF_PTF1 = 1;}void interrupt ISR_PIT2_Scheduler(void){    HeaterControlTask();  <---I set the break point on this point, but it never stop on it. PITTF_PTF2 = 1;}#pragma CODE_SEG DEFAULT

 

Now, I've one problem, the interrupt of PTI2 is not work. When I use BDM and set breakpoint on the PTI2's interrupt function. It never stop on it.  Why the PTI2 can't work? Does anyone can help me? Thansk a lot.

 

Regards,

Pogo Lin

标签 (1)
0 项奖励
回复
1 回复

311 次查看
kef
Specialist I

You problem is that  PITTF_PTFx = 1; is clearing ALL PITTF flags. Try searching the forums for how to clear timer flags in C.

0 项奖励
回复