Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Does the polling fast enough

Solved!
Go to solution

>There's no data lost as long as you acquire in continuous sample mode, since all data will be kept on the module before sending to PC.

But 9239 and 9162 seems not have memory or FIFO, at least 9239.

If the data from the module will be saved in the PC's memory, can I increase the size of the memory to get safer.

0 Kudos
Message 11 of 19
(2,075 Views)

By using the attached vi.

 

1) Try to set buffer as 5M, is it valid?

 

2)Try to pull out the data as soon as possible in the upside loop. Hw to control the read rate for DAQmx Read?

 

3) If I make a general file open operation in win xp, sill found the pull out loop will be slow down and almost will lost the data. Any suggestion?

 

4) In the upside loop, why can only read 250 samples out display by the graph.

 

Thanks.

Message Edited by turbot on 01-14-2009 01:49 AM
0 Kudos
Message 12 of 19
(2,072 Views)

Hi Turbot,

 

1. It doesn't make any sense to increase PC memory. The maximum data size you kept is 4Bytes*12s*4ch*50kS/s=9.6MB which is very small for nowadays PC.

2. 5MS is not valid, since it's too large. By default, the input buffer size is twice of sampling rate. Therefore, you can hold sample on modules for two seconds without over written, and you don't need to set this buffer size. I don't see any benefit from setting it in your application.

3. Read rate is the loop rate that you read the data.

4. I don't know how do you use file open, but if you streaming data to file by open it outside the loop, just read/write in the loop, and close it after finish the loop, that could help  a lot. Another thing is writing it to binary instead of text file, since it can cut the processor time for transforming between text and numeric.

5. I don't see you use any graphs in upper loop.

6. You don't need to set samples to read on DAQmx Timing, but you should set number of samples to read between 12.5-25k instead of -1 in DAQmx Read.

 

Regards, Kate

Message 13 of 19
(2,067 Views)

>1. It doesn't make any sense to increase PC memory. The maximum data size you kept is 4Bytes*12s*4ch*50kS/s=9.6MB which is very small for nowadays PC.

 

I donot mean to increase the  PC's physical memory, but to increase the buffer size in PC's memory.

 

>2. 5MS is not valid, since it's too large. By default, the input buffer size is twice of sampling rate. Therefore, you can hold sample on modules for two seconds without over written, and you don't need to set this buffer size. I don't see any benefit from setting it in your application

 

By default, the sampling rate is 50k, so the buffer size is 100k. For 1 ch, it can hold 2 seconds data. But now 4 ch collect data simultaneously, so now can only hold 0.5 second data, right? If windows do some application and take some time, there will be a risk.

To gurantee no data lost, I need a buffer of 9.6MB. I just wonder the function to change buffer size is valid for usb device(9239+9162) or not?

 

Thanks for your suggestion of file storage.

 

>6. You don't need to set samples to read on DAQmx Timing, but you should set number of samples to read between 12.5-25k instead of -1 in DAQmx Read.

What does -1 means? Does it means read as much as possible. If so, is it better. I also set the upper loop pull asap.

 

Attached is my updated program, do you think there will be data lost?

 

Also, you said if not read data out in time, the read function of DAQmx will give an error for index of time out. But when I run in debug mode, which is very slow, still no error as the screenshot. Does it mean it not work or buffer in PC can auto increase.

Message Edited by turbot on 01-14-2009 10:12 PM
Download All
0 Kudos
Message 14 of 19
(2,052 Views)

Hi Torbot,

 

1. Buffer is on module only, and as I told you, you only need ~10MB memory.

2. No, buffer is separate for each channel, and you cannot use module buffer to keep that large data. Every loop you acquire data, data is transferred to PC memory already, and you've to append this data to array manually to keep it on PC memory.

6. Press CtrL+H to open context help, and point your cursor to a vi you wish to know how it works. Click on detailed help to see detailed of each input/output. -1 means read all data available in buffer. However, I remember that I gave you an example to achieve what you're trying to do sometimes ago. Have you tried it? I don't think your code is work, since I've not seen it append data to array every loop until threshold is reach. I think you've not found an error while high light executioning because you read all data on buffer, and there's nothing left to over-written. I recommend you to refer to Help>>Find Examples>>Hardware Input and Output>>DAQmx>>Analog Measurements>>Voltage, and refer to those examples begin with Cont Acq, they show you how to write program for continuous acquisition. I also recommend you to study an example I gave you previously so that you can understand how to achieve your task. It doesn't write for 4 channels, but you must study it, and modify by yourself.

 

Regards, Kate

Message 15 of 19
(2,041 Views)

Thanks. 

 

1. The specs of 9239 said '0 sample on-board memory', and no info of 9162 on board memory. May I confirm how much buffer on them.

 

2. May I double confirm each CH on 9239 has 100k memory.

 

3. When using the 'DAQmx Read' function, it reads data from buffer in hardware module or from PC's memory?

 

4. Reading the given sample and help in details, thanks, I am learning from it. Actually my job is to capture 12s data triggered by a voltage threshold.

 

5. Just want to learn the reason why not pull data asap but with 25-50% of sampling rate.

 

6. > I think you've not found an error while high light executioning because you read all data on buffer, and there's nothing left to over-written.

Assume the buffer on hardware module for 1CH is 100k, but from the screenshot, it read out more than that. So how does it store the data before reading.

 

7. All the samples from help using timeout in DAQmx Read function. But it was set to 10s. How does it work by such long value.

 

Thanks.

0 Kudos
Message 16 of 19
(2,034 Views)

Hi Turbot,

 

1. 9162 just transfer a data. You don't need to worry about it, since you cannot do anything with it anyway. For 9239 on-board memory, please refer to http://digital.ni.com/public.nsf/allkb/0C639C970487D4D2862572F200043B97?OpenDocument on how to determine it.

2. See #1.

3. Module.

5. If you pull data too less, left data is kept on module, and over flow later. If you pull too much, you have to wait for a longer period to grab desired data size.

6. See #1.

7. If all desired samples to read is not available in 10 secs, error shots.

 

Regards, Kate

Message 17 of 19
(2,025 Views)

Thanks,

 

By using the method from reference, the buffer for CH 1 to 4 is 1000k, 500k, 500k and 500k.

 

Refer to http://digital.ni.com/public.nsf/allkb/A224DA0551EEA073862574F60060AB6F, the 'DAQmx Read' is read data from PC buffer. As soon as the 'DAQmx start task' run, the driver will keep transfer data from FIFO buffer to PC buffer automatically. As the screenshot, I tried to set a delay before 1st DAQmx Read. If it is over 20s, the first read will generate a overwrite error. If I decrease the delay time, or increase the PC buffer over 1000K, the error will gone. But 50k x 20s x 4CH >1000K, :(, unless 1000k is for 1 CH only in PC memory.

0 Kudos
Message 18 of 19
(2,012 Views)

Hi Turbot,

 

Concerning about buffer does not and will never help anything.

 You'll never achieve what you wish by playing around with buffer.

The only way to achieve what you wish is appending data to an array to keep it until threshold is reach.

You must go back to study an example I gave, and modify it for 4 channels.

You may modify it to use queue, if one loop is not fast enough.

 

Regards, Kate

Message 19 of 19
(2,008 Views)