NI6221数据采集卡 用VB编写AO通道程序 出现了些问题
往AO通道送数据的时候 数据感觉总是送不进去
不知道问题出现在哪里?
我把ao程序段贴下,希望各位高手帮帮忙:
Private Sub AO(double MV)
Dim numSampsPerChannel As Integer
numSampsPerChannel = samplesPerBufferTextBox.Text
ReDim data(numSampsPerChannel)
' Create the DAQmx task.
DAQmxErrChk DAQmxCreateTask("", taskHandle)
' Add an analog output channel to the task and check to see whether there is only ONE task.
DAQmxErrChk DAQmxCreateAOVoltageChan(taskHandle, "Dev1/ai0", "aoChannel", -10#, 10#, DAQmx_Val_VoltageUnits2_Volts, "")
' Write to the desired channel(s).
DAQmxErrChk DAQmxWriteAnalogF64(taskHandle, numSampsPerChannel, True, 10#, _
DAQmx_Val_GroupByScanNumber, MV1, sampsPerChanWritten, ByVal 0&)
MV=MV1
Exit Sub
ErrorHandler:
If taskIsRunning = True Then
DAQmxStopTask taskHandle
DAQmxClearTask taskHandle
taskIsRunning = False
End If
generatingLabel.Visible = False
CmdStart.Enabled = True
CmdEnd.Enabled = False
MsgBox "Error: " & Err.Number & " " & Err.Description, , "Error"
End Sub
希望高手们多多帮忙~