LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx saving data and rate

I have DAQ9178 + NI 9227. I want to measure continuous current on 4 channels and saving all data to excel file. I have main problem:

 

1. I set "sample rate" at DAQmx Timing, so I want just that number of samples per seconds to save on my excel file, but in my case this is not working correct. I don't know why?

 

Please see my attachments

_________________________
Rookie; LV 2011 on WIN 7
0 Kudos
Message 1 of 11
(3,634 Views)

Hi hlod,

 

"I set "sample rate" at DAQmx Timing, so I want just that number of samples"

Sample rate isn't the same as Number of Samples"...

Maybe you should also give a "samples per channel" value? Otherwise DAQmx will not know how many samples you actually want...

 

Then it's not useful to use a loop for a "Finite Samples" aquisition. You will receive your number of samples and that's it...

Also there are better ways to create a filepath:

check.png

Btw. a file suffix of "csv" would be more appropriate than "xls" in your case...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 11
(3,629 Views)

Ok I change

1.path

2.continuous samples at DAQmx timing block

3. change at DAQmx read block "numbers of samples" which I wire to "sample rate". Is this now correct? I have now problem with saving 2d array to 1d array string which I'm writing to .xls

 

See attachments

_________________________
Rookie; LV 2011 on WIN 7
0 Kudos
Message 3 of 11
(3,624 Views)

Hi hlod,

 

no idea, why you still convert your path to string and back...

 

"I have now problem with saving 2d array to 1d array string which I'm writing to .xls"

Yes, now you receive samples of 4 channels for a full second. You will have to change your saving routine to adaopt to this. Maybe you want to change the "header" columns too. A FOR loop might help:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 11
(3,620 Views)

hlod,

 

Several comments on your VI.

 

1)  You have set your 'Sample Mode' to finite.  This will configure the hardware to acquire only 'samples per channel' number of samples.  Since you haven't wired this, it will default to 1000.  I would recommend that you change 'sample mode' to be continuous.

 

2) I would not recommend using the NChan 1Samp version of DAQmx Read.  It is typically way more efficient to use an N Channel N Sample version, and to specify the 'number of samples per channel' input.  If you would like to save data every second, you'll need to set this to be equivalent to your sample rate.

 

3) You are specifying a sample clock rate that is greater than the 9227 is capable of.  From it's specification (see page 12 an 13),  "When using the internal master timebase of 12.8 MHz, the result is data rates of 50 kS/s, 25 kS/s, 16.667 kS/s, and so on down to 1.613 kS/s."  When I run your VI as is, I see DAQmx return error -200077.

 

Hope that helps,

Dan

Message 5 of 11
(3,614 Views)

I hope this will work now (picture), I will try on friday...

 

Capture.PNG

 

Must I still change anything ? (see attached .vi)

 

So max sample rate for NI 9227 is 50 kHz per channel, right ?

 

What's the value of internal resistor, is this 12,8 mOhm (page 17: http://www.ni.com/pdf/manuals/375101c.pdf ) ???

_________________________
Rookie; LV 2011 on WIN 7
0 Kudos
Message 6 of 11
(3,602 Views)

No.  Use this.  This fixes the build path function that you haven't fixed yet like it was suggested to you.

Message 7 of 11
(3,596 Views)

Dear hlod,

According to the manual:

"When using the internal master timebase
of 12.8 MHz, the result is data rates of 50 kS/s, 25 kS/s, 16.667 kS/s,
and so on down to 1.613 kS/s, depending on the value of n.So 50 kS/s is the highest possible with internal timebase."

also

"Input impedance (AI+ to AI–) ..........12mΩ"

If you have further questions please don't hesitate to ask.

 

Sincerely,

Tamas Roman

0 Kudos
Message 8 of 11
(3,576 Views)

Well still not working. I have 4 channels and with "for loop" have problems with writing to spreadsheet file...

 

So I choose to not use "for loop" (se attachments). This code is working all ok, but just for frequency 1Hz, if I choose 2 or more, it goes to 2d array and having problems with writing to spreadsheet file.

 

Any advice?

 

 

_________________________
Rookie; LV 2011 on WIN 7
0 Kudos
Message 9 of 11
(3,527 Views)

Any idea?

_________________________
Rookie; LV 2011 on WIN 7
0 Kudos
Message 10 of 11
(3,506 Views)