Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Data acquisition in real time

Hello,

 

I'm trying to read a NI9213 in real time. I can read some value but I have an issue.

 

My code is :

myTask = DaqSystem.Local.LoadTask("TaskNIMAX")

'Verify the Task

myTask.Control(TaskAction.Verify)

analogInReader = New AnalogMultiChannelReader(myTask.Stream)

' Use SynchronizeCallbacks to specify that the object

' marshals callbacks across threads appropriately.

analogInReader.SynchronizeCallbacks = True

analogInReader.BeginReadWaveform(1, myAsyncCallback, myTask)

 

Private Sub AnalogInCallback(ByVal ar As IAsyncResult)

Try

If (Not (runningTask Is Nothing)) AndAlso runningTask Is ar.AsyncState Then

data = analogInReader.EndReadWaveform(ar)

analogInReader.BeginMemoryOptimizedReadWaveform(1, myAsyncCallback, myTask, data)

Debug.Print((data(0).Samples(0).Value).ToString)

End If

Catch exception As DaqException

MessageBox.Show(exception.Message)

myTask.Dispose()

End Try

End Sub

 

The task is configure with continuous sampling (1 sample at 500 Hz). You can see the value read on the file debug.txt.

My question is why I have many time the same value ? What is wrong in my code ?

Thanks

 

0 Kudos
Message 1 of 2
(2,468 Views)

Hello

 

My problem is solved. I use a thermocouple card and it's not possible to get the value at 500hz

0 Kudos
Message 2 of 2
(2,434 Views)