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:
- Create a task
- Create a virtual channel and add it to the task
- 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;
// 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.