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 Open ( _
cardType As String, _
cardIdentifier As String _
) |
C# |
---|
public void Open(
string cardType,
string cardIdentifier
) |
Visual C++ |
---|
public:
void Open(
String^ cardType,
String^ cardIdentifier
) |
JavaScript |
---|
function open(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.
Examples
This sample illustrates how to use the
Open(String, String) method.
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();
/* Open the second Q8 card in the system */
card.Open("q8", "1");
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()
' Open the second Q8 card in the system
card.Open("q8", "1")
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();
/* Open the second Q8 card in the system */
card->Open(L"q8", L"1");
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
Exception | Condition |
---|
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