Acquire pwm on a digital line

Hello,
Does anyone have a suggestion or starting code that would allow me to acquire a duty cycle on a digital input port? I have 24 pwm (0-5vdc) signals I need to continuously monitor during durability testing. Currently I use the counters on an x series card (PCIe 6323) but my sample size has increased and we prefer not to use 6 daq cards.
Thanks,
Diesel
Solved!
Go to Solution.

How accurately do you need to measure duty cycle, in terms of time units?  Or, alternatively, what is the minimum on time that you need to be able to measure?  I don't have a 6323, but it appears that you can do buffered acquisition of digital signals at up to 1mhz; is this fast enough for your application?  If so, you can calculate duty cycle by reading a number of samples (several periods is probably best), adding the number of true samples, and dividing by the total number of samples.  (I'd do this by using the boolean to 0,1 function, cast to a 32-bit value if necessary, then sum array elements and divide.)

Similar Messages

  • Is it possible with cDAQ to output PWM-Signal and Digital lines through same module?

    Hello
     I try to output a digital line and a PWM signal through one 9401 module. I use it for actuator control with PWm = speed and digital hig/low = direction.
    In LV, I set up cDAQ/_ctr1, then use channel property outport to set it to e.g. cDAQ/module9401/PFI0.
    But when I start a second task to use PFI1 as digital output on the same module, the vi fails with timeout error.
    Is simultaneous useage possible or will I have to use 2 modules
    Thanks for your insights.
    Michael

    Hi,
    you can upload your LV VI, because I suspect you make a mistake in you're program.
    Best regards
    Marko

  • Executing Acquire upon Digital Line State

    I have a homework problem where a analog voltage measurement isn't supposed to start until a digital line becomes true.
    I have it working, but just checking if there is a preferable way.
    As a test, I used a T/F toggle switch inside a continuous while loop to simulate the digital line state. When I toggle the switch to True, I pass a True value out of the While loop. I pass this True value to a Case structure that accepts 2 values, True and False. On True, it starts the analog data aquisition, which works all OK.
    Is there a preferable way to "wait" on a trigger, and then execute a block of code?
    thx
    Jeff

    There are a number of examples that ship with LabVIEW that already incorporate digital hardware triggering.
    The program you described will work, but the amount of time between the triggering event (toggling the switch) and the start of the acquisition will vary because you are monitoring the value of your digital line in software. The latency will depend on how many things your computer is doing at once, as well as the speed/memory of your computer.
    By using hardware triggering, you eliminate the software dependancy and achieve a response time in the nanoseconds. You can find the triggering examples by choosing "Search Examples" from the LabVIEW splash screen. Once the help window comes up, choose "I/O Interfaces -> Data Acquisition -> Analog Input -> Triggering a
    n Acquisition."

  • Help: Can you use software trigger on a digital line.

    Hi:
    We have a legacy DAQCARDard 700 which does not support hardware triggering.
    We have a trigger from our instrument that is 5 V+ and we would like to
    trigger when it drops to 0 V. We have several questions.
    1. Do we need to invert the signal in MAX or is that only for V that are
    negative?
    2. Is there a good example in the examples where the state of this digital
    line is used to trigger an analog acquisition? When we tried using the
    digital trigger examples, we had an error saying that the hardware did not
    support that mode.
    3. We have an analog software trigger mode (based on the Analog Software
    Trigger example) working which we would like to modify over to read the
    digital line, but we have done very little wi
    th digital I/O.
    4. The digital trigger has been assigned a virtual channel of dtrg.
    Any help would be much appreciated.
    Thanks in advance,
    Pete

    Thanks Doug,
    If we read the digital line instead of as an analog line would it improve
    the accuracy of the triggering. Everything works now except we have a
    little bit of timing jitter within about 1 data point scanning at 50 kHz.
    However, I've never done any digital i/o with LabView, but may I should work
    through some of the tutorials. If you thought that this might solve the
    jitter problem. Would checking the state of the digital line allow a faster
    response with softtrig, I guess is my question?
    Pete
    "Doug Norman" wrote in message
    news:[email protected]..
    > Hello Pete,
    >
    > You are correct that the DAQCard-700 has no digital (or analog)
    > hardware trigger. The analog trigger example t
    hat is working for you
    > is using conditional retrieval. This is where data is always being
    > acquired and the driver looks at the values to determine when to
    > "trigger" and read the data into LabVIEW. To answer your questions:
    > 1. I don't think you need to invert the signal. This is for when you
    > want a digital low (below 0.8 volts) to show up as a digital high, and
    > a high (above 2.0 volts) to be read as a low.
    > 2. I don't know of a good example. You would basically have to
    > monitor the digital line. When it goes from high to low you would
    > then start your analog acquisition.
    > 3. I think this could be your best bet. If you have enough analog
    > input lines, why not just connect this digital signal as one of your
    > analog inputs. Then use this example to trigger when the 5 volts
    > drops to 0. It won't hurt to acquire your digital signal on an anlog
    > input along with your other data.
    > 4. I don't understand this question.
    >
    > Best Regards,
    >
    > Doug Norman

  • PCI 6602:How can I use the digital lines of the board and in the same time to generate pulse train using a counter?

    Hello!
    My problem appeared when I tried to update my code from Traditional NI-DAQ Legacy to DAQmx.
    I am using 2 counters (counter 5 and counter 7)  from PCI-6602, to generate pulse train, and also the Digital I/O lines of the port 0 (the lines form 0 to 7). What I do in my application is that I am starting to generate the pulse train on the output of the 2 counters, and after that I am playing with the state of the digital lines.
    In traditional there was no problem using the counters and the digital lines in the same time, everything was going perfectly, but in DAQmx this is not possible.
    What happens: I start to generate pulse train on the output of the counters,  no errors encountered, but when I try to modify the state of one line of the digital port the generation of the pulse train is stopped. This is happening when I start the task associated to the digital port.
    My question is: it is possible to create a channel on the digital lines without altered the channels created for the counters?
    Another thing what I manage to see using the  "Measurement & Automation Explorer" and Test panels for PCI-6602, basically is the same thing, I generate pulse train on the output of the counter 7 and try to start a task on the digital line, but I get one error :
    "Error -200022 occurred at Test Panel
    Possible Reason(s):
    Measurements: Resource requested by this task has already been reserved by a different task.
    Device: Dev4
    Terminal: PFI8"
    Instead if I use the counter 0 or counter 1 to generate pulse train I don't encounter the same problem.
    Which resources are used by the counters 2 to 7 from the PCI-6602 board and the counters 0 and 1 do not use?
    Thank in advance for any replies!
    Ciprian
    Solved!
    Go to Solution.

    Hello Jordan, thank you for your reply.
    I am sorry but I can not see or run your example, I don't use LabView, I use Visual C++ for developing.
    Here is the code for generating the pulse train:
    GeneratePulseTrain(unsigned long ulCount1, unsigned long ulCount2)
        short nStatus = 0;
        nStatus = DAQmxCreateTask("",&m_taskHandle);
        nStatus = DAQmxCreateCOPulseChanTicks (m_taskHandle, "Dev4/count5", "", NULL, DAQmx_Val_Low, 0.0, ulCount1,ulCount2);
        if( bTriggerMode == true) // if hardware trigger is enabled
            nStatus = DAQmxSetTrigAttribute (m_taskHandle, DAQmx_ArmStartTrig_Type, DAQmx_Val_DigEdge);
            nStatus = DAQmxSetTrigAttribute (m_taskHandle, DAQmx_DigEdge_ArmStartTrig_Edge, DAQmx_Val_Rising);
            nStatus = DAQmxSetTrigAttribute (m_taskHandle, DAQmx_DigEdge_ArmStartTrig_Src,"Dev4/PFI17" );
        //set the internal timebase
        nStatus = DAQmxSetCOCtrTimebaseSrc(m_taskHandle,"Dev4/count5","20MHzTimeBase" );
        nStatus = DAQmxStartTask(m_taskHandle);
        return nStatus;
    And the code where I try to set the digital line:
    SetChannelState(short nState)
        short nStatus = 0;
        uInt8 wrtBuf0[1]={0};
        nStatus = DAQmxCreateTask("",&m_taskHandle);
        // Configure line as output 
        nStatus = DAQmxCreateDOChan (m_taskHandle, "Dev4/port0/line0", "", DAQmx_Val_ChanPerLine);
        nStatus = DAQmxStartTask(m_taskHandle);
        wrtBuf0[0] = nState;
        nStatus =DAQmxWriteDigitalLines (m_taskHandle, 1, 0, 0, DAQmx_Val_GroupByScanNumber , wrtBuf0, NULL, NULL);
        nStatus = DAQmxWaitUntilTaskDone(m_taskHandle,10);
        nStatus = DAQmxStopTask(m_taskHandle);
        nStatus = DAQmxClearTask(m_taskHandle);
        m_taskHandle = 0;
        return nStatus;      

  • Multiple VI's using different digital lines in one VI.

    I have created multiple vi's, each of which require either reading or wroting to a different digital line on the CB-68LP board. I need to put them all in one individual vi so that I can see everything on the front panel. When I have tried this the vi seems to send a confused signal and operate things which it shouldn't.
    Is it even possible to try and do what I am doing? If not, any ideas what I can do? Thanks.

    Multiple VIs are usually the better approach. What I would suggest is parallel loops. These are loops which do not have any data dependency on each other. One handles the User Interface - the front panel where you "see everything." Another which reads and writes from/to the digital lines. Maybe even a third which processes the data. Exchange data among the loops with queues or functional globals.
    Keep a record of the state of all the digital lines. When something is to be written to certain lines, use either a Write Line.VI ( I don't recall the exact name) or use AND and OR functions with masks to protect the states of line you do not want to change.
    BTW, the CB-68LP is merely a connection interface, not the digital I/O baord itself.
    Lynn

  • How does one write to individual digital lines accross many DIO-96 ports?

    I want to be able to write to any individual DIO-96 line without having to repeatedly init. The available vi's can set up only 24 lines at a time. If it is desired to write to a line outside of those 24, another 24 lines must be initialized, then to return to the first 24 lines, those must be initialized once again. Very clumsy! Does anyone know how to init all lines one time and then allow random access to all 96 lines without further initialization?
    Thanks,
    CBD

    Hi Tom,
    try to use (or at least to insert) that control in another environment (like a Visual Basic form) in order to check if it's working properly. Also, check if you have the DLL with the same name in your system folder - this control it's just a simpler way to use that dll.
    You can use Write to Digital Line.VI, but pay attention to ITERATION terminal - if it is 0(default) LV will call DIO Port Config (find details in help).
    Hope I understood the problem...

  • Pxie-6556 - How to control the rise time in the digital lines (hsdio)

    Hi,
    Is there any way to control the rise time in the PXIe-6556 digital lines?
    Even in a low frequency signal 10kHz the rise time is about 2ns.  
    Tks,
    Solved!
    Go to Solution.

    Hello engfpe,
    The PXIe-6556 is a 50 Ohm system, meaning the output is source series terminated to be 50 Ohms and all our cables and accessories are 50 Ohms.  With this setup regardless of the data rate you should have a clean rising or falling edge regardless of the data rate. The quality of the output (rising or falling edge) at your device will be related to the impedance matching of your cables. 
    The PXIe-6556 cannot adjust the slew rate by itself.  However you can insert some simple passive components to do this for you.  I've attached below to images.  The first is a schematic showing one way of slowing down the edge.  The second is the a simulated waveform showing the original edge rate before slowing it down, and the slowed down edge.   This simulation is not of the PXIe-6556 but instead a generic digital output for concept.  In the schematic R1 is set to 34 Ohms because U1.8 has the additional 16 Ohms inside it.  TL1 is the 50 Ohm output simulating the cable on the PXIe-6556.  R2, R3 and C1 are components you could insert after the PXIe-6556 cable before it goes to your device/cables.  In this setup the cable going to your device is TL2 which is also 50 Ohms but it could be another impedance in which case you would change R3 to match.
    You can see in the attached images you can significantly slow down the edge with this setup by altering C1.  I hope this helps,
    Jesse O. | National Instruments R&D
    Attachments:
    edge_compare_schematic.jpg ‏94 KB
    edge_compare_waveform.jpg ‏44 KB

  • Digital lines showing in full quality quicktime export

    Hello - just an addition to a previous matter - I exported an 11 min. movie in H.264, w/the default settings, NTSC 4:3; 720 x 480. It's 572.1 MB and I burned to a CD, so that the client can download it into their own laptop, then project it onto a screen. When I viewed it on my computer, there were all kinds of 'digital lines' that showed up, particularly through the transitions (though on most everything else as well), that don't show up on the burned DVD copy. I'm wondering what, if any, particular settings can I use when exporting, so that these pesky 'lines' won't show up, as it looks perfect on the DVD, but won't be viewing from that on the day of the event - ok, thank you!

    I have the same problem... Im using DV pal. Looks loke this is a big problem for many users, bus nobudy knows how to fiks it..my lines are still there on the dvds to by the way..)

  • Time Controlled digital line PXI-6251

    Hi,
    I need to create a time controlled boolean.
    For example a digital line is set to False. I'd like to change to True status for a certain amount of time (e.g. 150ms).
    Is it possible with PXI 6251?
    Thanks

    Hi,
    yes you can. Set a buffered digital output task like "Digital - Finit Output.vi" example.
    You can use an external clock, generate it throught counter output or use ananog in/out sample clock.

  • Arming a counter polling a digital line

    For arming a counter, a start trigger on the STC counter can be roughly emulated by polling a digital line and arming the counter once a high digital pulse is sensed. How can i do that?
    I'm using a PCI-MIO-16E-4

    Daniel,
    You did not mention which programming environment you are using, so I will describe the structure in LabVIEW (no matter which language you are using, this should give you the general idea).
    1. Configure your DIO port with DIO Port Config.vi.
    2. Configure your counter operation (Counter Group Config.vi, etc.).
    3. In a while loop, call DIO Port Read.vi.
    4. Monitor the bit corresponding to your trigger line. When this bit goes high, stop the while loop.
    5. Immediately after the while loop, call Counter Control.vi to arm your counter.
    This should be the basic structure of your program. Good luck with your application.
    Spencer S.

  • Green digitalized lines form when Screensaver is on

    Every time the screensaver comes on (a photo album), these green digitalized lines come on, and I cant get them to stop. Any advice?

    Thanks everyone for offering your thoughts. I have put it through a round of testing today and found that indeed the green lines appear when I'm taxing my system with Photoshop.
    Now my issue lies in what to do - get a video card or purchase a used Mac Pro of a similar vintage. Found a good deal on Craigslist for $400: 2.66GHz Quad Core XEON, 8 GB's of RAM, 500 GB hard drive, Nvidia 1024MB video card. I could stuff it with my other 3 hard drives and get a better card than mine (perhaps add that second display I've been wishing for). Opting for a new MacPro isn't an option, it's too expensive and I'd like to get another 2 years out of my 'system', generally speaking.

  • Anybody knows how to control parallel port to generate digital line ?

    All,
         I have found at some website, there are a software can generate corresponding signal (I suppose that is digital line) to driver a relay board, the relay board is 8 channels. which out put is pin 2, pin3, pin 4, pin5, pin 6, pin7, pin8 and pin 9 of parallel port to control it . it is well control, how can it do ?  and I want to simulate it at LV with parallel port too , how can it achieve ? which command, or a simple sample which you provide will be appreciated.
    thanks in advance.

    You forget to search through NI Web site. Here are some links.
    http://zone.ni.com/devzone/conceptd.nsf/webmain/72C6FC6CE4AD4D1386256B1800794596
    http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B123AE0CB9CB111EE034080020E74861
    Sergey

  • Write to digital line and wait 20 mico sec and aquisition

    i have DIO-32HS and PCI-6036E. i want to select a port by writing to digital port or line and then wait for 20 micro sec after thar i have to aquire data from AI.my problem is waiting 20 microseconds how i can achieve this?E-mail id:[email protected]

    Here is what I suggest. I'm assuming you will use the DIO-32HS for writing to the digital line. You could use that digital line as a trigger for a counter on the PCI-6036E. When the counter is triggered, it could generate a single pulse with a delay of 20 microseconds and that pulse could be used as a trigger for analog input on the PCI-6036E.
    There are LabVIEW shipping examples that will illustrate how to setup triggered counter and analog input applications. I hope this helps.
    Regards,
    Todd D.
    Applications Engineer
    National Instruments

  • Tutorial myRIO Stepper with 2 digital lines (step and direction)

    Hey NI Community!
    I'm new here and an academical employee.
    I want to program / control a stepper with myRIO, this is needed for a research project at my institute to build a prototype.
    The stepper is driven by a digital driver which have one digital line for the steps and one for the direction (see attached files).
    Now I want to know, if there is a tutorial or a example for this because I have no Labview, FPGA and myRIO skills at the moment. 
    THANKS!

    Hi MasterChief,
    There is no tutorial how to control a stepper with myRIO. But there is an example shipped with the myRIO that is using a DI task. You can find this example in the LabVIEW example library. Go to Help >> Find examples in an open LabVIEW window. In the dialog open the folder Modules and Toolkits >> myRIO. There is an example called Edge detection and Debouncing.
    The example contins a RT Main.vi. In this VI there is an express VI used. This express VI should be used in your application, too. You only hav to reconfigure the Digital Output instead of Digital Input.
    For your application you will need to control two tasks witht the VI. One for the direction and one that outputs the pulse for the stepper.
    Regards,
    Melanie

Maybe you are looking for