Darknesss
Newbie level 5
hidrxreport
I have been experimenting with the CREATE USB Interface:
This project will show up as a HID device (gamecontroller).
The example project from that page is written in C18 for mplab.
I was able to read the output of the pic (from analog inputs) in a C# program based on the software in this article:
http://www.vsj.co.uk/articles/display.asp?id=600
There is however one thing that I was not able to get to work. I was
trying to send commands to the pic.
Basicly I just want the pic to light a led based on the packet data it
receives but no luck so far...
Maybe it's the C# program that does not do it's job properly, but it
would be nice to know if the pic code is able to handle the data.
This is the code in the ProcessIO function that I use to handle the data:
I tried enclosing this code in:
if(!mHIDTxIsBusy()){ }
but still no luck
Do any of you perhaps have an example of how to do this kind of stuff?
Any hints are welcome.
The original example code is
I have been experimenting with the CREATE USB Interface:
This project will show up as a HID device (gamecontroller).
The example project from that page is written in C18 for mplab.
I was able to read the output of the pic (from analog inputs) in a C# program based on the software in this article:
http://www.vsj.co.uk/articles/display.asp?id=600
There is however one thing that I was not able to get to work. I was
trying to send commands to the pic.
Basicly I just want the pic to light a led based on the packet data it
receives but no luck so far...
Maybe it's the C# program that does not do it's job properly, but it
would be nice to know if the pic code is able to handle the data.
This is the code in the ProcessIO function that I use to handle the data:
Code:
if (HIDRxReport(rbuffer,32) > 0) // USB receive buffer has data
{
//do stuff with Buffer[]
// for example blink led
switch(rbuffer[1]) {
case 0:
LATB = 0;
break;
case 1:
LATB = 0x7F;
break;
default:
LATB = 0x5A;
break;
}
}
I tried enclosing this code in:
if(!mHIDTxIsBusy()){ }
but still no luck
Do any of you perhaps have an example of how to do this kind of stuff?
Any hints are welcome.
The original example code is