From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
12-03-2014 02:36 AM
Hi all,
i'm wondering if is it possible to stop acquiring data from ni pcie 6323 with a trigger pulse the same way as i start acquiring samples with a trigger pulse in finite sample mode.
Thanks in advance
MR
Solved! Go to Solution.
12-03-2014 04:22 AM - edited 12-03-2014 04:23 AM
I've found this related post (http://forums.ni.com/t5/Measurement-Studio-for-NET/How-to-read-from-start-to-reference-Trigger/m-p/1... )that seems the solution i need but since i'm using
BeginReadWaveform() and BeginMemoryOptimizedReadWaveform() function calls to work asynchronously i'm asking you the right way to start and stop acquisition with a trigger and reference trigger in C#.NET
12-03-2014 01:50 PM - edited 12-03-2014 01:52 PM
The idea is to configure a reference trigger (which will stop the acquisiiton) but instead of reading relative to the first pretrigger sample (the default), read the data continuously as it is acquired. I don't have the .NET libraries currently installed and it's been a while since I have used them, but I believe it should look something like this:
From there, the task will behave like a continuous input task except when the reference trigger is received the acquisition will stop (2 samples after the trigger).
Best Regards,
12-04-2014 02:44 AM
Hi,
this white paper can help you: http://www.ni.com/white-paper/2835/en/
For stop acqusition with trigger you have to use "Reference Digital Edge" DAQmx Trigger block.
12-04-2014 03:03 AM
Thanks for the answer, i will try soon this... in the meanwhile i'd like to ask you also the following:
I'm configuring my task this way:
analogInputTask.Timing.ConfigureSampleClock(
ClockSource
, SampleRate //1Khz
, ActiveEdge //PFI0 rising
, SampleMode //finite samples
, samplesPerChannel); // ?????
I haven't understood clearly how to set correctly the samplesPerChannel number... Can you please explain me this ? is this number that i have to set to 1/10 of sample rate? (1Khz -> 100 samplesPerChannel??)
how relate this .net function call to the Max Task Time Settings Configuration Page where Acquisition mode, samples to read and rate have to be set??
Thanks in advance
12-04-2014 03:14 AM
In Finite Acquisition, samplesPerChannel set the number of samples you want to acquire.
in Continuos Acquisition, samplesPerChannel set the dimension of the buffer for storing data.
12-04-2014 03:54 AM
Hi! Thanks for your interest,
let me check if i got it:
In finite acquisition i set samplerate = 1000 (1Khz)
if i set samplesPerChannel = 100 what i get is a undersampling of factor 1:10? acquiring signal @ 100Hz instead if 1Khz specified in the samplerate variable?
Thanks
12-04-2014 04:22 AM
With sample rate = 1000 and SamplesPerChannel = 100 means that you acquire 100 samples at 1KHZ (you acquire 100 samples in 0.1s).
12-04-2014 05:03 AM
so sampleperchannel value defines the acquisition duration:
if i acquire data @1Khz and samplesperchannel is 100K samples, Whole Acquisition will last 100s ( 100k [samples]/ 1k [samples/s] = 100 [s] ) so i have to set my PCIe 6323 read timeout accordingly... how can it be done in .net c#?
Have you some sample code in c# to read asynchronously data in these conditions?
I mean:
12-04-2014 03:09 PM - edited 12-04-2014 03:10 PM
The samplesPerChannel which you specify when configuring the sample clock sets the total number of samples for the finite acquisition. In your case, you will be reading the pre-triggered data continuously so in effect this parameter really only sets the buffer size. So you just want it to be large enough to avoid underflows (although... if the window you are acquiring from is potentially very short, you might want to explicitly configure the buffer size to something larger and keep the samplesPerChannel value low so that the reference trigger can be accepted sooner).
The numberOfSamples which you specify when you start the reader sets the number of samples for the next read call. So you can read smaller windows of data continuously to avoid having a blocking call with a large timeout. If you do want to change the timeout it is a property of the DAQStream class.
The "continuous" examples (e.g. this one) should show how you can read back data asynchronously as it is being acquired. Your configuration is more like a "continuous" example.
Since you want to start and stop using the same line as a trigger, perhaps an alternative to changing the default read pointer would be to configure a continuous analog input task with a pause trigger. The caveat to this is that the pause trigger does not stop the task and as soon as the line goes back high you will begin to acquire data again--I would suggest using a counter to separate the groupings of samples from the continuous buffer. If you want to acquire multiple windows of data in short succession though, then I would go with this instead to avoid having to restart the task (and potentially miss samples while the task is being restarted).
Best Regards,