05-23-2022 05:49 AM
Dear all, I have been trying to set up an experiment in which I have to record a number of spectra (at 1 kHZ) on a CCD in synch with the operation of a programmable filter, which is programmed to play a sequence of different waveforms at 1 kHz rate (CCD and programmable filter are both triggered by the same master trigger). I thus have to make sure that the CCD acquisition vi (black vi icon, bottom timed loop) only starts some time after the filter vi (blue/yellow/white vi in the top timed loop). I added a 2000 ms offset which gives time to the filter vi to calculate and upload onto the device all the needed waveforms so that the CCD is being read only when the filter is playing the waveform sequence. Now, when the code gets to the CCD part (at least I am assuming so), despite the filter keeping on playing its waveforms, labview stops responding without showing any error and needs restarting.
Is there something obviously wrong in my code or could it well be a hw problem (as in the PC cannot keep up with both operations at the same time and it freezes? It is a fairly old 64 bit win7 3ish GHz i5 with only 4GB RAM)?
Thanks a lot for your help.
Did not attach the vi as it cannot be run on a pc which is not connected to the CCD and programmable filter hd, but happy to provide it if needed.
05-23-2022 08:26 AM - edited 05-23-2022 08:28 AM
Without analysing fully, the lower timed loop being inside a for loop seems wrong
Why not loop within the Timed loop instead of wrapping it in a for loop?
In addition, the "init" code at the top left has no data dependency with the follow-on sequence, therefore the two will execute in parallel. It seems like the wait defined up there is essentially pointless in this case. I assume you want to force this initialisation before the rest of the code runs.
05-23-2022 08:54 AM
woops, forgot to add a frame in the flat sequence before the timed loops. Here is the fixed version (for loop removed as well)
05-23-2022 09:02 AM
Stop condition for the bottom loop is weird, only loops once
05-23-2022 09:04 AM
that's what it has to do. It is one iteration for a sequence of >350 waveforms, each played 300 times, at 1 kHz.
05-23-2022 09:10 AM
Hmm, OK, seems weird because it was in a for loop earlier.
05-23-2022 09:28 AM
it is the other loop (dealing with the burst acquisition of CCD data) that was in a for loop previously. the CCD subvi has to run multiple times while the filter one only executes once. It is maybe confusing as they swapped places when i used the auto diagram cleanup to make the code look better
05-23-2022 09:57 AM
@g_bress wrote:
it is the other loop (dealing with the burst acquisition of CCD data) that was in a for loop previously. the CCD subvi has to run multiple times while the filter one only executes once. It is maybe confusing as they swapped places when i used the auto diagram cleanup to make the code look better
g_bress,
the loop with 'stop if true' condition and i > 1 will do 3 (three) loop iterations, for i=0; i= 1 and i=2!
If you want the filter to execute only once, you do not even need a loop at all.
05-23-2022 10:25 AM
you are right, I normally try to avoid while loops exactly cos the number of iterations always confuses me. So, for it to only execute once the stop condition should be wired to true if num of iterations is different from zero? Or would that still run twice? I realise it is weird to have a loop only running once, but I need the CCD loop to start after the filter loop by a time offset i can control, and this was the only way of doing so I could come up with.
05-23-2022 11:35 AM
@g_bress wrote:
you are right, I normally try to avoid while loops exactly cos the number of iterations always confuses me. So, for it to only execute once the stop condition should be wired to true if num of iterations is different from zero? Or would that still run twice? I realise it is weird to have a loop only running once, but I need the CCD loop to start after the filter loop by a time offset i can control, and this was the only way of doing so I could come up with.
Well, then just run it once, stuff any output through a Stall dataflow.vim and wire that output to the CCD loop input! Dataflow 101.