Samples Per Channel Matter when Taking Continous Samples?
So noob question of the day. I have been playing around with the lightbulb feature. Anyways, I notice my array size is greater than my samples per channel input. Does the DAQmx sample clock even look at the samples per channel input when set to continous?
Did you check the help file for the DAQmx sample clock function?
"samples per channel specifies the number of samples to acquire or generate for each channel in the task if sample mode is Finite Samples. If sample mode is Continuous Samples, NI-DAQmx uses this value to determine the buffer size."
Similar Messages
-
Multiple channels acquisition and Number of samples per channel
Hi,
I'm a new labview user and I need some help in trasposing an old traditional NI-DAQ acquisition software in a NI-DAQ-mx one.
I followed the tutorial (#4342) but I found a problem with Analogue 2D DBL Multiple Channels Multiple Samples DAQmx Read Vi.
I'm trying to acquire 8 voltage signals from a NI-USB-6341 device. When the Number Of Samples Per Channel I set is below the number of channels (8), the software acquires only a number of channels equal to the number of samples per channel I set.
Is that a normal behaviour?
Thank you
DanieleThis is my code. The problem is the same with or without the code for the scan backlog indexing.
Tomorrow I will try with the code from the example.
Thank you
Daniele
Attachments:
acq code.jpg 119 KB -
Sample per channel and sample to read
Hello everybody
I am new in LABVIEW and I have some difficulties with something.
I don t know exactly what is the difference between the sample per channel et the sample to read. I believe knowing that the sample per channel is the size of the buffer which is more big than the sample rate but I don t know what is the sample to read.
I ve tested with different sample per channel and sample to read. Sometimes I have an error and sometimes know and I would like to know why. If you have any example for I understand better, it will be great.
I really need to understand this part for my project
Thank for your help
Romaric GIBERT
Solved!
Go to Solution.Hi Roro,
As you mentioned, when acquiring continuous samples you can specify the sample buffer size by placing a value at the input "samples per channel" on the timing vi. The "number of samples per channel" input on the read vi which automatically names a control/constant with "samples to read" specifies the number of samples you wish to pull out of the buffer in one go when reading multiple (N) samples. This link may provide a bit more clarification. I have also attached a good example from the NI example finder which you may find useful to explore. I'm assuming you are using the DAQmx driver set so please let me know if this is not the case, but the same principles should apply either way.
This therefore means when sampling at a given rate, you need to ensure you are pulling data out in big enough 'chunks' to prevent the buffer from overflowing (which may well be causing the error you are seeing). Conversely if your sampling rate is slow and your read vi is having to wait for the number of samples to read you specified to be available, it may throw a timeout error. You can avoid this by either increasing your sampling rate, reducing your samples to read or increasing the timeout specified at the read vi input (-1 means it will wait indefinitely).
Let me know if this helps and how you get on.
All the best.
Paul
http://www.paulharris.engineering
Attachments:
Cont Acq&Graph Voltage-Int Clk.vi 27 KB -
Sample clock vs sample per channel per second
Referring to this link http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/dbe7ac32661bcf9b86256ac000682154?OpenDocument
What's the difference between sample clock and sample per channel per second? Looks the same to me.The sample clock is the clock that sets the timebase for channel operations on the board. The samples per channel per second is the actual rate at which data can be transferred on a particular channel.
Alex A.
Applications Engineer -
how to use ni-6008 and build a four channel data acquisition at a rate of 250 samples per channel and display all the data in a waveform chart
Hi kdm,
please stick in one thread for the same topic!
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome -
Buffer size and samples per channel
I have a question regarding the allocation of the output buffer. I have
a digital I/O card PCI-6534 and I use the driver NI-DAQmx 7.4.0f0. I
would like to generate a digital output using different clock rates.
For example, I need to write 500 samples at 1000 samples per second and
other 500 samples at a rate of 10000 samples per second. the simplest
solution is to prepare two different waveforms, write the first one on
the buffer and generate the output. Then I can load the second waveform
on the buffer and generate the second output. In order to minimize the
delay between the two output sequences, I would like instead to write
the buffer once. I tried to set the buffer size to 1000, and the number
of samples per second to 500, but it doesn't work. There is a way to
set independently the buffer dimension and the number of samples which
have to be generated?I can post the whole thing but I'll talk a little about it. It's a producer consumer loop with a continuous analog input sample from external clock program in the producer loop. Right now the consumer loop has a simple write to spreadsheet VI in it but eventually I want to average each revolution (well, two since it's a four stroke but that's neither here nor there) of pressure traces and spit out a single curve.
The wiring is simple. I have a voltage supply feeding the encoder and the quadrature A input on PFI 8 of the 6212 DAQ. I also have the Z index plugged in but nothing else to it. The analog input is a BNC right to AI 0. I can make a diagram if you want one. I've scoped the rotary encoder output and it looks great, very square with small relative rise times.
Attachments:
Yanmar Program V2.vi 46 KB -
Fehler nach "Samples per Channel"
Hallo,
Ich verwende das cRIO System NI 9074 mit AD-Wandlermodul NI9239. Hier sollen Daten kontinuierlich gewandelt und anschließend gespeichert werden. Allerdings gehen hierbei immer nach einer Sampleanzahl von „Samples pro Channel“ Daten verloren. Dies wird auch im in LabVIEW angezeigten Graphen sichtbar. Bei einem Sinussignal am Eingang ist dann ein Sprung erkennbar.
Der Speicher des FIFOs ist großgenug, zumindest wird mit kein Überlauf angezeigt. Kann mir irgendjemand weiterhelfen?
jukr
P.S. Ich verwende LabVIEW 2010
Attachments:
FPGA.vi 77 KB
PC.vi 365 KBHi Jukr,
it is useful to write forum posts in english; you will get many more replies :-)
I don't expect the error to be caused by the measurement. Maybe there are some parts in the network streaming that are not stable enough?
Just have a look at the following example and compare it to your network connections. You might find it useful!
Reference Example for Streaming Data from FPGA to cRIO to Windows
If the example won't help you finding the error, please attach your project.
Have a nice day,
Stefan Egeler
NI Germany -
I am using the 6031E series board. The EXTMUX is setup to pulse on each convert pulse. While taking data, I am getting a pulse on the EXTMUX for each sample taken, and a pulse for each time the 6031E switches its own internal mux. Is there anyway to only have the EXTMUX line pulse ONLY when a sample is taken, and not when the internal mux switches?
If you are reading the DAQ-STC manual, the signal I am talking about is the EXTMUX. If you are reading the PCI E Series manuals, the signal I am talking about is called SCANCLK (just to make things easier to understand, I guess??). The EXTMUX is setup through the MITE, and will pulse after every convert signal. My problem is that it also pulses when the internal mux changes as well.
So (for simplicity), if I wanted 2 channels, with 5 samples on each channel, and a mux outside the card on each line, the EXTMUX signal would sync the external hardware with the card/software.
In theory I would expect 10 pulses on the EXTMUX/SCANCLK pin, but in reality I get 12 pulses. If I had 3 channels, 5 samples per channel, (Expected 15 pulses) I end up getting 18 pu
lses in reality. This throws off any kind of sync to the outside world. -
I am running a VI that samples 2 channels using the AI Sample Channel vi within a for loop (executing equal to the number of samples i require), i then calculate the difference between the channels. Within the for loop i use a chart to displays this difference in realtime.
On exiting the loop the data is converted to an array, which in turn i then convert to a waveform (using dT as 0.01 as an arbitary solution at the moment). The waveform is then compared to limits using the limit specs and limit testing vi's.
There is also other code displaying graphs from the previous iterations of the VI.
My question is how do i control the aquisition rat
e so that i know that the AI Sample Channel vi is sampling my data at a set rate (250Hz)?
I have tried to use some of the hardware timed exaples supplied by NI to no avail. They can't give me the single point output required within the initial for loop for the real-time display.
Any solutions welcome!!How about buffered acquisition? You can let your DAQCard acquire the number of samples you require instead of doing it with a FOR loop. Using a FOR loop means that you are software timed, which may as well be untimed since it's about as deterministic as the weather in Florida.
Look for the "Acquire N Scans.vi" example.
If you want to do this the RIGHT way, use continuous acquisition. Start your acquisition and keep doing AI Read in a loop. Also include your porcessing and display functions in the loop. Just make sure your loop runs fast enough to keep up with your acquisition. At 250 Hz, you should have no problem.
Dan Press
www.primetest.com -
Acquire, display, and write data at 50 samples per second
I have a vi running on a PXI which samples data using two 4220's (all 4 channels) and one 6031 (only 6channels). I am acquiring data at 100 samples per second, but only need to write the data out at 50 samples per second. The data needs to be displayed at a minimum of 10samples per second. The problem is that the VI can not get 50samples per second writen to the file, it writes about 20 to 30samples per second.
I dont know if the issue is displaying the data which is holding up the writing at 50samples per second or if it is something else in the VI. I have moved the writing of the data to the outside of the while loop, but this did not help enough to reach 50samples/sec.
Is it better to change the waveform data types to dynamic waveforms? Would this increase speed of operations?
Galen
Attachments:
ATM_FrictionTests_v1.2.vi 375 KBGalen,
Looking at your vi, I would recommend writing to your file in a different way. The function you are using is actually opening, writing, and then closing the file every time you call it. This greatly increases the amount of resources being used. Take a look at the Cont Acq to Spreadsheet File.vi example and note that the file is only being opened and closed once. The data is being written to the file during execution of the program, and then closed when the app is done running. The example is done in traditional DAQ but you should be able to do something similar with DAQmx. Try this and let me know if it helps.
Regards,
LA -
Set variable samples per chanel from counter
Hi, all. I have to set variable samples per chanel for sample clock. I want to take that samples from counter input with different number of edges for every second (different speed of metal plate). What can i do for that task? Is there a god example for this problem?
Thanks.Hi, GerdW. Thanks for reply. I want Sample Rate and Samples per Chanel to come from couter. CI is a metal plate with 52 tooth. The speed of metal plate is 500 cycles/min but it is not constant ( may be 490-520). For example rate of cycles is 500/60=8.33 cycles/sec. Rate of edges (tooth) is 8.33*52=433 edges/sec, but when speed goes over or under 500 the rate is different. How to put that variable samples in sample clock on AI?
P.S. Matlab script is to calculate max samples per chanel for mean function in while loop. In the picture control "Speed cycles/min" is that 500 cycles/min speed. I have to put in that control the variable rate of edges. Other solution is to set 1 sample per edge, but i have problem here to . -
Error -201402; how do you programmat​ically determine 'Samples per file' size
Error -201402 - The samples per file is not divisible by the file write size. The error also give a suggested value to use, which is helpful, and i have amended by code to suit this value.
I am writting to a tdms file in chunks, such as the first 2.5-5 seconds save the data (sampled at 1M samples per second per channel) to tdms files named initial.tdms, initial_0001.tdms (need to be able to split the files due large data size) then capture the remainder, such as 150 seconds of data (sampled at 1000 samples per second per channel) into a single file, remainder.tdms
Example Inputs to the vi will be:
Initial sampling rate = 1M
Initial acquire time = 2.5 seconds
Remainder sampling rate = 1000
Remainder acquire time = 150 seconds
What I want is to be able to programmatically set Logging.SampPerFile and maybe Logging.FileWriteSize to improve maintainablility and code reuse (I have a number of difference sequence patterns to generate/ capture.)
I am also developing this code on a debug system which may have a different hard drive volume sector size so need to be able to derive the FileWriteSize based on this value, but don't know how to get/view this hard drive info.
How do I go about this?
Cheers,
Helen
CLD, CTDThank you for your help.
The Get Volume Info does indeed give me the Sector Size, however i still had problems with working out what multiple of the sector size to use.
Based on "Samples per file - must be EVENLY divisible by the file write size" and "File write size - must be EVENLY divisible by the sector size" I have derived te following code snippet which ensures that the calculated SampPerFile is divisible by 4 (2 lots of evenly divisble by).
Whilst this appears to work I wonder if anyone could comment/ suggest any pitfalls etc.
Regards,
Helen
CLD, CTD -
Using 2 ni usb 9215 devices to sample 8 channels Simultaneous
Hi,
I Need to sample 8 channels Simultaneous using usb devices.
If i use 2 9215 ( 4 channels ) devices in a 9172 chassis i will get acctually 8 channels Simultaneous ?
Does the 2 devices use the same clock?
Is it realy Simultaneous ?I just want to be sure it is possible to have 8 samples Simultaneous before i buy the devices.
If you want to be sure, then don't trust me!
I suggest you call NI directly and when talking to the inside sales rep, ask them to let you talk to support so they can send you an e-mail stating if the operations you need are supported.
Ben
Ben Rayner
I am currently active on.. MainStream Preppers
Rayner's Ridge is under construction -
PCI-MIO-16E4: simultaneous or sequential sampling of channels??
I am using a PCI-MIO-16E4 board to sample
pressure transducers on four different channels. I can't seem to work
out from the literature whether this board samples all four channels
together, each scan, or if it samples them one at a time.
I am hoping it samples them simultaneously. Although the Labview
measurements manual definitely says "some" DAQs sample simultaneously,
it does not go on to explain which ones!
If it cannot sample simultaneously, then I guess the shortest period of
time between each of the four samples, is dictated by the 250,000
samples/sec rate of the board, ie 0.004 ms?? This amount of delay
might be ok, but I'd much rather be sampling all four at the same time. Anyone care to enlighten me?!
Thanks
TheoMatt, that's great, cheers for the explanation. I assume my calcs above
are right, so yes, the delay is very small. I'm actually measuring
variation of in-cylinder pressure in a four cyl diesel engine. The four
channels are read every half degree of engine rotation - you can
imagine that at any appreciable speed half a degree of rotation doesn't
take a very long time! So, short as the delay may be, i estimate that
the period of time to read four channels is over 15% of the scan
period, even at a fairly low speed ~ 1000rpm. I'd really like all
four channels to be read at exactly the beginning of each scan, but
since that clearly requires a different board, I don't think that's a
short term option!
On a related note, I seem to be having a very strange problem with how
the four channels are being written to the buffer - if I use the AI
Read vi to output what is written to the buffer each revolution, and
then output that to a spreadsheet or similar, I'd expect to see four
columns, one for each channel, each column being 720 elements long, for
the 720 half-degree pressure readings in each rev. BUT, for some
unknown reason, I am presented with 16 columns, with the first channel
data being duplicated four times, then the second, then the third and
fourth. However many of my channels I specify to read, the output is
always duplicated four times over, so reading three channels would
result in a 12 column output for example. I've checked the shaft
encoder output with scope and it's perfectly in line with the engine
(thought perhaps it was giving four times too many pulses per rev), and
I've experienced the same problem if I
use one of my own vi's or one of the NI examples, so I begin to wonder
if
this is something more deeply rooted with the DAQ? After all, what I'm
seeing in the output of the AI Read is just what is being taken from
the DAQ and written to the computer buffer, so it's hard to
believe this is a Labview/software problem...
Any thoughts??
thanks very much
Theo -
How to Extract the Freq List, Cycles per Freq and Samples per Cycles of sweep waveform
How to Extract the Freq List, Cycles per Freq and Samples per Cycles of sweep waveform
I want to extract the freqency distribution, cycles per freqency, and samples per cylce of swept waveform, in order to output the same of swept waveform with I have acquired by NI DAQ card, tks!
owen wan
Attachments:
Untitled 1.vi 2333 KBLook inside the palette called Signal Processing - Waveform measurements. There are a lot of functions here that you can use to get the information you desire. For instance, the Extract Tones function will output an array of clusters, with each cluster element giving the frequency, amplitude, and phase of the signal component. Go through the entire arry to see each frequency component of the complex waveform.
Also, in the Waveforms palette there is the Get Waveform Components function that will give you t0, dt, and Y components of the waveform. 1/dt should give you the sample rate. See attached VI.
- tbob
Inventor of the WORM Global
Attachments:
WfmInfo.vi 4658 KB
Maybe you are looking for
-
IPod won't hold charge anymore
Okay so I posted before under a bugmenot account, I didn't realize I wasn't logged into this one. Here is the deal with my iPod. I purchased my iPod on 01/07/07. I was trying to use my iPod with my laptop that uses Microsoft Vista. I installed iTunes
-
Hi dear sir/madam, I would like to put forward a problem before u that How to Implement a BADI in MIGO to give warning message if Document Date and Posting Date are not same..? I need bief description of the logic and an e
-
I can't hookup to my home Wi-Fi
Upon returning home from a recent 3-week trip, I couldn't hookup to my home Wi-Fi. In the past it's always hooked up automatically once I'm inside the house. I've input the correct password several times.....but no luck. Anyone else had this probl
-
Must resize Mail window to view some mail
I've been searching to see if anyone else has seen this problem, and if Apple is aware of it. There have been occasions when mail does not completely appear in the mail window. I believe it is always with HTML imbedded in it, but it could be more tha
-
Developer first name different from apple id
I have an apple id but when I use it to try enroll as a developer it does not use my correct first name when I log in.