question about sequence execution


Gert

Recommended Posts

Hi,

I am using sequences in DaqFactory Express.

I use a auto-start sequence named "StartUp" in which I assign initial values to a number of parameters. Then this sequence start some other sequences. This is working.

My understanding is that all sequences are executed continuously. But if this is true, why isn't the StartUp sequence continuously assigning the intial values over and over again?

Can somebody explane this behaviour?

Gert.

Link to comment
Share on other sites

No, sequences run until they don't have any more statements to exectute. A sequence will only run forever if you have a loop in it. So this sequence:

var.a = 3
var.b = 4
beginseq(myotherseq)

will set a and b and start myotherseq and then stop since it ran out of things to do. However, this sequence:

while (1)
   var.a = 3
   var.b = 4
   beginseq(myotherseq)
endwhile

would repeated set a and b and try to start myotherseq. "while(1)" means loop forever because 1 is the same as true. Since myotherseq is probably already running the second time around, it will not restart it, but instead the second and subsequent execution of beginseq(myotherseq) would probably do nothing. Once myotherseq stopped though some other means, this sequence would restart it.

Please note: you would NEVER want to do the second sequence as it is essentially an infinite loop. If the sequence priority was anything other than 0, you would most likely hang DAQFactory. If it is 0, your graph and image drawing might be sluggish. Instead, you should pretty much always have a delay() inside the loop. The delay typically should be at least 0.01:

while (1)
   var.a = 3
   var.b = 4
   beginseq(myotherseq)
   delay(1)
endwhile

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.