Does anyone know if PB9 can address devices via USB
Announcement
Collapse
No announcement yet.
Pb9
Collapse
X
-
If the USB device includes a software driver or other communication method (such as COM port access), then YES it can be used with PB/WIN.
Comment
-
@Brian
What sort of devices?
I am not sure, but I think Kev and Richard may be eluding to some of the following??? (<INSERT My Shameless Plug here>)
Available Serial Ports
USB Device Attach
and of course My most favorites
List USB Info (VID PID)
USB In-Complete
All the above I know Kev and Pierre had some hand at assisting me with so they get credit too.
And many more that Kev and Pierre have done in the past as wellEngineer's Motto: If it aint broke take it apart and fix it
"If at 1st you don't succeed... call it version 1.0"
"Half of Programming is coding"....."The other 90% is DEBUGGING"
"Document my code????" .... "WHYYY??? do you think they call it CODE? "
Comment
-
VB examples.....Heck if VB can do it, PB can do it (only BETTER)
If you can post the VB Example, I am sure its just a matter of porting (and correcting VB mistakes) to Pure PB code.
You will probably have to zip it up including the DLL they supply (according to the quick drive by peruse I did to see what the board does)Engineer's Motto: If it aint broke take it apart and fix it
"If at 1st you don't succeed... call it version 1.0"
"Half of Programming is coding"....."The other 90% is DEBUGGING"
"Document my code????" .... "WHYYY??? do you think they call it CODE? "
Comment
-
Copy of listing from the documentation, hope ypu can help?
Using the K8055D.DLL in Visual Basic
In the listing of an application example there are the declarations of the K8055D.DLL procedures and
functions and an example how to use the two most important DLL function calls: OpenDevice and
CloseDevice.
Note: Make sure that the file K8055D.DLL is copied to the Windows' SYSTEM32 folder:
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
Comment
-
Assuming the code is VB6 (which it seems to be), here is an almost direct translation:
Code:#Dim All #Compile Exe Declare Function OpenDevice Lib "k8055d.dll" Alias "OpenDevice" (ByVal CardAddress As Long) As Long Declare Sub CloseDevice Lib "k8055d.dll" Alias "CloseDevice" () Declare Function ReadAnalogChannel Lib "k8055d.dll" Alias "ReadAnalogChannel" (ByVal Channel As Long) As Long Declare Sub ReadAllAnalog Lib "k8055d.dll" Alias "ReadAllAnalog" (Data1 As Long, Data2 As Long) Declare Sub OutputAnalogChannel Lib "k8055d.dll" Alias "OutputAnalogChannel" (ByVal Channel As Long, ByVal Data As Long) Declare Sub OutputAllAnalog Lib "k8055d.dll" Alias "OutputAllAnalog" (ByVal Data1 As Long, ByVal Data2 As Long) Declare Sub ClearAnalogChannel Lib "k8055d.dll" Alias "ClearAnalogChannel" (ByVal Channel As Long) Declare Sub SetAllAnalog Lib "k8055d.dll" Alias "SetAllAnalog" () Declare Sub ClearAllAnalog Lib "k8055d.dll" Alias "ClearAllAnalog" () Declare Sub SetAnalogChannel Lib "k8055d.dll" Alias "SetAnalogChannel" (ByVal Channel As Long) Declare Sub WriteAllDigital Lib "k8055d.dll" Alias "WriteAllDigital" (ByVal Data As Long) Declare Sub ClearDigitalChannel Lib "k8055d.dll" Alias "ClearDigitalChannel" (ByVal Channel As Long) Declare Sub ClearAllDigital Lib "k8055d.dll" Alias "ClearAllDigital" () Declare Sub SetDigitalChannel Lib "k8055d.dll" Alias "SetDigitalChannel" (ByVal Channel As Long) Declare Sub SetAllDigital Lib "k8055d.dll" Alias "SetAllDigital" () Declare Function ReadDigitalChannel Lib "k8055d.dll" Alias "ReadDigitalChannel" (ByVal Channel As Long) As Long Declare Function ReadAllDigital Lib "k8055d.dll" Alias "ReadAllDigital" () As Long Declare Function ReadCounter Lib "k8055d.dll" Alias "ReadCounter" (ByVal CounterNr As Long) As Long Declare Sub ResetCounter Lib "k8055d.dll" Alias "ResetCounter" (ByVal CounterNr As Long) Declare Sub SetCounterDebounceTime Lib "k8055d.dll" Alias "SetCounterDebounceTime" (ByVal CounterNr As Long, ByVal DebounceTime As Long) Function PBMain Dim CardAddress As Long Dim h As Long Dim Value1 As Long Dim Value2 As Long ' Enter values for Value1 and Value2 'Value1 = ??? 'Value2 = ??? CardAddress = 0 CardAddress = 3 - (Value1 + Value2 * 2) h = OpenDevice(CardAddress) Select Case h Case 0, 1, 2, 3 ? "Card " + Str$(h) + " connected" Case -1 ? "Card " + Str$(CardAddress) + " not found" End Select CloseDevice End Function
Comment
-
Originally posted by Michael Mayerhoffer View Postah -ha
That is a Vellman Kit... I recognize the DLL. I made a interface program for a buddy with PB. PB works fine with that.
See:
http://www.powerbasic.com/support/pb...light=VellemanThe most exasperating part of the "rat race" is how often the rats are in the lead!
Comment
-
I wrote an application and used that DLL.
I just know that PB has no issues working with that DLL. Now I can say it was all done in PB.
I know it has been working flawlessly, the app sends data every hour and reboots the computer every 20 days as a precaution. If there was an issue. I would know, my buddy is rather anal about what he is logging.A dozen what.
Comment
Comment