Constructs a Hil object and opens the first card of the given type.
Namespace:
Quanser.HardwareAssembly: Quanser.Hardware.Hil (in Quanser.Hardware.Hil.dll)
Syntax
| Visual Basic (Declaration) |
|---|
Public Sub New ( _ cardType As String _ ) |
| C# |
|---|
public Hil( string cardType ) |
| Visual C++ |
|---|
public: Hil( String^ cardType ) |
| JavaScript |
|---|
Quanser.Hardware.Hil = function(cardType); |
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.
Remarks
Using this constructor is equivalent to calling the Open(String)
method after initialize the Hil object.
Examples
This sample illustrates how to use this constructor for the Hil class.
It opens the first Q8 card in the system.
| C# | |
|---|---|
try {
Hil card = new Hil("q8"); /* open first 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 | |
|---|---|
Try
Dim card As New Hil("q8") ' open first 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++ | |
|---|---|
try {
Hil^ card = gcnew Hil(L"q8"); /* open first 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
| 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. |