Example Code

Reconfigurable Finite Counter Output Using DAQmx on E or M Series

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
The example is to demonstrate how to overcome the challenge of the generation of finite signal using the E or M series

Description:
The challenge of using the E or M series is generating a finite signal with its counter. One of the way to overcome this is by leveraging the event structure of the signal pulse generation that would eventually stop the the while loop used in the counter of the DAQ Hardware

Steps to Implement or Execute Code:
To implement this example:

  1. Define the Physical Channels
  2. (Optional) Set the value of the parameters as needed
  3. Run the VI
  4. (Optional) Turn on the Highlight Execution to see the flow of the VI


To execute this example:

  1. Install the required software.
  2. Connect the DAQ hardware that supports the Counter features
  3. Confirm the connection with the MAX with TestPanel
  4. Open the VI and refer the Implement Steps


Requirements
Software
LabVIEW 2012 or compatible
NI-DAQmx 9.0 or compatible

Hardware
cDAQ with C series Counter Input Module

 

fp.PNG

 

bd.PNG

 

**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
Paul_C.
Active Participant
Active Participant
on

Nice code!

yamadj
Active Participant
Active Participant
on

Hey! This code is great, but I found when you actually run in on a device if comes up with...

Error -200966 occurred at Register For Events in ...

Possible reason(s):

Every N Samples Acquired Into Buffer Event registration has failed because the event is already registered within the task.

Unregister the event before registering it again.

Task Name: _unnamedTask<E>

...

I think I've found a fix by making sure the task is stopped before trying to unregister the event.

Capture.PNG

JY
Application Engineer, RF and Communications
National Instruments
Prabhakar_Sithambaram
Member
Member
on

Hey, 

I wrote the following program trying to output a series of 1000 samples of pulses whose frequency is 250 (Variable) Device: USB X series (6353)\

I got an error: -201291: Pulse specifications cannot be written to a finite counter output task on this device.

I do not know what was wrong. This is to generate a finite no.of samples for the stepper motor control.pwm.JPG

I want to write a finite no.of samples in order to control the stepper motor with a particular mentioned degree of rotation.