08-11-2012 07:19 PM
Hi, I just got a new piece of equipment I would like to control via Labview and I'm having trouble getting started communicating with the device - an Acton spectrometer (previous post related to topic). The instrument can connect via either RS-232 or usb cable and shows up in device manager as COM 5 and properly label as the acton spectrometer.
I have the instrument's dll file and header file and a detailed description of all the functions but I'm afraid I'm at a loss for how to get started. I've previously written labview programs to communicate through the VISA read/write functions but that instrument communicated through hex commands and seemed simpler to me to work with than this new instrument where it looks like I need to send string commands - I'm getting lost in syntax and proper structuring of the functions. The Call Library Function node will list the functions from the dll but I'm unclear on how to take it from the generic void funcname(void); and match it to the described functions and their arguments.
I'm also unsure what options I have for communicating with the instrument, is using the dll with Call Library Function node at some level equivalent to sending a string command via the VISA write, or are they used in combination, or can the Call Library Function nodes be used alone to communicated with the instrument? I understand these questions are very basic/generic I've just been having trouble finding the resources to learn the answers to them so links to either NI documentation/examples or other forum posts would be greatly appreciated.
I'm including as example some info on the first basic command I'd like start with - a simple device search command:
----------------------------------------------------------------------------------
"detailed description":
ARC_Search_For_Mono , function used to search for attached monochromators. With the
exception of ARC_Ver, must be the first function called.
Delphi : function ARC_Search_For_Mono(out Num_Found : integer): wordbool;
stdcall;
VB : Private Declare Function ARC_Search_For_Mono Lib "ARC_SpectraPro.dll"
(Num_Found As Long) As Integer
Num_Found : The number of Acton Research Instruments found and enumerated.
Enumeration list starts with zero and ends with Num_Found minus one.
Result : True, if any instruments where found.
----------------------------------------------------------------------------------
some code from the dll header file:
typedef unsigned _int16 (CALLBACK* LPFNDLL_Search_For_Mono) (long &);
----------------------------------------------------------------------------------
Any help would be appreciated, I think I just need a little help getting started. Thanks in advance!
Solved! Go to Solution.
08-11-2012 08:12 PM - edited 08-11-2012 08:12 PM
First, why did you feel it necesssary to create a new thread about the same instrument?
Second, why are your messing around with DLL and such when the operating manual has plain text commands that can be sent over RS232?
You marked your previous thread as solved.
08-11-2012 08:26 PM
1) The thread I linked to was not mine but seemed similar enough to be worth including to help provide responders with more information. I reffered to it as previous post but should have said previous thread.
2) I have no experience yet with labview and working with instrument dll's so I don't know if I can completely ignore the dll and just send commands with VISA writes (I asked this in original post) or perhaps using the Call Library Function could be more efficient than using just VISA write/reads? I'm comfortable working with VISA read/writes but from the info I have about the instrument I don't know how to write the command with the proper syntax (my current attempts have been unsuccessful) and I don't have a simple example to work from. I thought maybe the missing information about the proper syntax might be hidden in the dll and call library function node but I can't decipher it.
08-11-2012 08:33 PM
Since you have neglected to post to model number of this intrument, everything would be conjecture at this point.
08-11-2012 09:17 PM - edited 08-11-2012 09:18 PM
Hi,
If you have all the DLL docs then you need to know what data types the dll is using, and matching them with LabVIEW. Most of the basic data types are the same, like int32, etc... You can pass clusters for structures as long as the elements match. The more complex the more you have to read on this board.
You can create VI's that mirror the DLL functions, use the import wizard or build them as you go, SubVI for Function. Start with the simplest functions first to get up to speed. You may have to hit a C website to learn to read the functions in your docs, not sure of you C experience.
Some DLL's encapsulate VISA or GPIB, etc.. calls.
Sometimes the DLL is not congruent with the instrument VISA calls, for example, you might be able to use a VISA call "program constants" but the DLL might not have implemented or might have incorrectly implemented the function "program constants" so you have to use the VISA call.
***
Your code looks like it has integers of different types.