30.12.2014 Views

TIMER - AN0014 - Application Note - Energy Micro

TIMER - AN0014 - Application Note - Energy Micro

TIMER - AN0014 - Application Note - Energy Micro

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

3 Interrupts, PRS and DMA<br />

...the world's most energy friendly microcontrollers<br />

The timer has 5 output events that can trigger an interrupt. All except the buffer overflow also trigger a<br />

PRS Signal and a DMA request:<br />

• Counter Underflow<br />

• Counter Overflow<br />

• Compare match, input capture or buffer overflow (one per Compare/Capture channel)<br />

To enable one or more interrupts, <strong>TIMER</strong>n_IEN register must be written with the corresponding interrupt<br />

enable bits. Also, the NVIC vector for the corresponding interrupt line must be enabled.<br />

There is also a function available on the emlib to activate timer interrupts: void<br />

<strong>TIMER</strong>_IntEnable(<strong>TIMER</strong>_TypeDef *timer, uint32_t flags);<br />

The <strong>TIMER</strong> always generates Reflex outputs (one HFPERCLK cycle pulse), on the above output events<br />

regardless of the <strong>TIMER</strong>n_IEN register or if it is selected by a PRS channel.<br />

If an interrupt is generated the interrupt flag can be read from the <strong>TIMER</strong>n_IF register and cleared by<br />

writing <strong>TIMER</strong>n_IFC.<br />

2013-05-08 - an0014_Rev1.07 4 www.energymicro.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!