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

Similar Messages

  • I am working with the NI PCI-5411 AWG in arbitrary mode. How change the duty cycle of the square wave output located at the Sync connector by software?

    We use Labview 7.0 and NI fgen 2.1 in order to drive the pci card.Can you send me a VI example?

    Hi LtDel,
    To achieve this you will need to insert an niFgen property node from the niFgen functions palette into your code flow somewhere in amongst the configuration vi steps. Wire up the reference and error inputs and outputs. Left click on the "property" and select >>output attributes>>sync duty cycle high. Right click and set to "write" then wire in a control or constant defining the % duty cycle for the high phase.
    Hope this helps,
    Nick

  • Is there a way to reverse the active/inactive portions of the duty cycle?

    I'm trying to sync the start times for an AI operation and a buffered encoder read. These two operations happen at different sampling rates and different sampling intervals, so I can't just port the AI scanclock over to the gates of the encoder counters.
    My approach is to use three counters: one to generate a triggered pulse that has a width equal to the total sampling time (the trigger for this pulse comes from the AI start). The OUT from this counter then feeds the GATE for a counter that generates a pulse train while the GATE is high. Therefore, it generates a finite pulse train for the desired acquistion time. The out from this second counter goes to the GATEs of the encoder counters to
    generate the DMA transfers.
    The problem is that the pulse train always puts the active portion of the duty cycle at the end of the period, so the DMA transfer happens at a delay of T/2 relative to the start of the AI acquisition.
    Is there a way to put the active portion of the duty cycle at the start of the period? i.e., when the gate goes high, I want the pulse train to start high then go low at the end of the duty cycle.
    Thanks,
    rgames

    The simplest seeming answer would often be to use 'Set Attribute.vi' to change the counter's output polarity. Then the counter will be at a high state during the delay and low during the pulse. However, that would also put it in the high state while armed and waiting for the trigger, and again after the pulse completes. It doesn't seem like that would work for you.
    A near-miss idea would be to leave the polarity alone and simply specify the shortest possible delay. Use the internal max timebase as a source and set "Pulse Spec 1" == 2. On a 660x device, that'll only delay you by 25 nsec.
    In fact, you may be able to change that near-miss into a perfect hit. The short delay may or may not change the timing of the DMA transfers relative to the trigger, depending on exactly how the "generate pulse train while gate is high" function is implemented. Here are some ways I can imagine:
    A. The "pulse while gate is high" counter is always cycling internally. An output signal is always being generated on the TIO chip and is always being AND'ed with the state of the Gate signal coming in. The result of the AND is sent to the actual IO pin.
    B. Similar to (A), but the AND'ing is done only when there's a state transition and the result is latched until the next state transition.
    C. Internally, the pulse train counter always *wants* to run, but its Source is always being AND'ed with the Gate signal. Then, as far as the pulse train counter is concerned, time is frozen when the Gate is in the inactive state. This is how I *think* I remember it working.
    In cases (A) and (B), the timing of the DMA transfers wouldn't be affected except for the rare case where the trigger event occurred within 25 nsec of a "scheduled" transfer. In case (C), you can compensate by changing the duty cycle of the "pulse while Gate is high" counter. Simply subtract 2 from "Pulse Spec 1" and add 2 to "Pulse Spec 2". Then (assuming its polarity is low state delay, high state pulse) make sure the encoder counter Gate is set to do DMA transfers on the low-->high transition.
    Final note: if timing synchronization between analog and encoder is really important, there may be a better way. As I recall, the AI start signal does not have deterministic timing relative to the actual A/D conversions. You might instead have two counters of the 660x set to "pulse while Gate is high" and set up the other one to be the AI scan clock. Then you'd be more fully in control of their time==0 marks.

  • How the duty cycle is calculated by Timing and Measurement.vi

    I am using the Timing and Measurement express vi(LabView8.0 is used) to measure the Duty cycle and frequency. I want to know how the same is calculated by the Timing and Measurement express vi. Please reply.

     The Timing and Measurement Express VI uses \vi.lib\measure\mascope.llb\Pulse Measurements N chan.vi to do the Duty Cycle and Frequency measurements. 
    Help says the following about this VI:
    Accepts a periodic waveform or an
    array of periodic waveforms and returns the period,
    pulse duration (pulse width), duty cycle (duty
    factor), and pulse center of a selected pulse and period.
    Refer to the Pulse and Transition Measurements VI in the labview\examples\measure\maxmpl.llb for an example of
    using the Pulse Measurements VI.Maybe NI can explain the algorithm.
    Hope that this helps,
    Bob Young
    Bob Young - Test Engineer - Lapsed Certified LabVIEW Developer
    DISTek Integration, Inc. - NI Alliance Member
    mailto:[email protected]

  • Changing duty cycle for PXI 5422

    Hi
    I am using the PXI 5422 as a standard function Generator to generate a square wave. However I want to change its duty cycle.
    I know it is possible to do that because the niFGEN (.exe) has the provision for changing the duty cycle of a square wave.
    However I could not find a niFGEN function which would allow me to do that.
    Any response will be appreciated.
    Thanks,
    Nishad

    Hi Nishad -
    There is a property called Duty Cycle High that you can set on-the-fly.  It only works for square waves.
    Message Edited by David S. on 07-27-2007 10:17 AM
    David Staab, CLA
    Staff Systems Engineer
    National Instruments
    Attachments:
    fgen2.png ‏2 KB

  • Trying change duty cycle in "Simulate Signal"

    Hi, 
    Anyone knows why I can't change the duty cycle in Simulate Signal? This option appears unavailable for me. How I can access this option? I need generate a wave triangular assymmetric. 
    Thanks.
    Attachments:
    simulate signal.JPG ‏66 KB

    The dutiy cycle is only for square waves, i.e. a signal that only has two possible states (on or off). The duty cycle defines the percentage of the time the signal is on during each interval.
    In any of the other signal shapes, the amplitude is variable and the concept of a "duty cycle" makes no sense.. 
    LabVIEW Champion . Do more with less code and in less time .

  • "create analog signal" programmatic control of parameter Duty Cycle

    I need to generate a square wave with a programmable duty cycle in LabView (not SignalExpress).  I can use "Create Analog Signal" for a fixed duty-cycle signal but I cannot figure out how to get at the Duty Cycle parameter to change it programmatically.  I was hoping for something like Property Node access but found that this only works for front panel objects.
    Is there a way to dynamically change the Duty Cycle parameter in the "Create Analog Signal"? 
    Solved!
    Go to Solution.

    The Square Waveform vi found in Signal Processing - Wfm Generation has an input at the top for offset.
    - tbob
    Inventor of the WORM Global

  • Changing the PXI-6624 Counter Output rate on the fly

    I'm programming an application in VB.net 2005 to set several counter output channels (each with its own task) on the PXI-6624 card. I'd like to know if there is a way to change the frequency of the output without stopping the task, changing the frequency and restarting the task. I'm using the PXI-6624 card to simulate encoders and speed sensors.
    Thank you very much,
    JonS101

    Hi,
    Yes, you can change the frequency on the fly. Here is a knowledgebase that will give you an insight of how you should approach this matter. How Can I Change the Duty Cycle on My Continuous Pulse Train? To find this property node and how to use it refer to the DAQmx .NET reference: Where Can I Find NI-DAQmx Property Node Listings and Help?
    I hope it helps
    Jaime Hoffiz
    National Instruments
    Product Expert
    Digital Multimeters and LCR Meters

  • Custom square wave duty cycle in signal express

    Hey everyone,
      I am using an USB X Series Multifunctional DAQ Model 6361, with labview signal express 11 on windows7 (version 9.3.5) and I am trying to figure out if i can change the duty cycle of a square wave.  I need to have one period be at 75% duty cycle and another 25% or something along these lines.
    thanks!
    Adam 

    Hi Adam,
    I believe another Applications Engineer has corresponded with you concerning this issue already. If you are looking to generate a truly custom square wave where the duty cycle changes from one period to the next then you will need LabVIEW as this functionality is not supported in SignalExpress. 
    Using the Analog Output along with the Create Analog Signals options will allow you to specify one fixed duty cycle for your square wave, but this will remain constant throughout the generation. 
    Regards,
    James D.
    Applications Engineer
    National Instruments

  • Wrong duty cycle (pci 6014 and bnc2110)

    Hello,
    I want to generate a square signal with labview 7.0, pci 6014 and bnc 2110. I attached my VI . The duty cycle works properly for instance for 10%, 20%, 30% (I suppose that it works because when I anlyse the signal: some pulse seams to not appear ) . BUT when I change the duty cycle constant to 15%: the output is again 20% and not 15%. It's the same case for 17%, 18%....
    I really need to create square signal with a perfect duty cycle.
    Do you know where is the problem?
    Thank you 
    labview 7.0
    Attachments:
    Untitled41.vi ‏310 KB

    I found the problem for missing pulse: it's the while loop. I delete it and add more samples.
    The duty cycle works now due to the precision of the "simulate signal"
    labview 7.0

  • Duty Cycle

    how to generate a waveform with the duty cycle?
    Pls reply soon
    Thanks,
     Jinal

    Hi Jinal,
    Look in the examples folder, there is a function generator example with a square wave function that allows you to change the duty cycle.
    labview\examples\measure\maxmpl.llb - Function Waveform Generator.vi
    ssk

  • 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

  • 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

  • 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

  • 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

Maybe you are looking for

  • Hyperlinks from Outlook 2010 don't work anymore (Firefox is my default browser)

    Since I installed IE 9 I can't use Hyperlinks in Outlook anylonger (Firefox remains my default browser!). I tried already a) set IE 9 default (Hyperlinks works) and switch back to Firefox (Error message and Hyperlinks don't work) b) "Start" + R with

  • Java class - webservice

    Hi Experts, How to consume more than 2 webservices in Java class? And how to expose that Java class (which contains two webservices) as a webservice? Regards Sara

  • Don't have permission

    I was doing an Airdrop to my wifes macbook air and weird things happened and now the Air has lost all permissions- I can not see any files and cannot reset permissions.  Doing a search it seemed like full reinstall is the only answer... pain in the b

  • How can I Sync the applications from my ipod touch to my iphone 4s through itunes???

    I recently got a new iphone4s And would like to sync some apps which i have on my ipod touch over to my iphone but not all of them. I am using itunes through windows 7 many thanks

  • MSN / Outlook for iMac

    I've had MSN as my email for a long time and don't care to change. Msn switched to Outlook a while back and I've been accessing it through Safari. But my iMac was set up to default to the Mac email software. I'd like the computer to default to Outloo