K8055 slow response digital/analog input

For educational purpose I have written software that uses the K8055 USB board to make the software more interactive.

The program is written in Visual Basic 6.0

When a student pushes a button on the K8055, there is (by example) an animated switch on the screen.

It takes however a little while for the software to react.
I’ve noticed it mainly because the software can also use a parallel (printer) interface. When I use this interface the software is much more responsive.

The demo files from this site show the same difference in speed. The program in C is much faster.

You might think that C is of course much faster then VB 6.
However in parallel mode, that also uses a dll, (inpout32.dll) there is no performance lag.

Is there a way to do it better/faster in VB?

btw. The software is free to download from EduTechSoft.nl
(Digitale Technieken Dutch only)

HOB

I tried to find the VB 6 demo files from the site you mentioned but due to my missing Dutch language skills I didn’t find it.
Could you please give a link…

The program can be downloaded on the following link.

edutechsoft.nl/elektro/digit … nieken.zip

Screenshots are available on…

edutechsoft.nl/intscher.html

The source code isn’t free at this moment.

I’ve found out that in the demo file from velleman the timer was set to 50 ms. When I change this to 10 ms it is much better.

But in my program the timer responsible for reading the status is set to 10 ms. So what else is different.

In my project I’ve created a module where the functions and subs are declared as Public.

So maybe the call from the active form to the module is delayed.
After changing the code (putting the functions and subs in the form as Private) I hoped the problem would be over.

Unfortuanatly not.

I will have to dig deeper in my code, but I know now that in the speed of the demo file isn’t a problem.
Strange however that in the demo files (.vbp and the .exe) the timer is set to 50 ms.
Reading the analog input is also much better with 10 ms.

Thank you for reading…

The impout.dll can give some troubles on XP or Vista machines due to security reasons, that is the only thing I can help you with, without the source of your program.

Hi.
I have a similar problem with slow performance.
Regardless which dll version I use I get slow performance from K8055 in visual basic.
When I am testing precompiled VB demo version from Velleman it is fast but the same source code compiled on my system is slow. That makes me very confident that the source code isn’t the problem.

Compiling C version with visual C++ Express 2008 generates fast code.

Any suggestions?

Mr. Shadowfaxe.
When you set the timer at 10 ms, the performance is ok in de Velleman demo for Visual Basic 6.0


So far I have not been able to really find out what is causing my problem.

I’ve found out that…

  • when the input button is pushed the harddisk light flashes a short moment, as if the .dll is reloaded.

  • when I set the timer of the startup Form the performance improves remarkable.

I will explain what I mean bij this.

The project has 9 forms and 1 module. In the module I Public Declare the Functions/Subs for the k8055d.dll.
In the .bas module there are sub’s to communicate with the USB card.

example…

Sub SetDigital(ValueOut)
WriteAllDigital ValueOut
End Sub

In a module you can’t place a Timer so that has to be done in the Forms.

From each Form I can call now SetDigital (with the value I need.)

Normally when I show another form, I disable the timer of the previous Form.
However when I keep the timer enabled of the startup Form the performance is much better.
At this moment I can’t see why???

Setting the Timers of the other Forms makes no difference.

  • when I quickly repeat pushing the button it also looks as if the reaction time improves.

As this moment the performance is acceptabele, tomorrow at school I’ll see if the performance is increased.

HOB

If you are getting it slow in VB and fast in C/C++ then the problem is your code. VB is simple, but its also simple for people to make messy rubbish code sadly.

You are not going to beable to tell reaction times in anything less than 250ms from your own eyes

As for your timer, the example uses a timer on the form, its a little messy really, so its best to code it with the windows APIs for SetTimer etc. Currently my code has no forms at all, using Sub Main() as everyone should be… even with forms.

Why unload the form with a timer? If you really insit on using a form. Add a new form with the express purpose of adding a timer only. Load this by just using “Load frmFormname”, and it will load but not show. This is how you should be loading all forms but people are lazy and use just .show which isn’t really the proper way to do it.

drsquirrel…

I can tell you, from my own eyes, that the difference in reaction time is huge.
You can see if for yourself when you execute the Velleman demo for visual basic 6.0. and change the timer1.interval from 50 to 10 ms.

Set to 10 ms, when pushing the button, you see an immediate screen update. The slide bars of the analog inputs are quicker too.

Set to 50 ms, you have to wait a ‘short’ time before the screen updates.

(Please don’t be lazy and try it. Your eyes will tell you!!!)

I have tried the API timer but found no increase of performance.

Your suggestion of loading a form with only a timer placed on it sounded very reasonable so I’ve tried it.
It didn’t give any noticeable perfomance increase.

Normally when I load a form I want it to be visible on the screen. I don’t understand why you call someone lazy when using show instead of load??

Still there is the question why the parallel interface is faster than the k8055.
The whole project was written for the parallel interface and there was no problem at all with the timers or performance.
I only noticed the difference when I added the k8055 board.

However at this moment the performance is very acceptable and I wil go on supporting the k8055.

The picture below is the interface I use at this very moment.

I have placed the k8055 in a special case. There are also 2 K2633 relay cards added and 2 digital Panel Meters.

  • On the back panel there are connectors for the relay cards.
  • The leds are also connected to the relay cards.
  • A1 and A2 are directly connected to the K8055 card.
  • For the panel meters I had to use a 9 Volt battery.
  • For analog use connectors will be added later.

Thank you for reading…
HOB