This content is not available in your preferred language.

The content is shown in another available language. Your browser may include features that can help translate the text.

Serial VISA Read Terminates Before Specified Number of Bytes Has Been Read

Updated Apr 5, 2023

Reported In

Software

  • LabVIEW

Driver

  • NI-VISA

Issue Details

VISA Read will return from reading after it receives a termination character, even if it has not yet received the number of bytes specified. The default termination character is a line feed, 0x0A or \n.

Unfortunately, my application requires that I am able to read all 256 ASCII characters, including any termination characters that may come through the serial port. How can I turn this termination feature off?

Solution

To do this, create a Property Node for the VISA resource name and set the Termination Character Enable property to False and the Serial End Mode for Reads property to None. Complete the following steps to accomplish this:
  1. Place a Property Node onto your block diagram.
  2. Connect your VISA resource name to the Reference input on the Property Node.
  3. Right-click the Property portion of the Property Node and choose Change All to Write from the shortcut menu. Also, use your positioning tool to expand the Property Node to have two properties instead of one.
  4. Using the Operating tool, click the first Property and select Message Based Settings » Termination Character Enable. Right-click on this property, choose Create » Constant and use your Operating tool to select False as the input value.
  5. Using the Operating tool, click the second property and change it to Serial Settings » Serial End Mode for Reads. Right-click on this property, choose Create » Constant and use your Operating tool to select None as the input value.
Make sure that you insert this Property Node after you call the VISA Configure Serial Port vi, otherwise the property will be set back to True.

See the code below for an example of how to implement this.