Pwm measurment

How can i measure a duty cycle & frequency of a PWM Signal with a 6014PCI usinf traditional  NI-Daq functions.
I need to measure the pulse and the pause to calculate the PWM in percent.

What you'll need to set up is called "semi-period measurement" and you may need it to be a buffered measurement.
However, the last I knew, this was a little quirky under trad NI-DAQ with DAQ-STC counters.  Specifically, there was no way of specifying or knowing whether the measurement started with a high time or a low time.  So when a real signal has a duty cycle of 25%, your program had no way of knowing whether it's measuring 25% or 75%.  Sometimes you may have special knowledge of your PWM signal that will help you know which is more sensible, but other times you're just plain stuck.
Frequency is easy enough though -- just take the reciprocal of the sum of two adjacent semi-periods.  Any two adjacent semi-periods sum to 1 whole period, and the reciprocal of that is frequency.
DAQmx provides some additional capabilities (including triggering) that *may* help.  I vaguely recall a thread here that suggested a DAQmx bug in a particular version that would have caused a similar ambiguity -- ah yes, here it is.   It references a different type of counter, so I'm not sure if the workaround applies to your board.
I haven't used DAQmx much for DAQ-STC counters -- I've mainly been using the 6602 and an M-series board which use different timing chips that sometimes work a bit differently than the DAQ-STC.  Nevertheless, here's a basic concept thay might also work.  As far as I know, this approach also requires DAQmx because trad NI-DAQ doesn't support triggering on DAQ-STC counters.
You would need to configure 2 counters to be triggered by the same signal (to guarantee simultaneous start), both measuring your PWM signal.  However, one would do buffered semi-period measurement (where polarity might be ambiguous) while the other does buffered period measurement (where polarity won't be ambiguous).  If your period measurement is set to measure rising edges, then you'll be able to examing the semi-period data to determine whether that rising edge corresponds to the 1st or 2nd entry in the semi-period data.  This in turn resolves the polarity ambiguity.
Note that even though you only need the 1st value in the buffer, the period measurement still needs to be buffered to make sure that the period measurement starts at the trigger signal.  In unbuffered mode, period measurement starts at the first active edge of the PWM signal after the trigger.
-Kevin P.

Similar Messages

  • Pulse width measurement on two to four signals

    Using the shipped PWM measurement solution I am able to make this work as needed on one signal. I would actually like to be able to do this same measurement on up to 4 signals at the same time. First, is this possible, and second, can this be done using a PCI-6601 counter timer card. My current card is a PCI6024E, and I am aware of the limitation of 2 counters, but I am hoping that the methods to get 2 signals to work will work with 4 signals.
    Troy

    Spencer, thanks for the answer. I tried using a PCI6024E with its two counters and single DMA channel, and the computer kicks back that the DMA channel is busy and cannot be used.
    Do you have some suggested code that might work?
    Troy

  • PWM & AI Synch

    Hello,
    I've been searching at the forums and support to no avail. What I've checked so far is: http://decibel.ni.com/content/docs/DOC-10785  http://forums.ni.com/t5/Multifunction-DAQ/How-to-S​yncronize-Analog-Digital-PWM-Input-and-Analog-Digi​... and the LabVIEW included examples.
    What I'm trying to achieve is as simple as reading a PWM signal and an Analog signal synched using LabVIEW 8.2.
    I'm measuring:
     - A PWM signal at about 1050Hz using two counters (one used to measure the exact frequency and the other to measure the width of the high pulse)
     -  Analog Signal between -10V and 10V (from a load cell). I will add another analog signal from the same device in the future, but this is irrelevant.
    This is what I've got so far:
    I'm facing mainly one problem with this:
     - Some of my Width and Frequency measurements are wrong. So wrong as extremely tiny width measurements or extremely high frequency measurements (as high as 2500-3000 Hz). I may avoid this by "filtering" the data... But I'm sure I'm doing something wrong and I should be able to get the data OK right from the start.
    I guess I'm getting wrong measurements from the counters due to the counter reading "from time to time" getting some of the pulses cutted. I was expecting the counter to read continuosly at the best timebase available with my expected frequency/width and simply discarding the excess of data. For example: at time 0 it will return the first value and at dt it will return the nearest value measured, discarding the inbetween data. So if my rate is 100Hz and my PWM goes as fast as ~1000Hz I will have about 10 PWM measures to chose from for each AI measure.
    By the way, is there any other way of measuring a PWM with just one counter (a part from guessing the frequency)? In the future I may need to read 2 PWM signals and reading them with just one counter will ease my work, as I will avoid having to synch two boards.
    I will greatly appreciate any help on this, as I'm getting stuck.
    Thanks in advance,
    Xavi
    Solved!
    Go to Solution.
    Attachments:
    TestSynchro_Example.vi ‏63 KB

    Sorry to reply myself...
    Now I'm feeling completely stupid. I was relying on the stability of the signal being measured. I've just checked my vi with a pulse train generated from another DAQ device on MAX and it works flawlessly. So problem may be on the signal measured, unfortunately I have no way to check it right now.
    Anyway, problem solved... 

  • How can I Create a software analog trigger for a counter (6602)

    Hi ?
    I need a software trigger (variable trigger level) for a rising trigger slope of a PWM signal.
    So is there any possibility to start the PWM measurement at a special PWM-voltage level?
    Or could I at, in front of the Counter an AnalogIn and generate there a fast (< 1?s?) RTSI signal for the counter?
    Thanks

    Hello,
    I think, you will get a good deal of information by taking a look at at the following link.
    Counter/Timer
    Please let me know if it helps or if you have further questions.

  • Multiple counter input using NI 6602

    I am using NI-DAQmx to write a VI  that will read 10 pwm measurements using 10 counters on 2 NI 6602 PCI interfaces.  It is my understanding that I must create a task for each respective counter.  I have attempted to implement a for loop to accomplish this, as shown in attached VI draft.  As it stands the VI will not write any data to file.  I suspect there are multiple errors in the VI.  I would ask if anyone could take a look at the attached VI and perhaps provide some insight?
    Saul LaCoursiere
    Attachments:
    MelexisMODdraft2.vi ‏41 KB

    Hi Saul,
    It looks like you had a subVI "Create Header" which needs to be included to run, so I deleted all of the report related code.  The Counter portion ran fine.  If you can't get the report generation portion to work, you may want to simplify your code (for example start with a single counter task) and build up from there.
    Please repost if you have further questions.
    Thanks,
    Luke
    Applications Engineer
    National Instruments

  • 6602 heap overflow

    Hello all,
    after several measurements, my program shuts down because of heap overflow.
    I searched the forum and found out that on Win NT a maximum buffer of 64MB for buffered counter measurements exists.
    I nearly reach these 64MB when measuring.
    My question is:
    How can I clear the buffer? I only allocate memory for 15 PWM-measurements and after calculation this memory is freed.
    But it seems that the 6602 uses always new memory...
    My system: PXI 233Mhz (!), PXI 6602
    NI-Daq 6.9.1f28
    measured signal 2x PWM, 5V
    CVI 6.0
    Measurement is done in a do while loop (but always crashes after 5,5 hours).
    Before any measurement the counters are reset an configured.
    I attached a piece of my software with setup and measurement routine...
    Is there any help ?
    Thanks, Mike
    Attachments:
    measure.c ‏10 KB

    Hello Robert,
    How can I reinitialize the board?
    Init_DA_Brds() won't help, this is already implemented.
    ND_RESET is always done before a measurement.
    For driver 7.4 I need SP6 for NT?
    Now SP2 is running.
    Gerne auch in deutsch
    regards, Mike

  • Problem to measure 0% and 100% duty cycle of a PWM.

    Hi,
    I am using counters of USB-6341 to measure duty cycle of PWM just by following the example 'Meas Duty Cycle-Buffered-Finite.vi'. It works almost all the time. However, when the duty cycle of a input pwm is 0 or 100%, the DAQ can't read anything, in another word, it can't measure 0 or 100% duty cycle.
    How to modify that?
    Thank you very much :-)
    Nan

    That's the thing about PWMs, you never really know if the PWM is 0% or 100%.
    Let's say we have a 50% duty cycle, at 1/2Hz.  So low for 1 second, high for one second right?  What if we run at 1/20Hz, so low for 10 seconds high for 10 seconds.  Or is this a 0% duty cycle for 10 seconds, and a 100% for 10 seconds?
    A true PWM read will never be 0% or 100% it will just keep waiting until the trigger is seen, and recalculate the frequency and duty cycle of it.  The solution to your problem is for you to define a duration to watch for a change, and if one isn't seen, then you can define 0% or 100% appropriatly.
    So I would recommend taking your duty cycle like you normally are, and then at the same time watch the digital signal for however long you want, if the digital line does not change state, then output 0% if it is low and 100% if it is high and ignore what ever duty cycle you read.  But if the digital line does change state, then use the read duty cycle as the actual value.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • Counter 1 - Measure Frequency & Counter 0 - Generate PWM POSSIBLE?

    Is this POSSIBLE with a NI-6025E DAQ card? Can I use the two counters to generate % control a TTL PWM signal and at the same time measure frequency from a circuit? This is my connection.
    GPCTR1_SOURCE - connected to find frequency circuit
    GPCTR1_OUT - connected to GPCTR0_GATE
    GPCTR1-GATE - not in use
    GPCTR0_SOURCE - not in use
    GPCTR0_OUT - connected to DC motor circuit
    GPCTR0-GATE - connected to GPCTR1_OUT
    My concern is that changing or controlling the TTL PWM might change the frequency reading. This is because COUNTER O is connected to COUNTER 1.

    I understand to measure frequency of a signal there are TWO methods. A ONE counter method and a TWO counter method. I need to measure a frequency between 1 Hz to 200 Hz. Is the ONE counter method possible? What is the ONE counter method?

  • Measure rpm and PWM signals using digital input of NI9401 module

    Hi, is there a simple way how measure rpm (to 5000 rpm) and PWM (about f=3kHz) signals using digital input of NI9401 (ultrahigh-speed digital I/O)  module plugged in NI 9172 ?  I will wellcome any suggestions and VI examples (bether still). I'm begginer using LView 8.2. I apologize for my poor English. Many thanks.

    Hi CUA,
    Since you have already the right tools, you just need to get started with the software. The NI-9401 will give you access to the counters that are inside the cDAQ chassis 9172.
    You need to place the module in slots 5 or 6. You can read in how they work and how to configure them in the counters section of the user guide found here.
    Now to measure rpm, you can either measure the period of the signal (seconds) and multiply by 60 to have minutes and the number of ticks per revolution. You can find a shipped example to read period called “Meas Dig Freq-Buffered-Cont-Large Range 2 Ctr.vi” found under Hardware Input and Output » DAQmx » Counter Mesurements
    To measure PWM, it is similar procedure and you can read the semiperiod (high time or low time). There is also a shipped example called “Meas Semi-Period.vi” found under the same location.
    There is great information for these kind of task at this page or just post back if you need to.
    Hope this helps.
    Gerardo O.
    RF Systems Engineering
    National Instruments

  • Using FieldPoint Quad510 to measure PWM

    Can the FP-QAUD-510 be used to measure a pulse width modulated signal? Or are we going to have to use the Analog input module?

    I do not believe an FP-QUAD-510 can be used to measure PWM. The FP-QUAD-510 requires two inputs A and B and increments or decrements the position count by the changing of A and B with respect to each other (e.g. AB, !AB,!A!B, A!B). Whereas the FP-QUAD-510 does also provide a velocity reading (counts/usec), wiring a single signal to A or B and will simply result in the count incrementing by 1 then decrementing by 1 then incrementing by 1 etc... This will not yield accurate results on the velocity reading.
    Depending upon the period of your pulse width signal, you may want to consider using a FP-CTR-500 or FP-CTR-502 module. The counter modules can use internal clocks to allow you to measure the on-period of the signal. If you know the signal is always the exact
    same period, by measuring the on-period portion of the total period you can determine the duty cycle. If the period of the signal will vary, then you can still use a counter module, but will need to use multiple channels (one for the on-period and one for the off-period) and an external inverter on the signal (you would feed the signal into one count channel and the inverted signal into a second count channel).
    Regards,
    Aaron

  • Measure PWM with CRIO Module 9403

    Hi,
    I'm trying to measure a PWM signal generated by an absolute encoder. The encoder outputs a PWM with a period of approximately 1000 microseconds. This correlates to about 0.4 deg/microsecond.
    When I run an FPGA code that has a counter that counts ticks while the PWM is high, the counter takes approximately 265 ticks per loop (and increases when other I/O readings are made) - according to the benchmark timer I've incorporated into the code. This means that the loop requires about 6-7 microseconds to take a reading from the DIO. This correlates to a couple of degrees in resolution which is not a good enough for our application to read from the encoder. 
    Is there any way to increase the speed of the FPGA? I've included a screenshot of the FPGA code as well as the project containing the test VI.
    Attachments:
    fpgaproblem.jpg ‏65 KB
    testfpga.zip ‏21 KB

    Hello NIo33,
    Have you benchmark the rate at which the PWM signal is coming in from the NI 9403 module? What type resolution are you trying to achieve? I do not see to many ways to pipeline your FPGA code.
    Paul-B
    Applications Engineer
    National Instruments

  • NI 5105 - Measure PWM Waveform Duty Cycle

    Will the Positive Duty Cycle scalar measurement in the NI-SCOPE software calculate duty cycle correctly on a PWM (pulse-width modulated) waveform?  I have a 400Hz signal that is pulse-width modulated with a 40Hz signal that I need to measure the duty cycle for.  Since this is not a normal, continuous waveform (like a sine wave or square wave) I don't know if the NI-SCOPE software will correctly calculate the Duty Cycle.  Has anyone tried this with success?  I am looking at using the NI-5105 because it has 8 channels, but am open to using other hardware and just multiplex my signals to the digitizer.

    The positive duty cycle scalar measurement should correctly calculate duty cycle on your pulse.  By default, the measurement finds the base and top of your waveform using a histogram of the Y values (there will be peaks in the histogram at the base and top values).  Duty cycle is calculated from the 50% level crossings between these two values.  You must have at least one complete cycle and only the first cycle is measured.
    If that doesn't work for you, there are a plethora of parameters you can change (except for which pulse you measure - it is always the first).  For example, you can set the upper, lower, and level crossing values to specific % or voltage levels.  See the documentation and examples for details.
    If you need to measure the duty cycle of multiple pulses in the same pulse train, there is a LabVIEW function (Pulse Measurements.vi) which allows you to do this.  It uses the same algorithms as the internal NI-SCOPE routines.
    In either case, the measurement is independent of the hardware.  Any NI-SCOPE device will work.  If you have any other questions, let us know.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • Measuring PWM Signal with NI9423 with C-RIO 9073

    Attachments:
    Simulator1.vi ‏114 KB

    Eh..sorry. I do not know what happened, but it seems like my questions is gone in my previous post.
    Let me recap, I'm new to NI Components and LabView.
    I wanted to measure 8 PWM Signal generated from a controller (200Hz, Max 4A, 24Vdc).
    WIth NI engineer's suggestion, I bought cRIO 9073 and NI 9423 for this purpose.
    I have created a VI for this purpose. It seems to be working at first, but later on, the value read by the NI 9423 becomes unstable even though the out put signal from the controller was stable.
    The value read by 9423 just goes up and down with an increasing PWM signal from my controller.
    below is the setting for the 9423.
    Thanks.

  • Measuring PWM duty cycle with Analog Input

    Hello folks,
    I have a NI 9205 module and was wondering if there was a way to measure the duty cycle of a PWM signal that I am generating with a separate microcontroller?  I have found a lot of examples with Digital inputs but not analog.. Is this possible?
    Thank you,
    Bob

    Hi Robert,
    I'm not sure what that error is, try searching for it.
    If you want to measure a PWM signal you would usually use a counter input.  A counter is a dedicated piece of hardware that is used to measure digital signals.  Since the NI 9205 is an analogue device and it doesn't have any counters onboard, you will not be able to select counter input.
    I would recommend you get the right tools for the job and buy a digital acquisition device with an onboard counter.  It will make reading PWM much easier for you.  The NI 6008 has a counter onboard and is only £99.  It will also offload processing from software to hardware since you don't have to calculate duty cycle.
    If you still want to use analogue post back and we can look into why its not working for you.  Tips to start you off: Voltage is the correct setting and  Look in the manual and make sure you have connected it like you have configured it (differential, RSE, NRSE page 14)
    Lewis Gear CLD
    Check out my LabVIEW UAV

  • Measuring the changing duty cycle of PWM waveform

    I need to measure the changing duty cycle of PWM waveform.
    conditions:
    1. the period is fixed.
    2. but the duty cycle is changing.
    goal:
    measure the every duty cycle of a period in the waveform.
    Can you please give me a help?
    Thank you in advance.
    the waveform image is attached.

    You need to provide more specific information.
    What is the period? What is the minimum, maximum, and resolution of the PWM signal? What is the time scale in your image?
    How are you measuring or generating the signal you show in the image?
    What should the output look like? An array of duty cycles expressed as percentage? Some kind of plot on a graph?
    How long will this measurement last?
    Lynn

Maybe you are looking for

  • Calculation of interest amount with two variables formula

    Hello everyone, Iu2019m facing a problem with the way that TRM calculate the interest amount for money market transaction when I have a formula with two variable, e.g. reference interest rate u201CXu201D multiplied by 0,98. Some contracts explicitly

  • GTX 480's on sale at Dell for $365 (thru June 10th)

    Folks, Well, maybe I can be of help myself. I'm new 'round here and hope my listing a hardware deal in this forum isn't a faux pas. I wanted as many PPro CS5 users as possible to see it here in this forum. For all I know, listing deals anywhere on th

  • Bi Presentation server error

    Hi, Presentation server is not running i am getting the below error pls help some one. Could not start the Oracle BI presentation server service on Local computer Error 3: The system cannot find the path specified.

  • Picky DN attribute strings

    Just installed 5.0 SP1 and searches with filters that are user defined attributes of type DN are treated strangely. Server defined attributes of type DN work fine. Spaces in the DN somtimes cause problems......... This is difficult to relay, so bear

  • Listing of PO's to be released & responsible "releaser"

    Hi All Is the a way to see the list of PO to be release and who is suppose to release them Regards Susan