Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger pulses with delay

Solved!
Go to solution

I am using labview and a NI DAQ (6341). I have attached a VI I am working on. In this VI the DAQ waits for a trigger signal and then creates a burst of two square pulses with each trigger.

 

I need one more addition; how can I instruct the DAQ to wait a prespecified time (a few us to ms) after it receives the trigger and then trigger the pulses?

The delay must be hardware timed for accuracy.

0 Kudos
Message 1 of 14
(4,618 Views)

Hi kmargaris

 

To implement a hardware timed delay, I would suggest using another counter on the NI DAQ. This counter should use set to CO Pulse Time and you could set the high time to set your delay. Use the original trigger, and use an internal clock for timing (also make it retriggerable!)

Set the original counter task to trigger from the falling edge of the 2nd counter.

This should all be compatible with the 6341.

 

I have put an example implementation into your code to demonstrate this and attached it below.

 

If you have any other questions please post them and I'll get back to you

 

 

 

 

Ian S
Applications Engineer CLA
National Instruments UK&Ireland
0 Kudos
Message 2 of 14
(4,607 Views)

Could you save the file as a 2011 version, I haven't upgraded yet to 2012.

0 Kudos
Message 3 of 14
(4,598 Views)

I found a PC with Labview 2012 and converted the file. I tried to make it work, but I couldn't. The file is attached.

 

The input trigger is at PFI13 and is the source for the second counter ctr1. Ctr1 is triggered at the rising edge of PFI13.

Ctr0 will output the two pulses when triggered at the falling edge of Ctr1. Which one will be the source for Ctr0? PFI14? How should I change the wiring connections in the DAQ?

 

Labview also requested to add the sample rate for the second counter. The task in connection for the second counter doesn't seem to have any options, why?

0 Kudos
Message 4 of 14
(4,590 Views)

Hi,

 

Sorry for not sending a 2011 file, glad you managed to get it open!

 

The sample code I attached is not fully functional, just an example of how you could create the task up to the task start.

 

To use a counter output as a trigger, you may need to right click on the trigger source constant or control, and select I/O name filtering, and tick the box "Include Advanced Terminals". This will allow you to choose the counter output, and the internal wiring will reflect this.

 

The sample clock requires a rate, you can just set it to the highest frequency of the counter source (such as 100MHz)

 

To see what PFI the counters terminals are assigned to by default, you can use NI Measurement and Automation Explorer (MAX), find youir device, and click on "device pinouts" in the top bar, this should display a help file with the information. You can change them programmatically using the signal routing functions in the DAQmx/advanced palette, but I don't think you will need to as setting the triggers will mean the internal wiring is done for you.

 

I've attached a new version of the code which should be ok for 2011, where I have included what I have written above. Feel free to get back to me with any more questions or if you need me to clarify anything I have said.

Ian S
Applications Engineer CLA
National Instruments UK&Ireland
0 Kudos
Message 5 of 14
(4,583 Views)

Hi Ian,

 

Thanks for sending the updated file. I have made a few edits, but doesn't seem to work.

PFI15 (not PFI13 as in the file) receives the external trigger (I have verified that with an oscilloscope). The rising edge triggers Counter Ctr1.

 

Ctri1InternalOutput is then used as a source for Ctr0 (falling edge).

From which terminal can I test the output of Ctr1 which is redirected to trigger Ctr0?

0 Kudos
Message 6 of 14
(4,577 Views)

Hi

 

The default pin for Ctr1 Out is PFI 13, if you test this is it should work.

As I mentioned before, you can see what all the default pin numbers are using NI measurement and automation explorer.

I've put links to the help files below so you can take a look (depending on which 6341 you are using).

 

NI USB-6341 - NI-DAQ™mx Help - National Instruments

NI USB-6341 (BNC) - NI-DAQ™mx Help - National Instruments

NI PCIePXIe-6341 - NI-DAQ™mx Help - National Instruments

 

The code looks good for working with your device, you will have to add code after the start task vi to finish it off and close the task etc. It will look similar to your ctr0 task with a loop and clear.

 

Keep me posted if you need anything else.

Ian S
Applications Engineer CLA
National Instruments UK&Ireland
0 Kudos
Message 7 of 14
(4,573 Views)

Hi Ian,

 

I've added the code, but run into a different problem.

I get an error 201025:

Non buffered hardware-timed operations are not supported for this device and channel type

Set the buffer size greater than 0, do not configure continous sample timing, or set sample timing type On demand.

 

What is the solution to this?

 

 

0 Kudos
Message 8 of 14
(4,570 Views)

I think I have managed to find the solution. I have added a DAQmx timing property with On Demand sample timing.

 

I have also added a DAQmx configure input buffer. Is this really necessary?

 

From the oscilloscope readings it seems that all the signals are in sync. Could you confirm that everything is okay with the hardware timing? The input signal at PFI15 would be up to 6000Hz.

0 Kudos
Message 9 of 14
(4,568 Views)
Solution
Accepted by topic author kmargaris

Hi,

 

I've taken another look at the code and have a few answers/suggestions:

 

1) To solve the timing issue, you can use the implicit timing mode. This mode will use the most suitable clock for the pulse generation timing. Set this using the timing vi instead of using sample timing.

 

 implicit.png

2) You don't need the timing property node, as the implicit timing vi sets all the timing you need.

3) You don't need to set the input buffer. The hardware will automatically configure the input buffer to be the size it needs to be.

4) There won't be any problem with a 6000Hz signal, the 6341 is able to sample the PFI ports at up to 1Mhz.

 

It should end up looking like this:implicit.png

This shouldn't produce the timing error you had before, and should all be fine with the hardware.

 

Ian S
Applications Engineer CLA
National Instruments UK&Ireland
0 Kudos
Message 10 of 14
(4,555 Views)