LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

timed loop issues

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. 

 

timed_loops_camera_AOPDF.JPG

 

0 Kudos
Message 1 of 19
(2,014 Views)

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.

Message 2 of 19
(1,982 Views)

woops, forgot to add a frame in the flat sequence before the timed loops. Here is the fixed version (for loop removed as well)

timed_loops_camera_AOPDF_2.JPG

 

0 Kudos
Message 3 of 19
(1,967 Views)

Stop condition for the bottom loop is weird, only loops once

0 Kudos
Message 4 of 19
(1,959 Views)

that's what it has to do. It is one iteration for a sequence of >350 waveforms, each played 300 times, at 1 kHz.

0 Kudos
Message 5 of 19
(1,954 Views)

Hmm, OK, seems weird because it was in a for loop earlier.

0 Kudos
Message 6 of 19
(1,951 Views)

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

0 Kudos
Message 7 of 19
(1,937 Views)

@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.

0 Kudos
Message 8 of 19
(1,926 Views)

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.

0 Kudos
Message 9 of 19
(1,913 Views)

@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.


"Should be" isn't "Is" -Jay
Message 10 of 19
(1,902 Views)