Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

C++ program to read temperatures from NI cDAQmx-9191

I'm also not sure where the actual temperature readings from the thermocouple is stored in this program. The Read in the example looks like this:

 

int32       error=0;
    char        errBuff[2048]={'\0'};
    static int  totalRead=0;
    int32       read=0;
    float64     data[1000];

 

DAQmxErrChk (DAQmxReadAnalogF64(taskHandle,-1,10.0,DAQmx_Val_GroupByScanNumber,data,1000,&read,NULL));
    if( read>0 ) {
        printf("Acquired %d samples. Total %d\r",read,totalRead+=read);
        fflush(stdout);
    }

 

Are the temperatures being stored in the data array? I tried printing the first element (data[0]) but it comes out as a very large number, I'm sure if this number is supposed to represent the temperature in some way.

0 Kudos
Message 11 of 12
(1,693 Views)

Hi TimCast,

 

To verify if you are getting correct measurements, you can use NI MAX and create a task on it. The following link will show you how to do it.

http://www.ni.com/getting-started/set-up-hardware/data-acquisition/thermocouples

 

I also want to show you the article that can guide you a little more with Text Based DAQmx examples. In here, you should be able to select which Text Based Language you are using and understand better the coding for them.

http://www.ni.com/example/6999/en/

 

Luis C.

National Instruments

0 Kudos
Message 12 of 12
(1,681 Views)