03-26-2021 01:18 PM
Hi everybody.
I have written a LV code for switching on and off a group of six lasers and record their intensity output every n seconds for 24 hrs.
It works quite well but after a certain number of iterations the recording/switching operation gets out of sync.
Might anybody help me out with that?
Solved! Go to Solution.
03-26-2021 01:37 PM - edited 03-26-2021 01:45 PM
Hi nicop,
@nicop92 wrote:
It works quite well but after a certain number of iterations the recording/switching operation gets out of sync.
Might anybody help me out with that?
This is because you use a hardware-timed DAQmx task and an additional Wait in your loop. Delete this Wait function!
Btw. you do some serious Rube-Goldberg code in your VI! You REALLY should cleanup that monster!
Example:

Those offset values should be provided as an array instead of 4 scalar values…
03-26-2021 01:43 PM
Hi Gerd.
Thank you very much for your reply!
Are you referring to the wait function I have highlighted in the attachment?
Cheers
PS: yes, it's quite intricate. I'm trying to simplify it as much as possible
03-26-2021 01:47 PM - edited 03-26-2021 01:50 PM
Yes!
When you set a timing in your DAQmx task then you just request a fixed amount of samples at DAQmxRead, which also sets the iteration time of your loop! (Simple math of samplerate*number of samples…)
Btw. don't forget to delete that additional wait function in the case structure, where you write the data to a file, too!
03-26-2021 01:54 PM
Thank you very much Gerd.
Just one more question:
If I remove the the wait function you pointed out in the
beginning the data acquisition gets too fast (I cannot see a thing on waveform charts).
Could you please advise?
03-26-2021 02:01 PM
Sorry Gerd!
Your last message notification got visualised in delay.
You're right: just set the samples number in the write functionality.
Cheers