06-27-2007 07:52 AM
07-02-2007 04:32 AM
07-05-2007 10:54 AM
Thanks for that.
I'm now using the correct function call but data retrieval is very slow - taking 0.45 seconds to get the data for a task holding 121 channels.
Here's my code, any ideas?
Private Sub tmrSample_Timer()
Dim sampsPerChanRead As Long
Dim numBytesPerSample As Long
Dim arraySizeInBytes As Long
Dim i As Integer
On Error GoTo ErrorHandler
If Not taskIsRunning Then
Exit Sub
End If
NumSamps = NumSamps + 1
DAQmxErrChk DAQmxReadAnalogF64(taskHandleAI, numSampsPerChannel, 10#, _
fillMode, data(0), arraySizeInSamps, sampsPerChanRead, ByVal 0&)
DAQmxErrChk DAQmxReadDigitalLines(taskHandleDI, 1, 10#, _
DAQmx_Val_GroupByChannel, arrayDI(0), numDI, _
sampsPerChanRead, numBytesPerSample, ByVal 0&)
'Populate the listView
PopulateListView numChannels, fillMode, sampsPerChanRead
For i = 1 To lvDI.ListItems.count
If i < UBound(arrayDI) Then
lvDI.ListItems(i).SubItems(1) = IIf(arrayDI(i) <> 0, "ON", "OFF")
End If
Next
lblPerformance.Caption = perf.ElapsedTime
Exit Sub
ErrorHandler:
tmrSample.Enabled = False
acquiringLabel.Visible = False
startCommandButton.Enabled = False
StopCommandButton.Enabled = False
MsgBox "Error: " & Err.Number & " " & Err.Description, , "Error"
End Sub
Thanks,
Snelly