falaigai
Leren kan je alleen maar door te Doen
Hoi ,
ik heb me vandaag K8055 van velleman aangeschaft
Deze zou ik graag programmeren in Visual basic 10 express edition .
ik vindt hier en daar op het internet dat je stukken code er in moet zetten .
bv :
Option Explicit On
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" (ByVal Data1 As Long, ByVal 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
Maar als ik dit doe dan geeft ie veel fouten . Ik denk dat dit komt omdat deze code van een oudere versie is .
Wie kan me helpen ? eventueel met een voorbeeldprogramma ?
Grtz
Heb je dit ook netjes gedaan?
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.
Volgens mij ontbreken er 3 checkboxes.
Verwijder deze regel, dat scheelt
CardAddress = 3 - (Check1(0).Value + Check1(1).Value * 2)
[Bericht gewijzigd door mbbneon op (13%)]
falaigai
Leren kan je alleen maar door te Doen
de prop. Caption vindt ik niet ..
En ik denk dat ik de verkeerde dll in die map heb gezet
kga m ff is opnieuw downloaden
free_electron
Silicon Member
Professioneel ElectronenTemmer - siliconvalleygarage.com - De voltooid verleden tijd van 'halfgeleider' is 'zand' ... US 8,032,693 / US 7,714,746 / US 7,355,303 / US 7,098,557 / US 6,762,632 / EP 1804159 - Real programmers write Hex into ROM
je hebt geen class of module definitie.. vandaar al die warnings :
Option Explicit On
Public Module K8055
Public Declare Function OpenDevice Lib "k8055d.dll" (ByVal CardAddress As Long) As Long
Public Declare Sub CloseDevice Lib "k8055d.dll" ()
Public Declare Function ReadAnalogChannel Lib "k8055d.dll" (ByVal Channel As Long) As Long
Public Declare Sub ReadAllAnalog Lib "k8055d.dll" (ByVal Data1 As Long, ByVal Data2 As Long)
Public Declare Sub OutputAnalogChannel Lib "k8055d.dll" (ByVal Channel As Long, ByVal Data As Long)
Public Declare Sub OutputAllAnalog Lib "k8055d.dll" (ByVal Data1 As Long, ByVal Data2 As Long)
Public Declare Sub ClearAnalogChannel Lib "k8055d.dll" (ByVal Channel As Long)
Public Declare Sub SetAllAnalog Lib "k8055d.dll" ()
Public Declare Sub ClearAllAnalog Lib "k8055d.dll" ()
Public Declare Sub SetAnalogChannel Lib "k8055d.dll" (ByVal Channel As Long)
Public Declare Sub WriteAllDigital Lib "k8055d.dll" (ByVal Data As Long)
Public Declare Sub ClearDigitalChannel Lib "k8055d.dll" (ByVal Channel As Long)
Public Declare Sub ClearAllDigital Lib "k8055d.dll" ()
Public Declare Sub SetDigitalChannel Lib "k8055d.dll" (ByVal Channel As Long)
Public Declare Sub SetAllDigital Lib "k8055d.dll" ()
Public Declare Function ReadDigitalChannel Lib "k8055d.dll" (ByVal Channel As Long) As Boolean
Public Declare Function ReadAllDigital Lib "k8055d.dll" () As Long
Public Declare Function ReadCounter Lib "k8055d.dll" (ByVal CounterNr As Long) As Long
Public Declare Sub ResetCounter Lib "k8055d.dll" (ByVal CounterNr As Long)
Public Declare Sub SetCounterDebounceTime Lib "k8055d.dll" (ByVal CounterNr As Long, ByVal DebounceTime As Long)
End Module
Public Class Form1
Private Sub Connect_Click() handles 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() handles me.formclosing
CloseDevice()
End Sub
End Class