Samples per second by vb6 with PCS10

In the technical data from the Product PCS10 it gives 100 Samples/Second. I need 80 Samples per Second. How I can get this? I changed the timer interval to 1 ms. The result is what I get only 20 Samples per Second. I use only the second chanel for my project.

Here is the VB6 Code for testing:

Option Explicit

'Declare use of the DLL
'K8047D.DLL interface

'GENERAL PROCEDURES
Private Declare Sub StartDevice Lib “k8047d.dll” ()
Private Declare Sub StopDevice 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)
Private Declare Sub LEDon Lib “k8047d.dll” ()
Private Declare Sub LEDoff Lib “k8047d.dll” ()

'Declare variables
Dim DataBuffer(0 To 7) As Long

Private Sub Check1_Click()
If Check1.Value = 1 Then LEDon Else LEDoff
End Sub

Private Sub Command2_Click()
Timer1.Enabled = False
Exit Sub
End Sub

Private Sub Form_Load()
StartDevice
SetGain 2, 10
End Sub

Private Sub Form_Terminate()
StopDevice
End Sub
Private Sub Command1_Click()
Dim i As Integer

Timer1.Interval = 10
End Sub
Private Sub Timer1_Timer()
Dim s As String
ReadData DataBuffer(0)
s = “”

    s = DataBuffer(3)

List1.AddItem Time & "        " & s

End Sub

On this downloads page there is a faster version of the PCS10/K8047 software available:
velleman.eu/distributor/supp … 8047&type=

Please download the package: “DLL for K8047 (PCS10) for faster communication”.
Extract it and copy the files K8047D.DLL and the K8047E.EXE from this package to your Visual Basic project folder and to the Windows\System32 folder.
(Copy to the folder SysWOW64 if you have a 64-bit operating system.)

You can use this kind of code to “see” some data:

Private Sub Command1_Click() Dim i As Integer Dim j As Integer Dim s As String For j = 0 To 10 ReadData DataBuffer(0) s = "" For i = 0 To 5 s = s + Str(DataBuffer(i)) + Chr(9) Next i List1.AddItem s Next j End Sub
No need to use the timer.

You can use the “time stamps” (the two first data bytes) to check the time.

It is not possible to change the sampling interval. It is fixed in the hardware to 10ms.

I have this *.dll for faster comunication. But it’s not enough. I get only 20 Samples per Second. If I use PcLab200E and print the values in a file (Option Save Date from Pull Down Menu) I have 100 rows per Second. How you make this? With the VB Sample what you show me i can’t get this sample rate. Only max. 20 Samples/Second. I nedd the source-code from PcLab200E or show me a way how I can get the time step from 100 S/s. I will use the same rate in my VB-Project.

Here’s a print from PcLab200E:

START: 25.01.2011 07:35:11
STOP : 25.01.2011 07:35:21

TIME STEP:
100 = 1s

VOLTAGE RANGE:
CH1: 255 = 30V CH3: 255 = 30V
CH2: 255 = 3V CH4: 255 = 30V

N CH1 CH2 CH3 CH4 Time/s CH1/V CH2/V CH3/V CH4/V

0 112 153 0 0 0,00 13,176 1,800 0,000 0,000
1 112 153 0 0 0,01 13,176 1,800 0,000 0,000
2 112 153 0 0 0,02 13,176 1,800 0,000 0,000
3 112 153 0 0 0,03 13,176 1,800 0,000 0,000
4 112 153 0 0 0,04 13,176 1,800 0,000 0,000
5 112 153 0 0 0,05 13,176 1,800 0,000 0,000
6 112 154 0 0 0,06 13,176 1,812 0,000 0,000
7 112 153 0 0 0,07 13,176 1,800 0,000 0,000
8 112 154 0 0 0,08 13,176 1,812 0,000 0,000
9 112 153 0 0 0,09 13,176 1,800 0,000 0,000
10 112 154 0 0 0,10 13,176 1,812 0,000 0,000
11 112 153 0 0 0,11 13,176 1,800 0,000 0,000
12 112 154 0 0 0,12 13,176 1,812 0,000 0,000
13 112 154 0 0 0,13 13,176 1,812 0,000 0,000
14 112 154 0 0 0,14 13,176 1,812 0,000 0,000
15 112 154 0 0 0,15 13,176 1,812 0,000 0,000
16 112 154 0 0 0,16 13,176 1,812 0,000 0,000
17 112 154 0 0 0,17 13,176 1,812 0,000 0,000
18 112 154 0 0 0,18 13,176 1,812 0,000 0,000
19 112 154 0 0 0,19 13,176 1,812 0,000 0,000
20 112 154 0 0 0,20 13,176 1,812 0,000 0,000
21 112 154 0 0 0,21 13,176 1,812 0,000 0,000
22 112 154 0 0 0,22 13,176 1,812 0,000 0,000
23 112 154 0 0 0,23 13,176 1,812 0,000 0,000
24 112 154 0 0 0,24 13,176 1,812 0,000 0,000
25 112 154 0 0 0,25 13,176 1,812 0,000 0,000
26 112 155 0 0 0,26 13,176 1,824 0,000 0,000
27 112 154 0 0 0,27 13,176 1,812 0,000 0,000
28 112 155 0 0 0,28 13,176 1,824 0,000 0,000
29 112 155 0 0 0,29 13,176 1,824 0,000 0,000
30 112 155 0 0 0,30 13,176 1,824 0,000 0,000
31 112 155 0 0 0,31 13,176 1,824 0,000 0,000
32 112 155 0 0 0,32 13,176 1,824 0,000 0,000
33 112 155 0 0 0,33 13,176 1,824 0,000 0,000
34 112 154 0 0 0,34 13,176 1,812 0,000 0,000
35 112 154 0 0 0,35 13,176 1,812 0,000 0,000
36 112 154 0 0 0,36 13,176 1,812 0,000 0,000
37 112 153 0 0 0,37 13,176 1,800 0,000 0,000
38 112 153 0 0 0,38 13,176 1,800 0,000 0,000
39 112 153 0 0 0,39 13,176 1,800 0,000 0,000
40 112 152 0 0 0,40 13,176 1,788 0,000 0,000
41 112 152 0 0 0,41 13,176 1,788 0,000 0,000
42 112 151 0 0 0,42 13,176 1,776 0,000 0,000
43 112 151 0 0 0,43 13,176 1,776 0,000 0,000
44 112 150 0 0 0,44 13,176 1,765 0,000 0,000
45 111 149 0 0 0,45 13,059 1,753 0,000 0,000
46 112 149 0 0 0,46 13,176 1,753 0,000 0,000
47 111 149 0 0 0,47 13,059 1,753 0,000 0,000
48 112 148 0 0 0,48 13,176 1,741 0,000 0,000
49 111 148 0 0 0,49 13,059 1,741 0,000 0,000
50 111 148 0 0 0,50 13,059 1,741 0,000 0,000
51 111 148 0 0 0,51 13,059 1,741 0,000 0,000
52 112 148 0 0 0,52 13,176 1,741 0,000 0,000
53 111 147 0 0 0,53 13,059 1,729 0,000 0,000
54 112 148 0 0 0,54 13,176 1,741 0,000 0,000
55 111 147 0 0 0,55 13,059 1,729 0,000 0,000
56 111 147 0 0 0,56 13,059 1,729 0,000 0,000
57 111 147 0 0 0,57 13,059 1,729 0,000 0,000
58 111 147 0 0 0,58 13,059 1,729 0,000 0,000
59 111 147 0 0 0,59 13,059 1,729 0,000 0,000
60 111 147 0 0 0,60 13,059 1,729 0,000 0,000
61 111 147 0 0 0,61 13,059 1,729 0,000 0,000
62 112 147 0 0 0,62 13,176 1,729 0,000 0,000
63 111 147 0 0 0,63 13,059 1,729 0,000 0,000
64 112 147 0 0 0,64 13,176 1,729 0,000 0,000
65 111 147 0 0 0,65 13,059 1,729 0,000 0,000
66 111 147 0 0 0,66 13,059 1,729 0,000 0,000
67 111 147 0 0 0,67 13,059 1,729 0,000 0,000
68 111 147 0 0 0,68 13,059 1,729 0,000 0,000
69 111 147 0 0 0,69 13,059 1,729 0,000 0,000
70 111 148 0 0 0,70 13,059 1,741 0,000 0,000
71 111 147 0 0 0,71 13,059 1,729 0,000 0,000
72 112 148 0 0 0,72 13,176 1,741 0,000 0,000
73 111 147 0 0 0,73 13,059 1,729 0,000 0,000
74 112 147 0 0 0,74 13,176 1,729 0,000 0,000
75 111 147 0 0 0,75 13,059 1,729 0,000 0,000
76 112 148 0 0 0,76 13,176 1,741 0,000 0,000
77 111 148 0 0 0,77 13,059 1,741 0,000 0,000
78 112 148 0 0 0,78 13,176 1,741 0,000 0,000
79 111 148 0 0 0,79 13,059 1,741 0,000 0,000
80 112 148 0 0 0,80 13,176 1,741 0,000 0,000
81 111 148 0 0 0,81 13,059 1,741 0,000 0,000
82 112 148 0 0 0,82 13,176 1,741 0,000 0,000
83 111 148 0 0 0,83 13,059 1,741 0,000 0,000
84 112 148 0 0 0,84 13,176 1,741 0,000 0,000
85 111 148 0 0 0,85 13,059 1,741 0,000 0,000
86 111 148 0 0 0,86 13,059 1,741 0,000 0,000
87 111 148 0 0 0,87 13,059 1,741 0,000 0,000
88 112 148 0 0 0,88 13,176 1,741 0,000 0,000
89 111 148 0 0 0,89 13,059 1,741 0,000 0,000
90 112 149 0 0 0,90 13,176 1,753 0,000 0,000
91 111 149 0 0 0,91 13,059 1,753 0,000 0,000
92 112 149 0 0 0,92 13,176 1,753 0,000 0,000
93 111 149 0 0 0,93 13,059 1,753 0,000 0,000
94 112 149 0 0 0,94 13,176 1,753 0,000 0,000
95 111 149 0 0 0,95 13,059 1,753 0,000 0,000
96 112 149 0 0 0,96 13,176 1,753 0,000 0,000
97 111 149 0 0 0,97 13,059 1,753 0,000 0,000
98 112 149 0 0 0,98 13,176 1,753 0,000 0,000
99 111 149 0 0 0,99 13,059 1,753 0,000 0,000
100 112 149 0 0 1,00 13,176 1,753 0,000 0,000

It seems that your program is still using the old K8047e.exe file.
It allows only 20 samples / second to read.

Here below is the code I use and get all the samples.
You can see in this screenshot that all the samples are read.
The same sample may be read even twice to the VB6 program.

Here is the link to download my VB6 project files:
box.net/shared/bml65r9nhs

Here is the VB6 code I used:

[code]Option Explicit

'Declare use of the DLL
'K8047D.DLL interface

'GENERAL PROCEDURES
Private Declare Sub StartDevice Lib “k8047d.dll” ()
Private Declare Sub StopDevice 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)
Private Declare Sub LEDon Lib “k8047d.dll” ()
Private Declare Sub LEDoff Lib “k8047d.dll” ()

'Declare variables
Dim DataBuffer(0 To 7) As Long

Private Sub Check1_Click()
If Check1.Value = 1 Then LEDon Else LEDoff
End Sub

Private Sub Form_Load()
StartDevice
End Sub

Private Sub Form_Terminate()
StopDevice
End Sub
Private Sub Command1_Click()
Dim i As Integer
Dim j As Integer
Dim s As String
List1.Clear
For j = 0 To 15
ReadData DataBuffer(0)
s = “”
For i = 0 To 5
s = s + Str(DataBuffer(i)) + Chr(9)
Next i
List1.AddItem s
Next j
End Sub

Private Sub Option1_Click(Index As Integer)
SetGain 1, Index
End Sub

Private Sub Option2_Click(Index As Integer)
SetGain 2, Index
End Sub

Private Sub Option3_Click(Index As Integer)
SetGain 3, Index
End Sub

Private Sub Option4_Click(Index As Integer)
SetGain 4, Index
End Sub [/code]

Thanks for your help. It’s right I had the old K8047e. Now my problem with the sample rate is finished

My problem with the samples per second is not full finished. With the new K8047E I get 64 Samples per second. Not enaugh. I need 125 Samples per Seconds, it’s a sample rate from 8ms. Now I have 15ms with the new K8047E. Is it possible to make this file a little bit faster 125 or 140 S/s?

best regards

Sorry, the 100 samples/second is fixed to the firmware of the K8047. It is not possible to increase the sample rate.
It is strange why you get only 64 samples/second.
It should be possible to read all the samples the K8047 sends.
This loop reads 16 “rows” of the samples as you can see in the screenshot in the previous post:

For j = 0 To 15 ReadData DataBuffer(0) s = "" For i = 0 To 5 s = s + Str(DataBuffer(i)) + Chr(9) Next i List1.AddItem s Next j

All the samples at the interval of 10ms are read from the K8047.
Some samples are read twice (as you can see looking the time stamps in the screenshot).