Example Code

Software Timed Pulse Width Modulation

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 regulating the width of digital pulses programmatically.

Descriptions:
This examples allows the user to regulate the low and high time of the digital pulse on the fly.

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


Steps to Implement or Execute Code:

  1. Select digital lines at which the digital signal will be generated.
  2. Set the Low and High Time (ms). You may also change this while the VI is running.
  3. Run this VI.


Block Diagram Steps:

  1. Creates a Digital Output channel to generate digital pulses.
  2. Write a single sample into the card buffer.
  3. Specifies whether to invert the lines in the channel. If you set this property to TRUE, the lines are at high logic when off and at low logic when on.
  4. Transitions the task to running state to begin generation.
  5. Depending on the iteration count, the digital output channel will write a low and high alternately.
  6. Clears the task.
  7. Displays any error occurs.

Front Panel.PNG

 

Block Diagram.PNG

 

**This document has been updated to meet the current required format for the NI Code Exchange.**
Doug Farrell
Solutions Marketing - Automotive
National Instruments

National Instruments Automotive Solutions

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

Comments
okky.septa.c
Member
Member
on

I have plant DC Motor and I using NI-USB 6009. Can I generate PWM signal with this VI ?