LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQ Sampling senqronization.

Hello,
I want to learn DAQ senqronization. For example if I sample signal at a rate of 1 Khz and I read it at same rate(as seen at attachment), how this two proses senqronized?
I draw  three possible alternatife.(see sample_read cycle attechment) Perhaps none of them is tha case.
Can anybody inform me?
Download All
0 Kudos
Message 1 of 16
(4,239 Views)

Hi eesen,

There are serveral examples for synchronization. The best way would be to use the LabVIEW Example Finder (LabVIEW>Help>Find Examples) and search for a example using 'synchronize' as search string.

The synchronization is done in hardware e.g. by sharing the AI sample clock to the AO.

BR, Christian

0 Kudos
Message 2 of 16
(4,221 Views)

This is not answer to my question. I need an exact and clear answer. (  I look every DQA example as you mentioned.)

If  I used the samling vi (attached at my pervious message) , how is the be sample and read cylcles.

Is there any body to know the detail of the samling process cycling?

0 Kudos
Message 3 of 16
(4,218 Views)

eesen,

So, if you want to know how your VI works, in therms of aquisition and data transfer from the board to the application software (so there is no synchronization), then this is quite easy to answer. If you configure the acquisition Task for continous and the sample rate at 1kHz, then the mentioned channel will be sampled with a hardware clock with 1kHz. The number of samples at this point is the buffer size in your RAM, where the sampled data will be transfered from the card into this buffer via DMA. Then the application software, in your case LabVIEW, reads this buffer with a rate of 1kHz, as you configured the timing of your timed loop. So the last one is software timing of your operating system, and this is not deterministic! You can see the number of samples as a buffer in your RAM to avoid loosing samples if another windows task with a higher priority is disrupting windows!

E.g. if you configure a task with a sample rate of 100kHz, with a number of samples of 100 and place the DAQmxRead.vi within a timed loop with 200ms timing you will get a buffer overflow error!

I hope I answerd your question now clearly!

 

Christian

Message Edited by Christian_M on 03-08-2007 06:24 AM

0 Kudos
Message 4 of 16
(4,219 Views)

Do you mean that sampling and reading run independently? so non of my drawing shows the right case:( Am I correct?

You said that using software timing is not deterministic, as far as I know, PCI -6289 card does not support Hardware timing.

Is this means that I can't make deterministic data acqusition with PCI -6289 card?

 

0 Kudos
Message 5 of 16
(4,207 Views)

Hi eesen,

Sampling is done in hardware with the rate you specifiy, so if you take samples continuous with 1000Hz and specify the number of samples to 1000, then you will have a buffer in your RAM with the size of 1000 samples. What your now meaning with software timing is the rate with which you are reading the samples out of this buffer! So, between the samples there is always 1ms!

The best would be to read the M-Series Help, or DAQmx help for more information on sampling!

BR, Christian

0 Kudos
Message 6 of 16
(4,187 Views)
Just to add to what Chrisitan said :

Eesen, in the example that you posted in the first post, you are configuring how you want to acquire your data using the DAQmx Timing.vi.  You have specified a rate of 1000, which means that you are getting 1000 samples per second.  All the DAQmx Read is doing is using what you specified in the DAQmx Timing VI, therefore there is no synchronization involved.

There is an input called "source" on the DAQmx Timing VI, here you can specify the hardware source that you want to use.  If you just use the onBoardClock then you are using one of the Timebases (20Mhz or 100KHz) on the M series card itself and using a programmable clock divider to get the rate that you desire ( in your example 1000 Hz).



As far as software timing and hardware timing, your card supports both.

Software Timing : With a software-timed acquisition, software controls the rate of the acquisition. Software sends a separate command to the hardware to initiate each ADC conversion. In NI-DAQmx, software-timed acquisitions are referred to as having on-demand timing. Software-timed acquisitions are also referred to as immediate or static acquisitions and are typically used for reading a single sample of data.  Since software timed acquisitions are dependant on your operating system, this method is not very accurate as far as timing is concerned and is limited to 1ms intervals (depending on the operating system that you are using).

Hardware Timing : With hardware-timed acquisitions, a digital hardware signal (ai/SampleClock) controls the rate of the acquisition. This signal can be generated internally on your device or provided externally.  Samples are "read" at the rising edge of your clock source.

As Christian said, all of this information is also in the NI-DAQmx help and in the M-Series User Help.

Best Regards,
Raajit L
National Instruments
Message 7 of 16
(4,174 Views)
Hello,
Thank you for your reply.
Let me explain why I interested cycles, clocks etc so deeply. I tried to achieve a simple sampling actually. I need to sample
at 1 khz and I need to read at every msec one sample. But I couldn't achieved this before since in my program when I trie to read sample, sometimes the sample is not ready, my timed loop give "finish late" true. So I trie to inverstigate how can I synchronize sampling and read process so when I  attempt to read, sample is ready.
I stepped further with your help.:)
 I was using software timing before for my timed loop,now I use HW timed. (I used onboard clock of the DAQ card for clock, I atteched the vi).
This solve my synchronization problem, now I can sample and read sampled signal  with no problem.
But now anaother problem is arised. 😞
 To use onboard clock of the DAQ card  , I need to start sampling.  But I need clock all the time. (But I don't want to  sampling all the time)
Is there any way to reach onbourd clock, run it always without starting sampling and so used it any timed loop in the application.
 

Message Edited by eesen on 03-13-2007 08:00 AM

0 Kudos
Message 8 of 16
(4,149 Views)
I wait for a help:(
0 Kudos
Message 9 of 16
(4,129 Views)
Eesen,

Once you have configured the DAQmx Timing VI,  you are only specifying the timing and not actually acquiring anything. All your data will be acquired at that rate into a circular buffer.  When you do a DAQmx read the data will just be read from that buffer.  This means that you can do a DAQmx Read in two different loops and your data will still be read at the rate that you specified in the DAQmx Timing VI (see attached). 

One other thing is that you do not really need to control your loop around the DAQmx read with the DAQmx Create Timing from Source.vi.  If you just specify continuous samples in your DAQmx Timing VI and use only a while loop for your DAQmx Read, you will still acquire data at the rate you specify.

The DAQmx driver is actually shipped with an example that continuously acquires data based on the internal clock of the device.  You can find this example in your LabVIEW environment by clicking on Help > Find Examples.  A new window called NI Example Finder will open.  You will see folders in the middle window.  Click on Hardware Input and Output > DAQmx > Analog Measurements > Voltage  and then click on the Cont Acq&Graph Voltage-Int Clk.vi.  I hope this helps.

Best Regards,

Message Edited by Raajit L on 03-15-2007 10:30 AM

Raajit L
National Instruments
0 Kudos
Message 10 of 16
(4,116 Views)