From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timed Loop runs only once with pulse train?

Solved!
Go to solution

Attached is a VI that attempts to drive a timed loop with a NI 6608 card pulse train.  My timed loop never appears to run more than one cycle.  No errors are reported.  I suspect it is because I am not setting up correctly with NI-DAQ.  Any help would be most appreciated.


WB

0 Kudos
Message 1 of 13
(3,399 Views)
It looks to me that you are not sending it a corrent name for the timming source. If you disconnect the source name the loop run fine. I would look into the counter name that you are trying to use and make sure that you are calling it correctly.
Tim
GHSP
0 Kudos
Message 2 of 13
(3,377 Views)
I tried removing the name input with no change.  Attached is a later version of the same VI that demonstrates how the code DOES work when using a LabVIEW event structure.  Still no luck with the timed loop version.  I am beginning to wonder if I am not chasing a bug in LabVIEW RT.  LabVIEW is acting like I need to restart something to get another tick of the timed loop. 
0 Kudos
Message 3 of 13
(3,356 Views)

Your loop doesn't "tick once and hang" it loops forever. You have a false constant wired to "stop if true" thus it'll run forever. You wont get any error out since you wire it to ... nothing.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 13
(3,354 Views)

Perhaps I do not understand the timed loop.  I wire false to the stop icon to allow the loop to tick again on the next timed loop source tick.  To wire true to the stop icon, would stop the loop after the first tick.  Is this not how the timed loop works?

 

Thanks for looking at this.

 

WB

0 Kudos
Message 5 of 13
(3,350 Views)

Yes, wiring false will allow the loop to continue to run. Forever. 🙂

Use the Highlight execution (the light bulb in toolbar) to see how your program works, i'm pretty sure it'll get to the loop and stay there. You can also remember the values in wires (the bulb beside it) to see what's really being sent. Since you dont feed the output node the error it'll just "vanish".

 

(I looked at the vi at home yesterday) If memory serves the loop itself did absolutely nothing, just wait.

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 13
(3,337 Views)

I have confirmed the failure using the debugger on many occasions.  The timed loop "i" counter never rises above zero.  The error line never shows an error.  The loop ticks once (setting "i" to zero and the error to "no error") and suspends.  Any code following the timed loop (not shown in the attachment), does not execute.

 

I believe the problem is a misunderstanding about NI-DAQ counters and generating signals.  The first signal gets through, after the requested 1 second delay, and all others are suppressed.

 

WB

 

0 Kudos
Message 7 of 13
(3,329 Views)

Hi WB,

 

Would it be possible to post a screenshot with highlight execution enabled, showing the loop state in the block diagram?

 

Have you also verified that the Timed Loop inherently invokes the DAQmx Task by directly measuring the counter output?

 

Though the documentation explicitly states that the Timed structure will enable the task, the behavior you describe seems to indicate that the timed structure is waiting on an active clock signal. The event case behaves as expected by virtue of the DAQmx Task beginning. 

 

Also, could you also post your version of LabVIEW, and the hardware used for this application; such that, we may do additional testing if necessary?

 

Thanks,

Patrick Corcoran
Application Engineering Specialist | Control
National Instruments

0 Kudos
Message 8 of 13
(3,293 Views)

I am running LabVIEW 2009 SP1 with the LabVIEW RT module (SP1).  I am running DAQmx 9.0.2.  I am using a PXI 1042Q chassis with a NI 6608 card installed in slot 2.

 

Thus far I have not been able to read the counter output using either the event structure or the timed loop.  I agree with you that the timed loop appears to be waiting on an active clock signal.  Please note the timed loop does execute once (confirmed with the debugger).

 

Execution highlight is attached.

 

Thanks.

 

 

0 Kudos
Message 9 of 13
(3,286 Views)
Solution
Accepted by topic author ww.brown

Hi Wb,

 

Taking a closer look at the Timed Loop, I can see that the period dt value is set to 1000. This period is scaled based on the units of the timing source. In this case, the clock contains 0.5 second pulses. Altering the dt to a value of 2 allowed me to see the timed structure iterate as expected. See the image below for further detail:

 

TimedLoop.jpg

 

Hope this helps. Let me know if this does not behave that same way on your system.

 

Cheers!

Patrick Corcoran
Application Engineering Specialist | Control
National Instruments

0 Kudos
Message 10 of 13
(3,277 Views)