Custom probe

From LabVIEW Wiki
Jump to: navigation, search

A Custom probe is a user-defined Probe that allows for more interactive and specific monitoring of data passing through a wire in a LabVIEW block diagram during execution. Unlike the standard probes that simply display the data flowing through a wire, custom probes can be designed to allow users to interact with the data, apply conditional formatting, perform calculations, or even modify the data on the fly.

Creating a custom probe involves programming a small LabVIEW VI (Virtual Instrument) that can include controls and indicators, providing a customized interface for data inspection and manipulation. When you attach a custom probe to a wire in a block diagram, it can display information in a more meaningful way specific to your application needs, such as plotting a graph, showing an array's contents in a table, or implementing custom logic to highlight certain conditions.

Custom probes are particularly useful in debugging and data analysis, offering insights into the operation of a VI that might not be easily obtained through standard probes or debugging techniques. They extend the functionality of LabVIEW's debugging tools by enabling the creation of application-specific probes tailored to the unique requirements of each project.

Creating a Custom Probe

Creating a probe allows you to have more control over how LabVIEW probes the data that flows through a wire. When you create a new probe, the data type of the probe matches the data type of the wire you right-click. Before you begin creating custom probes, refer to the caveats and recommendations.

Steps to Create a Custom Probe

Note: If you are creating a custom probe for a LabVIEW class or interface data type, some steps may vary depending on whether you are creating a member VI of the class or interface or a non-member custom probe. Member probes can access the private data of the class directly and display any aspect of it. A non-member custom probe may only display information accessible via the public interface of the class.

  1. Right-click a wire and select Custom Probe»New... from the shortcut menu to display the Create New Probe dialog box.
  2. Select whether to create a new probe or to base your probe on an existing one.
    1. To create a probe based on an existing one, select Create a probe from an existing probe. LabVIEW displays all supplied probes in the [LeabVIEW 20xx]]\vi.lib\_probes directory and any custom probes you've created.
    2. Click the Next button and select an existing probe to base the new probe on.
    3. Enter the filename, window title, shortcut menu name, and the directory where you wish to save the probe. LabVIEW stores custom probes in the [Documents]\LabVIEW Data\Probes directory by default. To make a custom probe the default for a particular data type, save it in the [LabVIEW 20xx]\user.lib\_probes\default directory.
    4. Click the Save button. LabVIEW opens a probe matching the existing probe you selected.

Note: For creating a non-member probe for a LabVIEW class or interface, follow the instructions above. For member probes, save the custom probe in the subdirectory with other member VIs of the class or interface for easy distribution.

  1. To create a new probe, select Create a new probe and click the Next button.
    1. Enter the filename, window title, shortcut menu name, and directory for the new probe.
    2. Click the Save button. LabVIEW opens a probe with a control matching the data type of the wire you right-clicked and includes a Boolean indicator acting as a conditional breakpoint. It also contains the To Probe String function for configuring the display value in the Probe Watch Window.
    3. (Optional) Wire any data type to the data value input of the To Probe String function to display the data as a string in the Value column of the Probe Watch Window. The function breaks down and converts data into a string that the Value String indicator can display, compressing and trimming as needed to fit the available space.
      Note: LabVIEW automatically wires the control to the To Probe String function. You can remove this function if you wish to specify the string displayed in the Value column.
    (Optional) Specify the string you want LabVIEW to display in the Value column by wiring that string to the Value String indicator.
  2. The block diagram shows a custom probe for numeric data, using a Case Structure to display "Greater than five" or "Less than five" instead of the default data display.
  3. After customizing the probe, save and close it. To edit it, open it from the directory where it was saved.

Note: The Create New Probe dialog box does not make the new probe a member of the class or interface by default. To make it a member probe, add it to the class or interface.

Using the Custom Probe

To use the probe, right-click the wire and select Probe from the shortcut menu. To change the default probe for a data type, right-click a wire of that data type, select Custom Probe from the shortcut menu, and choose from the available options.

Note: A custom probe does not become the default probe for any data type until used. For member probes, use the Class/Interface Properties dialog box to set it as the initial default probe when distributing the class or interface.

Caveats and Recommendations When Using Custom Probes

  • Custom probes only execute when data flows through the wire. That is, although you can operate the controls on a custom probe at any time, programmatic responses to the changed control values occur only when the probe receives data from the wire.
  • You can debug a custom probe similar to a VI. However, a probe cannot probe its own block diagram, nor the block diagram of any of its subVIs. When debugging probes, use the generic probe.
  • Save probes in the labview\user.lib\_probes\default or the Default Data\Probes directories. Probes saved in the labview\user.lib\_probes\default directory are available to anyone running LabVIEW on the computer remotely. This directory is useful for public probes. Because the Default Data directory changes based on which user is logged in to the computer, National Instruments recommends you save non-public probes in this directory.
  • The main block diagram pauses until the probe finishes execution. Avoid using loops or Event structures in custom probes as these elements can increase the time it takes the probe to finish executing.
  • Be careful when using uninitialized shift registers in custom probes. Even if a VI is non-reentrant, when that VI is used as a probe, all uninitialized shift registers behave the same as reentrant VIs. Each probe retains the last value of the loop and does not share these values with other instances of the same probe.