9S12XEP100 ECT Interrupt not work in first time

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

9S12XEP100 ECT Interrupt not work in first time

跳至解决方案
1,371 次查看
dlp
Contributor I

 Hello!

 In my system I am work with Input Capture. After reset Interrupt input capture not work. But on next time all work is correctly.

Help me, please.  

 

Timer.tc[1].word = 0xFFFF;
Timer.tc[2].word = 0xFFFA;
Timer.tcnt.word = 0;

 

Timer.tios.byte = 0xFE;
Timer.tscr2.byte = 0x82;  
Timer.tscr1.byte |= TEN;
Timer.tctl4.byte |= EDG0A;
Timer.ocpdstr.byte = 0xFE;
Timer.tie.byte = 0x05;

 

 It's setting timer on start command...

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
1,190 次查看
kef
Specialist I

S12XE has to timers, TIM and ECT. Are you sure your Timer struct belongs to ECT and not to TIM? It this is OK, then you should explain why do you think it works only 2nd time. Certainly your code is not enough to proove it. Also, what is your bus clock and how narrow is your external pulse and; voltage or MCU power supply and what is amplitude of your pulse.

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,191 次查看
kef
Specialist I

S12XE has to timers, TIM and ECT. Are you sure your Timer struct belongs to ECT and not to TIM? It this is OK, then you should explain why do you think it works only 2nd time. Certainly your code is not enough to proove it. Also, what is your bus clock and how narrow is your external pulse and; voltage or MCU power supply and what is amplitude of your pulse.

0 项奖励
回复
1,190 次查看
dlp
Contributor I

Voltage - 4,97 V

Amplitude impulse - 0 - 5 V

Bus clock - 32 000 000 Hz 

This system read pulse data from IR key. 

Each team is always initialize the timer and at the end
it turns off and resets. I am put breakpoint on input capture and start. If not work input capture on long time - timer owerflow and work interrupt overflow... After first command, next all commands work input capture and all system work correctly.

THX.

0 项奖励
回复
1,190 次查看
dlp
Contributor I

 Sorry, all work! I am not disable pin IR LED ! After first step I am down this pin and all time after it input capture work!

 THX!

0 项奖励
回复