LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How implement a set of commands/properties, various i/o data types, for an instrument driver?

I have this machine that is run by the manufacturer's software. The software is basically designed for a user to create various programs (kind of like a scripted procedure list) and then be able to run them. However, they also provide a COM/ActiveX interface for their customers who want to integrate the machine into a larger, more automated/robotically controlled platform. So instead of a user standing by the machine and running it as a standalone device, something more like a SCADA/job scheduler program could have a robot bring something to the machine and tell it to perform some task.

 

The automation interface includes a pretty wide range of properties & methods that includes a mix of read only/write only/read-write properties, some methods that have no input parameters, some have up to 3. These inputs & outputs also have a number of different data types.

 

My first crack at making a driver for this was to make a vi for every property and method I could foresee wanting, and then making a polymorphic vi of all of them so that I could just plop it down wherever I needed to interact with the instrument and could select the property/method I wanted and have the connector pane adjust to the appropriate number of inputs/outputs and data types.

 

However, as I've progressed further, I've come to realize I'm calling these from lots of different places/vis and I'm thinking I really need these commands to be serialized to ensure the order in which they are sent and avoid simultaneously trying to send more than one request. My assumption is that polymorphic vis are both non-reentrant & nor are they really a single vi that ensures no more than one subvi that makes up the poly can't be called simultaneously. Basically, when you make your selection for the poly, it's the equivalent of having placed that particular subvi on the wiring diagram, right? So if the poly is called by vi A and vi B at the same time, and the poly selection is different, two different commands could be sent simultaneously to the ActiveX interface, right?

 

Is there just a better way to go about this? I'm just so hung up on how to deal with different data types and number of input/outputs. While a variant could be used for the data types problem I can't wrap my head around how make it so that it knows how to wrap/unwrap & route variants once they're "inside" to the appropriate ActiveX method/property and how to deal with outputs for properties that have them. I also want to address the issue of ensuring these commands are called sequentially no matter which vi calls them.

 

Anyone got any pointers or strategies for this?

0 Kudos
Message 1 of 2
(2,291 Views)

hi there,

i may have mistunderstood you, but what i gather is that you have one big project and you have built a wrapper for calling your machine to action from different parts of your code.

 

what i have done in a similar situation was using the wrapper to add to a queue, that another control-VI then dequeues and processes the request (sends you activex/com to the machine). (you could of course use a queue directly in each instance you want the machine to do something, but the control-vi dequeuing elements is still required)

 

for passing varying data into you wrapper vi/queue, create a cluster having an enum and a variant for the data input, then you can specify via the enum what kind of data the variant holds and variant-to-data accordingly.

 

hope that helps

regards


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 2 of 2
(2,261 Views)