Example Code

Reset all probes in a VI to the

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Description

Overview
This VI uses VI scripting to delete all the current probes and recreate them . Please note that the VI scripting API is a product of the NI Labs and refer to the following link for more information about technical support and additional disclaimers:

https://www.ni.com/en/support/downloads/tools-network/download.labview-vi-scripting.html


Description
After the probes in a VI have been executed, there is no option to reset them to the 'not executed' state before you run the VI again. This means that the probes have a value from the previous execution and you have to rely on the timestamp to check if the value of the probe has changed in the current execution of the VI. The attached VI will help you get around this by deleting and recreating the probes thereby giving the effect of resetting the status to 'not executed'.

This VI requires the path of the VI (target VI) whose probes you want to reset as the front panel input. The VI is a state-machine with three states described below:

  1. GetProbe: This state gets a reference to all probes within a VI by examining every wire of the blockdiagram.
  2. DeleteProbe: This state is responsible for deleting all the probes in the current VI
  3. SetProbe: This state recreates all the probes in the target

 

Steps to Implement or Execute Code

  1. Enable VI scripting: This can be done by going to Tools>Options>VI Server > VI Scripting as shown below:
  2. Select the target VI using the front panel control as shown below:
  3. Click on the run arrow to execute the code and notice that the probes in the target VI have been reset.


Requirements

Software:

  1. LabVIEW 2014(or compatible)

 

Steps to Implement or Execute Code

  1. Download the .zip file
  2. Set your desired configuration (a, x1, x2, degrees, etc)
  3. Run the VI

 

Additional Information or References
VI Block Diagram

1.png

 **This document has been updated to meet the current required format for the NI Code Exchange.**

Thanks and Regards,
Supreeth.K

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Larry.C
Active Participant
Active Participant
on

Nice work Supreeth!

Happened to need this functionality while testing my VIs but didn't bother to think it was possible. Stumbling accross your example has brought a smile to my day will definitely use it next time I'm probing like a madman!

Cheers,

Larry


Larry Colvin
Associate Principal Engineer
Dyson Technology Ltd.

Larry.C
Active Participant
Active Participant
on

Just realised I can't use this yet

Would it be possible to recompile for LV2013? I have not yet upgraded to 2014.

Cheers mate!


Larry Colvin
Associate Principal Engineer
Dyson Technology Ltd.

Supreeth.K
Member
Member
on

Hey Larry,

Sorry mate, I read the notification and thought I would action it later and never got around to it

To make up for this, I have uploaded V2 of the code. This is better because it can handle probes within subdiagrams as well (sub VIs and programming structures) which the previous code didn't do!

Hope you find this useful.

Cheers

Thanks and Regards,
Supreeth.K

Larry.C
Active Participant
Active Participant
on

Hi Supreeth,

I have played around with your VI and it is exceptionally useful! Really good job!

As a possible next version I have an idea for you:

Make this function run as a keyboard shortcut and make it apply the action to the currently selected block diagram.

Thanks for the function mate

Regards,

Larry


Larry Colvin
Associate Principal Engineer
Dyson Technology Ltd.

Supreeth.K
Member
Member
on

Thanks for the feedback Larry...will try and implement the shortcut in the future...It will be a very useful..

Thanks and Regards,
Supreeth.K