Interrupt Routines Best Practices

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

After fumbling around with the routines for setting up the Interrupt routines for various components (BLESS,ADC_SAR,Pins,TCPWM), I'm curious if there is a general approach to handling turning ISR's on and off during various parts of the application code?

   

 

   

So far, I've been calling the _Disable(); _Stop(); to turn off the ISR, but then I have to call _StartEx(); and _Enable(); when I turn it back on; What I want to know is if I should be merely enabling/disabling the ISR and that is good enough for turning off all of the hardware (as far as reducing power consumption during sleep/deepsleep/hibernate)?

   

Or should I be calling _Stop(); to ensure the component is drawing no current while not in use?

0 Likes
1 Solution
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted
        If using StartEx and Stop, then Enable and Disable are not required. Alternatively, after starting isr once by StartEx you can use Disable and Enable multiple times, which may be slightly faster than calling StartEx every time (takes about 50 CPU ticks to execute). The results are the same. Can't comment on power consumption, but suspect no difference.   

View solution in original post

0 Likes
2 Replies
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted
        If using StartEx and Stop, then Enable and Disable are not required. Alternatively, after starting isr once by StartEx you can use Disable and Enable multiple times, which may be slightly faster than calling StartEx every time (takes about 50 CPU ticks to execute). The results are the same. Can't comment on power consumption, but suspect no difference.   
0 Likes
Anonymous
Not applicable

Good to know; I did look under the start/stop routines and saw that it called the enable/disable functions, but wasn't sure if I should be calling those directly or not. Thanks 🙂

0 Likes