LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a better way to control the tempo of the program?

I tried two ways to control the tempo of my program.

One is to use the While Loop's counter and a wait. The drawback of this
method is the cycle length is dependent on the measuring load. So if the
program runs for days, it will be significent off the real time.

The other way is to use the difference of the Tick Count. It provides
accurate timing but the problem is the sychronization of the clock cycle
and the While Loop cycle. I can try to put a little bit wait but still
can not sychronize them very well. So after a while, there will be two
measures get together.

I don't know whether there are some better ways to control the program
or whether we have some ways to improve either or both of the
above two
methods to make them work better. Please let me know if you have any
suggestion.

Thank you in advance,

Guangde Wang
0 Kudos
Message 1 of 4
(3,985 Views)
Guangde,

Referring to your 2nd method, use rendezvous (under advanced>>synchronize
on function palette) to synchronize two processes. There are good examples
that come with labview. basically, you create a rendezvous, giving it a
size. Using the wait on rendezvous vi, a function will not continue until
all rendezvous have reached that point. Using this method, you can synchronize
your 2 while loops.

Jared

Guangde Wang wrote:
>I tried two ways to control the tempo of my program.>>One is to use the
While Loop's counter and a wait. The drawback of this>method is the cycle
length is dependent on the measuring load. So if the>program runs for days,
it will be significent off the real time.>>The other way is to use the difference
of the Tick Co
unt. It provides>accurate timing but the problem is the sychronization
of the clock cycle>and the While Loop cycle. I can try to put a little bit
wait but still>can not sychronize them very well. So after a while, there
will be two>measures get together.>>I don't know whether there are some better
ways to control the program>or whether we have some ways to improve either
or both of the above two>methods to make them work better. Please let me
know if you have any>suggestion.>>Thank you in advance,>>Guangde Wang>
0 Kudos
Message 2 of 4
(3,985 Views)
Jared,

Thank you for responding to my posted message. Rendezvous is a new concept to me, maybe
it's the solution to my problem. I have been trying to read the on line manual and
example VIs from National Instruments website. I still have a hard time to understand
the concept.

One of the example I saw is using rendezvous to run some sub VIs. But in my case, I have
only one VI that is a while loop. Inside the while loop, there are a few tasks running
simultaneously. I don't know whether it will serve my purpose.

Guangde Wang

Jared O'Mara wrote:

> Guangde,
>
> Referring to your 2nd method, use rendezvous (under advanced>>synchronize
> on function palette) to synchronize two processes. There are good examples
> that come with labview. basically, you cre
ate a rendezvous, giving it a
> size. Using the wait on rendezvous vi, a function will not continue until
> all rendezvous have reached that point. Using this method, you can synchronize
> your 2 while loops.
>
> Jared
>
> Guangde Wang wrote:
> >I tried two ways to control the tempo of my program.>>One is to use the
> While Loop's counter and a wait. The drawback of this>method is the cycle
> length is dependent on the measuring load. So if the>program runs for days,
> it will be significent off the real time.>>The other way is to use the difference
> of the Tick Count. It provides>accurate timing but the problem is the sychronization
> of the clock cycle>and the While Loop cycle. I can try to put a little bit
> wait but still>can not sychronize them very well. So after a while, there
> will be two>measures get together.>>I don't know whether there are some better
> ways to control the program>or whether we have some ways to improve either
> or both of the above
two>methods to make them work better. Please let me
> know if you have any>suggestion.>>Thank you in advance,>>Guangde Wang>
0 Kudos
Message 4 of 4
(3,985 Views)
The best way to ensure that your vi is running in a deterministic manner is
to use LabVIEW RT (Real Time) with an imbedded Daq board or PXI chassis.
This will allow you to build your application and run it on it's own processor,
independant of Windows issues which completely destroy any reliability with
respect to timing.

Another way to improve the performance is to run it in a higher priority
thread. You can change this in VI properties >> execution options

angde Wang wrote:
>I tried two ways to control the tempo of my program.>>One is to use the
While Loop's counter and a wait. The drawback of this>method is the cycle
length is dependent on the measuring load. So if the>program runs for days,
it will be significent off the real time.>>The other way
is to use the difference
of the Tick Count. It provides>accurate timing but the problem is the sychronization
of the clock cycle>and the While Loop cycle. I can try to put a little bit
wait but still>can not sychronize them very well. So after a while, there
will be two>measures get together.>>I don't know whether there are some better
ways to control the program>or whether we have some ways to improve either
or both of the above two>methods to make them work better. Please let me
know if you have any>suggestion.>>Thank you in advance,>>Guangde Wang>
0 Kudos
Message 3 of 4
(3,984 Views)