LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help to locate timing problem

Solved!
Go to solution

Hi,

 

If anyone can offer a line of attack for this, I'd really appreciate it.

 

I've attached a screen dump showing the problem. The time delay is selected because the vi stopped when trying to move the stepper motor. This stepper vi runs fine in other parts of the main vi, and runs fine in highlight and single step mode. It even runs fine inside the inner FOR loop at full speed when highlight is switched off, but fails when the vi reaches it when it is called again in the outer while loop.

 

I've tried increasing the delay to 2 seconds, and I've tried using the error line from the inner For loop, but no joy.

 

Any suggestions ?

 

Thank you.

0 Kudos
Message 1 of 10
(2,959 Views)

It looks like you have a bit of a race between your Stepper Move VIs in your inner and outer for loops.

Is the Stepper Move in the outer loop supposed to happen before or after the inner loop?

 

In either case, you need to fix your dataflow.

0 Kudos
Message 2 of 10
(2,954 Views)

Hi,

 

The two loops build a 2D array. The outer loop moves the first stepper motor to its start point, then the inner loop moves the other one 3 times, before the outer moves an increment, etc.

 

Strangely, it’s only the outer loop that has the problem even though I’ve tried to use the same technique as the inner loop which does not have a race problem.

 

I agree, it’s a data flow problem, but there’s no issue when I examine the data flow using highlight or single step.

 

I’m hoping there may be a diagnostic technique I could use ?

 

Thank you

0 Kudos
Message 3 of 10
(2,946 Views)

OK first I will tell you that you should not post .doc or docx document on this forum. That is a big no no and it will get you yelled at. If you want help with your code it is much easier to help if you post the actual code that way we can go through it and see what is going on. I picture has limited help capabilities.

 

If you want to post a picture you need to post a non-proprietary format such as tiff or png

Tim
GHSP
0 Kudos
Message 4 of 10
(2,942 Views)

Oops ! Sorry.

 

Here is the LLB.

 

The problem is in Tune_E1.vi, second frame.

0 Kudos
Message 5 of 10
(2,935 Views)

Run a wire from the error out terminal  of the time delay in the outer for loop to the error in terminal of the stepper move vi in the inner for loop. 

 

JohnCS

Message 6 of 10
(2,928 Views)
Solution
Accepted by topic author Placebo

Brilliant ! Works perfectly, thank you.

 

I'm a bit puzzled why, as the data flow means the outer loop is performed before the inner loop, and adding the wire delays the inner loop and my vi was failing before it got that far. If you have time to offer an explanation, I'd appreciate it, but thanks for the solution anyway.

0 Kudos
Message 7 of 10
(2,903 Views)

Glad it works for you.


@Placebo wrote:

The two loops build a 2D array. The outer loop moves the first stepper motor to its start point, then the inner loop moves the other one 3 times, before the outer moves an increment, etc.


As written, your VI did not act as you expected because there is no data dependency in the nested loops to cause things to happen in the desired order. When the outer loop starts, both the inner loop and the Stepper Move.vi can independently start in parallel and both instances try to take control of the bus. I expect that when you single step or trace, each call to the Stepper Move.vi is able to complete at slightly different times. Adding the connection to the error loop forces the outer call to Stepper Move.vi to complete before the inner loop starts.  The same effect could be achieved by connecting Visa resource name out of the outer call to Visa resource name in of the inner loop.  

 

JohnCS

 

 

 

0 Kudos
Message 8 of 10
(2,887 Views)

That's nice and clear, thank you.

0 Kudos
Message 9 of 10
(2,862 Views)

Good luck on the CLD exam. Smiley Happy

 

Normally one would attribute the solution to the one providing the solution.

 

JohnCS

0 Kudos
Message 10 of 10
(2,845 Views)