11-18-2009 03:19 PM
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
11-18-2009 03:23 PM
11-18-2009 03:56 PM
11-18-2009 04:25 PM
Thank you for replying. This programme is from a friend, so it is quite difficult for me to understand.
Thank you again.
regards,
11-18-2009 07:08 PM - edited 11-18-2009 07:13 PM
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.