From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

AnalogSingleChannelReader?

I have an application using an NI 9205 module configured for 16 differential analog channels.  I want to make it so that a user can select which paricular channel/s he/she wants to log data to TDMS.  It may only be one channel or could be multiple.  Do I need to use AnalogSingleChannelReader or AnalogMultiChannelReader for this?  I'm currently using multichannel reader and the application is writing all channels to the TDMS file.  However, I'm unsure what more I need to do if indeed AnalogMultiChannelReader is what I need to use.  Of course all of the channles that the user selects to log to TDMS need to be logged to a single TDMS file.

 

 ' Verify the task
            MyTask.Control(TaskAction.Verify)
            reader = New AnalogMultiChannelReader(MyTask.Stream)
            reader1 = New AnalogSingleChannelReader(mytask.Stream)


            'Read the data
            Dim data() As AnalogWaveform(Of Double) = reader.ReadWaveform(1000)

            'Stream each analog channel's data to its respective Waveformgraph
            wfgCh0.PlotWaveform(data(0))
            wfgCh1.PlotWaveform(data(1))
            wfgCh2.PlotWaveform(data(2))
            wfgCh3.PlotWaveform(data(3))
            wfgCh4.PlotWaveform(data(4))
            wfgCh5.PlotWaveform(data(5))
            wfgCh6.PlotWaveform(data(6))
            wfgCh7.PlotWaveform(data(7))
            wfgCh8.PlotWaveform(data(8))
            wfgCh9.PlotWaveform(data(9))
            wfgCh10.PlotWaveform(data(10))
            wfgCh11.PlotWaveform(data(11))
            wfgCh12.PlotWaveform(data(12))
            wfgCh13.PlotWaveform(data(13))
            wfgCh14.PlotWaveform(data(14))
            wfgCh15.PlotWaveform(data(15))

 

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

Hi busarider29,

 

The easiest way is to use the multi channel. One reason is even if the user only wants one channel worth of data, having the extra won't hurt. Also, it helps ensure the TDMS file has a known number of channels so if you go to read it after the acquisition is over, you don't have to worry if the user only had one channel or multiple channels worth of data. A filter can be used on the data later to determine if it is data from the extra, unused, channels.

Justin M.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 2
(3,893 Views)