05-15-2006 09:09 AM
myTask3.CIChannels.CreateTwoEdgeSeparationChannel("Dev1/Ctr2", "", 0.0000001, 0.83886075, CITwoEdgeSeparationFirstEdge.Rising, CITwoEdgeSeparationSecondEdge.Rising, CITwoEdgeSeparationUnits.Seconds)
counterInReader =
New CounterReader(myTask3.Stream)myTask3.Start()
However I am not getting my 500 microscond count. I have tried using other counters and get the same result. I have used CTR2 as pulse generator successfully. I have used two different SCB boards.
Any help would be appreciated,
Thanks Diane
05-17-2006 07:26 PM
05-18-2006 10:14 AM
Hi Ryan,
I
05-18-2006 10:20 AM
Trying again.
Hi Ryan,
I just found my problem. I set up my two-edge detection task as threaded like I had seen in the pulse generation example code:
'Wait for the task to complete in another thread so the UI does not freezeThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf WaitForTask))
When I commented this out and moved the CounterRead Statement from the WaitForTask subroutine to directly under MyTask.Start() everything worked fine.
Can some types of tasks be threaded but not others?
Thanks,Diane
05-18-2006 01:13 PM
Me again.
I've got the threading working. I did not need the WaitUntilDone.
Thanks for answering my post
Diane
Private Sub WaitForTask(ByVal obj As Object) Try 'myTask.WaitUntilDone(-1)tinc = counterInReader.ReadSingleSampleDouble()
aquisitionDataTextBox.Text = tinc.ToString()
myTask2.Dispose()
Catch exception As DaqExceptionMessageBox.Show(exception.Message)
End Try End Sub