8.9.1 builtin_avr_cli Built-in Function
Inserts a cli
instruction, which disables global interrupts.
Prototype
void __builtin_avr_cli(void);
Remarks
The di()
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;
}