First page Back Continue Last page Overview Graphics
Interrupt Enable Flag
CLI ; clear the I flag (enable interrupts)
Interrupts may be globally disabled by setting the I flag to one.
On reset the I flag is set.
Clear the I flag to enable interrupts.
Interrupt enable/disable instructions:
- SEI ; set the I flag (disable interrupts)
Each individual interrupt source has its own interrupt enable bit. This allows the programmer to enable only the interrupts that are needed for a particular system.
For example, the serial communications port can be set up to generate an interrupt only when a byte of data is received. This is done by setting an interrupt enable bit for the communications receive.
The I flag is a global interrupt enable/disable bit. All of the interrupt sources are gated with the I flag. If the I flag is set, none of the interrupts will be seen by the processor hardware. This allows the programmer to easily disable/enable all interrupts.
If a particular section of code is time sensitive, it may be necessary to disable all interrupts while executing that code in order to prevent an interrupt from slowing the execution. To do this, an SEI instruction is placed before the time sensitive code and a CLI instruction is placed after the time sensitive code to make sure no interrupts occur in the time sensitive code. The interrupt response time can be adversely affected when interrupts are disabled.