Reading a PWM and determining pulse width using a digital input pin on a NI 9425 DAQ

Hello!
I have been experimenting with LabVIEW for about a week now and have run into a brick wall.  I have found a fairly effective way of reading a PWM signal through an analog input and determining the pulse width.  However, it is becoming necessary for this project to do this same thing using a digital input.  I've been playing with this for about a day now and am not making much headway.
For reference, I will be using a 9524 device
Any ideas?

Also, if it is helpful at all, I've attached two vi's.  One, functions just as I need it to - but it doesn't involve data aquisition.  The second should be similar to the first, but is non functional - I keep getting an error that my amplitude is zero.
Any thoughts?
Attachments:
DigitalEdgeDetectionKnown.vi ‏47 KB
DigitalEdgeDetectionRead.vi ‏148 KB

Similar Messages

  • I have a macmini on order, I wonder if I can pair the wireless apple keyboard and magic touchpad without using any other input devices, especially, since everything is brand new and not yet paired.

    I have a macmini on order, I wonder if I can pair the wireless apple keyboard and magic touchpad without using any other input devices, especially, since everything is brand new and not yet paired.

    You may just want to save yourself any possible issues
    by just hooking up a wired keyboard and mouse on first
    start up.  Any USB keyboard and mouse should work.
    There have been many that have had problems on first boot
    using the Bluetooth devices. 

  • How to generate and output 3 TTL square waveforms with different pulse widths using counters of NI 6034E

    Hello
    I just have a few questions.
     I am using the NI 6034E DAQ board in order to
    generate simultaneouly 3 different TTL digital signals, with different
    pulse width, and output these TTL signals to an external circuit that I
    am using for this application.
    The following pattern of the TTL pulses will look like this:
    01010101 01010101
    00110011 00110011
    00001111 00001111
    From
    what I understand,  I have to use the 2 counters, Ctr0 and Ctr1, to
    generate the TTL pulses that I desire, because the DIO lines are
    software timed only and I will not be able to produce a deterministic
    output period using these DIO lines.  Am I correct?    Also, do I have
    to use a separate counter to generate a separate TTL digital pulse.  I
    need 3 different TTL pulses and there are only 2 counters for this DAQ
    device.  The three generated TTL signals will be feed to an external
    circuit.  Concerning the hardware connections for my application, I
    assume that the generated TTL signals will be output from
    GPCTR0_OUT(pin 2)  for counter 0 and GPCTR1_OUT(pin 40) for counter 1
    of the NI 6034E. Is this correct?  Is there any way that these TTL
    signals can be output from three DIO lines(DIO0...2). 
    Here is some code that I plan to use in order to do this:
     #include <NIDAQmx.h>
    static TaskHandle gTaskHandle = 0;
    DAQmxCreateTask ("", &gTaskHandle);
    DAQmxCreateCOPulseChanTime (gTaskHandle, "Dev1/ctr0", "", DAQmx_Val_Seconds, DAQmx_Val_Low, 1.0, 2.0, 2.0);
    DAQmxCreateCOPulseChanTime (gTaskHandle, "Dev1/ctr1", "", DAQmx_Val_Seconds, DAQmx_Val_Low, 3.0, 4.0, 4.0);
    DAQmxCreateCOPulseChanTime (gTaskHandle, "?????", "", DAQmx_Val_Seconds, DAQmx_Val_Low, 7.0, 8.0, 8.0);
    DAQmxCfgImplicitTiming (gTaskHandle, DAQmx_Val_FiniteSamps, 5);
    DAQmxStartTask (gTaskHandle);
    DAQmxWaitUntilTaskDone(gTaskHandle)
    DAQmxErrChk DAQmxStopTask(gTaskHandle)
    DAQmxErrChk DAQmxClearTask(gTaskHandle)
    I believe this code should generate the 3 TTL square waveforms that I want for my application.
    Please provide me with some feedback.  It would greatly be appreciated.
    Thank You

     Hi,
    The NI 6034E is a multifuntion DAQ device, this means you have:
      (2) counters
      (8) DIO lines (software timed)
      (16) AI, single ended
      (0) Analog Output
     You have a couple choices here:
       1. Software timed digital output of all three signals, max 1khz loop rate, non-deterministic.
       2. Hardware timed digital output of 2 signals, max 20Mhz.
       3. Hardware timed digital output of 2 signals and software timed digital output of 1 signal.
       4. Find another NI MIO board such as the NI 6251. This board will do 10Mhz pattern generation for (8) DIO lines.
    For the hardware connection, you are correct, the output for the counters will be taken from pin 2 & pin 40.  Here's the pinout for the NI 6034E for reference:
    The output of the Counters can be routed to some of the PFI's or to the RTSI connector. You can see this in MAX
    Message Edited by Matthew W on 11-19-2007 01:24 PM
    Attachments:
    2007-11-19_131609.jpg ‏61 KB
    2007-11-19_132435.jpg ‏86 KB

  • How does Pulse Params Vi determine pulse width

    I need to know how the PulseParams vi calculate pulse width, rise/fall time? Is it based on the standard 10/90 method or something else? How does it determine what is a "valid" pulse? What is the "Delay" parameter and how do you use it?

    Hello Lancer,
    The following is taken from LabVIEW Help under Pulse Parameters:
    X is the input sequence. X must meet the following conditions:
    � The number of samples in X must be greater than or equal to 3.
    � X should have a rising edge, a plateau, and a falling edge.
    � The expected peak noise amplitude must be less than 50% of the expected amplitude.
    If the number of samples in X is less than 3, the VI sets all the pulse parameters to NaN and returns an error. If X does not contain a rising edge, plateau, and falling edge, the VI analyzes the data, assigns values to as many pulse parameters as it can identify, and sets parameters it cannot identify to NaN. The VI does not report this condition as an error.
    Note X can be a positive- or negative-going pulse. A histogram is used to determine top and base. If the difference between top and base is negative, the pulse is considered negative-going with a negative amplitude.
    If the data in X is noisy beyond the expected 50% amplitude, the VI does not have enough information to differentiate between glitches and pulse data and may assign incorrect values to the pulse parameters. Because it cannot be detected, the VI does not report this condition as an error.
    Note If the data is noisy, you can apply a median filter to the data before passing it to the Pulse Parameters VI. Refer to Noisy Pulse Analyzed with a Median Filter for more information about analysis with a median filter.
    Note When the X data is a constant value c, the VI sets the pulse parameters to the following values.
    amplitude = overshoot = undershoot = delay = duration = 0.
    top = base = c.
    risetime = falltime = slew rate = NaN.
    slew rate is the ratio between (90% amplitude - 10% amplitude) and the risetime.
    overshoot is the difference between the maximum value in the pulse and the topline.
    risetime is the time required to rise from 10% amplitude to 90% amplitude on the rising edge of the pulse.
    top is the line that best represents the values when the pulse is active, high, or on. For a negative-going pulse, top is less than base and results in a negative amplitude. For a positive-going pulse, top is larger than base and results in a positive amplitude.
    amplitude is the difference between top and base.
    base is the line that best represents the values when the pulse is inactive, low, or off and is the level closest to zero. For a negative-going pulse, base is larger than top and results in a negative amplitude. For a positive-going pulse, base is less than top and results in a positive amplitude.
    undershoot is the difference between the baseline and the minimum value in the pulse.
    error returns any error or warning from the VI. You can wire error to the Error Cluster From Error Code VI to convert the error code or warning into an error cluster.
    falltime is the time required to fall from 90% amplitude to 10% amplitude on the falling edge of the pulse.
    duration is the difference between the falling edge time and the rising edge time at which 50% amplitude occurs.
    delay is the difference between the time origin and the time at which 50% amplitude occurs on the rising edge of the pulse.
    Pulse Parameters Details
    Note The Cycle Average and RMS, Transition Measurements, Pulse Measurements, and Amplitude and Levels VIs provide more measurements than the Pulse Parameters VI, and you can configure each of those VIs.
    The waveform-related parameters are slew rate, overshoot, topline (top), amplitude, baseline (base), and undershoot. If y-axis units are volts, then slew rate has units of volts per sample. The time-related parameters are risetime, falltime, duration (width), and delay and are expressed in units of samples.
    Note The VI assumes the input pulse or pulse train has a bimodal, or two-state, distribution. Any input other than a bimodal input can lead to inconsistent results.
    The Pulse Parameters VI uses the following steps to calculate the output parameters.
    1. Find the maximum and minimum values in the input sequence X.
    2. Generate the histogram of the pulse with 1% range resolution.
    3. Determine the upper and lower modes to establish the top and base values.
    4. Find the overshoot, amplitude, and undershoot from top, base, maximum, and minimum values.
    5. Scans X and determines the slew rate, risetime, falltime, duration, and delay.
    The Pulse Parameters VI interpolates duration and delay to obtain a more accurate result not only of duration and delay but also of slew rate, risetime, and falltime.
    If X contains a train of pulses, the Pulse Parameters VI uses the train to determine overshoot, top, amplitude, base, and undershoot but uses only the first pulse in the train to establish slew rate, risetime, falltime, duration, and delay.
    Note Because pulses commonly occur in the negative direction, the Pulse Parameters VI can discriminate between positive and negative pulses and can analyze the X sequence correctly. You do not need to preprocess the sequence before analyzing it.
    If none of these suggestions help, or if I�m not correctly understanding your issue, please post the software and versions you are using, the applicable portions of your code, and any other information that may help, and I�ll be happy to look further into it.
    Have a nice day!
    Robert M
    Applications Engineer
    National Instruments
    Robert Mortensen
    Software Engineer
    National Instruments

  • 6221 pulse generation using external digital trigger

    Hi there: I am trying to do something very basic, but cannot figure out how to do it. I have an NI 6221 USB I/O device.  I want to program it to generate a digital output 100ms after receiving a digital input. I am trying to create a task to do this using NI Max, but all of the options on the trigger source menu are greyed out. There is no way to specify an external hardware trigger.  Do I have to program this functionality using DAQmx in the code?

    I found the solution to this question in Gen Dig Pulse-Dig Start.vi from the NI example finder. The answer is that you do need to configure the input trigger programmaticaly using the DAQmx functions. See example code for more details.

  • How to use an Digital input as an Boolean?

    Dear all,
    I want to set up a digital input signal as a Boolean function. How can I do that?
    I also want to know how I can get Digital output lines which are all in DataAquisition box into different lines on my LabView screen? Is this possible with an array?
    Cheers

    We need more information before we can give you the info you need.
    What type of boolean function do you want (digital waveform, array of booleans)?  A boolean on the front panel can be programmed to do many things on the block diagram.  You will probably want more than one.  For example, one boolean to set a value, another to signal the program that you want to add a value.
    Getting data from a data acquisition device into LabVIEW can be either trivial or difficult depending on what the manufacturer of your data acquisition device provides in the way of drivers.  If the device is a National Instruments device and supports digital input, it should be pretty easy.  Look at the documentation and examples that came with the device.  If it from another manufacturer, look for a LabVIEW driver for it from the manufacturer.  If neither exist, you will need to write a driver yourself.  This is usually straightforward, but tedious.  It can get difficult if the manufacturer does not publish good interface specifications.  Once you have the data into your program as a digital waveform, displaying it on a digital graph is as simple as dropping the graph on the front panel and wiring the digital waveform to it on the block diagram.
    I would highly recommend you run through the LabVIEW tutorials on the main NI website.  There are several, depending upon how much time you have.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • Measure a single pulse width using usb 5133

    hi im trying to measure the width of a single pulseoutpout from NI SCOPE express
    however pulse measurements.vi seems to expect more than a single pulse.
    any ideas?
    ta

    Hi Slugger,
    Can you first try this with the SCOPE Soft Front Panel (SFP) located in Start >> Programs >> National Instruments >> NI-SCOPE >> NI-SCOPE Soft Front Panel.
    This should give you the screen below:
    Please set the items as seen in the red boxes. Make sure your trigger channel is correct Mode is set to SGL and press the measure button.
    This will give you a Scope measurement screen. Please press the Add button. Select the correct Channel and then in the measurement type choose "Period".
    On the main SFP window press the run button. Does the measurement give you the reading you expect?
    I do not have a Scope card to test this yet, so I have been using a simulated device.
    Regards
    JamesC
    NIUK and Ireland
    It only takes a second to rate an answer

  • Code to read xml file  and display that data using sax parser

    Hai
    My problem I have to read a xml file and display the contents of the file on console using sax parser.

    here you go

  • How to read a table and send a report using BPEL process?

    Hi Experts,
    I have a requirement to read list of records in few columns entered previous day from a particular table, prepare a xl report and send the xl file via email to users. Please advise.
    Thanks,
    Harisudhan Selvaraj

    Hi,
    Check this code.
    Here i creates context one node i.e  flights and attributes are from SFLIGHT table.
    DATA: lo_nd_flights TYPE REF TO if_wd_context_node,
            lo_el_flights TYPE REF TO if_wd_context_element,
            ls_flights TYPE if_main=>element_flights,
            it_flights type if_main=>elements_flights.
    navigate from <CONTEXT> to <FLIGHTS> via lead selection
      lo_nd_flights = wd_context->get_child_node( 'FLIGHTS' ).
    CALL METHOD LO_ND_FLIGHTS->GET_STATIC_ATTRIBUTES_TABLE
      IMPORTING
        TABLE  = it_flights.
    now the table data will be in internal table it_flights.

  • ***Resubmitted for further review*** How can I do position maintenance using a digital input to capture an encoder count and adjust the move profile on the fly.

    I have a rotary table (45:1 ratio) being driven by a stepper motor with an encoder attached to the motor. I am using a 7344 motion controller. I want to be able to do position maintenance on the move. The problem is that I am always moving in the same direction and the table has mechanical error. I have a home input on the table, which I have wired to the trigger input for the corrosponding axis. My thoughts were to capture the position when the table goes by the home input and compare it with the previous time and make the adjustment in the next move. I am just not sure what the best way to do this
    is.

    Hello,
    So when you say that the table has mechanical error you mean that the number of steps per table revolution will vary from revolution to revolution? I apologize that I misunderstood this initially. What you could do is use high speed capture to read the position of the stepper every time the home switch (or some other mechanical switch) is hit for each revolution of travel. Then when the high speed capture lined is toggled you can read the current position and modify your next move accordingly. To get details about High Speed Capture please search for High Speed Capture from our Developers Zone at: zone.ni.com
    There are examples programs on our website and examples available with the FlexMotion driver.
    Please let me know if you have any further questions.
    Re
    gards,
    Andy Bell
    Application Engineer
    National Instruments

  • How can I do position maintenance using a digital input to capture an encoder count and adjust the move profile on the fly.

    I have a rotary table (45:1 ratio) being driven by a stepper motor. I am using a 7344 motion controller. I want to be able to do position maintenance on the move. I have a home input on the table. My thoughts were to capture the position when the table goes by the home input and compare it with the previous time and make the adjustment in the next move. I am just not sure what the best way to do this is. I am thinking that I want to tie the home input to one of the trigger inputs as well as the home.

    Hello,
    Your best option will be to use an encoder for feedback in your system. If you use an encoder then at the end of the move, the controller will compare your trajectory position with the position the encoder reads (the actual position) and make the necessary adjustments. Also, this is all handled transparently so you won't have to worry about any complicated programming issues.
    Regards,
    Andy Bell
    Applications Engineer
    National Instruments

  • I need to start and stop logging based on a digital input event(or analog if necessary), log data for several seconds prior to the event, and have the data file close at the end of event and increment the filename for the next logging event.

    I don't know if this can be done with VI Logger or need to use Labview V7.1.

    After browsing through the VI Logger User Manual, it looks like the triggering that you are hoping to accomplish is possible. However, incrementing the filename for the next logging event is not going to be possible. VI Logger does exactly what its name tells - logs data. I don't think the automation that you are hoping to accomplish is possible.
    For help with setting up your application, if you do choose to stay with VI Logger, make sure to chek out the Getting Started with VI Logger Manual.
    Best of luck.
    Jared A

  • [cRIO] Pulse width measurement

    Hello,  I am working with cRIO-9074 with digial I/O module 9403. I was wondering where I could find examples or a list of function relevant to measuring the pulse width of a digital input (with resolution of about 10 usec).
    - Thank you 

    I've implemented something similar using the example given above, however due to hardware limitations I'm unable to use the SCTL, this isn't too much of a problem as I simply use a while loop with a 4-tick loop timer, however when driven with a constant digital signal I get the pulse width measurements 'bouncing' between two values, it's not out by 1 or 2 ticks, it jumps around 1000 ticks, it also 'sticks' when I slowly ramp up the frequency, suddenly jumping to other values
    any suggestions? I'm currently using the FPGA open function and accessing the FPGA in (I believe) scan mode, could this be the culprit? I've not undertaken the RT training course yet so I'd be poking in the dark a little
    this is for a proof of concept demo in a few weeks time!

  • FP-PWM-520 Resetting to 0% pulse width

    I am trying to use an FP-PWM-520 module to set a voltage output from a PV panel.  I am having an issue trying to reset the module to 0% pulse width.  I am taking a measurement, using an FP-AI-110 module on the same FP-2000 logger, every 1 second.  The VI I have written takes some number of readings, currently set to 10, and then resets the PWM module to 0% pulse width to open the PV module and take a new reading.  The VI then recalculates a new pulse width, sends it to the PWM and I resume taking measurements. 
    Am I wrong in assuming that I can reset, then set the PWM block 2 times in a matter of seconds?  Do I need to wait a specific amount of time before I send the reset and new pulse width? 
    Thanks for your help.
    Message Edited by upchuckjunk on 01-15-2008 05:25 PM

    I have been using Fieldpoint successfully for data acquisition for 3-4 years now.  I am new to the PWM blocks.  The code I am running resets the FP-PWM block, writing an array containing  eight "0" to the block, then waits for 1 second, reads the FP-AI block.  I can post code, but will have to strip out quite a bit from the state machine before I post it.  As I stated above, the PWM does not always reset.  It seems to reset most of the time, but every 3-4 cycles, it fails to reset the PWM to 0%.  I know this because my voltages never reach the maximum values they should. 
    To reset the blocks, what exactly do I need to do?  Do I need to wait a specific time?  Do I need to write some specific value to the block?  If I get answers to these questions, I know I can figure out what is going on with my code. 

  • FPGA programming for motor control using free downloadable IP cores for PWM and Quadrature encoder interfacing

    Hi,
    I have a cRIO-9014 with a NI9505 DC brushed servo drive module, and I would like to program the FPGA for PWM and Quadrature encoder interfacing using the intellectual property IP functions mentioned in the "CompactRIO Motor Control Basics Tutorial":
    Quadrature Encoder dX Method (FPGA, Use in SCTL).vi
    Pulse Width Modulation (FPGA, Use in SCTL).vi
    I made a search at ni.com/ipnet but I couldn't find them.
    Where can I find free downloadable IP cores for PWM and encoder blocks to include them in my FPGA interface program?
    Thanking you in advance,
    Manuel
    Solved!
    Go to Solution.

    Found by myself (google search!) at:
    https://lumen.ni.com/nicif/us/codepowelecguide/content.xhtml

Maybe you are looking for

  • Formu;a column

    hai all I am developing a report. I am using UTL_FILE in that report in formula column. When i try simply i am getting the result. When i include the utl_file concepts in the formula column which will create a text file in the server path , it is com

  • Unable to see report

    Hi I had one strange issue.Willbe greatful for some inputs. User is using one report.He sees report in .NET application which fetches data from BW.The report is based on one BW query. In BW query,we are using one characteristic SALES_ORG which has hi

  • BAPI_GOODSMVT_CREATE - Still to be Delivered Quanity

    Hi All, In the transaction Me23n, I can display my Purchase Order Number. In the Header Data, Under the Status tab, I can see the Quantities as below: Ordered: 400 Delivered: 300 Still to be delivered: 100 Now I run the BAPI_GOODSMVT_CREATE with the

  • How do I prevent sharing a text file by different users

    Hello, I am using LV8.6.1 and writing this application that read and write to a text file. The application is being used by many users at different sites and I want to prevent writing to the text file when other user is already using it (reading or w

  • Help required to help me keep the faith with apple!

    Hello, New to the apple world. Bought my first Apple Macbook in Dec 09. After 6 weeks of heavenly use, its now started to crash all the time. 14 times in the last day alone, & thats when i can get it to boot. Sometimes when I turn it on, all i get is