Does anyone have any working example code in PB that shows how to -
1. Search list of HID's and find a specific HID & PID
2. Connect to that HID & PID and transfer data and receive data
I have done a search and the best I've found is http://www.purebasic.fr/english/viewtop ... =5&t=37721.
This does provide a list of HID's but does not provide any write functions.
I have a strange feeling that these are not the right API calls.
I am playing around with some electronics (microcontroller PIC18F4550) and would like to try USB.
I can set the HID & PID to anything and I have not planned any data structure yet but know that I will need to read and write up to 256 bytes at any one time.
RS232 connection works ok but I want to move away from this and start using USB.
I want to use HID and not CDC.
Thanks.
Any USB HID Examples?
- tinman
- PureBasic Expert
- Posts: 1102
- Joined: Sat Apr 26, 2003 4:56 pm
- Location: Level 5 of Robot Hell
- Contact:
Re: Any USB HID Examples?
I know you want PB example code, but you'll be dealing with the Win32 API so much that you might be as well looking at C example code. You should be able to find some good stuff here: http://www.lvr.com/hidpage.htm
AFAIR the code at a previous company I worked for simply used the Setup API to enumerate the USB devices, looking for specific VID/PID combinations, opened a file at the device path and used ReadFile and WriteFile for reading and writing custom HID reports to/from devices. I wasn't working on that code so there's not much I can tell you about it directly.
Hope that helps.
AFAIR the code at a previous company I worked for simply used the Setup API to enumerate the USB devices, looking for specific VID/PID combinations, opened a file at the device path and used ReadFile and WriteFile for reading and writing custom HID reports to/from devices. I wasn't working on that code so there's not much I can tell you about it directly.
Hope that helps.
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
(WinXPhSP3 PB5.20b14)
Re: Any USB HID Examples?
Thanks for your reply.
I've got some examples in VB and C and they appear to use a lot of API calls.
I've got some examples in VB and C and they appear to use a lot of API calls.
-
- Addict
- Posts: 1519
- Joined: Wed Nov 12, 2008 5:01 pm
- Location: Russia
Re: Any USB HID Examples?
Use HID_Lib - Library http://www.purebasic.fr/english/viewtop ... 14&t=41729
Last edited by User_Russian on Mon Apr 05, 2010 2:10 pm, edited 2 times in total.
Re: Any USB HID Examples?
Thanks.
That may be a good starting point for me.
That may be a good starting point for me.
-
- Enthusiast
- Posts: 497
- Joined: Sat Oct 11, 2008 9:07 pm
- Location: Germany, Berlin > member German forum
Re: Any USB HID Examples?
Hi,
If have written in the german forum a program to read and write HID informations. You need for the program the dll file from here:
http://www.docpro.com.br/arquivos/mcHID.zip
"Hid Reader"
http://forums.purebasic.com/german/view ... 3d42868751
and i have written a USB Interface for WIN with 4xIN/6xOUT/1xAD/1xIR and 1xTemp with a PIC18F2550, you can use the code for the 4550 too:
http://forums.purebasic.com/german/view ... 3d42868751
i hope you can use a german to english translater to understand the words...
best regards,
Michael
I
If have written in the german forum a program to read and write HID informations. You need for the program the dll file from here:
http://www.docpro.com.br/arquivos/mcHID.zip
"Hid Reader"
http://forums.purebasic.com/german/view ... 3d42868751
and i have written a USB Interface for WIN with 4xIN/6xOUT/1xAD/1xIR and 1xTemp with a PIC18F2550, you can use the code for the 4550 too:
http://forums.purebasic.com/german/view ... 3d42868751
i hope you can use a german to english translater to understand the words...
best regards,
Michael
I
Working on - MP3D Library - PB 5.73 version ready for download
Re: Any USB HID Examples?
Thanks for all the help.
MPZ's solutons was the easiest to implement and my PC18F4550 is working just fine.
Thanks again.
MPZ's solutons was the easiest to implement and my PC18F4550 is working just fine.
Thanks again.