I'm new to PureBasic and would like to see example code for implementing USB communications
in a Windows OS. Hopefully, there are some easy methods that work well for both WinXP & Win7
in both 32 & 64 bit. My application would be for connecting remote laboratory instruments.
USB code examples
- Avatar Engineer
- New User
- Posts: 5
- Joined: Tue May 11, 2010 3:18 am
- Location: Scottsdale, Arizona
- Contact:
- Rook Zimbabwe
- Addict
- Posts: 4322
- Joined: Tue Jan 02, 2007 8:16 pm
- Location: Cypress TX
- Contact:
Re: USB code examples
Well the COMmate library may be of help there... I know you can probably do it with the API as well...
http://www2.hawaii.edu/~hermany/api.htm
http://www.usb.org/developers/hidpage/microhid/
http://virtual.software.informer.com/do ... r-usb-dll/
And the last one got me thinking... many devices designed for UB come with their own drivers... Why not just communicate with those drivers?
http://www2.hawaii.edu/~hermany/api.htm
http://www.usb.org/developers/hidpage/microhid/
http://virtual.software.informer.com/do ... r-usb-dll/
And the last one got me thinking... many devices designed for UB come with their own drivers... Why not just communicate with those drivers?

Re: USB code examples
Library HID_Lib is intended for work with USB HID devices. If only be not afraid of Russian.
http://pure-basic.narod.ru/libs/HID_Lib ... --4.50.rar

http://pure-basic.narod.ru/libs/HID_Lib ... --4.50.rar
- Avatar Engineer
- New User
- Posts: 5
- Joined: Tue May 11, 2010 3:18 am
- Location: Scottsdale, Arizona
- Contact:
Re: USB code examples
Thanks for links !
While most consumer devices may come with host drivers, I'll be connecting
to my own target hardware... The embedded controller code for USB is difficult enough
and the most expedient method is to use RS232 from the target and use a USB
converter cable to the host PC... but I'd like to "Roll my own" this time.
AE
While most consumer devices may come with host drivers, I'll be connecting
to my own target hardware... The embedded controller code for USB is difficult enough
and the most expedient method is to use RS232 from the target and use a USB
converter cable to the host PC... but I'd like to "Roll my own" this time.
AE
- Rook Zimbabwe
- Addict
- Posts: 4322
- Joined: Tue Jan 02, 2007 8:16 pm
- Location: Cypress TX
- Contact:
Re: USB code examples
What I did when writing the drivers for my Customer Display was sourceforge and hack a USB to COM driver and open the USB Gadget as a COM3 then write to COM3 (I could read from it as well...)
- Avatar Engineer
- New User
- Posts: 5
- Joined: Tue May 11, 2010 3:18 am
- Location: Scottsdale, Arizona
- Contact:
Re: USB code examples
Sounds good!
can you post the code?
can you post the code?
- Rook Zimbabwe
- Addict
- Posts: 4322
- Joined: Tue Jan 02, 2007 8:16 pm
- Location: Cypress TX
- Contact:
Re: USB code examples
I went to sourcefoge and grabbed these:
http://sourceforge.net/projects/libusb-win32/
http://sourceforge.net/projects/libusb/
A lot of what I did I learned from attempting to use this:
http://sourceforge.net/projects/libusbdotnet/
http://sourceforge.net/projects/npipe/
Code is being used... but you can freely use the sourceforge stuff. Easier in the long run. Just be sure to check license before distributing!
http://sourceforge.net/projects/libusb-win32/
http://sourceforge.net/projects/libusb/
A lot of what I did I learned from attempting to use this:
http://sourceforge.net/projects/libusbdotnet/
http://sourceforge.net/projects/npipe/
Code is being used... but you can freely use the sourceforge stuff. Easier in the long run. Just be sure to check license before distributing!
- Avatar Engineer
- New User
- Posts: 5
- Joined: Tue May 11, 2010 3:18 am
- Location: Scottsdale, Arizona
- Contact:
Re: USB code examples
Thanks again,... looks like I've got homework!