10-19-2005 01:38 AM
10-20-2005 03:40 PM
Dear R. Fink,
Managed C++ .NET is not officially supported or documented for the NI-DAQmx driver, so it is understandable that you are running into some frustrations in trying to use it. If you would be open to using C# .NET you could easily find many examples and documentation for the functions, but for the timebeing we can only offer support for unmanaged C++ .NET.
For unmanaged C++ code you may be interested to check out the ANSI C examples provided in the "C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Voltage" folder of your hard drive. Continuous acquisition examples for NI-DAQmx can be found here. If you need managed examples you should look at the C#.NET examples in the "C:\Program Files\National Instruments\MeasurementStudioVS2003\DotNET\Examples\DAQmx\Analog In\Measure Voltage" folder of your local drive.
Have a great day!
Marni S.
10-20-2005 06:05 PM
10-23-2005 02:33 PM
Dear R. Fink,
To lower the CPU usage while reading, set the wait mode on the read to sleep. When the Wait Mode is set to Sleep and a read operation needs to wait, NI-DAQmx tells the operating system to put the read process to sleep for some minimum period of time. The default value for the sleep time is 1 millisecond, but this value can be changed through the Sleep Time property on the DAQmx Read property node. While the process is sleeping, the operating system does not schedule it to use any of the CPU. As soon as the sleep time has expired, NI-DAQmx checks to see if the waiting condition has been met. If the read process is reading a lot of data that is arriving very slowly, then this wait mode vastly reduces the CPU used by the process at the expense of possibly longer latencies caused by putting the process to sleep. However, it should be noted that if data is arriving or space is being made available fast enough such that the NI-DAQmx process does not have to wait for data, then the process will never be put to sleep and no reduction of CPU usage will occur. The function is as follows:
DAQmxSetReadWaitMode(taskHandle, DAQmx_Val_Sleep);
Have a great day!
Marni S.