Data Acquisition Toolbox
  Function/Property:
    Search    Help Desk 
SampleRate    Examples   See Also

SampleRate specifies the per-channel rate (in samples/second) that the analog input or analog output hardware can digitize data.

Data acquisition devices have a finite (though often large) number of valid sampling rates. To find out the range of sample rates supported by your board, you can use the propinfo function.

If you specify a sampling rate that does not match one of the valid device values, then the data acquisition engine automatically selects the closest supported sampling rate that is within 1% of the requested rate. If there is no valid sampling rate within this tolerance, the next highest value is selected. If a higher value is not available, then an error is returned.

Since SampleRate can be set to a value that differs from the one specified with the set function, you should return the actual sampling rate.

Alternatively, you can use the setverify function. This function sets the SampleRate value and then returns the actual value that is set.

Note:
Whenever the SampleRate value is changed, the BufferingConfig values are recalculated by the engine.

Characteristics

Device Objects

AI, AO
Class

Common
Access

Read/write
Data Type

Double
Modify while Running

No

Values

The default value is obtained from the hardware driver.

Example

Suppose you create an analog input object AI for a sound card and add two channels to it.

You can find out the range of valid sample rates with the propinfo function.

You can use the set command to set the sample rate to 8 kHz for each channel.

To find out what the actual sample rate is set to:

Alternatively, you can use the setverify function. This function sets the sample rate value and then returns the actual value that is set.

See Also

Properties

BufferingConfig

Functions

propinfo, setverify



[ Previous | Help Desk | Next ]