Hi,
I have PIC32MX795F512L. I have used the "USB Host - MCHPUSB - Generic Driver Demo - PIC32 USB Starter Kit II.mcp" Firmware.
I am very new to Delphi. So I have copy and paste the code from http://www.sixca.com/delphi/article/microchip_usb.html It is working fine.
I want to use the UPDATE_LED (change the LED status). Please help me.
The Update LED status C# code is at http://www.piccoder.co.uk/content/view/42/26/. it is working perfect. but i want this in delphi.
---------------------
i think it may the problem so please convert c# code to delphi. i don't know about bytes data type.
byte* send_buf=stackalloc byte[64];
byte* receive_buf=stackalloc byte[64];
DWORD RecvLength=3;
send_buf[0] = 0x32; //Command for LED Status
send_buf[1] = (byte)led;//0111
send_buf[2] = (byte)(State?1:0);
if (SendReceivePacket(send_buf,3,receive_buf,&RecvLength) == 1)
{
if (RecvLength == 1 && receive_buf[0] == 0x32)
{
return 0;
}
else
{
return 2;
}
}
else
{
return 1;
}
Please help me.
Thanks,
Hari