InterruptPort Class

Represents an interrupt port.

Namespace: Microsoft.SPOT.Hardware
Assembly: Microsoft.SPOT.Hardware (in


public sealed class InterruptPort : InputPort


This class cannot be inherited.

When configuring an interrupt port, note the differences between level and nonlevel interrupts. Level interrupts, which are either InterruptEdgeLevelHigh or InterruptEdgeLevelLow interrupts, are dispatched when the value on a pin matches the specified high value or low value, respectively. The system dispatches only the first occurrence of a level interrupt until it is cleared by means of the ClearInterrupt method. With nonlevel interrupts, every specified edge is dispatched, and the ClearInterrupt method throws an InvalidOperationException.

In practice, it is best to use level interrupts when the interrupt condition needs to be checked only periodically.

It is possible to configure an InterruptPort object into an invalid state. In such cases, your program may not generate an exception until it actually uses the InterruptPort object. For example, suppose you create an InterruptPort object with its resistor mode set to Port.ResistorMode.PullUp, the interrupt mode set to Port.InterruptMode.InterruptEdgeLevelHigh, and the glitch filter set to true. This configuration does not generate an exception when you instantiate an InterruptPort object. If you then add an interrupt handler, the .NET Micro Framework throws an exception.

Version Information

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, 4.1, and 4.2.

See Also


InterruptPort Members
Microsoft.SPOT.Hardware Namespace