annulla
Visualizzazione dei risultati per 
Cerca invece 
Intendevi dire: 

How do you use the MPUSBAPI.dll?

I thought I set that...   Thank you.
0 Kudos
Messaggio 11 di 25
5.196Visualizzazioni
Ok, I think that the problem may be arising because I am not initializing the buffer that I am feeding the write or the buffer that I am reading from the read function .  How can I do this?  The Write function is expecting an array of type BYTE[64] and the Read function should return an array of type BYTE[64].


extern "C" __declspec(dllexport)
DWORD MPUSBRead(HANDLE handle,              // Input
                PVOID pData,                // Output
                DWORD dwLen,                // Input
                PDWORD pLength,             // Output
                DWORD dwMilliseconds);      // Input

extern "C" __declspec(dllexport)
DWORD MPUSBWrite(HANDLE handle,             // Input
                 PVOID pData,               // Input
                 DWORD dwLen,               // Input
                 PDWORD pLength,            // Output
                 DWORD dwMilliseconds);     // Input


0 Kudos
Messaggio 12 di 25
5.187Visualizzazioni

@mchp1 wrote:
Ok, I think that the problem may be arising because I am not initializing the buffer that I am feeding the write or the buffer that I am reading from the read function .  How can I do this?  The Write function is expecting an array of type BYTE[64] and the Read function should return an array of type BYTE[64].

Did you read my replies? That's precisely what I said in reply #5. Also, it makes no sense that it requires a fixed byte array of 64 elements. If it did, then the read would not require a separate input of how many elements are in the array. Same goes for the write. In your example C program you were pre-allocating an array of 64 bytes, but tellng the functions that the array length was 4 for the receive and 2 for the send. Made no sense to me, but whatever.

To have the read function read a maximum of 64 bytes then you would do something like this:

This allocates an array of 64 bytes and tells the function that you are providing an array of 64 bytes (not 4). The function will return how many bytes were read with its output parameters. Note that the output array will still be 64 bytes. You can use Split Array if you wish to chop off the extra zeros.


Message Edited by smercurio_fc on 08-12-2008 04:24 PM
0 Kudos
Messaggio 13 di 25
5.179Visualizzazioni
Thank you.  I found the problem.  I was calling the dll through the "Call Library Function" as if it were using the stdcall convention instead of the c convention.
0 Kudos
Messaggio 14 di 25
5.166Visualizzazioni
My comments regarding the pre-allocation requirement are still valid since you have to do that.
0 Kudos
Messaggio 15 di 25
5.161Visualizzazioni

HI  Mchp1

 

Please send me the correct labview code and the code of the controller for guidance.

0 Kudos
Messaggio 16 di 25
4.148Visualizzazioni

Hi

 

What kind of application have you developed by using mpusbapi.dll ? Are you making DAQ card , please tell me about it.

0 Kudos
Messaggio 17 di 25
4.128Visualizzazioni
A DAQ/Switching Matrix controlled  by a PIC32MX460F512L through LabVIEW.  Be sure to include mpusbapi.dll to the directory.
Messaggio 18 di 25
4.111Visualizzazioni

Thanks for your help. I want to ask some questions

 

http://www.elektor.com/magazines/2007/november/usb-data-acquisition-card.271706.lynkx

 

I found the above link of usb data acquisition card , this  daq card has eight analog channels , 8 digital inputs , 8 digital outputs and 2 pwm outputs. The software interface using this daq card is based on .NET Framework. This daq card uses PIC18f4550 microcontroller. I have understood the code of user.c but that code is compatible with Visual C++ application . I want to control this Daq card over labview8.2 . Please tell me how can i use your labview VI to control this DAQ card .

              

 

            In your driverVI , i have to add the 8 analog inputs of ADC  out of which the one i select sends a particular code to the pic18f4550 ,which recognizes that code and enables only that input channel. Similarly in your VI , i want to add two analog PWM outputs also and 8 digital inputs and outputs each.

 

  You have worked before on the MCHPUSB Framework. , please just go through  user.c  and user.h for better understanding what i am trying to say. I have attached the firmware also or you can go to the link and download it from there. 

 

Please help me in developing the labview application as i want , i am new to labview and learning call library function but i have to complete this application within a week.

 

Any help greatly appreciated

 

Regards

Simon

 

usb_novice@rocketmail.com 

0 Kudos
Messaggio 19 di 25
4.099Visualizzazioni

Hi mchp1

 

I sent you only the firmware of the 18f4550 , you can download the complete code from the link mentioned above.

 

Please just look into it.

 

 

Regards

 

Simon

0 Kudos
Messaggio 20 di 25
4.078Visualizzazioni