Hello, i’m trying to get data out of K8047 into my older application for K8055. With K8055 it worked well. With K8047 I can’t get data out of it.
I’m not succesfull writing “ReadData” into the program as in the visual basic example from the documentation.
Your help will be appreciated
My code is:
Private Declare Sub StartDevice Lib "k8047d.dll" ()
Private Declare Sub StopDevice Lib "k8047d.dll" ()
Private Declare Sub LEDon Lib "k8047d.dll" ()
Private Declare Sub LEDoff Lib "k8047d.dll" ()
'INPUT PROCEDURE
Private Declare Sub ReadData Lib "k8047d.dll" (Array_Pointer As Long)
'OUTPUT PROCEDURE
Private Declare Sub SetGain Lib "k8047d.dll" (ByVal Channel_no As Long, ByVal Gain As Long)
'Declare variables
Dim DataBuffer(0 To 7) As Long
'Dim CardAddress As Integer
Dim Channel As Integer
Dim a, b, c, d, e, f, g, h, i, j, k, l, m, q, aoud, boud, coud, doud, hysa, hysb, hysc, hysd, Uur, Minuut, Tijd, Dag As Integer
Dim Data00, Data01, Data02, Data03, Data04, Data05, Data06, Data07 As Integer
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Disposed, Timer1.Tick
Select Case j
Case Is < 8
ReadData(DataBuffer(0))
Data00 = DataBuffer(0)
Data01 = DataBuffer(1)
Data02 = DataBuffer(2)
Data03 = DataBuffer(3)
a = Data00
b = Data01
c = Data02
d = Data03
hysa = 0
Tijdklok.Text = TimeOfDay()
If j = 0 Then
Db1DataSet.db1.Rows.Add(Now(), Data00, Data01, Data02, Data03)
j = 1
End If
If Second(TimeOfDay) > 50 And Second(TimeOfDay) < 55 Then
l = 0
m = 0
End If
If (((Second(TimeOfDay) = 0) And ((a - aoud >= hysa) Or (aoud - a > hysa) Or (b - boud > hysb) Or (boud - b > hysb)))) Then
l = l + 1
Db1DataSet.db1.Rows.Add(Now(), Data00, Data01, Data02, Data03)
k = 0
aoud = a
boud = b
coud = c
doud = d
'TextBox1.Text = k
Me.Db1TableAdapter.Update(Me.Db1DataSet.db1)
End If
If (Minute(TimeOfDay) = 0 And Second(TimeOfDay) = 5 And m = 0) Then
m = m + 1
instance = Now()
returnDate = instance.ToShortDateString
Tijd = 100 * Hour(TimeOfDay) + Minute(TimeOfDay)
FilenameSave = ("C:\Meetwaarden\A" & returnDate & "_" & Tijd & ".mdb")
My.Computer.FileSystem.CopyFile("db1.mdb", FilenameSave, True)
TextBox1.Text = FilenameSave
End If
Case 8
'ClearDigitalChannel(8)
'SetDigitalChannek(1)
j = 1
End Select
End Sub
End Class