Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

application with visual studio

Hey /X\au|2()

As an example, I just ran the example Filippo mentioned above to acquire multiple channels from my NI PCI-6251 M-Series DAQ card using the notation "Dev1/ai0,Dev1/ai1" without the quotations and it worked perfectly. Have you tried opening just the shipping example without modifying the code and tried to acquire from multiple channels? What was the verdict?

Is it producing an error message if you type "Dev1/ai0,Dev1/ai1" in your Physical Channel? Does it continue to acquire but only show 1 channel? If you are able to get the simple shipping example to work properly, then it may help you when looking at your own application for any discrepancies.

Let us know! Good Luck!

Jordan Randall
National Instruments Italy
0 Kudos
Message 11 of 16
(1,771 Views)
Well...My application is C based, so I can't  specify a constant string without  quotations: it will generate a sintax error (at compilation time)
Bytheway if sintax for PhysicalChannel was wrong, it would be returned an error by DAQmx functions; I mean that if I put PhysicalChannel = "MyDog" I'd get a DAQmx error.
About the shipped example, I started from it!
Anyway I'll try to monitor data coming from that example....

thank you again....

my regards

/X\au|2()

0 Kudos
Message 12 of 16
(1,765 Views)
Ok, I started again from the example you suggested to me: ContAcq_IntClk.c
First of all, I found it also in this web site (example) and I read that there is no USB-6215 (my card) in Hardware Model Required
I didn't care about it, because the example works fine without any change.
Then made 2 simple things:
1) I modified the call to DAQmxCreateAIVoltageChan changing "Dev1/ai0" to "Dev1/ai0,Dev1/ai1"
2) I modified the call to DAQmxCfgSampClkTiming multiplying sample frequency by 2 (of course!)
3) I wrote incoming data to a text file with the following code in EveryNCallback function (just after DAQmxReadAnalogF64 call)
       for(i=0; i<read; i+=2){
          fprintf(out, "%f\t%f\n", data[i], data[i+1]);
       }
I did the same acquiring from one channel only and then I imported output files into Excel sheet.
I got the following graph:


The magenta line looks fine (acquisition of 1 channel)
The blue line is one of the 2 acquired channel, same analog shape as input.

I tested my USB-6215 with LabView too and I had not this problem, with LabView everything seems to work fine.

Why this difference?





0 Kudos
Message 13 of 16
(1,751 Views)
It looks like you're using event callbacks in order to acquire your data.
I hope this other example, closer to your application may help you.
 
Besides there are a couple of things I would like to point out hoping to give you better help.
In your code you double the sampling frequency, I'm not sure but It looks like you are doing so because you want to acquire 2 channels.
Actually multiplying the sampling freqency by the number of channels is not needed, for it's the daqmx driver itself that manages the clock knowing how many channels are needed.
If this is the case you are acquiring both your channels at 500Hz (250*2) and this can be misleading if you believe your acquisition is performed at 250 Hz
 
Maybe you can find this KB useful, it explains how Convert clock is determined by daqmx drivers.
 
Best Regards
 
 
 
 
FiloP
It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong.
Richard P. Feynman
0 Kudos
Message 14 of 16
(1,704 Views)
Hello!
At the end I found where I put my errors (I was sure I was wrong! Smiley Wink).
It's ok to setup 250 Hz if I want to sample at 250 sample/second.
My mistake was in reading from the board. Infact I understood that I have to specify that I want to be notified every (for example) 100 samples, but 100 is not the true size of the buffer, that is I have to read 100*numChans. It was simple, but now that I solved the problem!
Anyway thank you very much for your precious help.....thank you again!

/X\au|2()

0 Kudos
Message 15 of 16
(1,691 Views)

Glad to see everything is working.

Have a great week!

Jordan Randall
National Instruments Italy
0 Kudos
Message 16 of 16
(1,686 Views)