Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

sampling period or sampling rate without Timing VI

Hi everyone, 

 

Here is a part of a program from my friend (quite simple), the problem is that there is no Timing VI in both output process and input process (data acquisition process). In this condition, how can I know the  data acquisition period, or the rate at which data points (samples) are being acquired (sampled).

 

 

Thank you very much!

 

Regards

0 Kudos
Message 1 of 5
(3,446 Views)
I  am using Labview 8.5 and DAQ USB-6251
0 Kudos
Message 2 of 5
(3,445 Views)
You have no idea of the sample rate. You are doing software timed I/O and don't even have a Wait (ms) or Delay inside the loop to give you a little bit of control. Even with the timing functions, your loop rate is going to be highly variable because you are not running on a real-time os. There is considerable jitter with windows. You could choose to return a waveform data type from the DAQmx Read so at least you would have a timestamp. If you are at all concerned about sample rate, you should be doing hardware timed I/O.
Message 3 of 5
(3,436 Views)

Thank you for replying.  This programme is from a friend, so it is quite difficult for me to understand.

 

Thank you again.

 

regards,

0 Kudos
Message 4 of 5
(3,432 Views)

Hello Pacino,

 

Dennis is correct about the sample rate.  We typically refer to this as an On-Demand task.  For each loop iteration, the DAQmx Write and DAQmx Read are called.  Each time DAQmx write is called a sample is written to the board to update the analog output read.  For the DAQmx read, each time it is called a sample is read from the analog input. 

 

As Dennis mentioned, when no timing vi such as wait is used to software control the rate of the loop, the loop will execute as fast as at it can.  This rate is depends on quite a few factors including the processor / computer used, other applications running (CPU load), etc.  If you use the DAQmx timing vi, you can specify what rate you would like to update or read from your analog output / input.  

 

My recommendation would be to start from a simple example program.   These can be found by going to Help » Find Examples within LabVIEW.  Once the example finder loads, navigate to Hardware Input and Output » DAQmx » Analog Generation (for analog output examples) or Analog Measurements (for Analog input).

 

These examples also clarify a few things missing from your example.  One is the fact that you are never closing your DAQmx task.  This is done by calling the DAQmx Clear Task.vi at the end of you code.  This clears the resources so they are no longer reserved and you can run a new task on your device.  Another thing missing is proper error handling. This allows the DAQmx driver to handle errors and pass them appropriately through your code.  For example, if you DAQmx device fails, you would want to stop your application and not continue writing to disk.  By passing the error cluster through the vis as shown in the above examples, we can ensure that this happens.

 

If you have anymore questions or if you are having trouble getting started, please post back with what type of application you are trying to complete and I will do my best to help out.

 

Regards,
Paul C.

Message Edited by Paul C. on 11-18-2009 07:13 PM
0 Kudos
Message 5 of 5
(3,423 Views)