I am using a cDAQ-9171 with a NI 9211 to read some thermocouples. I am looking to eventually write some C++ code that reads temperature from this device. I am looking at the DAQmx ANSI C example code, and I am having trouble running that. Is there any good documentation on configuring the channels to be read?
I am currently getting the following output when running the "ContThrmcplSamps-IntClk.c" sample code.
Need some support finding what values to put into the following functions to read channel 0.
Solved! Go to Solution.
I would suggest that you check NI MAX, under Devices and Interfaces, to make sure your DAQ device is properly connected to your system.
As you already know, the error popping up is due to not properly specifying the module/channel of the thermocouple.
Below is a snippet of the original, unedited "ContThrmcplSamps-IntClk.c" sample code that you are working with:
At the 146th line, you can see many variables, such as chan, min, max. These are the ones you need to substitute for your own values to make the code work. The variable chan is the one that determines which module/channel your system is reading from.
In order to know the name of this module/channel, you need to check your NI MAX software, under Devices and Interfaces. Once you are there, click your cDAQ device and take a look into Slot Details:
These are the different modules on my DAQ device. If you notice, on the 2nd slot I have my NI 9211. The name of that slot being cDAQ1Mod2. Now you know the name of the module, but still require the name of the channel that your Thermocouple is connected to.
I have mine connected to the AI 0+, AI 0-. The channel name for that is ai0.
Therefore, my module/channel name for the TC reading is cDAQ1Mod2/ai0. I substitue that in place of chan-- it should look like this:
Reach out if you have further questions,