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

Similar Messages

  • 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

  • High accuracy duty cycle with DAQ-STC

    I am trying to measure the duty cycle of a 4 kHz TTL pulse train with high accuracy. I can do this over one cycle but actually need to average over a number of cycles because there is noise. This doesn't seem possible with the stanard VI's? Can anyone help?
    Thanks,
    Gavin

    Gavin,
    There is an example on our website that does buffered duty cycle measurement on DAQ-STC devices that should be helpful for you. From www.ni.com/support you can search under Option 3 through Example Code for +duty +cycle +stc to find it or follow this link: E Series Duty Cycle Example
    Regards,
    Molly K.
    National Instruments
    Applications Engineering
    Molly K.
    Web Support & Operations Manager
    National Instruments

  • 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

  • How to write a VI to measure the difference between two analog inputs (voltage)

    I'd like to measure the difference voltage between two analog inputs.
    Could someone write me a VI for it, please?
    I'm new with Labview....
    Thanks a lot!!!

    On the numeric palette, there is a function called subtract. As the
    help for it says, it 'Computes the difference of the inputs.'.
     Since
    this is such a simple process, you need to provide some details on why
    you can't do this. You can wire just about any data type into the
    inputs. Post your code if you need further help.
    Message Edited by Dennis Knutson on 04-05-2009 08:23 AM
    Attachments:
    Subtract.PNG ‏1 KB

  • Dv video time stamp with analog input

    Hi,
    I have a dv video which I want to time stamp with a analog input.  For the video, which is dv brought into the computer with ieee1394, LabView calls up a C++ program which then stores the video.  Simultaneously, in the program which calls up the C++, an analog signal is also stored (seperately).  I know it sounds tricky as well as messy but this is the best we've been able to work out, given the uncorroperative nature of LabView with dv camera.  Does anyone have suggections for time stamping these two signals so that I know exactly where in the video the analog signal occurs?  The PCI board we use is the NI 6014, which I know is timestamp capable, but I dont know if it can stamp the video feed since it doesnt come in through the NI card.
    All thanks in advance for any help!
    Daniel

    Daniel,
    Does your DV camera have any sort of timing or triggering signals? Without these, it will be virtually impossible to correlate measurements. It is cetainly possible to accurately time an analog input with your DAQ card, but correlating these to the digital video would be extremely difficult. Is this video streaming in real time? Or are you reading it off of an already-recorded tape? If this video is streaming in real time, with an acquisition started in software, I would suggest attempting to start the software DV reading at the same time as your DAQ task. If you do have an external signal that can trigger the video acquisition, then I would suggest using that same signal to start your analog acquisition.
    Hope this helps,
    Ryan Verret
    Product Marketing Engineer
    Signal Generators
    National Instruments

  • Labview performance suffering with analog input

    Hello,
    I am using a PCI-6036E and a cDAQ-9172 with LabView 8.0. I have created a VI that systematically writes four different digital outputs, three to the PCI-6036E and one to the cDAQ-9172.
    Just recently I added a thermocouple to the mix, using an analog input on the PCI-6036E to monitor temperature. Since doing so, I have noticed that the entire VI runs extremely slowly.
    Before installing the thermocouple, the VI slowed down a bit if left to run continuously (for days at a time). Now, however, the VI slows down a great deal if left to run for more than a few minutes. It is so bad that the "Elapsed Time" display will not properly display the elapsed time.
    Because this application will be run for days, even weeks at a time without being stopped, this gradual decrease in performance is a huge problem. The application needs to run very accurately and precisely. I have attached my VI below. Is there any way to fix this issue? Any help is greatly appreciated, as I am new to LabView.
    Thanks,
    Nick

    I didn't look at the code (yet), but do you have a slow analog samplerate?
    Look here
    And here (a KB aticle)
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • LF a home theater with analog inputs to support my creative x-fi 5.1 card. Budget is 225.

    My card does not support true surround sound in anything other than movies through SPDIF so I need to get a home theater that has analog inputs. Could someone recommend me a good speakers system for 225 or less. I current have a 1000 watt JVC TH-G30 that uses SPDIF. Thanks for any help
    My card is USB is why this is an issue.

    'Re: Creative X-Fi 5. Surround Problem. Hi,
    As far as I know, you can only get stereo audio from the optical output unless you are playing encoded Dolby or DTS audio. See this link for more info. http://forums.creative.com/creativel...&thread.id=270
    For your analog output, it seems strange that your speaker test only have audio in the front left and right but music is ok. Maybe you can try using earphone or something and connect to the rear jack and the centre/subwoofer jack to see if you can hear any audio from them? This may help to check if the problem is due to audio not coming out from your x-fi 5. surround or due to your speakers setup. It should also help to know which version of drivers you are running on. You may also want to try the new beta drivers that was release in Feb just to check.

  • My question has to do with analog input and triggering? Does anyone have any suggestions on how i can improve the attached vi so it can trigger on a 50kHz ten cycles pulse after the pulse has been sent out on the output?

    Could you just look at this vi and tell me if i am doing anything wrong? I get errors that are different each time I change something. here are the inputs I am using
    Output Side:
    amplitude = 1
    freuency = 50kHz
    Sampling Frequency = 1MHz
    3 of Samples = 200
    Input Side:
    Input Buffer 4000
    trigger type = analog
    pretrigger = 5
    edge or slope = rising
    scan rate = 500kHz
    # of scans = 2000
    Conditional Retrieval
    mode = on
    slope = rising
    skip count = 0
    level = .1
    offset = 0
    hysteresis = 0
    So what we want to do is capture the ten
    cycles of the 50k output pulse on the input and need to store that so we can plot it later, do you have any suggestions. we are using the PCI-MIO- 16E board.
    Thanks,
    Jarrod
    Attachments:
    InputOutput2.vi ‏88 KB

    1) Toss the sequence frames (no flames please).
    2) Set you read and have it ready to trigger before oing the output.
    3) After the output, go back and read the data that is waiting for you.
    4) If you have errors tell us what they are and under what conditions they occured.
    End of Ben's suggestions for now.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • 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

  • Servo tune with analog input (no encoder)

    I have a PXI-7340 motion controller and MID-7654/7652 Drive connected to a servo motor. As position information I use an analog signal, no encoder (it has to work in a radioactive zone and an encoder wouldn't resist). Can someone tell me how to find the PID coefficients in MAX and also where I can see the position information in MAX ? I use Servo Tune manually but no results .. the red line is always flat and the motor doesn't move;
    thanks for any help,
    otilia
    otilia

    Hello,
    Have you taken a look at the following link?
    http://digital.ni.com/public.nsf/allkb/19668AB2D4997F3D86256E940082F1EF
    Message Edited by ThiCop on 04-23-2010 06:55 AM
    Kind Regards,
    Thierry C - Applications Engineering Specialist Northern European Region - National Instruments
    CLD, CTA
    If someone helped you, let them know. Mark as solved and/or give a kudo.

  • How can I measure the frequencies of two analog input signals simultaneously?

    Hi
    I have two AI signals, and I need to determine the frequencies of those signals. The frequencies range from 1-125Hz. I currently have a VI where I can sample one of the signals for 1 second (sampling at 300 Hz for 300 samples) and determine the frequency. 
    I need to read two signals at the same time and get both of the frequencies at the same time, but I can only figure out how to read them individually, so I can read one signal, then one second later I read the second one, then I read the first one again, then the sceond one, etc..  How can I read two signals simultaneously?
    Thanks
    Attachments:
    FreqMeas11.vi ‏41 KB
    FreqMeas11.PNG ‏18 KB

    "at same time", this depends on the hardware, you can do as has been previously stated just set up a 2 channel acquisition and you will get 2 sampled waveforms back.  Most hardware A/D as multiplexed and true simultaneous sampling is not done.  At 125Hz this is not an issue unless you are interested in very small phase changes between the samples.  just keep this in mind if you are expecting samples to be completly synchronized.
    Paul
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA

  • 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

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

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

Maybe you are looking for

  • Can't empty file in trash under 9.2.2 or OS.X.3.9

    I have read the posts and tried the different options of emptying trash and can't get rid of this pesky folder. I was transferring files from a Jaz drive to an internal drive which is titled a workdrive. Some error messages came up that stated certai

  • Can't delete or edit a Mail account that is unable to connect and it keeps notifying me

    Can't delete or edit a Mail account that is unable to connect and it keeps notifying me and asking for password. Macbook Pro with Yosemite. If I highlight the account and go to Mailboxes, "Edit smart mailbox" is greyed out. Delete the mailbox is an o

  • Timestamp in Oracle Forms10g

    Dear ALL, Can any one tell me how can i use the timestamp data type column in Oracle Forms 10G. when i create table with a time stamp as datatype and then when i make Data block by wizard i am getting FRM-10009 error message. My table structure is as

  • Error in invoking target 'client_sharedlib' while installing

    Hi all Help me in for oracle installation , i am stucking in the linking step of oracle database installation on 64 bit machine , Linux RHEL AS 4.0 update 3 i am getting the following message Exception String: Error in invoking target 'client_sharedl

  • Interactive Gantt Charts in Webdynpro

    Hi at all, Where can i find information about the interactive gantt element in webdynpro for java or rather code examples how to use this element? thx