LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital Trigger Rate

Hello-

I am trying to output an analog waveform for a set amount of time based on a digital trigger.  I have modified the Cont Gen Voltage Wfm-Int Clk-Dig Start example, modified for a set number of output samples, and set to stop once the output is done; then all put in a while loop for multiple outputs.  The hardware is the 6715 DAQCard with LabVIEW 8.2.

The problem I am facing is that the trigger is only ON for 10 microseconds, up to a max of about 100 microseconds; and each loop only runs for around 100 milliseconds, for 256 loops.  With this configuration, the trigger misses atleast half of the triggers.  We have a feeling that this is because of an inadequate sampling rate for the digital trigger.  The sampling rate for waveform output is set to 500 kS/s, but changing this does not change the number of triggers measured.  Is there a way to change the sampling rate for the trigger?  Looking at examples online, it appears that in past editions of LabVIEW, this rate could be controlled.

The other concern is that the hardware simply can't handle that sampling rate.  When increasing the loop time to 200 milliseconds, all triggers were accounted for, but it is unclear whether that is due to the longer time or rather the sampling "lining up" with the trigger signal.  There are some operations being carried out within the while loop, but they are mostly math operations to modify the waveform.

Any suggestions would be greatly appreciated.  Thank you

Curtis Johnson
0 Kudos
Message 1 of 10
(4,786 Views)

Hi CurtisJ,

Let’s first take a look at this knowledge base: What is the Minimum Signal Width for an Analog Trigger on an NI Data Acquisition Board?, for your card the (6715) we can find that information on the manual, Analog Output Series User Manual page 3-7 and as you can see the minimum pulse width is 10 ns. Since your minimum pulse width can be 10 ms, it should not be the sampling rate of the digital trigger your problem.

Seems to me that you are trying to do a software retriggerable analog output by looping through part of the Cont Gen Voltage Wfm-Int Clk-Dig Start example 256 times, What you would like to do is follow this example: NI-DAQmx: Retriggerable Analog Output, this example basically allows you to use the onboard counters available on a National Instruments Multifunction DAQ device to perform retriggerable analog output.  

Please note that I tested this example with a simulated 6715 in Measurement and Automation Explorer and since the manual does not make any notes on retriggerable output on the PCMCIA card you should be able to run it.

I hope it helps

 



Message Edited by Jaime F on 11-19-2007 02:50 PM
Jaime Hoffiz
National Instruments
Product Expert
0 Kudos
Message 2 of 10
(4,763 Views)
Thanks for the help.  I haven't gotten a chance to test the program with our set up yet, but I had another question.

In the experiment, we hope to trigger 256 times, then make an alteration to the waveform, and trigger another 256 times.  We would do this probably about 10 times, and it would be ideal if the program didn't need to be stopped and restarted.  In my previous program I was using the loop iterations to count, and I am unsure how to get the program to stop after 256 triggers so that the necessary change can be made to the waveform with a loop.

I hope this was clear.  Any suggestions on how to do this would be great.

Thanks

Curtis
0 Kudos
Message 3 of 10
(4,720 Views)

Hi Curtis,

From what I understand, you want to trigger 256 times, make adjustments, trigger another 256 times, make more adjustments, and so on. You want to do all of this without having to manually restart the program.

You can place a second loop around the rest of your program to act as a control loop. Each iteration of this loop will set-up/reconfigure the acquisition and then execute the acquisition (all 256 times). This way the program will run after each reconfiguration without needing a manual start.

Please post if you have any questions. Have a great day!

Ryan D.
District Sales Manager for Boston & Northern New England
National Instruments
0 Kudos
Message 4 of 10
(4,703 Views)
Hey Ryan-

Thanks for the reply.  The loop is not the problem I am facing here.  The issue is that I am using the retriggerable feature on the triggering node, and I need to know how to count the number of times it has been triggered.  The only way I know to advance the loop an iteration is to get the task to finish or count to 256 triggers.  Since there is no gap between blocks of 256 triggers (i.e. there will be 2560 straight triggers), I need to know how to count.  I didn't see a property on the trigger node.  Please let me know if you have any ideas

Thanks
Curtis
0 Kudos
Message 5 of 10
(4,693 Views)

Hi Curtis,

There are a couple things you can do. The first is with loops as it sounds like you’re doing. I’m afraid that I can’t offer much more advice on this unless you post a screen shot of your block diagram or the VI itself.

If you want a hardware timed solution, you can use one of your counters as your timing source and retrigger in hardware. There is a shipping example that demonstrates how to do this. In the Example Finder (Help » Find Examples…) browse by task to Hardware Input and Output » DAQmx » Synchronization » Mult-Function » Multi-Function-Ctr Retrigg Pulse Train Generation for AI Sample Clock.vi. Add to this a count event task that counts pulses from the trigger line.

Let me know if you have any questions!

Ryan D.
District Sales Manager for Boston & Northern New England
National Instruments
0 Kudos
Message 6 of 10
(4,670 Views)
Ryan-

Sorry I didn't post my block earlier, I understand it was probably confusing.  It is attached below.

You will notice that I switched from using a single triggered event that ends in a loop and repeats, this is becuase I was missing atleast half the triggers in the sequence.  Because the triggers are very short (10 microseconds) and the time between triggers is also relatively short (60 milliseconds), it was assumed that it was taking the loop too long to execute and restart.

With the new approach, the issue is in counting the number of triggers.  You mentioned adding a count event task, and I believe you mean the CI Cnt Edges instance of the Create Virtual Channel VI.  I am wondering where to add it to the code, and what else I need to do to make it work.  I only started LabVIEW a couple weeks ago, so I am still learning the sequence of things.

Thank you for your continued help
Curtis


0 Kudos
Message 7 of 10
(4,655 Views)

Hi Curtis,

For just starting LabVIEW, your code is impressively clean! Be careful with routing wires behind VIs. That helps a lot!

I’ve attached the VI pictured below. Copy and paste the code in parallel with your existing VIs, but outside of the while loop. This task should only start and stop once during the execution of your program.  Be sure to wire the ‘Source’ terminal of your DAQmx Trigger.vi to the CI.CountEdges.Term property node. Also, make sure that you select a different counter than the one that you’re currently using in your existing code.

This is a modification of the shipping example (Help » Find Examples…) called Count Digital Events. Basically, every time your trigger line is exerted, it will count it.


Have a great weekend!



Message Edited by ryan_d on 11-30-2007 05:49 PM
Ryan D.
District Sales Manager for Boston & Northern New England
National Instruments
Download All
0 Kudos
Message 8 of 10
(4,635 Views)

Ryan-

Thanks for reply.  I added that piece of code in parallel as you said, but I got an error.  When I try to run I get ERROR -50103 DAQmx Start Task.vi:2, specified resource is reserved.  I attached a screenshot and the code, as well as the modified buffer generation I am using.  I am sure it is a wiring issue, so if you could let me know of the correct way to wire it would be great.

Thank you

Curtis

0 Kudos
Message 9 of 10
(4,566 Views)

Hi Curtis,

My mistake! I missed this before: since the counter task is finite, it uses both counters. The counter used for the Count Edges Task is already being used as your analog output clock. This is why you’re getting a resource is reserved error. Unfortunately, this means you need another approach. You could use another device that has a counter and use this code. You could free up your counters for counting edges by using another timing element (AI clock, etc.) and reset the task every time you want to re-trigger. Or you can count your triggers in software as you were trying to do earlier.

Ryan D.
District Sales Manager for Boston & Northern New England
National Instruments
0 Kudos
Message 10 of 10
(4,543 Views)