NumIterations Property |
Returns or sets the number of times to repeat a waveform output.
Variant = object.NumIterations()
object.NumIterations = vNewValue
The NumIterations property syntax has these parts:
object Required. A valid Mathcad Data Acquisition Control object.
vNewValue Required. Variant (Integer). The number of times to repeat a waveform output.
During waveform data output NumIterations of the waveform are sent to the output channel. The minimum value is one. This property is useful for generating a waveform for a long time. For example, instead of generating one thousand cycles of a sine wave, you could generate one cycle and repeat it one thousand times. The latter method can be done specifying less data points.
Sub SendWaveform()
Dim McadDAQ As AnalogIO
Dim i as Integer
Dim vData(99) as Variant
'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 send to channel 0
'Note: you can only send waveform data to one channel
McadDAQ.ChannelString = "0"
'set the IOFunction to output
McadDAQ.IOFunction = 1&
'set the IOType to waveform
McadDAQ.IOType = 1&
'Generate the data to send to the output channel
For i = 0 To 99
vData(i) = sin(i * 2 * 3.14159/100)
Next
'set the channel data
McadDAQ.Channels("0").Data = vData
'set the number of iterations
McadDAQ.NumIterations = 9%
'set the update rate
McadDAQ.Rate = 100%
'generate the waveform
McadDAQ.Send
End Sub