Hello.
I have read and tryd your codes. Work find exept that I have made some new code for fun but cant get it to work as I like.
const char PICPOST_STATUS[16] = {'0','1','2','3','4','5','6','7','8','9','1','2','3','4','5','6'};
case USB_SEND_POST_STATUS: i=0; while (i <=16) { dataPacket._byte[i+1]= PICPOST_STATUS[i]; ++i; } counter=0x11; break;
When I use this command in c#:
public String USB_SEND_POST_STATUS() { byte* send_buf = stackalloc byte[64]; byte* receive_buf = stackalloc byte[64];
string Temp = "";
DWORD RecvLength = (byte)17; send_buf[0] = 0x50; DWORD x = SendReceivePacket(send_buf, 1, receive_buf, &RecvLength); if ((x >= 1) & ((char)receive_buf[0]== 'P')) { for (int i = 1; i <= x-1; i++) { Temp += ((char)receive_buf[i]).ToString(); } } return Temp; }
The Problem is that I got only data every 2time I run this function. When I look at the ReceiveLength and the ExpectedReceiveLength they look like this.
1 time: ExpectedReceiveLength = 17 ReceiveLength = 17 Result: 0123456789123456
2time: ExpectedReceiveLength = 17 ReceiveLength = 17 Result: 0123456789123456
3time: ExpectedReceiveLength = 17 ReceiveLength = 0 Result:
4time: Same as 2time
5time same as 3time
Why?? Why does I not get 17bit every time?? just in the start?? What have I done wrong??
Sorry for my bad english, hope you understand what my problem is.
Best regards Svein Jarle
|