Hi to everybody. I'm trying to send and receive data from a LabVIEW 5.1 VI
and a 32bit DLL, but my VI crashes when
I try to run it.
Here's the DLL function source:
DWORD __stdcall PIC16C765_WritePipe01(PIC16C765_HANDLE hPIC16C765, PVOID
pBuffer, DWORD dwSize)
{
WD_USB_TRANSFER transfer;
BZERO(transfer);
transfer.dwPipe = 0x01;
transfer.dwBytes = dwSize;
transfer.pBuffer = pBuffer;
transfer.hDevice = hPIC16C765->hDevice;
transfer.dwTimeout = 10000;
WD_UsbTransfer(hPIC16C765->hWD, &transfer);
if (transfer.fOK)
return transfer.dwBytesTransfered;
return 0xffffffff;
}
This function sends data to a pipe in a USB connection.
My need is to write in the VI pane
l the Buffer to be sent over the USB .
My question is: how can I pass a pointer like pBuffer from the VI panel to
the Dll function?
Here's one of the Call Library Function setups I've (unsuccesfully) tried:
int32 PIC16C765_WritePipe01(uInt32 arg1, uInt8 *arg2, uInt32 arg3);
NB: no problems were encountered if calling the DLL function from a C++ code
like this:
printf ("Please enter the size of the buffer: ");
fgets(line, sizeof(line), stdin);
sscanf (line, "%d", &dwSize);
pBuffer = malloc (dwSize);
printf ("enter the input buffer: ");
GetHexBuffer(pBuffer, dwSize);
dwBytesTransferred = PIC16C765_WritePipe01(hPIC16C765, pBuffer, dwSize);
if (dwBytesTransferred==0xffffffff)
printf ("error on transfer\n");
else
printf ("transferred %d bytes\n", dwBytesTransferred);
free (pBuffer);
Any suggestions?
Lot of THANKS!
Gabriele Bellini