To detect all NI devices connected to the system programmatically through LabVIEW:
1. Install
NI System Configuration to gain access to the NI System Configuration APIs and VIs in LabVIEW. This can be downloaded from the
System Configuration Download Page.2. Either:
- Recreate the Block Diagram shown below, or use the LabVIEW snippet below.
- The code uses the Find Hardware VI to retrieve a list of NI hardware that is connected to the system.
Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.
3. Use the
System Hardware Property Node to select any additional information you would like to be displayed about the connected devices.
- In the example code, the Property Node is used to retrieve the device's Product Name, Vendor Name, Alias, and whether it's simulated. This information is then built into an array.
To search for connected NI devices by name programmatically in LabVIEW:
1. Follow the steps above for programmatically detecting all connected NI devices.
2. Either:
- Modify the code as shown below, or use the LabVIEW snippet below.
Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.
3. This example is the same as the previous, with an addition of the String Subset function.
- The Search Devices Control contains a string to be searched. The String Subset function then searches the device's Product Name property and checks whether it contains the Search Devices string. Note: this search is case-sensitive.