Fast output from K8055

Hi,
I’m using the excellent K8055 for an application that demands fastest possible reading of 2 digital & 2 analogue inputs. Each read command appears to take 8mS. I can save a bit of time by using ReadAllAnalog & ReadAllDigital, but that still leaves me with 2 commands = 16mS. I wonder if there is a single command that would send all data? - it doesnt matter if this is in a messy format because the data is stored for later analysis.
Thanks, AlanF

In the original source there was a ReadAll function to read all the data with a single command. That function was commented off in the final release version.
I uncommented (and slightly modified) that section of the code to get the ReadAll work again. Also I added one button to the demo software, so you may test this new feature.
There is Delphi source code included both for the DLL and the demo program.

The use of the ReadAll is quite simple:
Just pass a pointer to an array of eight (or more) 32bit integers.

The function returns following data to the array:

  • Digital input status
  • Card number (jumper setting) +1
  • Analog channel 1 value
  • Analog channel 2 value
  • Counter 1 LSB
  • Counter 1 MSB
  • Counter 2 LSB
  • Counter 2 MSB

You may download the software from: vel255.diinoweb.com/files/K8055_ReadAll.zip

Here an example how to use it in VB6.0

Private Declare Sub ReadAll Lib "k8055d.dll" (data As Long)

Private Sub Command3_Click() Dim i As Integer Dim data(0 To 7) As Long ReadAll data(0) Label5.Caption = "" For i = 0 To 7 Label5.Caption = Label5.Caption & data(i) & " " Next i End Sub

Thanks!! - The demo works fine but trying to call ReadAll from VB gives

“453: Specified DLL function not found”

This may be just a syntax issue because I am using a specialised variant of VB (EPrime e-basic), but the other dll functions work fine. Any ideas?

regards, AlanF

To be sure that the VB finds the new DLL, please copy it to Windows\System32 folder.

  • Copy it to your application folder too.

I had a bit of a struggle to get it to run in Visual Studio 2005 but it turns out the array is read as Integer not Long. This works -

Private Declare Sub ReadAll Lib “k8055d.dll” (ByRef Data As Integer)

Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
Dim i As Integer
Dim data(0 To 7) As Integer
ReadAll(data(0))
Label8.Text = “”
For i = 0 To 7
Label8.Text = Label8.Text & data(i) & " "
Next i
End Sub

Many thanks for your help.

Nice that you got it working - hope it is faster now…

Nice too that you noted that all “As Long” must be changed to “As Integer” when using VB 2005. Also you noted that the argument passing method is changed: “ByRef” is no longer the default method of passing arguments - now you have to define it.

Quote from: Help for Visual Basic 6.0 Users
Procedure Changes for Visual Basic 6.0 Users
msdn2.microsoft.com/en-us/library/kehz1dz1.aspx

I think you have also changed:

Private Declare Sub ReadAllAnalog Lib "k8055d.dll" (Data1 As Long, Data2 As Long)

to

Private Declare Sub ReadAllAnalog Lib "k8055d.dll" (ByRef Data1 As Integer, ByRef Data2 As Integer)in VB2005.

[quote=“VEL255”]In the original source there was a ReadAll function to read all the data with a single command. That function was commented off in the final release version.
I uncommented (and slightly modified) that section of the code to get the ReadAll work again.
[/quote]

The sizes of orginal releases of K8055D.DLL and the new one with ReadAll function are respectively 22KB and 343KB.

How this change can generate such a difference?

I’m using K8055 to control an astronomy dome.

Thanks,
Pierre
www.dppobservatory.net

That is because you got the source of the old and very first dll, it is also a lot slower and is without all the updates that have been done to make the current release stable and fast.

Hello pierredeponthiere!

You have really interesting application for the K8055 card: Lesve Dome driver!
Thank you for the very interesting link!

About the DLL:
Indeed, it may be confusing that so small modification changes the file size so much.
As VEL982 described the modification was made to the really “original” DLL dated 1/7/2003. It has size of 338 kB on the Kitsoft CD

It can be found on Kitsoft CD from the following folders:
D:\K8055_VM110 USB board\Demo PC soft source…
D:\K8055_VM110 USB board\Demo PC soft VC_NET
D:\K8055_VM110 USB board\Demo PC soft VB_NET

Newer one you’ll find from the folder: D:\K8055_VM110 USB board\DLL_Updates
and the newest one from the Velleman downloads site:
k8055dll_rev3_0_2.zip
New DLL (rev 3.0.2) file for K8055 & VM110, with Windows Vista support.
Also special Microsoft VC++ version and executable examples.
k8055_dll_2_001.zip
DLL rev 2 with examples and soure code (this source can be used also with DLL Rev 3.)