Public Sub CreateDAQTasks()
While ChannelCount < numChannels
While AIChannels(ChannelCount).Device = Device
TasksChannelCount(TaskCount) += 1
With AIChannels(ChannelCount)
Tasks(TaskCount).AIChannels.CreateThermocoupleChannel(.Device & "/" & _
.Channel, Trim(.Name), .Min, .Max, AIThermocoupleType.K, _
AITemperatureUnits.DegreesC, 25)
Tasks(TaskCount).AIChannels(.Name).AutoZeroMode = AIAutoZeroMode.None
If Not .Device.Contains("cDAQ") Then
Tasks(TaskCount).AIChannels(.Name).LowpassEnable = True
Tasks(TaskCount).AIChannels(.Name).LowpassCutoffFrequency = 4
End If
End With
ChannelCount += 1
If ChannelCount = numChannels + 1 Then Exit While
If AIChannels(0).Device.Contains("cDAQ") Then
Device = AIChannels(ChannelCount).Device
End If
End While
' Tell the task to take 100 readings of each channel at 10 kS/sec on the rising edge of the clock.
Tasks(TaskCount).Timing.ConfigureSampleClock("", frm.numSampleRate.Value, SampleClockActiveEdge.Rising, _
SampleQuantityMode.FiniteSamples, frm.numSamples.Value)
Tasks(TaskCount).Control(TaskAction.Verify)
Tasks(TaskCount).Control(TaskAction.Unreserve)
' Create a reader object for this task.
reader(TaskCount) = New AnalogMultiChannelReader(Tasks(TaskCount).Stream)
TaskCount += 1
TasksChannelCount(TaskCount) = 0
Device = AIChannels(ChannelCount).Device
End While
End Sub
Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI