Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Algorithm To Automatically Read, Save, Retrigger

What should my algorithm be to do the following?

 

Without any user interaction, the program should wait for a trigger, save the read analog signal to disk, and retrigger.

 

Current algorithm:

  1. Start NI-DAQmx Task (which has a hardware trigger)
  2. Wait (timeout = -1)
  3. If error: Stop, Clear, Exit 
  4. Read (timeout = -1)
  5. If error: Stop, Clear, Exit
  6. Save waveform to disk
  7. Stop
  8. Clear
  9. If no error, repeat

However with this algorithm, there is no way to gracefully exit the program.

 

Suggestions?  (Any language acceptable for code sample responses)

0 Kudos
Message 1 of 2
(2,627 Views)

Hi Steven,

 

The key here is to make your task retriggerable. That way, you only need to start and clear the task once, so you can quit the task easily with a stop button in your while loop. There is a VI example that ships with LabView which should get you started here. To find it, open the Example Finder (Help>>Find Examples) and then once you have it open, navigate to the search tab and search "Retriggerable." An example should come up titled "Acq&Graph Voltage-Int Clk-Retriggerable.vi." If you look at the block diagram here, you can see that a property node is used to make the DAQmx task retriggerable, so that you can trigger your measurement repeatedly. Please post back if you have further questions.

 

Best,

Dan Nelson

Applications Engineer

 

0 Kudos
Message 2 of 2
(2,613 Views)