From: mchp1 on
For some reason the attached DLL driver (Mpusbapi\Dll\Borland_C\Mpusbapi.dll) seems to crash whenever it is run within LabVIEW.  I have run this dll under visual c++ and it works just fine.  In particular the functions MPUSBRead and MPUSBWrite are generating errors within LabVIEW. The other functions of this DLL such as MPUSBGetDeviceCount and MPUSBGetDllVersion are working correctly.   I am using the "Call Library Function" to access this DLL.  Is there anything special that I have to do to use the functions MPUSBRead and MPUSBWrite?  Any suggestions?  Thanks.  Below is the header for this dll. #ifndef _MPUSBAPI_H_#define _MPUSBAPI_H_#define    MPUSB_FAIL                  0#define MPUSB_SUCCESS               1#define MP_WRITE                    0#define MP_READ                     1// MAX_NUM_MPUSB_DEV is an abstract limitation.// It is very unlikely that a computer system will have more// then 127 USB devices attached to it. (single or multiple USB hosts)#define MAX_NUM_MPUSB_DEV           127extern "C" __declspec(dllexport)DWORD MPUSBGetDLLVersion(void);extern "C" __declspec(dllexport)DWORD MPUSBGetDeviceCount(PCHAR pVID_PID);extern "C" __declspec(dllexport)HANDLE MPUSBOpen(DWORD instance,    // Input                 PCHAR pVID_PID,    // Input                 PCHAR pEP,         // Input                 DWORD dwDir,       // Input                 DWORD dwReserved); // Input <Future Use>extern "C" __declspec(dllexport)DWORD MPUSBRead(HANDLE handle,              // Input                PVOID pData,                // Output                DWORD dwLen,                // Input                PDWORD pLength,             // Output                DWORD dwMilliseconds);      // Inputextern "C" __declspec(dllexport)DWORD MPUSBWrite(HANDLE handle,             // Input                 PVOID pData,               // Input                 DWORD dwLen,               // Input                 PDWORD pLength,        &nbsp
From: mchp1 on
This DLL uses some non standard types.  Any suggestions as to how I can work around this?   Could this be the cause of the errors that I am seeing?
From: smercurio_fc on
What does you LabVIEW code look like? I'm guessing you're not properly allocating the memory for those pointers.
From: mchp1 on
I've attached the project


Labview PIC32 Driver.zip:
http://forums.ni.com/attachments/ni/170/348627/1/Labview PIC32 Driver.zip
From: smercurio_fc on
When you use the read function are you pre-allocating the buffer in your calling function, or are you trying to use the read function directly? The latter will probably cause a crash. You need to pre-allocate the buffer using Initialize Array.
 |  Next  |  Last
Pages: 1 2 3
Prev: 0x%08lx error
Next: Catch logout or shutdown event