Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Can't read voltage with C/C++ examples...

Dear All

I am using the DAQ-Card PCI6024E. I am trying to make a voltage read by the example code (C/C++)but i don't manage to.When i run the .exe file that is created after compiling the example of continuous voltage acquisition using the internal clock of the card, it returns the number of samples taken, and the "Total number" which is continuing increasing until i press stop (with Enter key). The thing is that the program doesn't return the value of the voltage...Shouldn't it? Should i add something at the code?

Chris
0 Kudos
Message 1 of 7
(8,364 Views)
hello chris,

could you specify, which example you use?

kind regards,

robert h
0 Kudos
Message 2 of 7
(8,353 Views)
Dear Robert,

I am trying to use the "Cont Acq-Int Clk" example. This example in C/C++ is supposed to make voltage measurement continuously until the user presses stop, by using the internal clock of the card. I am compiling it through the MS-Visual Studio.

Chris
0 Kudos
Message 3 of 7
(8,324 Views)
hello chris,

in this example there is only an output for the number of acquired samples.
the data is stored in the variable "float64 data[1000]" by the DAQmxReadAnalogF64() function.

if you want to print the data to the console, you must add an additional printf() or put it into the already existent one.

kind regards,

robert
0 Kudos
Message 4 of 7
(8,320 Views)
The thing is that when i tried to put it inside the printf(), (printf("Acquired %d samples. Total %d\r, Voltage = %d",read,totalRead+=read,data);), only received 0 value. I am sure that the computer can see the card because i make measurements by the MAX. I know that i must put the data somewhere else but after the printf() there is fflush(stdout)that erases the values...

Chris
0 Kudos
Message 5 of 7
(8,315 Views)
hey chris,

if i put this:
printf("Acquired %d samples. Total %d; Value 0: %.3f\r",read,totalRead+=read, data[0]);

i can see the first measured value in the data array.
the data will be valid as long as the program stays in the callbackfunction.

you must process the data or i.e. write it to a file,

kind regards,

robert
0 Kudos
Message 6 of 7
(8,296 Views)
Thanx a lot! Really helpful advice!

Chris
0 Kudos
Message 7 of 7
(8,293 Views)