From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Output a Constant Signal/Voltage From a Serial Port with NI VISA

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

    Driver

  • NI VISA

Code and Documents

Attachment

 

Overview
This example demonstrates outputting a constant voltage on the serial port.

 
Description
This example sets the DTR line state to output a constant 5V until the program stops. The Break State property is used to suspend transmission on the line when the user specifies. An event structure is used to detect when the button controlling the break state is clicked.

Requirements

Software:

  1. LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  1. Configure a Serial Port.
  2. Run the application.

Additional Information or References
It is not recommended that the serial port be used as a signal source, however it is possible. Note that using the computer’s serial port as a source can damage your computer.

VI Snippet

Continuous Break DTR Assertion 2012 NIVerified.png 

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

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