Constructs a Hil object and opens the specified card of the given type.

Namespace:  Quanser.Hardware
Assembly:  Quanser.Hardware.Hil (in Quanser.Hardware.Hil.dll)

Syntax

Visual Basic (Declaration)
Public Sub New ( _
	cardType As String, _
	cardIdentifier As String _
)
C#
public Hil(
	string cardType,
	string cardIdentifier
)
Visual C++
public:
Hil(
	String^ cardType, 
	String^ cardIdentifier
)
JavaScript
Quanser.Hardware.Hil = function(cardType, cardIdentifier);

Parameters

cardType
Type: System..::.String
A string identifying the type of card. For example, the string "q8" opens the first Quanser Q8 card in the system.
cardIdentifier
Type: System..::.String
A string identifying the particular board among all the boards of the same type. This parameter is only used when there is more than one board of the given type in the computer. The string is typically a number indicating the card number. Card numbers start at 0 and are numbered sequentially. The identifier of a card is often determined by the order in which the operating systems enumerates the hardware. Some card types allow symbolic identifiers, such as "Dev1". The National Instruments cards allow symbolic identifiers under the Windows target. These identifiers are assigned using NI Measurement and Automation Explorer.

Remarks

Using this constructor is equivalent to calling the Open(String, String) method after initialize the Hil object.

Examples

This sample illustrates how to use this constructor for the Hil class. It opens the second Q8 card in the system. Note that the first card has identifier "0" and the second card has identifier "1".
C# Copy Code
try {
    Hil card = new Hil("q8", "1"); /* open second Q8 card in system */
    try {
        /* ... use card ... */

    } catch (Exception ex) {
        Console.WriteLine("Exception occurred accessing card. " + ex);
    }
    card.Close();
} catch (Exception ex) {
    Console.WriteLine("Exception occurred opening card. " + ex);
}
Visual Basic Copy Code
Try
    Dim card As New Hil("q8", "1") ' open second Q8 card in system
    Try
        ' ... use card ...

    Catch ex As Exception
        Console.WriteLine("Exception occurred accessing card. " & ex.ToString())
    End Try
    card.Close()
Catch ex As Exception
    Console.WriteLine("Exception occurred opening card. " & ex.ToString())
End Try
Visual C++ Copy Code
try {
    Hil^ card = gcnew Hil(L"q8", L"1"); /* open second Q8 card in system */
    try {
        /* ... use card ... */

    } catch (Exception^ ex) {
        Console.WriteLine(L"Exception occurred accessing card. " + ex);
    }
    card->Close();
} catch (Exception^ ex) {
    Console.WriteLine(L"Exception occurred opening card. " + ex);
}

Exceptions

ExceptionCondition
Quanser.Hardware..::.HilException If the open cannot be performed then an exception is thrown. This situtation typically arises if the requested card is not present.

See Also