Do More with Your NI USB-TC01

This is an open group. Sign in and click the "Join Group" button to become a group member and start posting.

Separating TC01 driver (C)

What do I need to pull out of the massive beast that is NIDAQmx just to support the TC01 thermocouple?  Where is the dll or lib or similar for just the thermocouple?

I have an existing Visual Studio 8 C++ project we built using a non-NI USB thermocouple.  That device has proven unreliable, and I thought I could fairly easily switch to an NI USB thermocouple.  But the software is proving vastly more difficult than I expected.  I downloaded all of NIDAQmx, and can find some relevant source code there, but I cannot make it work.  Additionally, my full program is about 1 M, and installing a 1.3 G download on top of that is going to cause operations to scream.  I need a reasonable sized driver piece that can go in my install.

On a software level, how do I identify the physical channel to setup the device?  What do I need to call (C function) just to get data from the device?  The examples seem vastly over-complicated, with tasks and callbacks, when all I need is to occassionally get a single data point.

0 Kudos
Message 1 of 2

Re: Separating TC01 driver (C)

We have 3 "flavors" of DAQmx called Full, Config, and Core.  I'm sure Full is what you downloaded which contains all the application support necessary to develop in any of the numerous environments that DAQmx supports, which does make it very large.  Most likely when you are ready to deploy your application you'll just need the Core version which is much smaller.  You can read more about them here:

NI-DAQmx Run-Time Engine 9.4 - (Core)

NI-DAQmx Run-Time Engine 9.4 - (Configuration with MAX)

NI-DAQmx 9.4 (Full)

To get data from the USB-TC01 you need to do 4 things:

  1. Create a task
  2. Create a virtual channel and add it to the task
  3. Read
  4. Clear the task

Here's a simple example that reads 10 samples from the TC01 assuming your device is "Dev1":

// Create Task

TaskHandle task = 0;

DAQmxCreateTask("testTask", &task);

// Create Channel and add to task

int error = DAQmxCreateAIThrmcplChan(task, "Dev1/ai0", "channel0", 0, 300, DAQmx_Val_DegF, DAQmx_Val_J_Type_TC, DAQmx_Val_BuiltIn, 0, NULL);

// Read 10 samples

float64 value = 0;

for(int i = 0; i < 10; i++)


error = DAQmxReadAnalogScalarF64(task, 10, &value, NULL);

cout<< value<< endl;



// Clear the task


You won't need to use any callbacks because you will just be doing on demand reads.

When setting up the channel you may want to pass in different values than I set for my constants.  Those are all listed in the NI-DAQmx C Reference Help (located in the start menu) for the  DAQmxCreateAIThrmcplChan function.  You'll always want to use  DAQmx_Val_BuiltIn though, since the CJC is built in on the USB-TC01.

If you need to be able to find the correct Device ID at runtime you can use

int32 __CFUNC DAQmxGetSysDevNames(char *data, uInt32 bufferSize);

to get a list of the devices in the system.

Then you can use

int32 __CFUNC DAQmxGetDevProductType(const char device[], char *data, uInt32 bufferSize);

to see what type of device each is until you find the USB-TC01. 

Let me know if any of this was unclear or if you have more questions.

National Instruments
0 Kudos
Message 2 of 2
This is an open group. Sign in and click the "Join Group" button to become a group member and start posting.