USB to VB.NET


Closed Thread
Results 1 to 13 of 13

Thread: USB to VB.NET

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699

    Default

    Andre,

    I created my application using EasyHID. The code is in VB6 and it works fine. If you think that it might help you, I will post the VB6 code here.

    The VB code in your first post has the "plugged", "unplugged", and "OnRead" subroutines, but I don't see the "WriteSomeData" routine that exists in the VB6 version. What program did you use to get this code? Was it HIDMaker?

    Robert

  2. #2
    Join Date
    Oct 2004
    Posts
    448

    Default

    Robert, I would love to see your VB code; like I said earlier, I too managed to send data from the pic to the PC, but the reverse is just not happening.

    Regards,

    Anand

  3. #3
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699

    Default

    The following VB6 code is created by EasyHID. It is a subroutine to send bytes from the computer to the MCU. You need to comment out the BufferOut(0) and BufferOut(1) lines like I did below.

    Code:
    '*****************************************************************
    ' this is how you write some data...
    '*****************************************************************
    Public Sub WriteSomeData()
      ' BufferOut(0) = 0   ' first by is always the report ID
      ' BufferOut(1) = 10  ' first data item, etc etc
    
       ' write the data (don't forget, pass the whole array)...
       hidWriteEx VendorID, ProductID, BufferOut(0)
    End Sub
    All you need to do is give a value to variables BufferOut(1) to BufferOut(8) and call the WriteSomeData routine when the command button is pressed. Then, on the PIC side try to read bytes USBBuffer_IN[0] to USBBuffer_IN[7] by using the DoUSBIn routine.

    Code:
    Private Sub Command1_btn_Click()
    
    BufferOut(1) = 1
    BufferOut(2) = 2
    BufferOut(3) = 3
    BufferOut(4) = 4
    BufferOut(5) = 5
    BufferOut(6) = 6
    BufferOut(7) = 7
    BufferOut(8) = 8    
    
    WriteSomeData  'Calls routine WriteSomeData
        
    End Sub
    Robert

  4. #4
    Join Date
    Oct 2004
    Posts
    448

    Default

    Robert, thanks a lot. I'll try this out soon and be back with a feedback.

    Regards,

    Anand

  5. #5

    Default

    Thank you it works like a charm, now i can continue with the rest of my program, thank you once again

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts