From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Generating 2 retriggerable finite pulse trains of different duration using 2 counters

Solved!
Go to solution

Hi,

 

What I want to do is to generate simultaneously 2 retriggerable finite pulse trains using my PCI 6221.

To be more clear please have a look at the attached file. 

The trigger is in /dev/PFI0 for example and I want the 2 pulses in /dev/ctr0 and /dev/ctr1 simultaneously. 

I can easily produce /dev/ctr0 or /dev/ctr1 but never /dev/ctr0 and /dev/ctr1 at the same time.

Does it sound doable what I would like to achive?

 

Thanks a lot.

Adrian

0 Kudos
Message 1 of 6
(4,423 Views)

Hi Adrian,

 

Thank you for your post. I have done some preliminary research into your problem and have found some articles you may find interesting:

 

This relates to the generation of a pulse train using a counter output, the generation of a pulse train requires two counters here:

https://decibel.ni.com/content/docs/DOC-11729

 

Here is an article on the related to theory two frequency measurements in LabVIEW. In this article it can be seen that to perform higher frequency measurements, two counters are required to prevent roll over.

http://www.ni.com/tutorial/7111/en/

 

I hope these are useful to you.

 

Ingram

0 Kudos
Message 2 of 6
(4,390 Views)

Finite (n>1) pulse train generaiton generation requires both counters on the 6221.

 

A couple of options:

 

1.  Use a digital output task to output each of the two lines.  Use a finite counter output (retriggerable) to generate the sample clock for the digital output task.  Uses 2 counters + digital output subsystem.

 

2.  Use ctr0 to generate a single pulse (re)triggered from PFI0.  Connect the ctr0 output to a digital input line.  Configure a digital input task with change detection timing using this line as the sample clock (rising and falling edges).  Use the change detection event to (re)trigger the single (shorter) pulse output on ctr1.  Uses 2 counteres + digital input subsystem.

 

3.  Use different hardware (e.g. X Series cards only use one counter for finite generation and have 4 total counters).

 

 

Best Regards,

John Passiak
Message 3 of 6
(4,383 Views)

Thanks for your replies.

 

I followed John's second option and hurray, I managed to generate the signals I wanted on ctr0 and ctr1. Now, I tried to slightly delay the 2 pulses with respect to PFI0, but it does not look like a trivial task. Can anyone give me an idea how to do it?

I am attaching my (working) vi. Any suggestions highly appreciated.

 

Adrian

0 Kudos
Message 4 of 6
(4,357 Views)
Solution
Accepted by topic author Adrian_Bradu

I couldn't open your VI as I'm using LV 2011 on this computer still.  

 

However, you should just set the initial delay as well as the low time to whatever delay you want with respsect to PFI0 on the ctr0 task.

 

CO_Pulse_InitialDelay.png

 

 

Some other NI DAQ products behave differently, but the 6221 uses "low time" for the initial delay for every retriggered output after the first one.

 

 

Best Regards,

John Passiak
Message 5 of 6
(4,352 Views)

Thanks a lot John! Apparantely it is working! Smiley Happy

 

Initially I was using  DaqmxCreateChannel/CounterOutput/Frequency for both CTR0/1. 

Changed to DaqmxCreateChannel/CounterOutput/Time for CTR0 and I managed to get the result I want!!! 

I'm attaching my vi (LV2011). It may be of use to other people; 

 

Thanks again.

0 Kudos
Message 6 of 6
(4,331 Views)