04-30-2012 07:52 AM
I am sure there is a simple programming answer to this but I am drawing a blank. I would like to slow down my sample rate in the following block diagram, however changing the sample rate at my Sample Clock seems to have no effect. Any ideas? Thanks in advance for your help
Solved! Go to Solution.
04-30-2012 09:11 AM
Since you are using the 1Chan 1Samp mode of the DAQmx Read, you are not using the sample clock. Your acquisition is software timed by the loop rate and your loop does not appear to have any timing at all.
p.s. If you want to attach an image, at least post it as a snippet (look it up). Hard to debug an image - especially one as hard to read as yours.
04-30-2012 09:21 AM
Thanks Dennis,
I will look up snippets for the next time.
I knew that I was missing an obvious mistake. This VI runs fine, so should I remove all the "Sync timing" and just use the loop for my control?
04-30-2012 09:55 AM
Depends on what you want to do. The software timing is subject to a great deal of jitter so you can't depend on a constant time between samples. If you deploy this VI to a different computer/os, you may get far less or far more samples. for that matter, you might get far more or far fewer on this computer depending on what is going on in the background.
04-30-2012 10:12 AM
Thanks Dennis,
This is for a very slow event and I cant see a need to sample above 100Hz. Based on your explanation, I think I may be okay in this instance. What is the best practice for loop timing control?
04-30-2012 11:33 AM
@griff32 wrote:
Thanks Dennis,
What is the best practice for loop timing control?
How about a Timed Loop? It's one of the main structures. You can also just drop the Wait.vi (Timing Palette) in your current loop.
04-30-2012 12:52 PM - edited 04-30-2012 12:54 PM
@NIquist wrote:
How about a Timed Loop? It's one of the main structures. You can also just drop the Wait.vi (Timing Palette) in your current loop.
I recommend the Wait (ms) function over a timed loop unless you specifically need the timed loop behavior. I just learned today (looking up something related to a different thread): "Each timed structure on the block diagram creates and runs in its own execution system that contains a single thread, so no parallel tasks can occur." In a regular while loop, tasks can run in parallel.
05-01-2012 07:17 AM
The best practice is to use your hardware for timining. Unless you are using an FPGA or (maybe) LabVIEW RT, your loop timing will be subject to the vagaries of the operating system, and these can be pretty bad (e.g. one or two second stall as the disk recalibrates or e-mail arrives). I would highly recommend using a continuous timed acquisition on your DAQ board. Fetch as often as you need to (every 10 or 100 points, for example). The buffer size should be long enough to avoid OS problems.
05-01-2012 07:31 AM
Thanks Everyone for the help. I am going to change my code to use the best practice, which both Dennis and DFGray suggested and use the Hardware for my timing.