8.9.9 builtin_avr_sei Built-in Function

Inserts a sei instruction, which enables global interrupts.

Prototype

void __builtin_avr_sei(void);

Remarks

The ei() macro, available once you have included the <xc.h> header in your code, performs a similar task.

Example

unsigned int read_timer1(void)
{
  unsigned int val;

  __builtin_avr_cli(); // disable interrupts
  val = TCNT1;         // read timer value register; TEMP used internally
  __builtin_avr_sei(); // re-enable interrupts
  return val;
}