IntOn

Syntax:

    IntOn

Command Availability:

Available on Microchip PIC and Atmel AVR microcontrollers with interrupt support. Will be automatically removed on chips without interrupts.

Explanation:

IntOn is used to enable interrupts on the microcontroller after IntOff has disabled them. It should be used at the end of code that is timing-sensitive.

IntOn is removed from the assembled output if no interrupts are used anywhere in the program.

Example:

    #chip 16F628A, 4

    Dim CriticalValue As Word

    IntOff
    CriticalValue = ReadAD(AN0) * 2 + 1
    IntOn          ' <<< the IntOn instruction

Key line: IntOn — re-enables interrupts once the timing-sensitive sequence above has finished; any interrupt that occurred while disabled is processed immediately after this line runs.

See Also:

  • IntOff — disabling interrupts before timing-sensitive code, as used above
  • Interrupts — category overview