Academic Hardware Products (myDAQ, myRIO)

cancel
Showing results for 
Search instead for 
Did you mean: 

Requesting help with timing of data acquisition

The part of the code that I need help with consists of two main sections. The two sections are inside the same frame of a flat sequence structure. The bottom part is responsible for creating a pulse from NI-9263. 

The top part starts data acqusition for Voltage and temperature. The current set up causes the data acquisition to start simultaneously with the Pulse creation. I want to add a delay between the time when the pulse first starts and when data acquisition begins. For example, if I create a pulse for 150 seconds, I want to start the data acquisition at 100seconds so I will be taking data for 50 seconds instead of 150.  Any suggestions on how to time the data acqusition? 

 

Here's a list of the National instruments hardware  at my disposal: 

 

1. c-DAQ 9174

2. NI-9205

3. NI-9211

4. NI-9263

 

Please check the attached file for more information. 

Thanks!

Download All
0 Kudos
Message 1 of 2
(5,376 Views)

Hello Joe,

 

The main issue that you will encounter is that you are acquiring all at once with the DAQmx Read and so can not control it once it is started. You are effectively setting up the hardware to perform an operation.  I have two possible solutions for your project. The first is the easiest to implement and will give you the best data. The second is a bit more flexable but would require changing the program fairly drastically.

 

The first, is leave the code as it is, except for how you write the code to the file. The Sample Rate and the Samples per Loop control the ammount of time that the Read will run and so you know how many samples per second. You can then subset your Double Array using the ammount of samples that would occur in the 100 seconds. Then you would only write the subset of the data to your file.

 

The second, is change your program to use Continuous Samples and use the Elapsed Time VI to determine when the 100 seconds has elapsed. You would have to place your Read into a While loop and you would read in smaller chunks at a regular interval. The exact timing would not be perfect but you could also see the data as you go. In addition you would also have to manually stop the acquisition or use an Elapsed Time VI to stop it after a certain time interval. 

 

I highly recommend that you try the First option and see if it suits your needs. Have a great day.

 

Alex D
Systems Engineer
Academic Research
National Instruments
0 Kudos
Message 2 of 2
(5,352 Views)