Hi Ralph,
Hope I can help out a little here. First of all, the DAQmx Wait for Next Sample Clock VI is really intended for real-time systems, which a Windows PC is definitely not. Real-time systems can deterministically react to events (such as a sample clock tick) in a bounded amount of time. So if your application is programmed correctly, you can guarantee that you will process a given event within a time period that is bounded and has very little percentage error. You could have your application, for instance, read a voltage value and then output another voltage value depending on that within 100ms.
Windows is not this way at all. A Windows PC may be able to respond within 100ms to a given event
on average, but if Windows wants to launch your antivirus software, that might jump to 3 seconds. Your percentage error in your application is unbounded. This undeterministic nature will be present regardless of how fast your computer is.
So the difficulty is that you're doing HW-Timed Single Point in combination with DAQmx Wait for Next Sample Clock. This means that the DAQmx driver is not allocating any buffer for your acquisition. The read absolutely must occur within the sample rate period or else an error will occur. Windows doesn't handle this situation well. It is much better suited for buffered acquistions. In that case, if your Antivirus software kicks in, no problem, you've got a backlog of acquired samples to process whenever your application gets some time with the processor.
So here's what I suggest:
1. If you're running Windows or Linux or Mac and don't have a real-time system dedicated to your application and nothing else, forget about the HW-Timed Single Point. You can either do a buffered (continuous) acquisition set to run at 1Hz or do 1 Sample On Demand, meaning your application will query your DAQ board for a set of samples every time the DAQ Assistant runs. If you do a continuous acquisition, your reading of the data will still be "real-time." In other words, you are guaranteed that you will acquire data at the sampling rate, because this is being driven by hardware, not software dependent on Windows. Your application is merely responsible for reading these samples out of the buffer.
2. If you do a continuous acquisition with the DAQ Assistant, get rid of the Wait or Wait for Next Ms Multiple functions altogether in the DAQ loop. You don't need them. They are completely redundant and can only hurt. Your DAQmx functions are throttling the loop and allowing other resources to have CPU time. They do this by yielding processor time while they wait for samples to appear in the buffer, which only happens at your determined sample rate. Also get rid of the DAQmx Wait for Next Sample Clock VI, which is only really designed for use on RT platforms. If you are doing 1 Sample On Demand, you will still need the Wait or Wait for Next MS Multiple functions, since DAQmx isn't in charge of the timing.
Message Edited by Jarrod S. on 10-13-2006 03:48 PM
Jarrod S.
National Instruments