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

  • 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 13
DAQFlex Software User's Guide Using DAQFlex Software
14
Reading a digital bit
C#
// Read the value of digital port 0, bit 0
String[] Devices;
DaqDevice MyDevice;
DaqResponse Response;
try
{
// Get a list of message-based DAQ devices
Devices = DaqDeviceManager.GetDeviceNames(DeviceNameFormat.NameAndSerno);
// Get a DaqDevice object for device 0
MyDevice = DaqDeviceManager.CreateDevice(Devices[0]);
// Read and display the daq response
MyDevice.SendMessage("DIO{0/0}:DIR=IN");
Response = MyDevice.SendMessage("?DIO{0/0}:VALUE");
label1.Text = Response.ToString();
}
catch (Exception ex)
{
// handle error
label1.Text = ex.Message;
}
VB
' Read the value of digital port 0, bit 0
Dim MyDevice As DaqDevice
Dim Response As DaqResponse
Dim Devices As String ()
Try
' Get a list of message-based DAQ devices
Devices = DaqDeviceManager.GetDeviceNames(DeviceNameFormat.NameAndSerno)
' Get a DaqDevice object for device 0
MyDevice = DaqDeviceManager.CreateDevice(Devices(0))
' Read and display the daq response
MyDevice.SendMessage("DIO{0/0}:DIR=IN")
Response = MyDevice.SendMessage("?DIO{0/0}:VALUE")
Label1.Text = Response.ToString()
Catch Ex As Exception
' handle error
Label1.Text = Ex.Message
End Try
Vue de la page 13
1 2 ... 9 10 11 12 13 14 15 16 17 18 19 ... 124 125

Commentaires sur ces manuels

Pas de commentaire