Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-DAQ Multiple channels

Hi,
I wrote following code to simulate voltage values of 2 aircraft throttles. Retrieving the data for the first one is no problem, the voltage appears correcly (dev1/a0 --> ENG1ThrottleData(0, 0)). However the data for dev1/a1 is completely wrong. Can somebody tell me what i did wrong? (changing the ENG1ThrottleData(1, 1) did not help. I guess it has something to do with the multiple channel reading, but can't find a solution.
 
Thanks in advance,
 

Public Sub OnDataReady(ByVal i As IAsyncResult)

'Retrieve the data that was read.

'At this point, any exceptions that occurred during the asynchronous read are thrown

Dim Result As Integer

Dim ENG1ThrottleData As Double(,)

ENG1ThrottleData = ENG1ThrottleReader.EndReadMultiSample(i)

Dim ENG1ThrottleVoltage As Double = ENG1ThrottleData(0, 0)

lblVoltageENG1.Text = ENG1ThrottleVoltage

 

Dim ENG2ThrottleVoltage As Double = ENG1ThrottleData(1, 1)

lblVoltageENG2.Text = ENG2ThrottleVoltage

ENG1ThrottleReader.BeginReadMultiSample(100, AddressOf OnDataReady, Nothing)

End Sub

 

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

'ENG1Throttle

ENG1ThrottleTask.AIChannels.CreateVoltageChannel("dev1/ai0,dev1/ai1", "", AITerminalConfiguration.Rse, -10, 10, AIVoltageUnits.Volts)

ENG1ThrottleTask.Timing.ConfigureSampleClock("", Convert.ToDouble(1000), SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples, 1000)

ENG1ThrottleTask.Control(TaskAction.Verify)

ENG1ThrottleReader =

New AnalogMultiChannelReader(ENG1ThrottleTask.Stream)

ENG1ThrottleHandle = ENG1ThrottleReader.BeginReadMultiSample(100,

AddressOf OnDataReady, Nothing)

End Sub

0 Kudos
Message 1 of 1
(3,634 Views)