11 years, 3 months ago.

Disabling Ticker

I'm writing a program that requires interrupts to be disabled while some variables are being updated. I'm aware of _disable_irq() and Ticker.detach() and have used them in previous projects. My problem with this one is that I need very tight timing and I feel like disabling the entire interrupt system (which I think _disable_irq()) does or detaching/attaching the function will take too long.

I wrote this program for an LPCXpresso LPC1769 and there was an easy way of turning off the timer, basically stopping the counter register from updating. Is there a similar thing I can do for the LPC1768 MBED? Or will it just be easier to use the functions mentioned above?

1 Answer

11 years, 3 months ago.

Hello Ankit Patel,

if I understood correctly, you want to disable only interrupts from timer ?

Is this a function you are looking for: us_ticker_disable_interrupt() ? It's disables match interrupt (sets MCR to 0). But it's inside HAL and not available for invoking from an application. Write your own routine.

Regards, 0xc0170

Accepted Answer

That's precisely what I was looking for. How would I write that routine? Is it just accessing the configuration registers?

posted by Ankit Patel 08 Aug 2013

This should work right?

LPC_TIM0->MCR |= 1 << 0;

Or something along those lines. If this is the correct register, I'll just find which bit I need to be changing. Thanks for your help!

posted by Ankit Patel 08 Aug 2013

dont OR that does not help, if there has been 1 ( there is). use &= 1;

posted by Martin Kojtal 08 Aug 2013

Oh yeah, that's what I meant. I just changed the 1 to a 0 from the example.. Silly me. Thanks!

posted by Ankit Patel 08 Aug 2013