Example Code

Generate Multiple Cycles of Finite Pulses Using Two Counters

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 generating multiple finite digital pulse train from a Counter Output.

Description:
This example shows on how to pause pulse generation of the main counter by configuring a digital signal from another counter as the source of the Pause Trigger.  No external timing or triggering circuitry is required.

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


Steps to Implement or Execute Code:

  1. Select the Physical Channel which corresponds to the counters at which the pulses will be generated.
  2. Enter the parameters of the pulses.
  3. Run this VI.
    Note:  Use the Measure Period example to verify you are outputting the pulse train on the DAQ device.


Connection Overview:
The counter will output the pulse train on the output terminal of the counter specified in the Physical Channel I/O control.  
For more information on the default counter input and output terminals for your device, open the NI-DAQmx Help, and refer to Counter Signal Connections found under the Device Considerations book in the table of contents.

Block Diagram Steps:

  1. Creates Counter Output channels to generate digital pulse.
  2. Specifies digital level as the type of trigger to pause the task, the terminal where the digital signal is used as the source of trigger and at which edge of the pulse to pause the trigger.
  3. Uses the DAQmx Timing VI (Implicit) to set the channels to generate continuous samples.
  4. Calls the Start VI to arm the counters and begin the pulse train generation.
  5. Loops continuously until the user presses the Stop button. Check for errors every 100 ms using the Is Task Done? VI
  6. Calls the Clear Task VI to clear the tasks and displays any error occurs..

2017-05-31_12-43-11.jpg

 

2017-05-31_12-42-46.jpg

 

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

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

Comments
Harikrishna125
Member
Member
on

HI,

I am developing a similar code in LabVIEW and need a little assistance. I am using the module NI 9819 chasis along side 9402 4-channel TTL digital I/o, generating a double pulse(mostly) but sometimes with user defined pulse-width and user defined no of pulses.

I am trying to acheive this task but the problem is if I need more than 2 pulses then I need more counter in that case (where I will be using only 2 counters for 2 pulses). Can you  suggest me how to acheieve this task.

 

Thanking you,