LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Wait for Next Sample Clock error, or 'How do I put this VI on a diet'?

Hello!
 
In the attached VI I've been running since June, I have all the functionality I need.  No questions there at all, thanks to much time and help from this board! 🙂
 
My nagging problem is that any time I use the PC for other minor tasks other than Labview, it will display the following error:
 
209802 occurred at DAQmx Wait For Next Sample Clock.vi:1
 
A search earlier in the month indicated that it could have been a result of my old and outdated PC; I've since replaced it with a brand-new dell dimension 1100.  Celeron 2.53ghz with 1.00gb of ram.  Should be enough to service Labview and other minor tasks (automatic antivirus updating and also maintenance tasks).  However, any time any other program opens or even if the screen is scrolled around on Labview quickly, I get that same error.
 
Resource usage when idle, with nothing but this VI running is 5-10%, all labview.  Upon scrolling the VI, it quickly jumps to the 58-60% and above mark and soon throws that error.
 
I know that there's a lot of code here that can be cleaner--I know that even though it's functioning correctly, there could be a less resource-hogging way to go about it.  Can anyone give me any suggestions on how to make this VI a little 'lighter'?
 
Thanks so much in advance,
 
Ralph
___________________________________________________________________
Still confused after 8 years.
0 Kudos
Message 1 of 18
(3,916 Views)
Repeat, I've actually searched for help on the sample clock issue to no avail--I'm not just posting this out of turn--any advice would be appreciated--thank you...
___________________________________________________________________
Still confused after 8 years.
0 Kudos
Message 2 of 18
(3,892 Views)

Hi Ralph

              I just looked your VI and it seems that you can improve your timing. Instead of using the "WAIT VI"

try the "wait until next ms VI" this VI , in my opinion, is the best way to release computer resources.

Try to change this and tell me your results.

I hope that you can run your application very soon

Smiley Happy

 

Erwin Franz

Certified LabVIEW Architect, Certified TestStand Developer
0 Kudos
Message 3 of 18
(3,886 Views)
Thanks Franz, I'll do that later in the day...  I need to find a time when the test can be paused.
 
Much appreciated!
 
PS, will that wait for next ms VI still use the delay value of 500 that I currently have wired?
___________________________________________________________________
Still confused after 8 years.
0 Kudos
Message 4 of 18
(3,878 Views)
Hi Ralph,

The wait.vi waits until the amount of time has passed. While the wait on next ms.vi uses some kind of quotient and remainder on the computer time until the remainder passed zero.

In this way you can synchronize 2 loops, and somehow it is less time-consuming. The only difference you will see is in the first run!
There you see a smaller amount of time:



Message Edited by TonP on 10-04-2006 04:21 PM

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 5 of 18
(3,874 Views)

I do not have the time to do a detailed analysis of the code, but I can drop a hint to let others run.

The observation that "moving the screen around" causes a problem COULD indicate an issue with the UI thread, so make sure screen updates are not in any DAQ loop.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 18
(3,867 Views)
Ralph,

Thanks for contacting National Instruments.  It's good that you have things working, and yeah the code is a bit unkept, but that's development right!  As far as methods to free up resources.  There are some structures that are more efficient for watching for errors.  Such as Event structures that poll whether a control or some other item changes it's value.  This one structure could completly replace your while loops.  You would just have different events based on the value change of one of your indicators.  This is more efficient than while loops and local variables. 

That's all I can see at first glance, I would start there and see what results you get.

Regards,
Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 7 of 18
(3,857 Views)

Using the 'wait for next ms' vi helped a lot!

One thing that doesn't make sense to me, though.  While I was in the process of changing all my 'wait' VI's to 'next ms' VI's, I also increased the timer values, figuring if I slowed the whole process down enough that it would also help.

Boy, was I ever wrong!  I had it where it was only sampling every 4 sec, and the timers were marking off 8 sec intervals, and it had the previous 'missed sample clock' error every time I turned around!  Speeding it back up eased it...  I don't understand that one, can anyone help?  Do I have my DAQ assistant setting for acquisition wrong?

 

Thanks again, so much.

Ralph

PS Kenn...  I'm intrigued by your post.  Can you shed a bit more light on some of the detail of which you speak regarding event structures and polling?

___________________________________________________________________
Still confused after 8 years.
0 Kudos
Message 8 of 18
(3,837 Views)
Ralph,

Glad to hear you are making some progress.  I have attached a vi with an even structure setup to listen for value changes on the booleans you are watching in your while loops with local variables.  As a rule of thumb you only want to use local variables if you absolutely have to.  Right-click on the edge of the event structure loop to see the different settings for each case.

Regards,

Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 9 of 18
(3,831 Views)
I've used the local variables with my event structures outside the loop...  I kinda get that concept (this VI was complete on June 30th--I'd never even seen labview a month beforehand so it's pretty hacked together) and would love to see your attachment...
 
...but I don't see the attachment! 🙂
___________________________________________________________________
Still confused after 8 years.
0 Kudos
Message 10 of 18
(3,828 Views)