Rate Property

Returns or sets the rate, in samples per second, at which analog to digital or digital to analog conversions take place.

Syntax

Variant = object.Rate()

object.Rate = vNewValue

The Rate property syntax has these parts:

Part Description

object Required. A valid Mathcad Data Acquisition Control object.

vNewValue Required. Variant (Double). The new sample or transfer rate.

Remarks

The Rate property has dual usage. For input operations it specifies the rate at which analog to digital conversions take place. For output operations it specifies the rate at which digital to analog conversions take place.

The time between samples or updates, in seconds, is usually the inverse of the Rate property. However, this may not always be the case. To determine the actual time between samples that was used for the data transfer operation, get the DeltaT property of the channel item.

Example

Sub GetWaveform()

  Dim McadDAQ As AnalogIO

  Dim lTemp as Long

  'the next statement assumes there is a Mathcad Data Acquisition control called

  ' AnalogIO1 on Form1 of a VisualBasic project

  Set McadDAQ = Form1.AnalogIO1

  'set the channel string to acquire from channels 0 and 3

  McadDAQ.ChannelString = "0,3"

  'set the IOFunction to input

  McadDAQ.IOFunction = 0&

  'set the IOType to waveform

  McadDAQ.IOType = 1&

  'set the number of samples to acquire for all channels

  McadDAQ.NumSamples = 1000%

  'set the sample rate in samples per second

  McadDAQ.Rate = 10000%

  'acuire the data

  McadDAQ.Acquire

  'See if the right number of samples was acquired, zero base assumed

  lTemp = UBound(McadDAQ.Channels("0").Data) + 1

  MsgBox CStr(lTemp) & " samples were acquired"

End Sub