Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with 6024e Pre-trigger VB.NET

Hi,

I am trying to use the 6024e in pre-trigger mode, with software start and a digital reference trigger (VB.NET 2003).  Until yesterday, I was able to acquire test data with the sample code named AcqVoltageSamples_IntClkDigRef,  most important lines pasted here:

            myTask.AIChannels.CreateVoltageChannel(physicalChannelComboBox.Text, "", CType(-1, AITerminalConfiguration), rangeMin, rangeMax, AIVoltageUnits.Volts)
            myTask.Timing.ConfigureSampleClock("", sampleRate, SampleClockActiveEdge.Rising, SampleQuantityMode.FiniteSamples, samplesPerChan)
            myTask.Triggers.ReferenceTrigger.ConfigureDigitalEdgeTrigger(referenceTriggerSourceTextBox.Text, referenceEdge, preTriggerNumeric.Value)
            reader = New AnalogMultiChannelReader(myTask.Stream)
               reader.SynchronizingObject = Me
            reader.BeginReadMultiSample(samplesPerChan, AddressOf myCallback, Nothing)

  Private Sub myCallback(ByVal ar As IAsyncResult)
        Try
            'Read the available data from the channels
            Dim data As Double(,) = reader.EndReadMultiSample(ar)

With no change to my hardware, I now constantly get an error saying "Wait for acquisition to complete before reading, or increase read timeout."  

Any suggestions would be greatly appreciated.

Thanks.



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

Hi lemmik,

There is a timeout value associated with reading the data. Once you begin the reader the NI-DAQmx driver will wait for the data to be acquired for the duration of the timeout. If the data has not been acquired within the timeout the error you are seeing will be thrown. The default timeout value is 10 seconds. So if you run the program and the reference trigger has not occurred within ten seconds you will get a timeout error. Make sure you have specified the correct reference trigger source. If it is taking longer than 10 seconds for a trigger to happen then you can increase the timeout length. To increase the timeout length, add the following line to your code before you create the reader.

myTask.Stream.Timeout = readTimeout

Where readTimeout is the time in seconds that you want to set the timeout to. Please let me know if you have any questions and take care.

Thanks,

Nathan
NI Chief Hardware Engineer
0 Kudos
Message 2 of 2
(2,795 Views)