Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Self-triggering a pause that is externally resumed

Solved!
Go to solution

Hello!

 

I'd like to have an analog output card output the first part of a buffer, and then pause itself until it receives an external trigger to resume outputting the rest of the buffered data.

 

The easiest method, starting a second task and setting up a start trigger for that task, doesn't work because that can take ~15ms, which is too slow - the external trigger frequently occurs in less than that amount of time.

 

It looks like handshake triggers almost achieve what I need, but I don't think it's possible within that framework; I'm not sure though.

 

The only solution I can think of involves having the card trigger its own pause trigger with a regular output, and having the external source also connected to the same pause trigger, with the two signals combined with physical AND gate. It seems like a better solution should exist.

 

I appreciate any pointers!

0 Kudos
Message 1 of 5
(2,664 Views)

I'm not familiar with handshake triggers.  They appear to be specific to a particular family of devices I haven't used.

 

I'm not sure I fully understand the scenario and requirements here.

 

1. Is this meant to be a finite sampling AO task that (eventually) generates every sample defined in its buffer exactly once?

 

2. What kind of sample rate and buffer size are we talking about?  And what DAQ device?

 

3. On what basis does the AO task "pause itself"?  Is it in reaction to an external signal?  Is it a software decision?  Is the pause point known before the task is started?

 

4.  What should be the behavior of the AO signal during the pause?  Many DAQ devices will hold the last output value.

 

5. After this pause, you want an external trigger signal to be able to unpause it to finish the generation task.  Apparently, this external signal may arrive within a few msec of when the task was paused -- thus you can't count on having time to detect that you're at the pause point and then reconfigure a task before the external trigger signal arrives.  You need a hardware-triggered solution.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
0 Kudos
Message 2 of 5
(2,593 Views)

Kevin, thank you so much for the response!

 

1) Yes!

 

2) This is ~ 500K samples from a ~ 1 MS/s device. Specifically, the PXIe-6739, though I'm also experimenting with the PXIe-6124 and this code is intended to be relatively portable across cards.

 

3) It's a pause point known before the pause is started. E.g. I want to output the first 200K samples, then wait for an external signal, then output the remaining 300K.

 

4) It should hold the last output value before the pause, yes.

 

5) Yes, this is correct. At the end of the first (e.g.) 200K samples, I add a rising edge to trigger an external device that takes a variable amount of processing time typically between 1 and 10 milliseconds, and I need to be able to unpause as soon as that external device signals completion.

 

Do you have any ideas as to what the canonical way of implementing this is? I imagine that this is not a unique usecase, but I may be wrong.

 

Thanks again!

0 Kudos
Message 3 of 5
(2,586 Views)
Solution
Accepted by topic author cchan3141

I don't know of a "canonical" implementation.  I keep arriving at approaches that depend on a single external logic OR gate, such as:

 

1. The AO task uses an external sample clock which is the output of the OR gate.

 

2. There are 2 counter finite pulse train tasks whose outputs will go to the OR gate inputs.

 

3. One counter task generates the first 200k pulses that will pass through the OR gate for the AO task to use as a sample clock.  When the pulse train ends, AO will be paused.  (Note: the AO task needs to be started before this first counter task.)

 

4. The other counter task generates the final 300k pulses and is triggered by the signal from the external device.

 

The problem I run into when trying to eliminate the OR gate is that I can't figure out how to make a single counter task do both things.  The first part has to be independent of the external trigger (which won't be present), the second part has to be dependent on it.  Since you don't have enough time to reconfigure, I think that has to be 2 distinct counters.  And *that* means there will be 2 distinct output pins.  So I feel stuck with the OR gate.

 

 

-Kevin P

 

P.S.  The 6739 can do this, the 6124 probably can't due to quantity and capability limits of its older generation of counters.

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
0 Kudos
Message 4 of 5
(2,573 Views)

Hey Kevin!

 

I ended up implementing it with an NOR gate and it does in fact work! 😄

 

- one output from the card itself goes through a NOT and into one input of the NOR, so it sets the NOR output when it goes high

- the output from the external device goes to the other input of the NOR, so it resets the NOR output when it goes high

- the output from the NOR goes into the PFI0 line, which is configured as the pause trigger source for the task

 

There was one hiccup where the 6124 does not support pause triggering the digital outputs, so I'm going to change it so that instead of using a pause trigger I use a counter gate, and I think that should work in the same way; otherwise everything works as expected!

 

Thanks again so much for the detailed help.

0 Kudos
Message 5 of 5
(2,521 Views)