8.8.2 ei Macro
A macro that enables interrupts.
Include
<xc.h>
Prototype
void ei(void);
Remarks
This macro inserts an sei
instruction, which enables global
interrupts.
Example
See the notes at the beginning of this chapter or section for
information on using printf()
or scanf()
(and other functions reading and writing the stdin
or
stdout
streams) in the example code.
unsigned int read_timer1(void)
{
unsigned int val;
di(); // disable interrupts
val = TCNT1; // read timer value register; TEMP used internally
ei(); // re-enable interrupts
return val;
}