9S12XEP100 ECT Interrupt not work in first time

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

9S12XEP100 ECT Interrupt not work in first time

ソリューションへジャンプ
1,378件の閲覧回数
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,197件の閲覧回数
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,198件の閲覧回数
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,197件の閲覧回数
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,197件の閲覧回数
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 件の賞賛
返信