Hi can anyone help, first of all is Visual Basic ver 3 compatable with the K8055 ? If yes can anyone tell me how to get started to do simple tasks like switching on a output and reading an input and what to put in the declarations/forms etc ? I have a little knowledge in Visual Basics but am having a problem programming the 8055.
I have downloaded the exelent EasyProgIntFace but I need to incorperate input/output within a custom program.
I Hope someone can help
Oldbod
You may download the packages containing Visual Basic example programs from this page:
velleman.eu/distributor/supp … 8055&type=
I hope you can extract some code (and the DLL function declarations) from these examples and use it in the Visual Basic 3.
Hi Thanks for reply but I dont seem to be able to open any of the files. I think what I realy need is a simple program that I can open up and see the structure in Visual Basics, any Ideas ??
Oldbod
If you downloaded this package there is a Visual Basic example source code in it:
“Source code files for Borland C++ builder, VB6 and Delphi 6.x”
velleman.eu/downloads/files/ … e_code.zip
If you can’t open the project file K8055_Demo.vbp, then you can open the file Form1.frm using any text editor.
There you’ll see the code.
Here a snippet how to open a card:
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
If h >= 0 Then Timer1.Enabled = True
End Sub
Here are the DLL function declarations:
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)
Thanks again, I have tried to enter the samples you gave me ,I asumed the declarations go in the “general declaration” code page and the “sub click” to open device go’s in the command button code page , is this right ?? when I try and run it I get errors .
oldbod
[quote]I asumed the declarations go in the “general declaration” code page and the “sub click” to open device go’s in the command button code page , is this right ??[/quote]I think this is OK.
[quote]when I try and run it I get errors.[/quote]What kind of errors? Can you copy and paste the error message to the post.
Hi,
When I run it stops on the first line of the declarations :-
Private Declare Function OpenDevice Lib “k8055d.dll” (ByVal CardAddress As Long) As Long
“Declare” is highlighted, and the error message is " Expected Static or Function or Sub "
Regards
Oldbod
Keep in mind that Visual Basic 3 was released in 1993, five years before Visual Basic 6. Times have changed since 1993, new compilers, new operating systems, new technologies The easiest thing might be to switch over to Visual Basic 6 to get everything to work.
Yes thanks I will get VB6 .
Thanks for your help.
Oldbod