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
Bookmarks