LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TTL trigger - Finite samples - Save to Excel

   I need to measure 2 analog voltage channels 300 times at a 50 kHz rate. This measurement cycle will repeat 100 times initiated by a TTL trigger pulse. Ideally, data will be saved to an Excel file. Each channel of data will be on a separate sheet. Each measurement cycle of 300 samples will be in a separate column.

   Since I am new to LabVIEW, I started with the mx example Acq&Graph Voltage-Int Clk-HW Trig Restarts.vi included with the version 8 demo. This example demonstrates how to acquire a finite amount of data using the DAQ device's internal clock, each time an analog trigger condition is met.

 

Changes made to the example vi include:

Analog trigger to Digital trigger - OK

Change While loop to nested For loops to stop the vi after 100 trigger events - Causes 100*300= 30,000 trigger events and

   breaks DAQmx Clear Task.vi

Add 2nd analog input channel - Will not connect wires

Add write to Spreadsheet File.vi - No troubleshooting done yet

 

I have had success learning triggering, finite samples and saving to an Excel file when they are not combined into one vi but have been unable to get them to work together. Thanks in advance to all who reply!
0 Kudos
Message 1 of 2
(2,966 Views)
Hello 2Stroke,

Couple suggestions for you, the way to read multiple channels is DevX/aiY:Z in which X is the device number, Y is the starting analog input channel and Z is the terminal AI channel.  There is a limitation that each A/D can only have one task associated with it, but you can associate multiple channels in each task.

As for the broken wire - you can right-click on the tunnels coming from your for loops and select Disable Indexing, instead of generating a task or error cluster for each loop iteration it will generation only one, the last instance. 

Let me know if you have more questions!

Regards,
Micaela N
National Instruments
Message 2 of 2
(2,952 Views)