Creates a monitor for tracking interrupt sources on a card.
Namespace:
Quanser.HardwareAssembly: Quanser.Hardware.Hil (in Quanser.Hardware.Hil.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Function MonitorCreateInterruptReader ( _ channels As Integer() _ ) As Hil..::.Monitor |
C# |
---|
public Hil..::.Monitor MonitorCreateInterruptReader( int[] channels ) |
Visual C++ |
---|
public: Hil..::.Monitor^ MonitorCreateInterruptReader( array<int>^ channels ) |
JavaScript |
---|
function monitorCreateInterruptReader(channels); |
Parameters
- channels
- Type: array<
System..::.Int32
>[]()[]
An array containing the numbers of the interrupt sources to be tracked by the monitor. Channel numbers are zero-based. Thus, channel 0 is the first channel, channel 1 the second channel, etc.
Select a board type from the list for board-specific details: .
Return Value
Returns a Hil..::.Monitor interface for manipulating the monitor, including starting and stopping the monitor, and for reading the events collected by the monitor "in the background".Remarks
The MonitorCreateInterruptReader method creates a monitor for tracking interrupts from the given interrupt sources. The monitor allows other operations to be performed while it waits for events "in the background". The events are stored in an internal "monitor buffer" from which they can be read at any time using the ReadInterrupt(array<SByte>[]()[]) method.
The monitor does not actually start tracking the interrupt sources until the Start()()() method is called.
Examples
This example illustrates how to track interrupt sources using a monitor. The monitor tracks interrupt sources 0-3.
It waits for any one of these interrupts to occur once.
Exceptions are ignored for simplicity.
C# | Copy Code |
---|---|
int [] channels = { 0, 1, 2, 3 }; sbyte [] buffer = new sbyte [channels.Length]; Hil.Monitor monitor; monitor = card.MonitorCreateInterruptReader(channels); monitor.Start(); monitor.ReadInterrupt(buffer); monitor.Stop(); |
Visual Basic | Copy Code |
---|---|
Dim channels() As Integer = {0, 1, 2, 3} Dim buffer(channels.Length - 1) As SByte Dim monitor As Hil.Monitor monitor = card.MonitorCreateInterruptReader(channels) monitor.Start() monitor.ReadInterrupt(buffer) monitor.Stop() |
Visual C++ | Copy Code |
---|---|
array<int>^ channels = { 0, 1, 2, 3 }; array<char>^ buffer = gcnew array<char>(channels->Length); Hil::Monitor^ monitor; monitor = card->MonitorCreateInterruptReader(channels); monitor->Start(); monitor->ReadInterrupt(buffer); monitor->Stop(); |
Exceptions
Exception | Condition |
---|---|
Quanser.Hardware..::.HilException | If the monitor cannot be created then an exception is thrown. This situtation typically arises if the board does not support interrupt sources or monitors. |