08-17-2005 03:56 AM
08-17-2005 04:42 AM
08-17-2005 05:32 AM
Dos the wait-time start when the loop becomes active
Doesn’t the code in the while loop execute when the wait until next ms multiple function executes
Is it necessarily to initialize the wait timer for every while loop or only for time critical loops like on page 4-6 of the real-time course manual
08-17-2005 06:45 AM
08-17-2005 11:42 AM
08-17-2005 12:03 PM
The fact that I chose Lucy as my current avatar should not disclose my gender any more than Sam, Max, Escher or Guybrush Threepwood (some former avatars).
That fact is currently being kept undisclosed to help keep Ben, Altenbach and CC on their toes, so they avoid making assumptions (plus, it's more fun that way).
08-17-2005 12:40 PM
If the code in de loop executes at the same time as the wait function I don"t understand this example form the NI-site Who can clarify me this? | |
Using Wait Until Next ms Multiple to Time a Loop in Time Critical Priority |
Figure 1: Desired timing of control system
Our first attempt to solve this problem is a simple loop with Wait Until Next ms Multiple (see Figure 2).
Figure 2: First attempt at timed loop
In this first attempt, we do not dictate when in the sequence the Wait Until Next ms Multiple executes. The behavior of this loop will differ depending on when the Wait Until Next ms Multiple gets executed. If the Wait Until Next ms Multiple executes first, then the analog input will be followed immediately by the analog output. This behavior is usually desired, but is not guaranteed in the example above.
If the Wait Until Next ms Multiple executes immediately after the analog input, then the analog output will not be able to execute until the Wait Until Next ms Multiple is finished. Again, this is because when any portion of a time critical priority VI sleeps, the entire thread sleeps. The resulting timing would be as shown below, in Figure 3. This behavior is usually not desired.
Figure 3: Wait statement executes after AI
08-17-2005 01:40 PM
I think what you may not understand is the dataflow concept which is at the base of LabVIEW.
In one sentence, it can be declared as (in my words)
A piece of code will only execute when all of its input are available.
This means that if you have pieces of code which aren't connected to each other by wire you have no control regarding when they will execute and the code in the rest of the loop could (and almost certainly would) be executed at the same the wait VI is executed.
So, if you put a wait VI in a loop with other code without forcing the timing, you can't know when the wait VI will execute.
The wait VI does something simple - it waits until the ms multiple and then it finishes, so the point in the code you saw in the example is to use a sequence structure to get the VI to wait at the right time.
It sounds like you should worry about LV basics and not about real time coding, which is a more advanced subject and requires that you have LV RT and a real time target.
Also, next time just include a link to the page you want us to see. The images weren't copied and it's very hard to understand this way.
To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).