Controling a LabVIEW VI from C#

Hello,
I'm writing a C# program that calls LabVIEW  VI's using the ActiveX automation interface.
Getting started was quite straightforward (Load a VI, set/get simple parameters, run VI, etc...), but I could not figure out how to pass "clusters" from my C# program to LabVIEW...
The help for the "VirtualInstrument.call" method mentions a cluster should be treated as an array of variants - any example available?
I also noticed a "LabVIEWTypes" assembly that seems to have been created to allow manipulation of waveform data types was available- Did anyone experimented with this already?
...Any information would be appreciated!
Regards

I could figure it out ...
In .NET, there are no variants anymore - everything derives from "object" and so we need to create an array of object - each object in this array being a "field" of our cluster.
Let's consider a cluster that contains 3 numeric (double), we would control it from C# in the following manner :
//settings cluster [cluster = array of objects]
object[] myCluster;
//declare settings "cluster"
myCluster = new object[3];
myCluster[0] = new double(); //
myCluster[1] = new double(); //
myCluster[2] = new double(); //
//assign values to settings cluster
myCluster[0] = 3.14; //
myCluster[1] = 1.2; //
myCluster[2] = 2.3; //
//Write value to the LabVIEW cluster
myVI.SetControlValue("<clusterName>", myCluster);
Enjoy...

Similar Messages

  • How to control labview VI from a program not written in LabView on another computer?

    I am tasked with finding a way to control (an existing) LabView application (VI) from another computer (networked together) as part of a larger application which is not constructed in LabView (likely C# .Net Windows app).
    So, I am looking to find a solution that
    a) requires minimal change to the existing stand-alone LabView VI
    b) does not require LabView on the remote (controlling) computer.
    Controlling the LabView application involves communicating various setpoints etc, controlling start / stop, and getting back from the application some measured data values; could be treated as file transfer or data streams.
    Will it be fruitful to look into controlling the VI over TCP/IP? I gather that support exists in LabView for sending and receiving data over TCP connections. This approach would I guess require code to be added to the existing VI to handle commands and requests on the connection; simulating the ability to interact with the front panel.
    Are other options available? I see in the help pages mention of DataSockets and web services among other approaches.
    I am totally new to LabView, so all suggestions gratefully received, but please don't assume any knowledge of LabView.

    You can control LV from other applications using the ActiveX interface from VI Server. Since you want to do this from a remote machine, you would have to enable ActiveX-access using DCOM. This is a rather worksome efford and to my experience not really suggested.
    So i suggest you to define a TCP-based protocol for remote control of your dedicated application. This of course is only valid, if the application is already running on the "server". So your "client" connects, sends commands which are executed by the "server" and data and status information is sent back. And you are correct that this will require (significant) changes to the LV application.
    Web Services are also a valid approach if you can connect to web based applications. LabVIEW utilizes RESTful Web Services architecture. REST provides a lightweight
    protocol accessible to a wide variety of clients. The architecture does not
    require complex message parsing and provides a simple interface for you to begin
    using Web Services
    in LabVIEW.
    Other methods are possible, but i recommend you to pick one of those.
    hope this helps,
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • How can I call a LabVIEW executable from within another LabVIEW executable?

    I have a customer requirement for two LabVIEW executables. Based on their current setup, they need to run executable "A" or "B", both of which are under independent revision control. I have created a third "selection" executable that allows the operator to choose between one of the two, but I am receiving errors when I attempt to call a LabVIEW executable from within a LabVIEW executable using either the "System exec" VI or the "Run Application" VI. If I call a non-LabVIEW executable (such as Windows Explorer) everything works fine.

    > I have a customer requirement for two LabVIEW executables. Based on
    > their current setup, they need to run executable "A" or "B", both of
    > which are under independent revision control. I have created a third
    > "selection" executable that allows the operator to choose between one
    > of the two, but I am receiving errors when I attempt to call a LabVIEW
    > executable from within a LabVIEW executable using either the "System
    > exec" VI or the "Run Application" VI. If I call a non-LabVIEW
    > executable (such as Windows Explorer) everything works fine.
    As with the other poster, I suspect a path problem. You might try the
    path out in a shell window, and if it works, copy the complete absolute
    path to LV to see if that works. LV is basically passing the comma
    nd to
    the OS and doesn't even know what is in it, so you should be able to get
    it to work.
    The other poster commented on subpanels, which is a good suggestion, but
    without going to LV7, an EXE can have open more than one VI. You can
    use the VI Server and the Run method to fire up another top-level VI.
    The decision is whether you want both to be in unique processes.
    Greg McKaskle

  • How can I use an Access front end and Access button to control a LabView Shared variable boolean?

    My company has invested a lot of money on the office network to write many many access databases and front ends. I'm looking for a way to tie a button on an access front end to toggle a LabView boolean shared variable to notify me when they changed something on their side of the network. I'm not seeing anything that helps on a web or forum search. They don't like the idea of a separate labview control that they have to push a button on to let me know.
    Thanks
    Solved!
    Go to Solution.

    Hi Patrick,
    While this is not the intended purpose of Network-Published Shared Variables, you might be able to accomplish this by writing separate accessor VIs for reading from and writing to the variable, making sure to wire the inputs and outputs. Then, you could build a DLL, making sure that you include the accessor VIs as Exported VIs and include the DLL Library in the Always Included section of the DLL Build Specifications. During this process, you will define the function prototype, which will provide the function call, required parameters, and return values. Once the DLL is created, you can then call it and its functions from another programming language (C, C++, C#, VB, etc.). This may or may not work, but it is the only way that I can think of at this point. I have included some references that may help you in this process.
    Building a Shared Library in LabVIEW (White Paper)
    Calling LabVIEW VIs from Other Programming Languages (White Paper)
    Calling LabVIEW DLL From C# (Forum with Examples)
    I hope this helps.
    Regards,
    Mike Watts
    Product Marketing - Modular Instruments

  • Is it possible to create user defined control in labview

    in .net we can create user defined contol in which i can put more then one control and,, can use it as single control when needed,, but,, how this possible in labview,,
    actually in my program i have a tab control and,, in that tab control there are 8 pages,, now there are 5 different kind option selection for each page lets say "a" "b" "c" "d" "e",,,,,.,. so,, when i select "a" configuration for tabpage 1 should show.. "a"(control collection)  on tabpage1....and,, same should b possible for all 8 pages............................. this can possible if its possible to create user defined contorl in labview
    while in .net its very easy task i m confused here,..,.
    i put these controls in another 5 different  VI,,,, and tried to call in subpanel but,, i dont find the solution,,,
    Attachments:
    tabcontrol.vi ‏1 KB

    Hi,
    I've tried to open you attachment but LabVIEW tells me it's not a vi... could you check it and repost please ?
    I'm not really sure of what you need but you CAN customize you control in LabVIEW, it is not hard, you just have to know how it works
    Sometimes being good at another programation language confuse you more than it helps because you try to do as you are used to... the difficulty it to "translate" functions from a language to another.
    I do know how frustrating it can be when you think "Damned, it would take me only 5 minutes to do that with language a and after 10 hours with language b it is still not working "
    You have to get in LabVIEW way of thinking, I wish you good luck !
    A quick exemple... this might not do exactly what you need but it may help you anyway.
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"
    Attachments:
    exemple.vi ‏55 KB

  • How to change slider control digital display precision from program

    I want to change slider control digital display precision from my Labview 2013 program. I can not find property that changes slider digital display format. 
    Solved!
    Go to Solution.

    rt clk the digital display>create>property node>format string
    you could also do the slide scale, if needed...
    from the front panel:rt clk properties>goto display format tab>goto drop down list and pick "digital display 0" and format

  • Controlling front panel properties from within a statechart

    I have a user interface that I am trying to put into a statechart.  On the user interface I have a bunch of buttons (controls) and indicators.  To populate the indicators I am getting data back from 2 sources (USB and RS 232).  For this, I have made shared variables for the data returning from the sources but this only works for indicators as far as I can see.  Anyway, I have the software working and now that I am trying to go back and place the code into the statechart format to clean it up I am running into issues.  Since the statechart does not run inside the labview panel I can not access the front panel properties of controls.  Basically, I am using the statechart to control which buttons are active on the front panel (this is dependent on the state the user is in).  Also I am using the states to control a LabVIEW “tab control” to determine which tab to display.  For instance, I have an operate screen and a calibrate screen.  Depending on which state the operator is in, different controls are active (I don’t want the user to accidently change an item on the operate screen while in calibrate).  Is there a way to do this inside the statechart structure?  

    You don't actually copy the reference itself. Rather, you want to add a control of the same type as the reference to your statechart Inputs.ctl. You can get such a control by right clicking on the reference you created and choosing "create control".
    Then you pass in the reference to your specific control into the statechart via the inputs terminal. You can then talk to this reference via VI server and manipulate the original control. 
    If this isn't clear probably the best thing to do is to look in the LV help index for the keyword "control references" and read about "passing to subVIs". Passing a reference to a subVI is very much like passing one to a statechart so most of this is relevant.
    Hope that helps.

  • Load picture control with png image from the web

    Hi guys,
    Is there an example anywhere for Labview 8.6 for loading a picture control with png image from the web?

    Hi lavalava,
    here you find a note on how to load pictures from the internet. After grabbing the data you could save them to a file, load the file with the picture file functions and then convert it into the image datatype to feed a picture indicator with the data...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Auto Tune prior to running motion control program (LabVIEW)

    Hi,
    I am controlling Parker Compumotor (404-LXR) linear servo table via GV6 drive and PCI-7344 motion controller.
    The problem is that I always have to run automatic tuning in MAX when I turn off all the system and restart it.
    Before I use the automatic servo tuning in MAX, the servo table buzzes and oscillates wildly. Cabling seems to be successful as linear servo motor is completely controlled by LabVIEW after auto tuning in MAX.
    I wonder how I can just run my LabVIEW program without running Auto Tune step.

    Hello Gino,
    Thank you for using our discussion forums. Yes, you can programmatic load the PID parameters from LabVIEW. Tune your servo using auto tune, once you are satisfied with the response look under the Control Loop tab for the PID parameters. In LabVIEW use the Load All PID Parameters.flx and use the tuned parameters from Measurement and Automation Explorer as the PID Parameters input for this VI. Place the VI before the multistart.vi. This will make sure the correct PID settings are used. I hope this helps you out. Have a nice day!
    Regards,
    Nipun M
    Applications Engineer
    National Instruments

  • Really need help (motor control using labview)

    hi all readers,
    im new beginner. really need help for my project. i've been assigned to monitor/control motor using labview 8.5 (using NI DAQmx). the problem is, the techinician told me that i cant use 3phase motor with this card. things that i need to displayed using labview is :
    torque
    power
    current
    voltage
    speed
    really appreciated if readers can help me with this:
    wut type of motor shud i use that compatible with NI DAQmx
    thanks a lot.

    Hi fauziana,
    NI data acquisition devices are primarily designed to take measurements, so it's a good idea to measure the signals that you have mentioned with a DAQ device.
    You also can use DAQ devices for control tasks, but for reliable and deterministic control behavioryou typically need to use a real-time operating system (not Windows!). If you want to learn more about the pros and cons of using DAQ devices for motion control tasks, please refer to these threads. Still for standard motion control tasks it's much more efficient in terms of development time, to use a dedicated motion control device for the motion control part of your application.
    In general the control part is independant from the motor type, as these devices only generate control signals (+/- 10 V). There are many power drives available, that accept this type of control signal and you should select your motor according to the requirements of your application.
    For a more detailed system consulting, please contact your local NI branch. To select the products that fit best to your application requirements a face to face discussion is much more efficient than a discussion forum thread, because there are a lot of parameters that need to be taken into consideration. If you tell me in which country you are living, I can provide appropriate contact data to you.
    Thanks and kind regards,
    Jochen Klier
    National Instruments

  • Simple motor control with Labview

    Can anyone suggest a simple motor to be controlled by labview. I am interested in making a small scale elevator that is controlled with a labview interface. If anyone could point me in the right direction it would be greatly appreciated. - Bryan

    Attached is the vi for the program.  I will also try and attach the C code for the project.  It took a lot of failed attempts to get it working so I hope this works for you.  I don't have a schematic for you, but if you look over the C code it should let you know.  Also I used the CCS development kit 16F877A.  I'm not great at programming in C so there is a good chance you can clean it up a bit.
    I'll keep an eye on this post if you have any questions, when winter comes I'll probably work on this some more.
    Message Edited by nutmegzzzz on 09-19-2005 01:56 PM
    Attachments:
    Serial Read with Timeout version 1b.vi ‏169 KB
    LED and Motor Control from LabView - Complete.c ‏3 KB

  • DC motor closed loop control through labview using usb 6008

    Hello
    i am doing a project in which i want to control the speed of a DC motor (PID control) through labVIEW 2010. I am having a DC motor, a drive unit that regulates the voltage to the motor by getting analog voltage from 0 to 3.3V ( it can be used for both directions) and i also have a NI usb 6008 board. The problem is that i can't feed the usb 6008 with the digital signal from my hall effect speed sensor. Is it posible with this setup to control the motor?? I can also try to use the pulse as analog input and trasform the frequency into rpm's. Then i am thinking of generating an analog signal to feed the motor drive. If you have any further suggestion of a probably better hardware setup would be more than helpfull to me.
    Sincerely
    Jason Chaloulos

    Hello Michael
    Thanks for the reply. I came across those topics before and all of them are trying to generate a PWM signal as output i want to use just an analog signal output so timing on the output is not that important i guess. i am struggling on getting the frequency from the digital input signal that my hall effect sensor generates. Since the maximum speed of the motor is 3000 rpm and with my tooth wheel the maximum  output frequency of the sensor will be 300Hz which i see its way less than the limitation of my ni board. Is there any tutorial documentation that might help me with this one ? Thank you in advance.
    Kind regards
    Jason

  • Is it possible to call a VI that is inside a LabVIEW executable from a TestStand sequence?

    I have created a custom TestStand operator interface and have modified the default sequential process model to display a UUT information dialog that prompts for more information than just the UUT serial number.  This UUT information dialog is a LabVIEW VI.  To distribute the operator interface, I build it into an executable.  As part of the build process, I make a copy of the UUT information dialog VI (which is part of my operator interface project) and place it in the same folder as the executable.  I have then configured the sequential process model to call the dialog VI from this location.  It would be really nice if I could embed the UUT information dialog VI inside the operator interface executable so that I could distribute just an executable instead of an executable and separate VIs.  Is this possible?  In other words, is it possible to call a VI that is inside a LabVIEW executable from a TestStand sequence just like a standard LabVIEW VI call?

    Ryan,
    The dialog that you've created isn't being directly called by the OI at all and shouldn't need to be included in the same directory as the OI for distribution. Since you are modifying the PreUUT of the default process model, you will give the path to the VI in that step, create a deployment and then manually copy the VI to the directory referenced in the step. The VI is considered a support file for the process model and is not related to the OI at all.
    Test Engineer - CTA

  • How to call a labview dll from excel-VBA?

    How to call a simple Labview DLL from Excel VBA?
    I have seen examples of DLL calls from VB but does it work the same way for VBA? I have 2000 excel and Labview 8.5. I created the DLL and tried to call it from VBA using the same type of code as in NI's website example(ofcourse its a bit diff with 8.5)
    http://zone.ni.com/devzone/cda/tut/p/id/...
    BUT it errors out when called from excel
    ERROR: The object invoked has disconnected from its client

    You would need to provide more details about the LabVIEW DLL, such as the prototypes of the functions (VIs) that you're trying to call, and your actual VBA code. Specifically, what object you're trying to create. You should also make sure the Run-Time Enginer is installed, as well as any required libraries such as the VISA Run-Time if you're using VISA. Have you made sure to enable the ActiveX server for the DLL?
    A search yielded the following items that you may wish to peruse:
    http://forums.ni.com/ni/board/message?board.id=170&message.id=261345&requireLogin=False
    http://forums.ni.com/ni/board/message?board.id=170&message.id=45099&requireLogin=False
    http://forums.ni.com/ni/board/message?board.id=170&message.id=299209&requireLogin=False
    http://forums.ni.com/ni/board/message?board.id=170&message.id=195846&requireLogin=False

  • I have an iPod, iPhone and iPad all set up to a Dell laptop. I recently got a Macbook Pro, how do I transfer all my control for my devices from the Dell to the MacBook?

    I have an iPod, iPhone and iPad all set up to a Dell laptop. I recently got a Macbook Pro, how do I transfer all my control for my devices from the Dell to the MacBook?  Can anyone help?

    http://www.apple.com/support/switch101/
    http://www.macworld.com/article/1153952/superguide_switchingtoamac.html

Maybe you are looking for

  • Unable to use variables of a function module in am enhancement spot

    Hi All, I have created an implicit code enhancement spot at the end of a function module. In this enhancement I am unable to access the local variables and the import/export variables of the function module. Is this the expected behavior or I am doin

  • OAS 10g metadata repository creation assistant & database version issue

    Hi, I have to install Oracle Application Server 10.1.2.0.2 on a server which already has an Oracle database 11g running on it and I dont want to install another database due to the load factor. I am not sure if I could use that database (version 11g)

  • Why don't iPhone alarms work when the phone is switched off?

    How come iPhone alarms won't work when the phone itself is turned off?

  • Unable to add Gatekeeper

    Hi to all, I'm new in Cisco Voice Portal. I have installed CVP, then checked all services are running. After that I have added CallServer, Reporting, VXML servers, etc. But I cannot add Gatekeeper from Device Managenemt menu. I can't understand diffe

  • Where can i get more info on WSDL?

    I have a web service already running which is written in non-Java. I'm supposed to be writing a client to get services from this web service. I have been provided with a WSDL file. Can anyone tell me how should I go about it?