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.

Similar Messages

  • How can I measure a 0% or 100% duty cycle signal ?

    I want to measure the duty cycle of an input signal using a counter of a 6030-E board.
    I work with a PXI Rack under Labwindows/CVI.
    My program already works properly for duty cycle between 1% and 99%, but it is not able to detect 0% duty cycle (ie : signal to ground), nor 100% duty cycle (ie : signal to power supply).
    The problem is I don't understand how the counter works in such a situation (it cannot detect any edge, as long as the signal is continuous 0V or continuous 12V).
    Please have a look on the following code :
    1- First, the counter is configured
    // Reset Compteur
    i_Status = GPCTR_Control(iDevice, iCptID, ND_RESET);
    //Definition du type de mesure du compteur (mesure temps impulsion)
    i_Status = GPCTR_Set_Application (iDevice, iCptID, ND_SIMPLE_PULSE_WIDTH_MSR);
    //Definition de la vitesse d'echantillonage (20 Mhz)
    i_Status = GPCTR_Change_Parameter(iDevice, iCptID, ND_SOURCE, ND_INTERNAL_20_MHZ);
    //Definition du signal a mesurer (defaut)
    i_Status = GPCTR_Change_Parameter (iDevice, iCptID, ND_GATE, ND_DEFAULT_PFI_LINE);
    // initialisation du compteur
    i_Status = GPCTR_Change_Parameter(iDevice, iCptID, ND_INITIAL_COUNT, 0);
    // Preparation du compteur avant de l'armer
    i_Status = GPCTR_Control (iDevice, iCptID, ND_PREPARE);
    2- Then, every 10 ms, the value of the counter is read, so that I can calculate the duty cycle...
    i_Status = GPCTR_Watch(iDevice, iCptID, ND_COUNT, ul_val_cpt);
    3- ...and the counter is armed again for the next reading
    i_Status = GPCTR_Control(iDevice, iCptID, ND_ARM);
    When duty cycle changes from x% to 0% or 100%, the counter always keep the value corresponding to x%.
    Even if I reset the counter between each measurement, it keeps this value ! I don't understand how it is possible.
    How can I know that the counter didn't see any edge, and so that duty cycle is 0% or 100% ?
    Thank you in advance for your help !
    FraB

    Hi,
    Just have a look at this link, it can be interesting for you...
    http://forums.ni.com/ni/board/message?board.id=40&message.id=2161&requireLogin=False
    Regards
    DD

  • 1242ag 100% Duty Cycle

    Greetings,
    I have a strange scenario I have been brought into at work. A loading dock that has 3 Cisco 1242ag units started filling the spectrum with noise keeping their set channel at 100% duty cycle. I'm using Cisco Spectrum Expert to locate the devices. When we unplug the AP the duty cycle on that channel drops to almost nothing. When plugged back in it may start again or not. Its hit or miss. We replaced 2 of the APs with other Cisco 1242ag units and had the same trouble. We do not use a controller with these units. Is there a setting on these units that would cause them to broadcast like this?
    Regards,
    Angel

    There is only one SSID in the warehouse. The problems started about the same time the local IT guys replaced the PoE hubs with D-Link PoE switches. What I'm trying today is putting one of my Cisco PoE switches in their IDF and plugging three APs into it to see if the problem recurs with those APs. Its the only common link to all APs in the warehouse. I don't like this line of troubleshooting, but its the only thing they have in common and it started about the time they moved to this hardware.

  • Read duty cycle of a PWM with DAQ

    Hi,
    I am doing a test system and I have several signals that control motors. They use PWM with a max frequency of 5 kHz.
    I would like to know if with a USB DAQ or a PCI DAQ for example PCI-DIO96 could I meassure the duty cycle of these PWM signals. I mean I need to meassure with 10kHz at least.
    Which are the read frequency of these systems?
    Due to the high number of I/O to test I am also thinking of using Compact-RIO with different I/O modules. What do you think?
    Thanks in advance

    If your PWM frequency is 5 kHz and you want to measure duty cycle to 1%, then you need timing resolution of 2 microseconds or faster.
    The USB-6343 has hardware timed DIO at up to 1MHz, so it might be suitable.  There are other devices with hardware timed DIO at rates of 10 MHz or faster as well.
    Before you buy, determine how often you need to measure the duty cycle to make sure the data transfer can keep up.  USB can sometimes be a bottleneck.
    Lynn

  • Dynamic Duty Cycle Change for PWM

    Hello savvy LabView people out there!
    I am trying to do PWM for servo control using LabView.
    I have been able to manually move my servo with this: http://www.ni.com/white-paper/2991/en
    My goal is to automate the servo position as a sinuisoidal movement, and to do so,
    I need to automate the duty cycle to oscillate in 5%~10% automatically over time.
    I have looked into some stuff as:
    http://forums.ni.com/t5/Counter-Timer/PCI-6602-PWM-GENERATION-Dynamic-sine-duty-cycle/td-p/1522442
    But it was not too helpful, as I was also getting Error -200301.
    I want to be able to move the servo position at ~10Hz, if that is important, and the square wave freq. for the
    servo signal (PWM) has to be 50Hz.
    Any help? Thank you!
    Attached is what I am trying to do. The sine motion of the servo is (supposed to be) actually paired up with
    an analog output from a BNC-2120 board. The servo control part is separated on the top portion.
    Solved!
    Go to Solution.
    Attachments:
    ServoTest3.vi ‏110 KB

    Is something like this for the PWM look like what you had in mind?
    (see attached)
    This works, but I need something that responds faster.
    For example, the PWM needs to be at 50Hz, which means the loop delay should be able to
    go as low as 20ms
    In the picture, it is currently 200ms, and this does not run. I found that with 50Hz, the minimum
    delay that the Error 200301 doesn't pop up is with 500ms delay, at which point the
    accuracy of PWM duty cycle in each period is compromised.
    Is there a way to have the loop delay be as low as ~20ms?
    Attachments:
    Servo.jpg ‏52 KB

  • Problem with faux column and 100% min height

    hello
    i',m trying to create a faux column on this page:
    http://www.malcmabe.co.uk/listtest.html.
    the column i'm trying to do is the left hand side menu
    column.
    i just can't get this to work, so i'm obviousley missing
    something.
    also, i've set the wrapper as minimum height of 100%. this
    isn't working, so my hunch is that it's having a knock on effect to
    the measurements of the left hand column....but i may be wrong
    any help would be appreciated.
    the css file is
    http://www.malcmabe.co.uk/listtest.css
    malc

    malcster2 wrote:
    > hello
    >
    > i',m trying to create a faux column on this
    > page:
    http://www.malcmabe.co.uk/listtest.html.
    > the column i'm trying to do is the left hand side menu
    column.
    >
    > i just can't get this to work, so i'm obviousley missing
    something.
    >
    > also, i've set the wrapper as minimum height of 100%.
    this isn't working, so
    > my hunch is that it's having a knock on effect to the
    measurements of the left
    > hand column....but i may be wrong
    >
    > any help would be appreciated.
    >
    > the css file is
    http://www.malcmabe.co.uk/listtest.css
    >
    > malc
    Malcolm
    That's not quite how faux columns work - you'd make an image
    the width
    of your container with the dimensions you need - perhaps a
    line only to
    separate a left and right column or something a little more
    detailesd -
    the image's height can be sliced very small as it will repeat
    on the y
    axis, attached via css to the container. You can then use
    margins or
    divs floated left and right to keep your content on either
    side.
    Something like this I made earlier......
    http://www.bealeandpyper.co.uk/
    and the background image......
    http://www.bealeandpyper.co.uk/p7bpassets/images/p7bp_layout.jpg
    btw most of us in here use the faster NNTP for accessing the
    newsgroups
    - OE, Outlook, Thunderbird and/or dedicated mail/newsreader
    apps would
    do to access them. Try clicking this link.....
    news://forums.macromedia.com
    HTH
    chin chin
    Sinclair

  • Detect 0% and 100% PWM Duty Cycles on 660X Card

    Hi,
    We essentially want to be able to detect 0% (all low) and 100% (all high) duty signals as well as > 0% and < 100% duty.  However, I noticed that when performing buffered pulse width measurement, if either 0% or 100% duty occurs, the previous detected duty is stored.  It seems as if the next edge or level change isn't detected, then the HWSave or SWSave registers store the last successful count.  Is there some flag on a status register for the NI PCI-6602 card that would indicate whether PWM is continuing to be detected?
    Thanks,
    Jeff S.

    Hi Jeff-
    You might be able to achieve this operation by setting the Counting_Mode to Synchonous_Source mode.  Check out the descriptions for bits 2:0 of the Gi_Counting_Mode register, as described in the 660x RLP manual page 3-22.  In that mode, you also must set the Gi_Alternate_Sync bit as described on page 3-21.
    Without making the change to synchronous counting, you might also be able to glean some useful information about when an error condition has been met by periodically monitoring the Gi_Stale_Data bits, as described on page 3-13.
    I haven't tested this, but I wanted to offer a few quick tips to try.  Please give these a try and let me know your results.
    Thanks-
    Tom W
    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.

  • Duty Cycle measurement

    Hello all,
    I am attempting to Measure and output duty cycle to a device. I don't have the device in my possession so I have my hardware hooked up to each other. I have NI 9472 output card hooked to a NI 9423 input card. I have found these 2 examples of how to adjust duty cycle and how to read duty cycle. They work great, but the reading of the duty cycle is oppesite of the outputing of the duty cycle. For example if I set my output duty cycle to 60% the reading is 40%. If I set my duty cycle to 30% it reads that it is 70%. I looked thru the block diagram to see if the input was looking for the resting signal to be low or hi. Being a new user it might be right in front of me. Can some one take a peak at them and tell me anything? Thank you.
    Attachments:
    Modify Duty Cycle while running.vi ‏31 KB
    Meas%20Duty%20Cycle%20Cont%20LabVIEW%208.2[1].vi ‏31 KB

    Hey greentea2,
    You can try taking your waveform data and adding a replica of itself to the end of the data using the Append Waveform VI, so that you have multiple cycles of data to send into the Timing and Transition Measurements Express VI or the Transition Measurements VI for calculating the rise time.  I've attached a picture that shows a simple example of this using a sine wave.
    If your data does not complete a full cycle that comes back to a similar starting low point, then this example may not work for you or give you the right value.  If that is the case, then please respond with a picture of what your waveform looks like, so we can determine how to manipulate it.
    Hope this helps,
    Attachments:
    Append Replica Wave Form Data.png ‏28 KB

  • 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

  • Is it possible to measure duty cycle of 6 pwn simultaneously using pci6624 board?

    Hi
    in my application i need to measure duty cycle of 6 pwm signal simultaneously  .
    Is it possible to measure duty cycle of 6 pwn simultaneously using pci6624 board?

    Here's what I mean...
    However, it only sends one command at a time. You didn't say if your servo controller requires all 4 commands at once. If so, then you can remove the case structures and concatenate all 4 slider values into one string.
    Message Edited by LabViewGuruWannabe on 11-15-2007 01:05 PM
    Attachments:
    SliderEvents-FP.PNG ‏31 KB
    SliderEvents.vi ‏36 KB
    SliderEvents-BD.PNG ‏63 KB

  • Bad Duty Cycle readings

    Hello!
     I’m building an application in which I want to measure a duty cycle.  I can control the “Duty Cycle In” and the FCM analyzes the info and sends a signal to the Motor. I want to measure the “Duty Cycle Out” of the motor. (I attached diagram) For this measurement I just connected a wire to the negative side of the motor. To calculate this Duty Cycle I am measuring the period and the pulse width. The program works very good when I have a “Duty Cycle Out” from 1% to 99%, but whenever is 0 or 100% it shows wrong info. I would expect that the pulse width at 0% or 100% is cero, but LabVIEW shows a value (1,1E-5 s) and calculates a Duty Cycle of about 23% which is totally wrong.  Also, if I run the program for the first time and I measure this pulse width with a “Duty Cycle In” of 0%, pulse width is cero., but whenever I change the “Duty Cycle In” to 10% or higher, and then I go back to a “Duty Cycle In” of  0% it shows a value, and calculates a bad Duty Cycle. I don’t know why this only happens when I put higher “Duty Cycles In”, and then I go back to 0%. I measured the signal with an oscilloscope and there is nothing, not even noise! I don’t know how the card gets these lectures.   Do you have any suggestions of what can be wrong?
    Appreciated! 
    Solved!
    Go to Solution.
    Attachments:
    Diagram.JPG ‏33 KB

    Hi Elmar
    Thanks for the reply. I attached my Code. I am measuring the period with ctr0 and pulse width with ctr1. I divide Pulse Width / Period to obtain the Duty Cycle. To detect 0% and 100% I compare the value of pulse width to zero. I created an additional Digital Input, with this channel I check if the signal is high or low. So if Pulse Width is zero, I read from the Digital Input the level of the signal, and then I know whether is 100% or 0%. My problem is when I have a Duty Cycle of 0 or 100%, the DAQ keeps sending a value for the pulse width, and I cannot apply the method explained before. I think this value should be zero, I don’t know if I am mistaken.    
    Attachments:
    PWM_Measurement.vi ‏61 KB
    PWM_Measurement.JPG ‏151 KB

  • How to convert a number to duty cycle (FPGA)

    Hi
    I want to convert a numerical number to a duty cycle value in FPGA module so I could use it to generate a PWM signal for the numerical value.
    I tried dividing it but it shows an error in FPGA as it would produce a float value. I tried even the example of scaled division but the quotient is rounded of to 0 (I wanted to convert an output by multiplying 10/36).
    In my project the 100% duty cycle is 360 degrees and 0% is 0 degrees of the motor shaft rotation.
    Please help me I need to use it for my project.
    Thank you
    Dinesh

      I am not exactly sure how your duty cycle is setup, but here is a way we have used a number to create a PWM in our FPGA.
         If you have 360 deg. then I would guess you want to create a PWM duty cycle that is some fraction of 360, say "number"/360.  You could use a for loop where 360 is wired to the "N" and then your "number" can be compared to the current loop count.  That comparison would be true/false which could triger a DIO to be high or low.  Therefor, if   (loop count) < "number"  then DIO is HIGH,  if (loop count) >= "number then DIO is LOW.   This would send out a PWM that has a duty cycle of "number"/360, (multiply by 100 to get in %)  
         I hope this helps.
     --Alex--

  • Frquency & Duty cycle Value changes- every time

    Hello all
     im using pcie 6320 to measure the frequency and the duty cycle of a signal.i have attached my vi & the data measured for reference.The values highlighted in red ,is my actual frequency and duty cycle but values changes for every 1 sec.Please correct me if i have any mistake.
    Solved!
    Go to Solution.
    Attachments:
    measure frquency-duty.vi ‏54 KB
    HZ-DUTY.JPG ‏37 KB

    You'll need to enable digital filtering--insert the following property node into your code (call the property node before starting the task):
    Try a "Min Pulse Width" of a few us and increase it if you still are picking up incorrect readings.
    The errant numbers are coming from false edges being picked up during transitions, enabling digital filtering will cause the DAQ device to ignore any transitions with a pulse width of less than the set value.  Your 475 Hz 72% duty cycle signal should have a high time of about 1.52 ms and a low time of about .59 ms):
    656 Hz = ~1/(high time)
    1718 Hz = ~1/(low time)
    MHz values = multiple edges picked up during a single transition.
    Best Regards,
    John Passiak

  • Generating square wave with variable duty cycle

    We like to generate a square wave with variable duty cycle using LabView 6.1 and SCB-68 and this duty cycle comes from some PID controller programmed by LabView by reading a voltage and feeding back this square wave

    the story begins with some one called separately excited DC motor
    this thing sometimes changes its speed
    so we are trying to keep a constant speed
    irrespective of the load no matter how it changes
    this comes by reading the voltage out from
    the tackometer which represents the speed as voltage
    then comparing this with a reference set by the labview program
    the labview program will send a control signal to some chopper circuit
    which is connected to the field of the motor which controls the speed
    we are tending to make the labview program as pid controller
    that will generate our beatiful square wave with some duty cycle
    which will vary to increase or decrease the voltage across the field
    we tried "Real-Time PID Control.vi" example and other examples
    and we are discussing different solutions for this duty cycle thing
    but till now no output
    this is our whole story with this DC motor thing

Maybe you are looking for

  • Why does movie say "cannot open" on my Iphone?

    I tried to watch a movie I downloaded to my Iphone the other day and today I wanted to watch the movie but my Iphone said, " Cannot Open". I don't even know what that means means the slightest bit except that it won't play. I've tried restarting my I

  • Custom data type causing trouble in deploying shared variable to RT target

    I seem to be having some difficulty in using a network published shared variable created from a custom data type when deployed as an executable on an RT cRIO target.  I'll start by describing why I believe this is where the problem lies.  I created m

  • How to print different  header & item data in new pages using smart forms.

    Hi, In smart forms I am trying to print header data & their item data. But there are more than one header data for a given input. I want to print all the different header data with their item data in new pages using smart forms. Can any one please he

  • How to remove remainer of iTunes money?

    How to remove remainer of iTunes money?

  • Adobe Edge Preview

    I cannot install. I get : A conflicting or prerelease version of Adobe Edge Preview exists on this computer. The conflicting version must be removed before installing from the current media. I did erase Adobe Edge Preview from the application folder