Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

generating and measuring pwm

Regarding to measuring pwm, I have no idea how many parameters I need to measure to describe the signal. My customer also wants to generate a standard pwm to compare with the acquired pwm signal through a DAQ card (PCI 6251). In fact, they just want to know if the pwm is good or bad comparing with some good or standard pwm the machine should have. How can I do this in LabVIEW? Please offer some good ideas.
Thanks!
0 Kudos
Message 1 of 7
(6,678 Views)
Hi UniSA,

It sounds like your customer needs to verify the quality of their PWM signal, and there are several ways to do this.

The simplest and most straightforward is to use the example VI that measures duty cycle. In LabVIEW, go to Help » Find Examples... and then navigate to Hardware Input and Output » DAQmx » Counter Measurements » Period or Pulse Width » Meas Duty Cycle-Buffered-Finite.vi. This example will take a finite number of samples and tell you the duty cycle of the input signal, but you could modify for continous measurement if you need to.

You can also take individual measurements on different aspects of the signal: period, pulse width, analog shape, and then do whatever analysis you require. The first two each use a counter on your DAQ card, and the last is an analog input measurement.

If you use the duty cycle example, you may not need to compare it with a known signal since you'll have the exact information you want. However, LabVIEW does ship with PWM generation examples as well. In the Example Finder, navigate to Hardware Input and Output » DAQmx » Generating Digital Pulses » Gen Dig Pulse Train-Continuous.vi.

Please have a look and see if they meet your needs. Let me know if you'd like further clarification.
Joe Friedchicken
NI Configuration Based Software
Get with your fellow OS users
[ Linux ] [ macOS ]
Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
0 Kudos
Message 2 of 7
(6,666 Views)
Hi...
I am using Visual Basic 6.0
   
     I want to measure the ON time and OFF time of PWM signal which is connected to digital pin that is counter1.
         How do i do that?.
        Can u give me an example code in vb. what are all the function to be used.
i found one function called "DAQmxCreateCIPulseWidthChan"  but after creating this task how to get the puls width on time and off time.
what is the next function to get that.
 for example
 
1.Creating the task
2.
                   DAQmxErrChk DAQmxCreateCIPulseWidthChan(taskHandle,"Dev1/ctr1","PWM",1,500,DAQmx_Val_Seconds,DAQmx_Val_Rising,"")
3.?
 
after this..what is the next function to get the pw of that signal. and also i want on time and off time.
i am using PCI 6221 card.
 
but i don't want the counter value.
there is one example code but it is not working.....always it gives 0
but when i measure in oscilloscope i am getting the pwm signal.
 
plz...reply soon...its very urgent...
 
 
 
 
0 Kudos
Message 3 of 7
(6,485 Views)
Hi All,
 
The message from NI_DAQ was posted on multiple threads and will be answered at the original thread to keep our community organized. You can find that here: https://forums.ni.com/t5/Measurement-Studio-for-VB6/CWgraph/m-p/720146#M3992
PBear
NI RF
0 Kudos
Message 4 of 7
(6,459 Views)

In the Example Finder I don't have DAQmx under Harware Input and Output.  Is it possibly in another location?

 

I'm using LabVIEW 2010.

0 Kudos
Message 5 of 7
(4,540 Views)

Hi jnclaker!

 

DAQmx examples should be directly under Hardware Input and Output if you have them installed on your computer.

First be sure that you have the DAQmx drivers installed on your computer. The latest version can be found here.

 

If you know that you already have those drivers installed, try repairing the DAQmx software.

1. Start>>Control Panel>>Programs>>Uninstall a Program

2. Doubleclick the "National Instruments Software" entry

3. Select "NI-DAQmx x.x.x" from the window that pop up and click "Repair".

 

This will catch all of the missing files for the DAQmx drivers, which in your case is the examples that are not in the proper folder.

 

 

Let me know if this helps!

Peter E
Applications Engineer
National Instruments
0 Kudos
Message 6 of 7
(4,528 Views)

I apologize for my post!  I dont' know how/when it happened but at somepoint DAQmx was removed from my host computer.  I have reinstalled it and found the examples.  Thanks for your time, though.

0 Kudos
Message 7 of 7
(4,527 Views)