What happens when the SEI and CLI instructions are executed back-to-back? Are pending interrupts handled or not? I'm a little confused by the descriptions of these instructions:
SEI - Sets the Global Interrupt Flag (I) in SREG (Status Register). The instruction following SEI will be executed before any pending interrupts.
CLI - Clears the Global Interrupt Flag (I) in SREG (Status Register). The interrupts will be immediately disabled. No interrupt will be executed after the CLI instruction, even if it occurs simultaneously with the CLI instruction.
It looks like you need at least one instruction in between to ensure that the interrupts will be serviced. Is this correct?