Overview Demonstrates how to use the .NET Serial Port Class to get a list of the serial ports in the system.
Description Here is simple example description:
This example shows how to use the .NET Serial Port Class to get a list of the serial ports in the system. In order to access the method shown below, a constructor was first created. Constructors may be found in the .NET palette, which is a sub-palette of the Connections palette. Once the constructor is placed, a dialog pops up so you can select which object and constructor to use. First, expand the system object, then select the system IO ports object. Then, select the serialport() constructor. Then, you can right click on the constructor and select create and method, and in the list of methods is the [S}GetPortNames method.
Below, there is a VI using this example to get serial ports, and then showing a dialog to select the COM port. Additionally, below that is a version of the .NET Basic Serial Write and Read that uses the dialog VI to select the COM port to use. .NET is useful for using COM ports where VISA is not installed on a system or additional parameters need to be configured for the COM port, that VISA doesn't allow for. Note that the class used is found in version 2.0 or higher of the VI framework.
LabVIEW 2015 (or compatible)
Steps to Implement or Execute Code
Unzip the file and open "NET Basic Serial Write and Read With Port Select Dialog"
Configure some related parameters, such as Port name, Baud Rate, Data Bits, Parity and Stop Bits and so on
Write the detected string
Check whether the string is received.
Additional Information or References
**This document has been updated to meet the current required format for the NI Code Exchange.**