If I understand your concerns correctly, you would like to correct the issue of data "drop-out" i.e. periods of time durring which no data is recorded.
TO help correct this issue I will suggest a slight archtectual change that should help. But first let me interpret what you are trying to do.
For a fixed period of time, you would like to do a continuous acquisition. The acquired data should be ploted versus time. durring acquisition you would like to perform a power spectrum analysis for a user selected channel. All acquired data should be saved to disk.
What you are doing now is;
For a fixed period of time
{
Configure your I/O
Start your I/O
Read 1 seconds worth of data
display the data
extract the selected channel
Do power spectrum
save data to file
check if done with one update
clear the I/O
}
There are a number of things in this proccess that take more time to analyze than collect. THe long steps are causing the drop-outs. I also suspect there may be some errors being returned by the AI read. You may want to check these.
I would suggest using a different program structure. It could be divded into two parts.
1) Collect data loop
2) Analyze and save loop
Collect data loop
This loop should start up a continuous double buffered acquisition (see LV help). These types of acquistions start up and repeatedly perform two operations, a)Check backlog, b)Read backlog. The check backlog is accomplished be read "0" samples using AI read and getting the "backlog" value. This backlog is then wired into a second AI read to accomplish part "b" Read the backlog. Add a wait to this loop to amke sure you do not burn up all of the CPU.
The data read from the second AI read can pass all reading out via a queue. Queues are now pretty fast and will adapt to whatever data type you are using.
Aside from checking if is time to stop, that is all the "Collect data loop" does.
Anayze and save loop
This loop will continually read from queue the same way your exisiting code runs. It will not stop based on time only but whenever all of the data from the has been proccessed.
Your code should adapt to this structural change rather directly.
Create a queue pass it to both loops.
move you I/O stuf to a new loop that stuffs the queue
convert your exisiting loop to read from a queue instead of the I/O.
Done.
Ben