Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

K8055 USB Interface Visual Basic Help

Status
Not open for further replies.

Sudonon

New Member
Is there anyone out there who has worked with one of these?
I have mine working fine with the supplied demo program.
My problem is with Visual Basic programming.
The source code is provided with the intent that the user can play with it for learning purposes but the project file is unreadable by my version of Visual Basic.
I think it's a version compatibility issue but I don't have enough experience to adapt the project file to build a new executable file.
 
Problem Solved

The K8055D.DLL supplied on the CD-ROM with the kit was unuseable.
Updates were on the disk to add faster switching between multiple boards but
I only have one board so I ignored them.
I noticed a fair amount of interest in my problem, Thanks for your time.
 
what is version of VB code? what is version of VB you have? you can download VB2005 free from microsoft website...
 
ok just looked at it... code is very simple...

1. copy supplied DLL file into c:\windows\system32 directory

2. start VB (should create new project), drop one button onto form, click on it and change properties for 'caption' and 'name' (both should be Connect).

3. drop one label onto form (this will be your display)

4. switch to code view (or just doubleclick on form or button you just created). once in the code window, delete everything and paste code that came with the kit:

'================ CODE ==========================

Option Explicit

Private Declare Function OpenDevice Lib "k8055d.dll" (ByVal CardAddress As Long) As Long
Private Declare Sub CloseDevice Lib "k8055d.dll" ()
Private Declare Function ReadAnalogChannel Lib "k8055d.dll" (ByVal Channel As Long) As Long
Private Declare Sub ReadAllAnalog Lib "k8055d.dll" (Data1 As Long, Data2 As Long)
Private Declare Sub OutputAnalogChannel Lib "k8055d.dll" (ByVal Channel As Long, ByVal Data As Long)
Private Declare Sub OutputAllAnalog Lib "k8055d.dll" (ByVal Data1 As Long, ByVal Data2 As Long)
Private Declare Sub ClearAnalogChannel Lib "k8055d.dll" (ByVal Channel As Long)
Private Declare Sub SetAllAnalog Lib "k8055d.dll" ()
Private Declare Sub ClearAllAnalog Lib "k8055d.dll" ()
Private Declare Sub SetAnalogChannel Lib "k8055d.dll" (ByVal Channel As Long)
Private Declare Sub WriteAllDigital Lib "k8055d.dll" (ByVal Data As Long)
Private Declare Sub ClearDigitalChannel Lib "k8055d.dll" (ByVal Channel As Long)
Private Declare Sub ClearAllDigital Lib "k8055d.dll" ()
Private Declare Sub SetDigitalChannel Lib "k8055d.dll" (ByVal Channel As Long)
Private Declare Sub SetAllDigital Lib "k8055d.dll" ()
Private Declare Function ReadDigitalChannel Lib "k8055d.dll" (ByVal Channel As Long) As Boolean
Private Declare Function ReadAllDigital Lib "k8055d.dll" () As Long
Private Declare Function ReadCounter Lib "k8055d.dll" (ByVal CounterNr As Long) As Long
Private Declare Sub ResetCounter Lib "k8055d.dll" (ByVal CounterNr As Long)
Private Declare Sub SetCounterDebounceTime Lib "k8055d.dll" (ByVal CounterNr As Long, ByVal DebounceTime As Long)

Private Sub Connect_Click()

Dim CardAddress As Long
Dim h As Long

CardAddress = 0
CardAddress = 3 - (Check1(0).Value + Check1(1).Value * 2)
h = OpenDevice(CardAddress)
Select Case h

Case 0, 1, 2, 3
Label1.Caption = "Card " + Str(h) + " connected"
Case -1
Label1.Caption = "Card " + Str(CardAddress) + " not found"
End Select

End Sub


Private Sub Form_Terminate()
CloseDevice
End Sub


'=================================================

5. click on Start project (your USB device should be plugged in and recognized by system, if not driver should be installed)
 
basically it shows how to use OpenDevice function (displays if device is connected or not). to develop real world application, you have to learn VB (or Delphi or C++ etc.) and use other functions which are contained in this DLL. Everything that starts with

Private Declare

is basically function or subroutine (aka "procedure") that you can use.
 
Thanks Panic Mode
I'm using VB4 Developer. I'll look at MS VB2005 but I think what I have probably has more power than I know how to use.

When I reported that I had solved the problem I had done three things:
1: Similar to your suggestion, I created a new project but I imported the vendors Form1 which has all the code you provided plus all the code required to replicate the vendors executable. VB reported a version incombatibility problem but accepted it.
2: I played with the project options and set start mode to OLE server. That is probably obvious to a person with some VB experience but was'nt to me.
At this point the project would compile and produce an executible which would run but not control the board.
3: I then replaced the DLL with the update that I found on the vendors disk and everything works.

I will attempt to modify the other vendor supplied routines to learn how they work first then try controlling things like a 7 segment display and a stepper motor

Again Thanks for your help.
 
K8055 from VB

You can get an ActiveX control that supports the k8055 and a parallel port based thingie (k2805) from homepages.ihug.co.nz/~fcjames
 
Learning the K8055

Hi,

Thanks for your time.

I have a working K8055 with the 'dll' files loaded and can run the 'demo software that came with the Velleman CD but that is where it stops.

I am a retired electronics tech and would like to learn how to use this board to monitor and control parameters in/on a car engine.

I purchased two books on the PIC controller but they are too complicated and do not help me learn how to interface the PC with the board.

I have a full copy of Visual Basic.net [2002] but not yet installed on the PC.

I would appreciate some sites, and or software guides, that I can use to learn and then adapt the K8055 to my project.

Kind regards, KH.
 
You could have started a new thread, considering this one is 2 years old. I have the K8055 also (bought it a few days ago, nice little interface).

So far I have only managed to use the demo program, as the programming bit is just abit over y head. I have experience with the PAWN language, which is a variation of C++, so it is somewhat familiar to me. if anyone has ever worked with these things before, i'd be interested in some help making up a custom application.
;)
 
Hi,

Thanks for your time.

I have a working K8055 with the 'dll' files loaded and can run the 'demo software that came with the Velleman CD but that is where it stops.

I am a retired electronics tech and would like to learn how to use this board to monitor and control parameters in/on a car engine.

I purchased two books on the PIC controller but they are too complicated and do not help me learn how to interface the PC with the board.

I have a full copy of Visual Basic.net [2002] but not yet installed on the PC.

I would appreciate some sites, and or software guides, that I can use to learn and then adapt the K8055 to my project.

Kind regards, KH.

hi KH,
The K8055 has user programs on Google: just Google K8055 VB programming
 
Last edited:
I did the VB approach for a while, but found an easier path through FreeBASIC:

With a text editor, FreeBASIC compiler, (and the K8055D.DLL in same folder as compiler at compile time), enter the following into a console window, FBC test.bas

Here is the FreeBASIC code for test.bas:
DIM OpenDevice AS FUNCTION (BYVAL CardAddress AS LONG) AS LONG
DIM CloseDevice AS SUB
DIM SetAllDigital AS SUB
DIM ClearAllDigital AS SUB

DIM hndl AS ANY PTR

hndl = DyLibLoad("K8055D.DLL")

OpenDevice = DyLibSymbol(hndl, "OpenDevice")
CloseDevice = DyLibSymbol(hndl, "CloseDevice")
SetAllDigital = DyLibSymbol(hndl, "SetAllDigital")
ClearAllDigital = DyLibSymbol(hndl, "ClearAllDigital")

OpenDevice(0)
SetAllDigital()
PRINT "Press any key to clear the output and close the device."
SLEEP
ClearAllDigital()
CloseDevice()
DyLibFree hndl

END
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top