ni.com is experiencing intermittent service disruptions.

Support teams are actively working on the resolution.

Example Code

Multithread Read Serial Data, Display and Write to Spreadsheet Using LabVIEW

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.

    Hardware

  • Instrument Control

    Software

  • LabVIEW

Code and Documents

Attachment

Download All

Overview

MultiThreaded application to read, graphically display and write serial port data to a spreadsheet file.

 

Description

This VI creates a multithreaded application that reads continuous packet data transferred over a specified Serial (COM)  port while continuously displaying the data graphically and writing the data to a file. In this example, the data is from an accelerometer with a fixed packet length. The contents of the packet are Header, Data, CheckSum (comma delimited HEX values)

 

[4bytes][XData][YData][ZData][CHKSUM]

 

Once the Data is read from the COM port it is put into a thread safe queue for the second thread to process it.

 

Requirements

  • LabVIEW 2013 (or compatible)
  • Serial Instrument

 

Steps to Implement or Execute Code

  1. Create a serial packet like the example below from the serial instrument.

               Serial Packet from serial instrument: FFAADDFF,5D,A6,55,CHKSUM

    2. Configure the serial instrument by inputting strings below the Waveform Chart.

    3. Check the Packet Data indicator and Chart.

 

Additional Information or References VI Block Diagram

VI Snippet

muliti.png

 

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

 

 

 

Applications/Systems/Test
National Instruments | AWR Group

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