mn75930
Newbie level 2
Hello, I’m new to pic and usb programming.
So I start to test the article Basic USB - Using Microchip Stack and C#.Net - Hardware form www.PICcoder.co.uk
This code works, but I got some trouble when I’m trying to receive more then 1byte from the microcontroller.
The thing I’m trying to do it that when I send the command 0x50 to the microcontroller, I need to get some data back from it. I’m using c# and ask for 4bit of data.
The problem is that the LED is working but I just get data back from the PIC every second time I run the command 0x50..
This is the code I have modified in to the PIC project:
Then I use the SendReceivePacket function and it returns this STRING 50495051.
The next time I use SendReceivePacket I got the STRING 0000.
ExpectedReceiveLength = 4
ReceiveLength = 0
Why?? The LED4 is flashing every time, but I can’t get data from the CHIP more then every second time I hit my button in the form1.
Please help me?? What am I doing wrong???
So I start to test the article Basic USB - Using Microchip Stack and C#.Net - Hardware form www.PICcoder.co.uk
This code works, but I got some trouble when I’m trying to receive more then 1byte from the microcontroller.
The thing I’m trying to do it that when I send the command 0x50 to the microcontroller, I need to get some data back from it. I’m using c# and ask for 4bit of data.
The problem is that the LED is working but I just get data back from the PIC every second time I run the command 0x50..
This is the code I have modified in to the PIC project:
Code:
case LED:
mLED_4_Toggle();
dataPacket._byte[1]= '1';
dataPacket._byte[2]= '2';
dataPacket._byte[3]= '3';
counter=0x04;
break;
The next time I use SendReceivePacket I got the STRING 0000.
ExpectedReceiveLength = 4
ReceiveLength = 0
Why?? The LED4 is flashing every time, but I can’t get data from the CHIP more then every second time I hit my button in the form1.
Please help me?? What am I doing wrong???