LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Delay in the DAQ program

Hi,

 

I am have written a DAQ program to trigger a RC servo (works with PWM signal) with encoder angles as the input. I am comparing a theoretical angle with the encoder angle and telling the servo to rotate when that angle is reached. To monitor that the encoder has reached the angle and the servo starts rotating, there are two booleans. Theoretically, both the boolean should switch on at the same time. However, I observe that the boolean for the servo switches on some time later compared to the boolean which detects that the encoder angle has reached. This means that there is a delay between the two operations. Also, I observed that this delay is not consistent across different cases and it varies significantly. I don't want this delay as I want the servo to rotate as soon as the encoder angle is detected. The VI I am using is attached with this post.

 

Can someone please help out on how to correct this delay issue and reduce it? 

 

Thanks

 

Abbishek

0 Kudos
Message 1 of 5
(2,606 Views)

Hi Abbishek,

 

  1. Please share the model of DAQ you're using and a complete connection diagram of how everything is wired up
  2. Please share the VI in the 2016 version, the majority of the forum members do not have LV2020 or higher
Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 5
(2,600 Views)

Hi Santosh,

 

Please find the VI attached in LabVIEW 2016 version.

 

Also, please find the connections made to the DAQ system attached with the mail. I am using USB-6341 DAQ system. The encoder is connected to Counter 0 while the servo connections are made to the Counter 1. The Encoder has 5 cables and they go into pins 96 (+5V), 86 (DGND), 81 (channel A), 85 (channel B) and 83 (Z index). Servo has 3 cables and they go into pins 96 (+5V), 94 (DGND) and 91 (signal).

 

Thank you

 

Abbishek

0 Kudos
Message 3 of 5
(2,587 Views)

Hi Abbishek,

 

it would help to cleanup your blockdiagram to follow the LabVIEW style guide. Really!

See this (partial) cleanup:

 

Atleast the wiring in the blockdiagram is the same kind of "horrible" as is the wiring on the DAQ box. 😄

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(2,552 Views)

Well, there's one very obvious reason for a delay that can vary from 0-25 msec.  Is that what you're chasing?

Kevin_Price_1-1635943246896.png

Your lower loop must wait a minimum of 25 msec between times that it checks the boolean value.  The indicator's local variable will be read at the very beginning of each 25 msec, but the indicator may change *at any unknown time* within a 25 msec interval.  So the time between seeing the changes can easily vary from 0-25 msec due to this alone.

 

Beyond that, I really don't want to spend time interpreting the scrambled mess of code I see until you spend more time cleaning it up.

 

 

-Kevin P

 

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 5 of 5
(2,488 Views)