Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

how do all four channels simultaneously in the .NET example?

I am using accelerometer with the cDAQ-9181 and NI9234. I try to run the C# .NET example, named "ContAccelSamp_IntClk_AnlgStart"

how do all four channels simultaneously in the .NET example?

 

0 Kudos
Message 1 of 3
(2,603 Views)

Hi,

 

Here's some code I used for a 4 channel 9211 temperature daq module. It should help you get started.

 

Curt

 

' Initialize local variables
            Dim sampleRate As Double = 2.4 '3 ' 1000
            Dim rangeMin As Double = 0
            Dim rangeMax As Double = 1 '5
            Dim samplesPerChan As Int32 = 4 '100
            Dim cliplimit As Double = 0.2


            Application.DoEvents()

            myTask.AIChannels.CreateThermocoupleChannel("Dev1/ai0:3", "", _
                        0, 200, AIThermocoupleType.J, AITemperatureUnits.DegreesC)

            myTask.Timing.ConfigureSampleClock("", sampleRate, _
              SampleClockActiveEdge.Rising, SampleQuantityMode.FiniteSamples, samplesPerChan)
            ' Verify the task
            myTask.Control(TaskAction.Verify)
            reader = New AnalogMultiChannelReader(myTask.Stream)

            ' Read the data
            Dim data As Double(,) = reader.ReadMultiSample(samplesPerChan)


            Dim data0(4) As Double
            Dim data1(4) As Double
            Dim data2(4) As Double
            Dim data3(4) As Double

            For i = 0 To 3
                data0(i) = data(0, i)
                data1(i) = data(1, i)
                data2(i) = data(2, i)
                data3(i) = data(3, i)
            Next
0 Kudos
Message 2 of 3
(2,592 Views)

Hi

 

Thank you for your repay.

0 Kudos
Message 3 of 3
(2,582 Views)