Bonjour je cherche à utiliser la commande : Private Declare Sub ReadBackAnalogOut Lib “k8061.dll” (ByVal CardAddress As Long, Buffer As
Long) mais je n’y arrive pas
j’ai l’erreur suivante : Error 1 Value of type ‘1-dimensional array of Long’ cannot be converted to ‘Long’.
je souhaite par exemple recuperer la valeur de la sortie analogique 2 de la carte 0 avec cette commande,
si quelqu’un peut m’indiquer comment utiliser correctement cette commande ca serait super génial merci
For VB .NET you have to declare the DLL functions like this:
[code] Private Declare Function OpenDevice Lib “k8061.dll” () As Integer
Private Declare Sub CloseDevices Lib “k8061.dll” ()
Private Declare Function PowerGood Lib “k8061.dll” (ByVal CardAddress As Integer) As Boolean
Private Declare Function Connected Lib “k8061.dll” (ByVal CardAddress As Integer) As Boolean
Private Declare Function ReadAnalogChannel Lib “k8061.dll” (ByVal CardAddress As Integer, ByVal Channel As Integer) As Integer
Private Declare Sub ReadAllAnalog Lib “k8061.dll” (ByVal CardAddress As Integer, ByRef Buffer As Integer)
Private Declare Sub ReadCounters Lib "k8061.dll" (ByVal CardAddress As Integer, ByRef Buffer As Integer)
Private Declare Sub ResetCounters Lib "k8061.dll" (ByVal CardAddress As Integer)
Private Declare Sub OutputAnalogChannel Lib "k8061.dll" (ByVal CardAddress As Integer, ByVal Channel As Integer, ByVal Data As Integer)
Private Declare Sub OutputAllAnalog Lib "k8061.dll" (ByVal CardAddress As Integer, ByRef Buffer As Integer)
Private Declare Sub ClearAnalogChannel Lib "k8061.dll" (ByVal CardAddress As Integer, ByVal Channel As Integer)
Private Declare Sub SetAllAnalog Lib "k8061.dll" (ByVal CardAddress As Integer)
Private Declare Sub ClearAllAnalog Lib "k8061.dll" (ByVal CardAddress As Integer)
Private Declare Sub SetAnalogChannel Lib "k8061.dll" (ByVal CardAddress As Integer, ByVal Channel As Integer)
Private Declare Sub OutputAllDigital Lib "k8061.dll" (ByVal CardAddress As Integer, ByVal Data As Integer)
Private Declare Sub ClearDigitalChannel Lib "k8061.dll" (ByVal CardAddress As Integer, ByVal Channel As Integer)
Private Declare Sub ClearAllDigital Lib "k8061.dll" (ByVal CardAddress As Integer)
Private Declare Sub SetDigitalChannel Lib "k8061.dll" (ByVal CardAddress As Integer, ByVal Channel As Integer)
Private Declare Sub SetAllDigital Lib "k8061.dll" (ByVal CardAddress As Integer)
Private Declare Function ReadDigitalChannel Lib "k8061.dll" (ByVal CardAddress As Integer, ByVal Channel As Integer) As Boolean
Private Declare Function ReadAllDigital Lib "k8061.dll" (ByVal CardAddress As Integer) As Integer
Private Declare Sub OutputPWM Lib "k8061.dll" (ByVal CardAddress As Integer, ByVal Data As Integer)
Private Declare Function ReadBackDigitalOut Lib "k8061.dll" (ByVal CardAddress As Integer) As Integer
Private Declare Sub ReadBackAnalogOut Lib "k8061.dll" (ByVal CardAddress As Integer, ByRef Buffer As Integer)
Private Declare Function ReadBackPWMOut Lib "k8061.dll" (ByVal CardAddress As Integer) As Integer[/code]
avec ceci ReadBackAnalogOut(0, lngAnalogOut(0)) j’ai l’erreure suivante :
System.AccessViolationException was unhandled
Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
The following functions and one button “Read Back Output” added:
Private Declare Function ReadBackDigitalOut Lib "k8061.dll" (ByVal CardAddress As Integer) As Integer
Private Declare Sub ReadBackAnalogOut Lib "k8061.dll" (ByVal CardAddress As Integer, ByRef Buffer As Integer)
Private Declare Function ReadBackPWMOut Lib "k8061.dll" (ByVal CardAddress As Integer) As Integer
merci je n’avais pas vue pour la CardAddress maintenant je n’ai plus l’erreur , pardonnez moi d’abuser encore un peu comment traiter cette commande pour avoir par exemple la valeur de la sortie analogique 1 de la carte 0 dans un label.text