HID half duplex

webluca

New member
Joined
Sep 16, 2010
Messages
1
Programming Experience
5-10
Hi,
everybody. This is my first topic on forum!

I have problem with comunicationn between pc and a pic microcontroller.
I have tried the library (generic_hid_vb_50) but I can not send and read data simultaneously.

The application works fine but I need a change.
I have divided the section to read the writing section.
I tried the version 5.0. The read operation waits for the reception of data.
I try to send data to the device and the application stops.

Link modified library

Can you help me ???
 
Last edited:
I have written a pretty good wrapper around the old mcHID generic HID library from Mecanique. The library was free to distribute and use back then, I included it in the archive. I have also made a little demo app to show you how to use it. Just open the solution in VB.Net and register the mchid.dll file in the library's root folder. It's all event driven and very easy to use, it can do 64 bytes every 1ms (512Kbps) over 2 interrupt endpoints and you can use as many instances as you need simultaneously (on different devices).

I haven't used this library in a while so let me know if you have any issues.

Essentially you just create an instance of the HIDDevice class like so:
    Dim WithEvents USBDevice As New mcHIDInterface.HIDDevice


The property, event and method signatures should tell you the rest...

    Public Property hidVendorID As Integer                   ' Device VendorID.
    Public Property hidProductID As Integer                  ' Device ProductID.

    Public ReadOnly Property hidVendorName As String         ' Vendor name.
    Public ReadOnly Property hidProductName As String        ' Product name.
    Public ReadOnly Property hidSerialNumber As String       ' Serial number.
    Public ReadOnly Property hidVersion As Integer           ' Device version.
    Public ReadOnly Property hidInputReportLength As Integer ' Input report length.
    Public ReadOnly Property hidOutputReportLength As Integer ' Output report length.

    Public ReadOnly Property hidBufferIn(ByVal i As Integer) As Byte            ' Input buffer, byte array.
    Public Property hidBufferOut(ByVal i As Integer) As Byte                    ' Output buffer, byte array.

    Public Event hidPlugged(ByVal sender As Object, ByVal e As System.EventArgs)           ' Public events to signal
    Public Event hidUnplugged(ByVal sender As Object, ByVal e As System.EventArgs)         ' client application.
    Public Event hidDataReady(ByVal sender As Object, ByVal e As System.EventArgs)
    Public Event hidDataRXError(ByVal sender As Object, ByVal e As System.EventArgs)
    Public Event hidDataSent(ByVal sender As Object, ByVal e As System.EventArgs)
    Public Event hidDataTXError(ByVal sender As Object, ByVal e As System.EventArgs)
    
    Public Function SendBuffer() As Boolean                         ' Send the content of the output buffer.
    Public Sub hidPingAllDevices()                                  ' Get info about all the HID devices connected.
    Public Sub hidChangeDevice()                                    ' Call this whenever you need to change the VID and PID.


http://www.freefilehosting.net/mchidinterface
 
Last edited:
Back
Top