Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

USB HID host application - Borland C++

Status
Not open for further replies.

yawijaya

Member level 2
Joined
Aug 18, 2009
Messages
42
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
New Freedom, PA-USA
Activity points
1,625
USB HID host application

Hi there,

I'm working on a USB HID project, using the demo board of pic18f4550. I managed to get the firmware to work. Now i'm about to create a windows application-GUI to communicate with the board....I am using borland C++ builder to do it. Does anybody has the example code that i can refer to?I read from several sources that I have to utilizes Windows API in order to communicate to the board, but i don't understand how to do it in BCB. I already have an example software, but it is not for HID compliant device, so it still puzzles me.... Any help please??Thanks in Advance
 

Re: USB HID host application

Hi
I assume you have installed the Microchip USB Framework.
You'll find many HID examples here: C:\Microchip Solutions\USB Device - HID - Custom Demos\Generic HID - PnP Demo - PC Software

Regards
Kabanga
 

Re: USB HID host application

yeah i do have it, but they can't really be recompiled using borland so I cannot tweak the code to see which line of code is doing which command...Anybody has an advice on how to create a USB HID host sotware?a link on the web may be?
 

Check Generic HID - Simple Demo - PC Software. It's pretty easy, all accesses are through generic Windows API functions: Identify the device name from the registry, open the device, read and write to it.

You may want to install the free Microsoft Visual C++ Standard Version, if you want to watch it in operation.
 

Thanks for all the advice. I managed to get several sample code from several websites. My biggest problem now is that my code would go error whenever I compile and run it. It happened after i inserted the code that calls the function from setupapi.h and hidsdi.h. I am on the stage of detecting whether a device is connected or not. I even try to just run the sample code I found online, but it is still error. When I press the run button, a debug window will pop up. And when I press run again this message appears--->Project C:\[...........] faulted with message : 'Access violation at 0x0000871f: read of address 0x0000871f'. Process stopped. Use step or run to continue. It happens on EVERY single project I tried to compile and run. I thought my compiler (Borland C++ 6) is probably too old, but the code that was designed for Borland C++ 6 never worked too!I am really desperate now, any advice?any clu why the error happened?some mistake in the compiler setting may be?
 

Learn how to use debugger, you won't go far without it. Call stack will guide you to error location.
For hid related headers and libraries you need to download DDK from MS page. It's free but huge download. Personally I would use MinGW as it comes with part of DDK, wrap required functions in single dll and import this dll to BCB.
There are also some components available, see topic .
 

Hi yawijaya,
Have you find a solution to your problem (USB HID) ?
Because I would like to do the same with c++Builder 6.
Thank you for your answer.
Franck
 

franckcl said:
Hi yawijaya,
Have you find a solution to your problem (USB HID) ?
Because I would like to do the same with c++Builder 6.
Thank you for your answer.
Franck

Hi franckcl, my project is kind of in a halt right now because i have other things to do, but i managed to get the board talking to the computer when i plugged it in. assuming that you have the firmware correct(HID), you can refer to FindtheHID() function from Jan Axelson sample code(www.lvr.com), even if the sample code is using visual c++, it should still be self explanatory. Of course you have to understand C++ and how borland works, because that was a problem to me when i just tried to copy and paste. One thing that i think is crucial is that make sure you change the data alignment to byte instead of quadword(project->option->advanced compiler) otherwise it would give you error. hope this helps!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top