Hello Chauhan,
I have reviewed the code you posted and from what I can determine you are performing the following steps:
1. Wait until "Acceleration time" is reached
2. Create an N dimensional array where:
N=(Distance of constant motion / Data Distance)
and
Array[N] = Distance of acc motion + (N x Distance of constant motion / (Distance of constant motion / Data Distance))
3. Acquire a sample every (Data Distance / Velocity) seconds until
(Distance of constant motion / Data Distance) samples have been
acquired.
Does this accurately represent the steps you are trying to
accomplish? It important thing to keep in mind that steps 1 and 2 above
will execute in parallel. Since the top For Loop in your program does
not have any Error wires as input tunnels, it will execute as soon as
it receives all its inputs. Since both of the inputs come from
Controls, this information will be available immediately and the loop
will begin right away. This paradigm will hold true for the While Loop
as well; since the data into this loop is immediately available, it
will execute immediately. However, the For Loop that contains the
acquisition must wait for the Error cluster out of the While Loop
before it begins execution. If this is not the desired order of
execution, I would recommend that you use the Error clusters to
determine program control, as you have with the While Loop and the
acquisition For Loop.
Other than the above points, I do not see any glaring problems that
would lead to the delay you described. However, data_acq.vi contains a
sub-VI (SMC_GetPos.vi) that was not included, so I could not tell what
it does.
One thing you may want to consider is the pattern of the delay you are noticing. For example:
1. Does it occur on every direction change or only when going from positive x to negative x?
2. Does the delay get worse as the laser moves across the surface? That
is, does the delay get longer the further the laser travels in the x
direction?
3. Does the delay get worse as the laser moves up the surface? That is,
does the delay get longer the further the laser travels in the y
direction?
If the issue is with your program, this information will help determine where exactly the problem is occurring. I hope this information is helpful.
Matt Anderson
Hardware Services Marketing Manager
National Instruments