02-19-2009 02:34 AM - edited 02-19-2009 02:39 AM
Problem:
LabVIEW seems to be overriding a value of 1 to a value of 2 for the Sample Quantity.Sample Per Channel DAQmx Property Node for a Continuous acquisition mode.
Information:
I have a task set up in MAX (version 4.4.0f1).
When I set Samples To Read to 1 the task runs correctly in MAX.
When I read the task in LabVIEW (8.5) the Sample Quantity.Sample Per Channel property node (which is the Samples to Read) is coerced to a value of 2.
If the value is greater or equal to 2 in MAX then the Sample Quantity.Sample Per Channel property node in LabVIEW returns the correct value.
I get the same problem with a real device or a simulated device.
Question:
Is this desired behavior?
Side note:
If N Samples (finite buffer acquisition) is selected Samples To Read cannot be 1 as it causes an error 200077 - it must greater or equal to 2.
But no error occurs when the task is saved as Continuous (continuous buffer acquisition). I don't know if this is related. The error generated is:
Error -200077 occurred at DAQ Assistant
Possible Reason(s):
Measurements: Requested value is not a supported value for this property.
Property: SampQuant.SampPerChan
You Have Requested: 1
Valid Values Begin with: 2
Valid Values End with: 8589934590
Not Expected
Solved! Go to Solution.
02-19-2009 03:57 PM - edited 02-19-2009 04:01 PM
Hi jg code,
When looking at the DAQmx functions, Samples to Read is used as a parameter in two places:
DAQmx reserves the DAQmx Timing Samples to Read value of 1 for HW Timed Single Point, so this is why you see the value coerce up to 2 when reading it back from the property node. When acquiring continuously, the actual buffer size will round up to a higher value based off of the following table, so this should not be a major concern:
When acquiring a finite amount of samples, DAQmx will not coerce the value up to 2 since this would result in different behavior. If you do not want to use a buffer, then you should select HW Timed Single Point for your acquisition. Please let me know if you have any questions about any of this.
-John
02-19-2009 11:05 PM
Thanks John - I will take you up on your offer.
A little info on the project:
1. Client spec has requested that application interfaces with MAX.
2. Client desired sample rate is 0.01 to 100Hz (Ihave to valid the application in that range)
3. Due to the higher end being 100Hz I want to use a Continous Buffered Acquisition as opposed to On Demand, and if the client selects a lower rate e.g. 0.01Hz I still wanted to reuse the same piece of code.
4. Maybe in hindsight I should be switching between On-demand and Continous Buffer based on Client input
5. But I have now implemented logic to choose a Read Value of 1 under certain circumstances.
Now I know - thanks to you - why LabVIEW coreces a value of 1 but...
1. I don't understand why MAX is to be able to collect correctly using Mode: Continuous, Read: 1 sample, Rate: 1Hz
2. Also can I access the non-coerced value from any other property node - e.g. I get a value of 2 but did the client enter 1 or 2? I can't find one.
Regards
JG
Incidently I quickly just tried your suggestion - if I choose HW Timed 1 Point in the task I get the following error:
(I will have more of a play)
Error -200077 occurred at DAQ Assistant
Possible Reason(s):
Measurements: Requested value is not a supportedvalue for this property.
Property: SampQuant.SampMode
You Have Requested: HardwareTimed Single Point
You Can Select: FiniteSamples, Continuous Samples
02-24-2009 06:22 PM
Hi JG,
Keep in mind that Number of Samples (the one associated with DAQmx timing parameters) is not relevant for continuous acquisition. To read one sample at a time, you need to simply specify this in your DAQmx read function. When you configure MAX to read one sample it does this same feature automatically.
You won't be able to get the value from another property node since the value is coerced as soon as the channel is created (the non-coerced value is not stored anywhere by the driver). There should not be a need for this value in your code, if you want to read one sample at a time use the DAQmx read single sample function. The amount of samples per read is not part of the task itself, but is set during runtime as an input to the DAQmx read function.
The error message you are getting indicates that your device does not support HW timed single point--I should have probably asked which device you were using.
02-24-2009 06:45 PM