9S12XEP100 ECT Interrupt not work in first time

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

9S12XEP100 ECT Interrupt not work in first time

Jump to solution
1,368 Views
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...

Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
1,187 Views
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.

View solution in original post

0 Kudos
Reply
3 Replies
1,188 Views
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 Kudos
Reply
1,187 Views
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 Kudos
Reply
1,187 Views
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 Kudos
Reply