ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Samples Being Overwritten

I have been working on a program that has multiple inputs from multiple devices, and it seems I cannot get around the problem of my samples being overwritten.  I have tried all the suggestions I found on the board, but so far nothing is working.  Im sure im just missing something simple, but I thought I would come here for suggestions.

 

In this example I am using a NI9217 to read temperatures from 4 RTDs.

 

Task Creation

 

temperatureTask(1) = New Task() temperatureTask(1).AIChannels.CreateRtdChannel(temp1Device.Text & "/ai0:" & temp1Channel.Items.Count - 1, "", _ Convert.ToDouble(-40), Convert.ToDouble(65), _ AITemperatureUnits.DegreesC, rtdType, resistanceConfiguration, excitationSource, _ Convert.ToDouble(0.001), Convert.ToDouble(100)) temperatureTask(1).Stream.ReadOverwriteMode = ReadOverwriteMode.OverwriteUnreadSamples temperatureTask(1).Timing.ConfigureSampleClock("", 100, _ SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples, 10000)

temperatureTask(1).Control(TaskAction.Verify)

temperatureReader(1) = New AnalogMultiChannelReader(temperatureTask(1).Stream)

temperatureReader(1).SynchronizeCallbacks = True

temperatureReader(1).BeginReadWaveform(-1, temperature1Callback, temperatureTask(1))

 

 

Callback

 

Private Sub temperature1InCallBack(ByVal ar As IAsyncResult) Try temperatureData = temperatureReader(1).ReadSingleSample If temp1Monitor.Value = True Then temperature1.Value = (Math.Floor((10 ^ 2) * temperatureData.GetValue(CInt(temp1Channel.SelectedItem.ToString))) / (10 ^ 2)) temp1Value.Text = temperature1.Value Else temp1Value.Text = "NA" End If If temp2Monitor.Value = True Then temperature2.Value = (Math.Floor((10 ^ 2) * temperatureData.GetValue(CInt(temp2Channel.SelectedItem.ToString))) / (10 ^ 2)) temp2Value.Text = temperature2.Value Else temp2Value.Text = "NA" End If If temp3Monitor.Value = True Then temperature3.Value = (Math.Floor((10 ^ 2) * temperatureData.GetValue(CInt(temp3Channel.SelectedItem.ToString))) / (10 ^ 2)) temp3Value.Text = temperature3.Value Else temp3Value.Text = "NA" End If If temp4Monitor.Value = True Then temperature4.Value = (Math.Floor((10 ^ 2) * temperatureData.GetValue(CInt(temp4Channel.SelectedItem.ToString))) / (10 ^ 2)) temp4Value.Text = temperature4.Value Else temp4Value.Text = "NA" End If temperatureReader(1).BeginReadSingleSample(temperature1Callback, temperatureTask(1)) Catch exception As DaqException MsgBox(exception.ToString) Catch ex As Exception MsgBox(ex.ToString) End Try End Sub

 

 

No matter what I try I seem to always get back to the error of samples being overwritten.  Any help would be greatly appreciated.

0 Kudos
Message 1 of 2
(2,572 Views)
Thread can be deleted, posted in wrong board.
0 Kudos
Message 2 of 2
(2,560 Views)