Measurement-computing DAQFlex User Guide Manuel d'utilisateur Page 25

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 125
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 24
DAQFlex Software User's Guide DAQFlex Software Reference
25
If using a device that does not have an ID assigned, you must use the NameOnly or NameAndSerno
format with the DaqDeviceManager.CreateDevice() method in order to create the device. A device
with no ID will not be created when using the NameAndID and NameSernoAndID format with
CreateDevice().
DaqDeviceManager.CreateDevice()
Creates a DaqDevice object. The DaqDevice object contains the methods used to configure, read data
from, or write data to a device. With the DaqDevice object, all DAQ operations are configured using one
API method called DaqDevice.SendMessage() rather than using multiple operation-specific methods.
SendMessage() takes a single parameter called message. This parameter is a text-based command that
the DAQ device parses to configure a particular operation.
C#:
static CreateDevice(string deviceName);
VB:
Shared Function CreateDevice(ByVal deviceName As String) As DaqDevice
Parameter
deviceName
One of the device names returned by the DaqDeviceManager.GetDevicenames() method.
Return value
An instance of a DaqDevice object.
Remarks
Depending on the DeviceNameFormat, the CreateDevice() method creates a DaqDevice object for
the device whose name, name and serial number, name and id, or name, serial number and id are
contained in the deviceName parameter.
The resources associated with the DaqDevice object can be freed by calling the ReleaseDevice()
method.
The CreateDevice() method can only be called once for a specific device, unless the ReleaseDevice()
method is called.
If CreateDevice() is called more than once for a specific device without calling ReleaseDevice(), the
DaqDevice object throws an exception, indicating that a driver handle has already been created for
the device.
Refer to the following sample code:
C#
try
{
MyDevice = DaqDeviceManager.CreateDevice(deviceName);
}
catch (Exception ex)
{
// handle exception
}
VB
Try
MyDevice = DaqDeviceManager.CreateDevice(deviceName)
Catch Ex As Exception
' handle exception
End Try
Vue de la page 24
1 2 ... 20 21 22 23 24 25 26 27 28 29 30 ... 124 125

Commentaires sur ces manuels

Pas de commentaire