Hello,
I use the following VB2008 code to control the PCSU1000:
Option Explicit On
Public Class MainForm
Dim DataBuffer1(0 To 5000) As Long
Dim DataBuffer2(0 To 5000) As Long
Dim SettingsArray(0 To 10) As Long
Private Declare Sub ReadCh1 Lib “DSOLink.dll” (ByVal Buffer As Long)
Private Declare Sub ReadCh2 Lib “DSOLink.dll” (ByVal Buffer As Long)
Private Declare Function DataReady Lib “DSOLink.dll” () As Boolean
Private Declare Sub Voltage1 Lib “PCSU1000D.dll” (ByVal Volts As Long)
Private Declare Sub Voltage2 Lib “PCSU1000D.dll” (ByVal Volts As Long)
Private Declare Sub Time Lib “PCSU1000D.dll” (ByVal Rate As Long)
Private Declare Sub RunOn Lib “PCSU1000D.dll” (ByVal Run_On As Long)
Private Declare Sub SingleOn Lib “PCSU1000D.dll” (ByVal Single_On As Long)
Private Declare Sub YPosition1 Lib “PCSU1000D.dll” (ByVal y_pos As Long)
Private Declare Sub YPosition2 Lib “PCSU1000D.dll” (ByVal y_pos As Long)
Private Declare Sub TrgOn Lib “PCSU1000D.dll” (ByVal trg_On As Long)
Private Declare Sub TrgLevel Lib “PCSU1000D.dll” (ByVal TrgLevel As Long)
Private Declare Sub TrgSource Lib “PCSU1000D.dll” (ByVal TrgLevel As Long)
Private Declare Sub TrgEdge Lib “PCSU1000D.dll” (ByVal Positive_Negative As Long)
Private Declare Sub Coupling1 Lib “PCSU1000D.dll” (ByVal AC_DC_GND As Long)
Private Declare Sub Coupling2 Lib “PCSU1000D.dll” (ByVal AC_DC_GND As Long)
Private Declare Sub Show_PCSU1000 Lib “PCSU1000D.dll” (ByVal Visible As Long)
Private Declare Sub Start_PCSU1000 Lib “PCSU1000D.dll” ()
Private Declare Sub Stop_PCSU1000 Lib “PCSU1000D.dll” ()
Private Declare Function GetSettings Lib “PCSU1000D.dll” (ByVal SettingsArray As Long) As Boolean
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Stop_PCSU1000()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Start_PCSU1000()
End Sub
Private Sub ReadData_BUT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReadData_BUT.Click
Dim i As Long
Output_LB.Items.Clear()
ReadCh1(DataBuffer1(0))
Output_LB.Items.Add(“Sample rate [Hz]” + Chr(9) + Str(DataBuffer1(0)))
Output_LB.Items.Add(“Full scale [mV]” + Chr(9) + Str(DataBuffer1(1)))
Output_LB.Items.Add(“GND level [counts]” + Chr(9) + Str(DataBuffer1(2)))
Output_LB.Items.Add("")
For i = 0 To 20
Output_LB.Items.Add(“Data(” + Str(i) + “)” + Chr(9) + Chr(9) + Str(DataBuffer1(i + 3)))
Next
End Sub
End Class
Execution fails on command: ReadCh1(DataBuffer1(0))
What is going wrong? I used the example from Velleman DLL manual.
Please advice and reply,
Regards
Christian