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

Use DAQmx Counter Input to Trigger VISA Serial Acquisition

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

  • Data Acquisition (DAQ)
  • Other

    Software

  • LabVIEW

    Driver

  • NI DAQmx
  • NI VISA

Code and Documents

Attachment

Overview

This example uses a counter input to trigger a serial acquisition. When the counter detects a digital event, the specified string command is written to the serial port and a serial read is executed.

Description

Serial commands are typically software-timed, sent every iteration of a loop.  By importing a sample clock, the serial commands can be synchronized with external acquisitions based on hardware timing.  Each time the external sample clock strikes, an event is registered and each event triggers a serial acquisition.

Requirements

Software

  • LabVIEW 8.6 or compatible
  • NI-VISA driver compatible with the version of LabVIEW
  • NI-DAQmx 8.7.2 or compatible

Hardware

Steps to Implement or Execute Code

  1. Configure the physical channel, source of events, and VISA resource on the front panel
  2. Configure the serial parameters on the front panel to match the serial parameters of your device
  3. Specify the VISA command to be written in the string to write control on the front panel
  4. Run the VI
  5. Observe the  events received, bytes read, and the read string on the front panel

Additional Information or References


Block Diagram

GenEventExtSerial.png

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

A_Ryan
AES
National Instruments

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

Comments
Todd S.
NI Employee (retired)
on

Great stuff!

Todd S.
LabVIEW Community Manager
National Instruments
Contributors