Thread Subject: NiDaq, Daq, Hardware Problem?

Subject: NiDaq, Daq, Hardware Problem?

From: Lars Warmbold

Date: 26 Nov, 2007 20:16:36

Message: 1 of 5

I'm using a Nidaq PCI-3660 Hardware. With Matlab I can not
set the samplerate to 44100. A message like
"Samplerate was set to 43435.34659143651 !" occures.

Under the original NI-software it is possible. Matlab
doesn't seem to like this samplerate.

???

Thanks LARS

Subject: NiDaq, Daq, Hardware Problem?

From: Rob Purser

Date: 3 Dec, 2007 15:34:44

Message: 2 of 5

An NI PCI-3660? I'm not familiar with that device. Can you
post a link to the description? Can you give us some M code
to tell us what you're doing? Also, what version of MATLAB,
OS, etc.

Thanks,
-Rob

Subject: NiDaq, Daq, Hardware Problem?

From: Lars Warmbold

Date: 5 Dec, 2007 21:11:59

Message: 3 of 5

Hallo Rob!

I'm sorry.
We are running a classroom version of R2006a at FHTW-Berlin
(Germany).

The Hardware is a NI-PCI-6036E.
http://sine.ni.com/nips/cds/view/p/lang/en/nid/11913

The Problem is, that this device supports inputsamplerates
of up to 200ks/sec but outputsamplerates only up to
10ks/sec. Therefor I'd like to use the soundcard as
output-device. This device supports only 44.1ks/sec and 8ks/sec.

The target is to find a samplerate greater than 20ks/sec
which is supported by both devices. Since there is only
44.1ks/sec (soundcard) I need to run the NI-hardware with
that samplerate. But

set(ai, 'SampleRate', 44100);

leads to the message like

'unable to set samplerate, samplerate set to
43673.893567824578!'

LARS

Subject: NiDaq, Daq, Hardware Problem?

From: Lars

Date: 13 Dec, 2007 08:56:54

Message: 4 of 5

Hallo Rob!

I'm sorry.
We are running a classroom version of R2006a at FHTW-Berlin
(Germany).

The Hardware is a NI-PCI-6036E.
http://sine.ni.com/nips/cds/view/p/lang/en/nid/11913

The Problem is, that this device supports inputsamplerates
of up to 200ks/sec but outputsamplerates only up to
10ks/sec. Therefor I'd like to use the soundcard as
output-device. This device supports only 44.1ks/sec and 8ks/sec.

The target is to find a samplerate greater than 20ks/sec
which is supported by both devices. Since there is only
44.1ks/sec (soundcard) I need to run the NI-hardware with
that samplerate. But

set(ai, 'SampleRate', 44100);

leads to the message like

'unable to set samplerate, samplerate set to
43673.893567824578!'

LARS

Subject: NiDaq, Daq, Hardware Problem?

From: Rob Purser

Date: 13 Dec, 2007 16:10:04

Message: 5 of 5

Like the Rolling Stones said: "You can't always get what you
want!" The toolbox is forced to adjust the user's requested
sample rate based on the clock resolutions of the board.
They should either use SETVERIFY or GET the SampleRate after
they set it to determine the actual sample rate that was
selected. The number of channels added may affect the rate
that is selected.

The reason for this comes back to hardware clocks on the
boards. Most cards offer a number of fixed speed base
hardware clocks that are used to drive the timing of
acquisition. For instance, the NI E-series cards have 5 base
clocks, including a 20MHz and a 100KHz clock. In order to
reach a given sample rate, there is a programmable divider
that can be set from 1 to 65536. This gives the 20MHz clock
a range of 20 million samples/sec (20e6/1) down to ~305.18
samples/sec (20e6/65536). But, these possible rates are
quantized: there are only 65534 possible values between
those two extremes. So, if you want 1,570,000 samples per
second on a single channel, you'll have to choose between
1,666,666.67 (20e6/12) and 1,538,461.54 (20e6/13).

This gets more complex what you add multiple channels to the
mix. Now, you need to find the nearest clock rate that is
the requested per channel rate times the number of channels
you want. So, if you want 80000 samples/sec on 7 channels
with a 10MHz base clock, you can only get 84033.61. How'd we
get that? 80000 samples/second/channel * 7 channels = 560000
samples/second. The base clock divided by the requested rate
gives the ideal divider: 10000000/560000 = ~17.8. The
divisor must always be an integer, so we truncate to the
lower value (so the sample rate chosen is always higher than
requested), which is 17. We then calculate the actual sample
rate the card can deliver: 10000000 samples/second divided
by the divider of 17 divided by the number of channels 7:
10000000/17/7 = 84033.61.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
data acquisition Rob Purser 3 Dec, 2007 10:32:49
settings Lars 26 Nov, 2007 15:20:10
nidaq Lars 26 Nov, 2007 15:20:10
hardware Lars 26 Nov, 2007 15:20:10
daq Lars 26 Nov, 2007 15:20:10
rssFeed for this Thread

Contact us at files@mathworks.com