01-24-2007 12:55 PM
01-25-2007 11:12 PM
01-26-2007 04:35 AM
Hi, Elijah.
It sounds like as that restriction was made
intentionally to teach for using of INDAQ 😉
I have external trigger signal to start measurement and internal sample
clock for the sampling.
Length of measured signal is defined by external conditions.
I would like to measure that whole signal with maximum accuracy, so I
need maximum
sample clock with certain number of samples which could be 1.
And it needs to respond quickly to some events, so I try to minimize time
spending in NIDAQ.
In general features programme looks like: this.
Measurement parameters definition:
DAQmxResetDevice();
DAQmxCreateTask();
DAQmxCreateAIVoltageChan();
…
DAQmxCreateAIVoltageChan();
DAQmxCfgSampClkTiming(taskHandle, NULL, rate, 0,
DAQmx_Val_FiniteSamps, nsamp); where rate and nsamp are defined from outside
DAQmxCfgDigEdgeStartTrig();
Then
continuous loop:
DAQmxStartTask();
while(1) {
if (DAQmxWaitUntilTaskDone()) {
DAQmxReadAnalogF64();
DAQmxStopTask();
DAQmxStartTask();
Some rendering acquired data and output results
}
watch out some events
}
I don't think it would be suitable to use 'On-Demand' mode here.
And I have another question about sampling.01-29-2007 12:16 PM
01-30-2007 07:02 AM
01-31-2007 11:32 AM
02-07-2007 07:49 AM
Hi Erik,
> I would strongly recommend setting up your timing using the DAQmx_Val_ContSamps
need to wait aqusition of whole impulse before rendering.
But that that case I can't use DAQmxWaitUntilTaskDone(). Can I ?
>I'm not quite sure what you are asking here, both the delay time and frequency will affect the influence from other channels ...
Well. In other words I suspect that delay which is set by DAQmxSetStartTrigDelay()
and another one which is set by DAQmxSetDelayFromSampClkDelay(() are not added for the first sample.
Am I right ?
Thanks,
Andrew
02-07-2007 08:16 AM
Erik: >> I would strongly recommend setting up your timing using the DAQmx_Val_ContSampsAndrew: > need to wait aqusition of whole impulse before rendering. But that that case I can't use DAQmxWaitUntilTaskDone(). Can I ?
True enough, you won't be able to use "DAQmxWaitUntilTaskDone() anymore. But you really don't *need* to. I've made a bunch of utility functions for myself to provide "Wait until X or Y or Z or timeout" style functionality for situations like this.
For example, make a loop that queries the # of available samples. Compare this with a variable holding the result of the previous query, then replace the 'prev_value' with the newly queried value. If the values were different, save a timestamp to mark "most recent change." Perform a short delay to let your thread sleep for 10 msec or so before the next loop iteration. If the values were the same, compare the current time to the timestamp marking "most recent change". If not much time has passed, do your 10 msec sleep delay before the next iteration. If "enough time" has passed, you can know that you're done receiving sample clocks and can exit the loop and read all available data. Somewhere in there you should compare time inside the loop with a time before the loop started to provide an overall timeout condition.
If I followed correctly, your app needs to be prepared for an finite but unknown # of samples coming in, including 1. With normal finite acquisitions, you must define the # of samples ahead of time. With continuous acquisitions, you don't need to know -- you can instead put some intelligence into the way you query task status and read data out of the acq buffer. The end result can be the ability to handle *any* number of samples from 0 to 100000 or more.
-Kevin P.
02-07-2007 11:47 PM
Hi Kevin,
I do measurement of impulse with known variable length
and with unknown repetition frequency (about 10-100 Hz).
Erik's suggestion
> if(nsamp = 1)
> DAQmxCfgSampClkTiming(taskHandle, NULL, rate, 0, DAQmx_Val_HWTimedSinglePoint, nsamp);
> else
> DAQmxCfgSampClkTiming(taskHandle, NULL, rate, 0, DAQmx_Val_FiniteSamps, nsamp);
is quite good for me.
But, I think, his supposition about 'DAQmx_Val_ContSamps' isn't.
How can I discern adjacent impulses (and ExtTrigEvents) ?
I couldn't find function which reports how many samples have been got since last StartTrigEvent,
beside waiting with DAQmxWaitUntilTaskDone().
All our sources have 50 ohms impedance, but the first sample seems to be sensitive to neighbour channel.
Thanks,
Andrew
02-08-2007 08:12 AM
I only program LabVIEW so I really don't have much to offer on specific function calls from C.
The value of *continuous* acquisition is something Erik also said -- you wouldn't have to keep stopping and reconfiguring the task over and over depending merely on the special case of whether your # samples was either 1 or >1. As he said, your code could run much more efficiently without these stop/reconfig/restart cycles. Then again, if the triggering behavior is crucial you may need the stop/reconfig/restart anyway.
Some of your other questions may very well depend on your choice of continuous acquisition vs. finite or single-point, but I'm honestly not clear on what you mean with the question, "How can I discern adjacent impulses (and ExtTrigEvents) ?" Could you explain this part for me?
-Kevin P.