Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

C# Fails to read the last channel of an ADC card via cDAQ-9137

I have a cDAQ-9137 with NI-9220. When I configure the task to read 0, 1, 2, 3 and 15, the ReadMultiSample raises Timeout exception. I can read 0, 1, 2, 3, 14 and 15, I can also read 0, 1, 2, 3, and 14, but not 0, 1, 2, 3 and 15. Is there anything special about channel 15?

 

I am using DAQmx 18.0

 

Below is the code:

==============

using (myTask = new Task())
{
    //Create a virtual channel
    myTask.AIChannels.CreateVoltageChannel("cDAQ1Mod1/ai0", "",
        (AITerminalConfiguration)(-1),Convert.ToDouble(minimumValueNumeric.Value),
        Convert.ToDouble(maximumValueNumeric.Value),AIVoltageUnits.Volts);
    myTask.AIChannels.CreateVoltageChannel("cDAQ1Mod1/ai1", "",
        (AITerminalConfiguration)(-1), Convert.ToDouble(minimumValueNumeric.Value),
        Convert.ToDouble(maximumValueNumeric.Value), AIVoltageUnits.Volts);
    myTask.AIChannels.CreateVoltageChannel("cDAQ1Mod1/ai2", "",
        (AITerminalConfiguration)(-1), Convert.ToDouble(minimumValueNumeric.Value),
        Convert.ToDouble(maximumValueNumeric.Value), AIVoltageUnits.Volts);
    myTask.AIChannels.CreateVoltageChannel("cDAQ1Mod1/ai3", "",
        (AITerminalConfiguration)(-1), Convert.ToDouble(minimumValueNumeric.Value),
        Convert.ToDouble(maximumValueNumeric.Value), AIVoltageUnits.Volts);

    myTask.AIChannels.CreateVoltageChannel("cDAQ1Mod1/ai15", "",
        (AITerminalConfiguration)(-1), Convert.ToDouble(minimumValueNumeric.Value),
        Convert.ToDouble(maximumValueNumeric.Value), AIVoltageUnits.Volts); 
    AnalogMultiChannelReader reader = new AnalogMultiChannelReader(myTask.Stream);
    //Verify the Task
    myTask.Control(TaskAction.Verify);
    //Initialize the table
    InitializeDataTable(myTask.AIChannels,ref dataTable);
    acquisitionDataGrid.DataSource=dataTable;
           
    //Plot Multiple Channels to the table
    double [,] data = reader.ReadMultiSample(-1);
}
 
Thank you very much.
0 Kudos
Message 1 of 1
(1,261 Views)