LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Syncronized Loops not starting

All,
I have process in which I <think> I need to utilized multiple timed loops with synchronization. In one loop,  I am sending a signal low on channel 1, reading a sample on channel 2, and then sending channel 1 high. This repeats every 100ms using a Timed loop.  In the second loop, I am attempting to send out a waveform on channel 3 whose amplitude is updated every 100ms. based on the sample I take in the first loop (using local variables to communicate).
I've attempted to synch the two loops following the shipped example, but what I am finding is that the second loop never starts. The first loop runs immediately and runs as designed. I am not sure if it's the second loop is waiting on something. Perhaps I have my DAQmx tasks setup incorrectly?

(If anyone has a better implementation for variable waveform generation, please let me know that too.)

Any and all help appreciated.

Matthew Pausley
NC State University
Raleigh,NC
0 Kudos
Message 1 of 9
(3,582 Views)
Well, this is very odd indeed. It turns out that your timed loops will start correctly if you add an extra character to the loop names in the string array for the Timed Structures Name input to the VI called Syncronize Timed Structure Start. The reason your first loop starts is that it actually has a carriage return after the name Loop1. You just can't see it because it's not a visible character. If you add a carriage return or any other letter after Loop2 in that string array (for instance Loop2x), then it will start as well. Similarly, if you delete the carriage return after Loop1 in that string array, it will stop starting correctly. I can't reproduce this from scratch, unfortunately, so it's hard to say if this is a bug or not.

Message Edited by Jarrod S. on 09-14-2006 02:56 PM

Jarrod S.
National Instruments
0 Kudos
Message 2 of 9
(3,572 Views)
Disregard that post. The only reason that works is that your loops are no longer in the list of loops to be syncronized, so they just start right away. There is something else going on here.
Jarrod S.
National Instruments
0 Kudos
Message 3 of 9
(3,560 Views)

hi there

here are some tipps from my side:

- create an indicator for the error-output of the timed loops to see the reason of the error
- then there's a third element "loop3" in the string array of the loops, remove this element (and yes, remove the additional EOL character Jarrod has mentioned)
- make sure the loops are running when trying to synchronise them

see attached VI and let us know

 

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 4 of 9
(3,544 Views)
"- make sure the loops are running when trying to synchronise them"
 
ignore this, this was stupid.
Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 5 of 9
(3,541 Views)
I've added indicators to the timed loop errors per Chris's suggestion and I do indeed get an error on the second loop:
"Code -821  <append> Loop3; L1; L2; " This is a timeout error, correct? One of the loops quits because another won't start?

I did have a third loop previously which I removed as part of my troubleshooting (another AI channel). Why it's still coming up in the error confuses me. I deleted the "Timed Loop Structure Names" constant entirely and put down a new one with different names and no CRs.

Any thoughts?

Big thanks for all help to this point!


Matthew Pausley
NC State University
Raleigh,NC
0 Kudos
Message 6 of 9
(3,537 Views)
I've added the delayed synch loop that Chris had in his example. This now allows both loops to start (an improvement!) however they do not appear to be truly synched. For a given second, Loop 2 should run 1000 times and Loop 1 should run 10 times, but its more like 985/9 or 1010/8...just the slightest bit off....
Should I not go by the counter?

Regards,

Message Edited by mepausle on 09-15-2006 12:48 PM

Matthew Pausley
NC State University
Raleigh,NC
0 Kudos
Message 7 of 9
(3,522 Views)
Hi,
looks like a little bug, something about memory initialisation on loop synchonizing start. If you call Synchronize Timed Structure Starts.vi with bad arguments (a name of a loop that does not exist in the loop name array input), the sequencial calls does not work even if the arguments are correct. So anyone who open your VI, run it once to see the issue and the group named "Loops" becomes messed up. To work the named of the group have to be modified.
 
 
cosmin
0 Kudos
Message 8 of 9
(3,504 Views)

hi there

be aware of the priority issue. make sure that not both loops have the same priority (it is impossible to run two loops deterministic at the same time!). you may also think of a phase shift between both loops (take the duty time of one loop as the phase shift for the second one). 

 

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 9 of 9
(3,489 Views)