Hi All,
I am playing with Measurement studio with VB, and i run into this error, I understand the error and would easily fix it in labview but .NET anguages give me a problem.
Attached is the error message i receive: some or all of the samples requested have not yet been aquired.
I understand the cause of the error, and i can solve it in labview, can i get help with it in VB, below is my code, the sampling frequency and sampling time are entered by the user. Public Sub sampleonevoltages(ByRef arTime() As Double, ByRef arWire1() As Double, ByRef arWire2() As Double, ByRef currenttempDbl As Double)
Dim onevoltagesTask As Task 'The name of the task which measures the three input voltages
Dim swStreamWriter As System.IO.StreamWriter 'the stream writer which is used to write the data to the respective files
Dim i As Integer
Dim onewireReader As AnalogMultiChannelReader
Dim lngNPoints As Integer
Dim sensortempDbl As Double = 186
Dim arTemp(CInt(Base.numbersamplesDouble) - 1) As Double
lngNPoints = CInt(Base.numbersamplesDouble) * 3
ReDim Preserve arWire1(lngNPoints / 3 - 1)
ReDim Preserve arWire2(lngNPoints / 3 - 1)
'ReDim Preserve arWire3(lngNPoints / 3 - 1)
ReDim Preserve arTime(lngNPoints / 3 - 1)
'I
nitialise the acqusition task by defining it based on the parameters set by the user in the main form
Try
'Create a new task
onevoltagesTask = New Task("")
'create a virtual voltage channel which houses all of the required parameters for the capture
onevoltagesTask.AIChannels.CreateVoltageChannel("Dev1/Ai0," & "Dev1/Ai1," & "Dev1/Ai2,", "Wire 1," & "Wire 2," & "Temp,", AITerminalConfiguration.Differential, Base.minvalueDouble, Base.maxvalueDouble, AIVoltageUnits.Volts)
'Set up the timing parameters of the scan
onevoltagesTask.Timing.ConfigureSampleClock("", Base.samplerateDouble, SampleClockActiveEdge.Rising, SampleQuantityMode.FiniteSamples, Base.numbersamplesDouble)
'Verify the task has been initialised correctly
onevoltagesTask.Control(TaskAction.Verify)
'Prepare the reader for reading the two channels
onewireReader = New AnalogMultiChannelReader(onevoltagesTask.Stream) Dim data(,) As Double = onewireReader.ReadMultiSample(Base.numbersamplesDouble)
Catch ex As Exception
MessageBox.Show(ex.Message)
onevoltagesTask.Dispose()
End Try
End Sub
The code samples fine up to 10 sec but cannot go higher i will need 27 sec of sampling at 10000Khz
Thank you