From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to re-trigger analog acquisition?

I hope 're-trigger' is the correct term for this..

 

I have a pulse train that, on falling edge, triggers analog acquisition.

The issue I am having is that once I press 'relay power' the second time, no data is acquired. The trigger seems to work only the first time.

What am I missing? I am using a PCI-6035E board.

 

The DAQmx Property  - Retriggerable gives me an error, I understand my board does not support that..

 

Code below:

 

code1.PNGcode2.PNG

0 Kudos
Message 1 of 30
(3,119 Views)

First, move the initialization to before the interface loop.

 

Have Relay Power event stop the task (just in case it was still running) and start it. It will remember its other settings.

 

That should handle the main issue.  But also...

 

Put a small delay in your interface loop so it doesn't hog the system.

 

Move the Delay (s) down to where its local variable is read, and get rid of the local variable.

 

Avoid having wires move data to the left unless using a feedback node (you aren't).

 

There are some other things I'd change, but those are what jumped out at me.

0 Kudos
Message 2 of 30
(3,103 Views)

Hm well, ideally, relay power just starts the whole process, which repeats, until user presses relay power to turn it off.

 

What I have not implemented yet is a 'Injection Mode' toggle, which would be either single (1 pulse train, acquire/log, stop) and the relay power button goes off, and a continuous, which does all what I mentioned until the user presses relay power to stop everything.

 

How would I get the "relay power" button to start the task and stop it?

0 Kudos
Message 3 of 30
(3,095 Views)

In that case what you want is a loop that monitors the task with "task done?" and if it's done, starts it over again. Give this one a short timeout if triggers occur often.

0 Kudos
Message 4 of 30
(3,084 Views)
You've got a continuous acquisition that starts when triggered. There is nothing that stops the acquisition except some confusing code in the acquisition loop. Please clean up the wiring. Please show the rest of the loop as well.
0 Kudos
Message 5 of 30
(3,072 Views)

What I want to happen is that the acqusition stops when N samples have been acquired.

 

Example: Delay is set to 1000ms. The acquisition loops stops when 1000 samples have been acquired.

0 Kudos
Message 6 of 30
(3,050 Views)

Rest of the loop. The 'task is done?' does not work, Guess the task never finishes?

Currently the initialization of the task and Start Task occur outside of the loop, as soon as the program is run. I need the task to start only when 'relay power' is pressed.

 

I also am not sure how the best way to go about stopping all of the loops when all is completed, I am thinking I create a local variable for the 'quit' button and link up all the while loops to stop when that is True.

 

loop1.PNG

0 Kudos
Message 7 of 30
(3,035 Views)

Do I want 'continuous' or 'finite' acquisition?

 

Depending on what the 'delay' is, I know how many samples to expect.

 

I guess I still need continuous since I want to gather 100 at a time, up until the expected amount is met?

0 Kudos
Message 8 of 30
(3,029 Views)
You still have not cleaned up that wiring mess!

You can use finite samples with a single read - no loop. Depends on how many samples you want and your rate. At a 1000 samples/second, requesting 1000 samples will require exactly 1 second with a single DAQmx Read.

I also don't understand why you have a front panel Boolean to generate a counter output to generate a leading edge trigger when you could use the front panel Boolean to start the acquisition.
0 Kudos
Message 9 of 30
(3,023 Views)

Dennis, the front panel boolean starts the pulse train, the acquisition is supposed to be dependent on the pulse train.

On falling edge of the pulse, acquisition starts.

 

0 Kudos
Message 10 of 30
(3,009 Views)