Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem of using pmcadll.dll (pmca get data) of Amptek MCA8000A

I was trying to acquire data from a Amptek MCA8000A using the provided pmcadll.dll and labview 8.2. All other functions seem to work well but the pmcagetdata function which has a function prototype of "long PmcaGetData(unsigned long *buffer, long channel, long dwordCount)". How to pass data to and retrieve data from the buffer? Attached are the source codes and the dll file from Amptek. Thanks for your help.
0 Kudos
Message 1 of 21
(6,538 Views)

Hi asddf,

Are you receiving a specific error associated with the function when you try to call it?  Call you successfully call the dll for all other functions?

You may want to consider contacting the manufacturer since it sounds specific to the dll, and they should have more information about the functionality.

Regards,

Lauren

Applications Engineering
National Instruments
0 Kudos
Message 2 of 21
(6,519 Views)
Dear Lauren,
 
Thank you very much for your reply. I have solved the problem after posting this message. I initialized an array with a size of dwordcount and passed it as the first parameter to "long PmcaGetData(unsigned long *buffer, long channel, long dwordCount)", and it worked.
 
However, I still got another question. I used the import dll tools, but some of the functions, such as "int PmcaGetFlags(PmcaFlagsType *flags)" and "PmcaGetStatus(PmcaStatusType *status)", cannot be imported, because they used complex data types (union, structure) as input arguments. I have read something about using wrapper function to solve this problem. Have you got some information about writing wrapper functions and some detailed examples?
 
Thanks
0 Kudos
Message 3 of 21
(6,514 Views)
Hi!
I am also trying to use Amptek MCA8000A using the provided pmcadll.dll and labview 8.5. I wuold like to thank asddf because the hint on the use of PmcaGetData was very useful for me.
All the functions now are performing well. Any news about how to import the functions "int PmcaGetFlags(PmcaFlagsType *flags)" and "PmcaGetStatus(PmcaStatusType *status)"?
Thanks!

0 Kudos
Message 4 of 21
(6,381 Views)

Hi,

If the function you wish to call contains complex data types, you need to manually use a Call Library Function Node function in LabVIEW to directly call the DLL, providing the prototype within the configuration dialog.  If your complex data type is a struct with more than primitive data types (int, double, char), it is easiest to create a wrapper DLL from a C-based language.  For more information on this, take a look at the following articles:

Call a Dynamic Link Library from LabVIEW

Writing a Wrapper Function

Regards,

Lauren

Applications Engineering
National Instruments
0 Kudos
Message 5 of 21
(6,362 Views)
Hi Lauren,
 
As I have no C compile, I would like to  get some status information through serial communication, but was not successful. Write to Serial shows no error, but the MCA does no response to the command at all, and Read from Serial always returns error message. The attached is the Data Transfer Protocol for the MCA. Have you got any idea on how to use it, or anyone else has done similar things. Thanks.
0 Kudos
Message 6 of 21
(6,195 Views)
here is the attachment
0 Kudos
Message 7 of 21
(6,194 Views)
Hello,
What is the error message you are getting?

Also have you tried getting the Bytes at Port to check if you have read anything from your device.
You might also try sending the status command by itselfs in the VISA test panel and see if you get
a response.

Let us know how this goes.
Christian A
National Instruments
Applications Engineer
0 Kudos
Message 8 of 21
(6,154 Views)
Dear Asddf, Lauren and everybody...
I'm from Frascati (INFN-LNF) and I tried to use the MCA8000A via Labview... but I found the same problems than asddf, but I'm not able to resolve them...
In particular:
1) how can I pass the Set Time to Start Acquisition? in the input I can put the setStamp, but the set time has a char* time and I 'm not able to find the same in Labview language;
2) asddf, what do you mean for "dwordcount array"? i.e.:


@asddf wrote:
Thank you very much for your reply. I have solved the problem after posting this message. I initialized an array with a size of dwordcount and passed it as the first parameter to "long PmcaGetData(unsigned long *buffer, long channel, long dwordCount)", and it worked.
Finally, asddf or
goblinsqueen, can I contact you directly, in order to show my routines (I'm newbbie in the Labview world, so I wish to know if all is ok...)... my skpye account is "teclis77"

Best Regards

Dariush Hampai

0 Kudos
Message 9 of 21
(5,918 Views)

Hi Dariush,

Please use the attached vi to get data from the MCA.

You might not be able to pass SetTime (the output is a string) to StartAcquisition (the input is an integer). You just set the time use SetTime, and pass a non-zero integer to the StartAcquisition to get the time, if no SetTime is used, it uses the current time of the computer as the start time.

Cheers. 

0 Kudos
Message 10 of 21
(5,898 Views)