Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Forums > General Electronics Chat


General Electronics Chat This forum is for general chat about electronics, eg: Dont know what a part does? Dont know how to read a circuit? Want to get an opinion?

Reply
 
Thread Tools Display Modes
Old 24th August 2006, 08:43 PM   (permalink)
Default K8055 USB Interface Visual Basic Help

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.
Sudonon is offline  
Reply With Quote
Old 25th August 2006, 04:20 PM   (permalink)
Default 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.
Sudonon is offline  
Reply With Quote
Old 26th August 2006, 12:45 AM   (permalink)
Default

what is version of VB code? what is version of VB you have? you can download VB2005 free from microsoft website...
panic mode is offline  
Reply With Quote
Old 26th August 2006, 12:58 AM   (permalink)
Default

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)
panic mode is offline  
Reply With Quote
Old 26th August 2006, 01:03 AM   (permalink)
Default

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.
panic mode is offline  
Reply With Quote
Old 26th August 2006, 03:33 PM   (permalink)
Default

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.
Sudonon is offline  
Reply With Quote
Old 11th September 2006, 12:24 AM   (permalink)
Arrow 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
wheesplay is offline  
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes




All times are GMT. The time now is 06:26 AM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.