Pid duty cycle PWM

I'm trying to find example of pid controlling duty cycle of PWM. Is there any simple example? Help to share if have any.
I coundn't find any of that topic in the Example Finder
Solved!
Go to Solution.

Refer to the  http://digital.ni.com/public.nsf/allkb/1561D31534F07D608625727900391114
If make a little change there by inserting a PID block, PID output line go into the duty cyle line (meaning delete the manually key in duty cycle).  How to set the limit there as illustrated in the attached limit.PNG?
Attachments:
PWM_output_SW-timed_with_digital_line (vers 8.2).vi ‏39 KB
limit.PNG ‏33 KB

Similar Messages

  • How can I vary a PWM´s duty cycle inside a while loop?

    Hi,
    I'm using the "Generate Pulse Train.vi" to generate pwm signals in counters 0 and 1 in order to drive a DC motor both ways.
    The problem is, I need to control the movement of the dc motor with my PI controller which is inside a while loop. I've tried letting the "generate pulse train.vi" outside the while loop, but the problem is, it only changes the value of the duty cycle when the loop is stopped. I also tried putting it inside the loop, but then it doesn't even work.
    So, how can I vary a PWM´s duty cycle inside a while loop?
    I'm attaching the VI with the PI controller.
    Thanks for your help!
    Guilherme
    Attachments:
    controleValvula.vi ‏332 KB

    Here's some code I threw together a while back to change a duty cycle on the fly. It generates a fixed 5KHz or 25KHz frequency depending on laser selection, then allows duty cycle to be changed continously. Maybe you can use the premise of it for your application.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
    "It’s the questions that drive us.”
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
    Attachments:
    Pulse_Width_Modulator.llb ‏197 KB

  • How to generate a pwm whose duty cycle has to be varied depending on the frequency of the input trigger??

    Sir/madam,
    I am quite new to the Labview FPGA module. 
    I am currently working on an application where i have to generate a pwm to control the ON time duration . The pwm ON time depends on the frequency of an input signal.I want to retrieve the ON time value from a lookup table which contain the duty cycle values for the pwm at different frequencies of the input.This input also has to work as a trigger. The input is pulsed and the trigger has to generate the pwm at every rising edge. I am using a PCI 7831R-  RIO series. I am urgently in need of some help and i have hardly a  couple of weeks before i meet the deadline.
    I am trying hard to learn the basics from the shipping examples but not able to quite make my vi work. 
    Kindly lend a helping hand and i would be very grateful to anybody who can help. Thanks a lot in advance.
    Do ask in case of any clarifications required. I  think i have explained my problem quite well. 

    Hello Manu,
    You can refer 
    Developing a PWM Interface using LabVIEW FPGA or PWM Output with LabVIEW FPGA
    How this helps.
    Best Regards, 
    Hardik Asawa
    AE
    National Instruments  
    Message Edited by Hardik Asawa on 05-05-2010 12:46 AM

  • Using labview cosimulation, how to control PWM duty cycle in multisim

    I am new to using Multisim with LabVIEW using cosimulation. I want to ask if there is a PWM component in Multisim that can have its duty cycle be controlled using LabVIEW? I have an algorithm in LabVIEW that outputs duty cycle values from 0 to 1, representing duty cycle percentages.
    How do I control the PWM duty cycle in Multisim using LabVIEW cosimulation?
    Many thanks,
    SPECTRE
    Solved!
    Go to Solution.

    Hi Spectre,
    In Multisim, search for the parts base on functionality, there are some PWM models in the database.  Have a look at this knowledge base  if you don't know how to search for parts:
    http://digital.ni.com/public.nsf/allkb/7309A5CABC677296862577ED006EC99E
    Aslo, have a look at this knowledgebase:
    http://digital.ni.com/public.nsf/allkb/EF391C48CF71AE4F862571B900644F84
    This article shows how you can get Mutlisim and LabVIEW to co-simiualte:
    http://www.ni.com/white-paper/13663/en
    I hope this helps
    Tien P.
    National Instruments

  • 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.

  • I want to store the data form the PWM and the value of the changing duty cycle into a file simultaneously and continually

    i want to store the data form the PWM and the value of the changing duty cycle into a file simultaneously and continually but having problem.Please can anyone help out.
    Attachments:
    data.vi ‏60 KB

    Hello,
    Have you looked at the "Write Binary File.vi" and "Read Binary File.vi" examples?
    They give you a good clue as how to write and read arrays to and from binary files.
    For your data it means that you could put the two data items to write in an array and write the array to file, for the read its important to in what sequence the number were written to file.
    Kind regards,
    André
    Regards,
    André
    Using whatever version of LV the customer requires. (LV5.1-LV2012) (www.carya.nl)

  • 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.

  • 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

  • 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

  • PWM duty cycle update stalls

    Hello
    I want to output a variable pulse width modulated signal via counters. The duty cylce should follow a sine or triangle pattern from 10 to 90 percent.
    Problem: When I observe the ctr output with an oscilloscope, I see that the update stalls, i.e. for some time, the output is seamlessly variable as expected, but then, update stalls and jumps to a new duty cycle to continue variable again.
    I tried several different approaches,
      -for-loop with wait ms- timing and single sample,
      -timed loops with single sample and
      -pulse train ouptut via DaqMX-Write-Counter-n-Samples.
    Albeit to no avail. In any case, I get jumps in the PWM duty cycle instead of smooth transitions.
    System is either cDAQ 9174 or PXI with 6602. As system load is 99% idle state, I can't imagine the OS at fault.
    Solved!
    Go to Solution.

    Hello, Frank
    After looking through some documentation, I think that I need RT-HW for what I want.
    6602 cards have STC-2 without buffer, so updating duty cycle is OS-limited. Even in timed loops there is no guarantee that update will run at the specified rate of 1/140 sec. I'll probably just get an error for untimely execution....
    With STC-3 based counters (such as cDAQ9074 or X.series PXI 6361) I can load 127 values into buffer which will be processed smoothly but on renewal of samples (every 127/140 sec), I get stalls again, since the OS seems to consider my request inappropriate. I was surprised to find that USB vs PXI does not change the behaviour, though I'd have expected better latency from PXI.
    Attached, please find a VI to get an impression of what I tried out. Pardon for code ugliness.
    I still hope that I maybe have missed something simple to get running with what HW I got
    Best regards
    Michael
    Attachments:
    Unbenannt 1.vi ‏172 KB

  • 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

  • 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--

  • TO change the Duty Cycle(DAQmxSetCOPulseDutyCyc)

    I have an application that uses Pulse Width Modulation (PWM) to control the speed of a motor. Thus, it requires that I change the duty cycle of my square wave. My continuous pulse is being generated on the output of my counter. When I use the function "DAQmxSetCOPulseDutyCyc" to update the duty cycle when the task is run, the changes aren't reflected. What is the problem? thanks in advances!
    cinzia

    Masa-
    Kevin is correct. Unfortunately, there is little we can do to change this behavior in DAQmx. There are only two options:
    1) change which property updates the pulse train value, which would leave you with the same issue you are currently having if you have a situation where the frequency needs to change but not the duty cycle, or
    2) add a third property that would be a "switch" command. This option would add more work for users, as a third property would have to be called.
    One other thing you might trying using instead of the properties (assuming you are using DAQmx 7.2 or later) is the DAQmxWriteCtrFreqScalar() method. This write method added in DAQmx 7.2 allows you to update the frequency on-the-fly without having to use the properties.
    I
    hope this helps!
    gus....

  • Duty cycle on SCXI Modules

    Hi All!
    I was wondering if anyone could tell me if there is an SCXI Module available that allows me to adjust multiple duty cycles. I need to control the duty cycles of multiple signals simulataneously and was hoping to find a module to do this with. It should be a module that fits to an SCXI housing because this is the system that I am currently using for the measurements. A single module containing multiple counters and counter outputs would be ideal.
    I am sure I am not the first to need something like this, so could someone please help me out and tell me how I can solve this?
    Thanks to everyone for the help!
    Regards
    Charel Marais

    Hi Wolfgang,
    Yes I was thinking of PWM for the duty cycle control. I have done this before using counters on the NI cards, but as you mentioned it is only possible to control 2 signals. I now need to do at least four, possibly more. The system I am using now is a 6036 PCMCIA card as acquisition connected to an SCXI 1000 with an 1102, 1126, 1163R and 1124. I have considered using another DAQ card to provide more counters, but this is a very untidy solution when you have two PCMCIA DAQ cards in one notebook each with a cable going into it. The connectors push very hard against eachother and in long term use, this will destroy the connectors on the cables, the cards and the notebook.
    I gather that there is no SCXI module available that provides counters as a normal "slide-in" module (like an 1102 for instance)...? Is there then some other effective way to connect two PCMCIA cards to one notebook?
    Thanks for the advice on the counter cards.
    Regards
    Charel

Maybe you are looking for

  • Setting delivery block

    Dear specialists,    If only one item of many items in sales order not confirmed with full quantity by ATP, I want to put delivery block in that sales order. How can i do this in confiugration only? Thanks jcmtse

  • Idoc : Validation on Vendor and G/L account

    Hi Friends, We are having an Ext-Classic Scenario and doing Invoice without reference to PO ; once the invoice is created (w/o r.po) it will generate the Internal Number range ( 81xxx) and once it's approved it triggered the IDoc for ECC to generate

  • ALV TO XML

    Hi Experts !! I have created an ALV which shows some Data!! Now I want to add a parameter in my selection screen which work as follows, When I click on it, it let me choose the path or the target where I want to download my XML file (like the browse

  • Transferring iTunes to a Mac

    I have over 14000 songs on my iPod and have them backed up on an external hard drive from a windows system. I just purchased a Mac and would like to get everything transferred over for the Mac system. I however do not want my iTunes to be on the comp

  • Sound question - it's not working!

    Hi all - novice flash user here - Was working on a file in Flash 8 Professional. I imported a WAV file to the library, made a new layer w/keyframe on the timeline, and dragged the wav file from the library to the stage. The first few times I tested t