Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

determining Terminal Configuration using NI-DAQmx ANSI C functions

Hello,
I'm using NI-DAQmx 8.0 to program my application in Visual C++ without Measurement Studio.
Is there any function in NI-DAQmx ANSI C that will tell me what are the Terminal Configuration available for specific DAQ board?
For example USB-6009 has only differential and RSE terminal configuration.When using DAQ Assistant to create a task and virtual channel it gives only this terminal configuration which are available for the DAQ board.
In my application I want to use a combobox for choosing the terminal configuration and I want to fill this combobox only with available terminal configuration

Best regards
Lukasz C.
0 Kudos
Message 1 of 9
(6,383 Views)
Lukasz C.,

Unfortunately there is no direct function to determine which terminal configurations are available.  However, you can determine which configurations are available by attempting to add AI channels into a task with the different terminal configurations selected.  If the configuration choice is not available the driver will throw an exception with an error code of -200077 even before you attempt to start the task.  If you catch this exception you can determine if the terminal configuration was valid.  Using this method on each of the four available terminal configurations you can establish which you can place into a combo box.  Below I included a little code snippit in C# that would do the trick.  It would be much the same in C++ as long as you are using a managed environment.  If you are creating an unmanaged application the procedure would be much the same, but would not leverage the class structure of the DAQmx .NET assembly. 

Regards,

Neil S.
Applications Engineer
National Instruments


0 Kudos
Message 2 of 9
(6,370 Views)
The Code:
            Task myTask;
            Boolean NRSEAvailable = false;
            String channel = "Dev1/ai0";
            Double maxVoltage = 10;
            Double minVoltage = -10;

            //test NRSE terminal configuration
            try
            {
                myTask = new Task();
                myTask.AIChannels.CreateVoltageChannel(channel, "",
                    (AITerminalConfiguration)(10078), minVoltage,
                    maxVoltage, AIVoltageUnits.Volts);
                NRSEAvailable = true;
            }
            catch (DaqException exception)
            {
                if (exception.Error == -200077)
                {
                    NRSEAvailable = false;
                }
                else
                {
                    MessageBox.Show(exception.Message);
                }
            }

            if (NRSEAvailable) MessageBox.Show("NRSE Terminal Configuration is Available.")

You would need to test each terminal configuration in the same manner.  The values of each are RSE : 10083, Differential : 10106, Pseudodifferential : 12529
0 Kudos
Message 3 of 9
(6,370 Views)
Neil S.

Thank You vey much for the idea.

Best regards

Lukasz C.
0 Kudos
Message 4 of 9
(6,367 Views)

Hello,

as I know, there is a function called "DAQmxGetPhysicalChanAttribute" which should return the terminal configuration possible for every channel. But it is not documented how the number is to interpret. In my case I only have a USB 6008 connected, which only supports RSE and Diff. For the first 4 channels the function reports "4" and for the last 4 channels it reports "0". Seems like a bitset, 0 (is always there) = RSE, bit 2 = Diff ???!!! With more hardware this could be solved.

example: DAQmxGetPhysicalChanAttribute( "Dev1/ai0", DAQmx_PhysicalChan_AI_TermCfgs, &terminal ); //int terminal

Greetings

0 Kudos
Message 5 of 9
(6,198 Views)
wanttoknow,

Typically we recommend that you start a new thread for a new issue.  I have tried out the same thing and I don't get the same results.  I get 5 for the first 4 channels and 1 for the next 4.  This is expected behavior.  The interpretation of the result returned is available in the NI-DAQmx C Reference Help available at Start >> All Programs >> National Instruments >> NI-DAQ >> NI-DAQmx C Reference Help.  Browse to NI-DAQmx C Properties and click on List of Physical Channel Properties.  Then click on Terminal Configurations under Analog Input.  It returns it as a bitset with the first bit representing RSE mode, the second representing NRSE, the third representing Differential, and the forth representing Pseudodifferential.  The table is included below for convience.  If you have further issues I would recommend starting a new thread.



Regards,

Neil S.
Applications Engineer
National Instruments

Message Edited by Neil S. on 03-12-2007 09:06 AM

0 Kudos
Message 6 of 9
(6,191 Views)
Hello,
 
and thank you. Unfortunately I couldn't see the table in my help-file (very strange, it only shows text!). Maybe there is something wrong with my installation. Also I get only bit 2 from the function (very, very strange). But the M&A-explorer allows RSE and Diff, so I think hardware and driver are ok. I'm working on this problem, maybe i'll try it on another computer.
 
Thanks and regards.
0 Kudos
Message 7 of 9
(6,178 Views)
wanttoknow,

That is strange indeed.  Let me know what you discover when you try a different computer.  Also let me know if I can do anything to help.

Regards,

Neil S.
Applications Engineer
National Instruments

0 Kudos
Message 8 of 9
(6,169 Views)
To whomever reads this thread,

I was just reading back through this thread and thought I would clear something up.  The function that allows you to access the available terminal configurations programmatically was added in NI-DAQmx 8.3.  That is why I suggested the alternate method earlier in the post (they were using NI-DAQmx 8.0).  The recommended the method is not the method show later in the post.

Regards,

Neil S.
Applications Engineer
National Instruments
Message 9 of 9
(6,163 Views)