Example Code

Continuous Pulse Train Generation with On The Fly Control

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)

    Software

  • LabVIEW

    Driver

  • NI DAQmx

Code and Documents

Attachment

Overview:
Demonstrates on changing counter output settings on the fly.

Description:
The NI-DAQmx Channel Property Node is placed in a while loop to allow the user to regulate the frequency and the duty cycle of a pulse train while a counter output task is running.

Requirements:
LabVIEW 2012 or compatible.
NI-DAQmx 15.5.1 or compatible.

Steps to Implement or Execute Code:

  1. Prior to running this VI, specify all the control values under the Channel Parameters tab.
  2. When the VI is running, change the Frequency and Duty cycle control values.

Steps:

  1. Create a Counter Output channel to produce pulses that frequency and duty cycle define.  If the Idle State of the pulse is set to low, the state of the line will begin low and remain low after the generation is stopped.
  2. Use the DAQmx Timing VI (Implicit) to configure the duration of the pulse generation.
  3. Call the DAQmx Start VI to arm the counter and begin the pulse train generation.
  4. Use the DAQmx Channel property node to update the pulse frequency and duty cycle each iteration of the loop.
  5. Loop continuously until the user presses the Stop button. Check for errors every 100 ms using the DAQmx Is Task Done.vi
  6. Call the DAQmx Clear Task VI to clear the task and display any error occurs.

 

Front Panel.PNG

 

2017-05-12_16-49-24.jpg

 

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

Product Support Engineer
National Instruments

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

Comments
Hesron
Member
Member
on

this is what i am lookin for. how do i convert the counters to TRUE-FALSE function to control the swutching frequency of a relay?