Hello Nimal,
Thank you for contacting National Instruments!
The reason that you are experiencing this problem is because the
Traditional NI-DAQ driver is single-threaded.  Your Cont handshake
input VI has a DIO Read VI inside a while loop with no wait.  When
this VI runs, the DIO Read VI will wait until it has acquired all of
the Scans to Read and then will release the driver to be used by your
position measurement.  The VI will either read the number scans in the
backlog or the number of scans to read.  Since you do not have a wait,
it is likely that the scan backlog is alway nearly zero.  This means
that the DIO Read VI will almost always be waiting for the total
number scans to read before it releases the driver.

You can do a couple things to alleviate this problem.

1.  Place a delay inside your Cont. Handshake input VI's while loop.
This will cause your backlog to grow.  Do not use too large of delay
for your scan backlog will grow out of control and overflow the
buffer.  1 - 10ms should work fine.
2.  The best way to solve this problem is to combine the two VIs into
a single VI.  This way, you can use the error cluster to control when
things execute.  You  can have both sets of code in parallel and then
snake the error cluster from the first set of code to the next.  This
will cause the DIO code to get configured first then the counter code
and then in the loop, you would run the error cluster to the DIO Read
and then to the counter get attribute to read the position.  This
would ensure that both measurements had equal time.

The easiest thing to try is to decrease the scans to read in the Cont
Handshake input and insert a delay in
the while loop.

Let me know if you are successful.

Regards,
Bill B.
Applications Engineer
National Instruments"

Reply via email to