LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Output a signal every N edges

trigger_counter.png

 

Hi, I have a PCIe-6323 and I want it to generates outputs on two analog outputs, on the Nth falling edge of the input signal. Each analog channel has a pre-defined array of values, and each analog output is the next value in the array.

 

Is this doable? Is there a similar VI that I can start with?

 

 

0 Kudos
Message 1 of 8
(3,099 Views)

Sure.  You've provided no code of your own, so it is difficult to guess what level of LabVIEW Experience you have, what you may or may not know about DAQmx, what version of LabVIEW you are using, etc.  

 

Your device has Counter/Timers that can detect edges (and I presume you know how to make something that can "Count to N in a cyclic manner", meaning it repeats when it gets to N).  Have you thought (not in LabVIEW, but in "Pencil and Paper") what your various Tasks should be?  Whether you have, perhaps, independent tasks?  Do you know about using Data Flow to manage simultaneously-executing independent Tasks (a.k.a. Parallel Execution)?  Have you heard about the Producer/Consumer Design Pattern?

 

Bob Schor

0 Kudos
Message 2 of 8
(3,091 Views)

This is a starting point which assumes that the external camera flash signal is digital TTL (and thus usable as an external clock.)   The basic idea is to treat that signal as a "timebase" signal and configure the AO task to divide it down into a sample clock.

 

It ran as shown without error on a 6341 device.

 

 

-Kevin P

 

external timebase AO.png

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 3 of 8
(3,054 Views)

I have created couple NI programs running on this PCIe-6323 board a while ago using NI-DAQmx in C. I wanted to switch to VI and see if that'd make things easier since there seems to be more discussions and resources around. LabView 2015 is installed, but I can get 2016 if needed.

 

I am not very familiar with the "task" concept in NI. The two analog outputs have independent output values, but their timings are the same, so I should create one task of two outputs?

 

To my understanding, in the producer/consumer design pattern, there is a queue/buffer in the middle, and producer'd focus on putting jobs into the queue and consumer'd take jobs out of the queue, and they work independently in terms of timings.

 

I have no experience with LabView and don't know what component are there and how flexible they are. But from a very high level point of view, I will have three main components, camera signal, counter, and counter output. Camera signal is the input to the counter. The counter is a N cyclic counter as you mentioned. Each time a falling edge comes in, the counter increases. When it reaches N, it'd send outputs signals (two in my case) and reset counter back to 1. I need to configure those output values so they are from a pre-determined array.

 

0 Kudos
Message 4 of 8
(3,051 Views)

Thanks Kevin! I'll start from your design.

0 Kudos
Message 5 of 8
(3,050 Views)

Here's the same snippet after saving back to LV 2013, same functions but easier to work with from LV 2015:

 

 

-Kevin P

 

external timebase AO.png

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 6 of 8
(3,042 Views)

Kevin, your example helps a lot.

 

You use a "Divisor" to determine the actually frequency of the master clock, and all the outputs follow it.

Now I have an additional AO channel for output and I want it to synchronize with the master clock too but two times slower, that's output on every 2nd rising/falling edge. Is there a way to do that?

0 Kudos
Message 7 of 8
(2,971 Views)

1.  No*, but...

2. You can just add that other AO channel to the same task and generate 2 samples of every output value at the 2x higher rate.  It'll have the same effect.

 

 

-Kevin P

 

*Most (if not all?) NI multifunction DAQ boards only allow one hardware-timed task for the entire AO subsystem.  You can't clock out two different channels at two different rates with two separate tasks.  You have to put all the channels into one task and define appropriate "oversampling" for the slower-changing channels.

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 8 of 8
(2,941 Views)