Using ETC as input capture to measure pulse period between rising edges of measurement pulse.

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

Using ETC as input capture to measure pulse period between rising edges of measurement pulse.

1,554 次查看
KY
Contributor I
how can I do it?I have made some process,but  it  can't go to the interrupt process.Such as:

#pragma LINK_INFO DERIVATIVE "SampleS12"
#pragma CODE_SEG DEFAULT
 
void TIM_Init(void)
{
   TIOS_IOS0 = 0;
 TFLG1 = 1;
 TIE_C0I =1;
 TCTL4_EDG0A = 1;
 TCTL4_EDG0B = 0;
 ICOVW_NOVW0 = 1;
 ICSYS_BUFEN = 1;
 ICSYS_LATQ  = 0;
 ICSYS_TFMOD = 1;
 TSCR1_TEN = 1;
}
#pragma CODE_SEG __NEAR_SEG NON_BANKED
/* Interrupt section for this module. Placement will be in NON_BANKED area.*/
interrupt 8 void TI0_Interrupt(void)
{
 
 TFLG1 = 1;          // Reset interrupt request flag

}
#pragma CODE_SEG DEFAULT
标签 (1)
0 项奖励
回复
1 回复

680 次查看
DanielM
Contributor III
Hi,

have a look at

http://www.freescale.com/files/microcontrollers/doc/app_note/AN3292.pdf

and the associated code

http://www.freescale.com/webapp/sps/download/license.jsp?colCode=AN3292SW&prodCode=MC9S12XDP512&node...

This appnote uses the ECT to capture edges of the input signal and then uses the time between the edges to determine how many bits were "received" on an emulated SCI channel. You should be able to use almost identical ECT set-up for what you waht to do.

Daniel
0 项奖励
回复