10-13-2005 03:16 PM
10-14-2005 05:34 PM
10-17-2005 03:45 AM
Hi and thanks for taking the time to reply. In CPU terms there's no such thing as "not much to do", a thread is either 'waiting' for something, in which case it is treated as 'not ready', or it is 'doing' something, in which case it will be treated as 'ready' and scheduled to execute by the Windows Scheduler. If it's not 'waiting' then it's 'doing' and therefore should not allow the System Idle thread any time on the CPU. It's the same reason why a CVI app will take ~100% of the CPU if the sleep policy of RunUserInterace() is set to 'never sleep' - it hasn't got much to do in a useful sense if there are few events to process, but it is 'doing' something in the sense that it continually checks for events without 'waiting' in between. I therefore don't think your reply answers my question and I throw it open to others.
Thanks
Jamie Fraser
10-17-2005 04:40 AM
10-17-2005 06:09 AM
10-17-2005 08:49 AM
Hi Jamie
If you look at the help for the function you are calling DAQmxReadCounterScalarU32, then you'll see that the 'timeout' parameter specifies how the function performs. If you set this to -1 (its default) then the function will wait until the specified number of samples are available before returning a result. This could be causing your delays.
**************************************************************************************************************************************************************************************************
int32 DAQmxReadCounterScalarU32 (TaskHandle taskHandle, float64 timeout, uInt32 *value, bool32 *reserved);
Reads a 32-bit integer sample from a counter task. Use this function when the counter sample is returned unscaled, such as for edge counting.
Input | ||
Name | Type | Description |
---|---|---|
taskHandle | TaskHandle | The task to read the sample from. |
timeout | float64 | The amount of time, in seconds, to wait for the function to read the sample(s). The default value is 10.0 seconds. To specify an infinite wait, pass -1 (DAQmx_Val_WaitInfinitely). This function returns an error if the timeout elapses. A value of 0 indicates to try once to read the requested samples. If all the requested samples are read, the function is successful. Otherwise, the function returns a timeout error and returns the samples that were actually read. |
reserved | Reserved for future use. Pass NULL to this parameter. | |
Output | ||
Name | Type | Description |
value | The sample read from the task. |
Name | Type | Description |
---|---|---|
status | int32 | The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error. |
**********************************************************************************************************************************************************************************************
Make sure you check how you have programmed this part of your application, like JPL6 said, it could be something in a library call.
Regards
Hannah
NIUK & Ireland
10-17-2005 10:50 AM
Hi Hannah,
Thanks for your response. I did try changing the time out value from 10.0 to 0 but it didn't make any difference to what I am seeing in terms of CPU loading.
I think now that perhaps it is the USB latency that is the limiting factor but would like confirmation from someone with detailed knowledge of the CVI ADE and DAQmx (perhaps one of the CVI ADE programmers?). Does my call to DAQmxReadCounterScalarU32 () block if NI-DAQmx has initiated a USB poll and is waiting for a response? This could well explain what I am seeing. My laptop only has USB 1.1 and I know that USB 2.0 is better as far as latency is concerned, but I would like to know if this is indeed the reason for what I am seeing before trying to get hold of a laptop that has USB 2.0
All help much appreciated.
Jamie Fraser
10-18-2005 02:57 PM