Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

problem with buffer while sending large volumes of data

Hello,

          I am using multifunction DAQ (NI-USB 6215)  two send a text file containing samples through two analog outputs(Ao0,Ao1) simultaneously. Also, i'm using an external clock for triggering. coming to the code, i try reading the text file to array( append the colums of the text file to an array of size 1x no.of columns). I repeat the same to make another array from my text file which is pretty much the same as previous. Now i use  build array.vi to build an array of size ( 2x no.of columns) from the above two arrays. this  array is then connected to DAQmx write.vi so that  the first row goes through the channel Ao0 and the second row  goes to Ao1. here's my problem. whenever i try to send large volumes of data i can see the error as "not enough memory to complete this operation" . what can i do to handle such large volumes of data? here i am attatching my code as wells as the text file. i would appreciate if you could suggest me how to do it or edit the code for me. thanks for the help. my text file is size around 60MB and not able to attatch it here. but i can say the text cotains rows and colums of of 0's and 1's.

 

Regards,

Raja
0 Kudos
Message 1 of 10
(4,423 Views)

Hi Raja,

 

You might want to try checking out the following link: Managing Large Data Sets in LabVIEW.  It looks like you might be creating unnecessary copies of your data.  LabVIEW requires a contiguous block of memory, so even though you may seemingly have enough memory available, you will run into problems if it is not continuous.  If you are still experiencing problems after reading through and following the steps in the above link, could you please post a screenshot of the error message you are receiving.  Thanks!

 

-John 

 

John Passiak
Message 2 of 10
(4,401 Views)

Hi john,

              Thanks for the link. it was helpul and i could solve my problem . I have one more issue now. I have two arrays of data that i placed in a for loop to write them to my DAQ such a way that for the first iternation the first column in both the arrays are written to my DAQ. this way i write all of my columns to DAQ as the iteration number reaches the Number of columns. it looks pretty good upto now. when i try to loop this ( like i want to send my first column again after i reach the last column and want this process to be done contiously until i stop manually) using a while loop, it executes the for loop inside for once and stops writing data to my DAQ. i can see the while loop executing many times but the for loop executes only once and i can see no output after the first iteration of my while loop. I hope u could understand better if you can look into the labview code which i am attaching here. Thanks john.

 

Regards,

Raja

0 Kudos
Message 3 of 10
(4,385 Views)

Hey Raja,

 

Have you tried running the vi with highlight execution turned on to see how the code is executing?  It seems like the for loop should run more than once--are you receiving any errors?  I made a simple code for a sanity check and it runs the for loop the desired 5 times for each iteration of the while loop:

 Sanity Check

Is the for loop executing several times the first while loop iteration, and then not at all afterwards?  This is my understanding of the behavior you are experiencing, but let me know if this is not the case.

 

Also, could you post a small example data file?  I'd like to see the way that you have the data formatted.  Thanks!

 

-John 

Message Edited by John P on 11-24-2008 11:29 AM
John Passiak
0 Kudos
Message 4 of 10
(4,342 Views)

Hi John,

              Here i attached the text data file i am using for my application. however, i deleted large part of the file but that's the way it looks like.  there are around 2200 rows and 500 columns. i run the for loop to write each column to the DAQ for each iteration. so for the first iteration the first column with 2200 samples are written to the DAQ and the process goes on till the for loop runs 500 times. now it comes out of the for loop and so i placed a while loop around it so that it restart the iterations from 1 (sending the first column) after it reaches 500 th iteration.but unfortunately i can see no data is written to DAQ after the 500th iteration thought it appears to be running the for loop again.

0 Kudos
Message 5 of 10
(4,338 Views)

Hi Raja,

I hope you had a happy Thanksgiving!  After looking at your code further, it seems that you have the DAQmx task configured in an unusual manner.  I'd imagine that you are receiving an error that is prevening the DAQmx write from generating, could you let me know the error code that you are receiving?  When I run the example on my computer I receive error -200288.  The error comes from the way that you have your trigger set up.  This example shows how you can perform a retriggerable analog output by using a dummy counter task.

 

What is the big picture of what you are trying to output?  It looks like you have some sort of external clock on PFI0 that you want to use for your analog output sample clock.  Is there a reason that you have set this line to be a trigger as well?  If I had a better understanding of what exactly you are trying to do I could come up with a better recommendation of how to set up your code.

 

-John 

John Passiak
0 Kudos
Message 6 of 10
(4,280 Views)

Hi john,

             what i am doing here is say i have two text files say A and B of same size (36000 rows X 400 columns). i now want to write the column 1 of file A to analog output of DAQ(1) say Ao0 and at the same time column 1 of B to Ao1. so for the first iteration of for loop, column 1 from both text files are written to my DAQ(1). As the iteration reaches to 400 all the columns are written to my DAQ(1). i am using an external clock for this VI at a rate 120Khz. this is all about the transmitter end. the two analog outputs are connceted to two analog inputs of another DAQ(2) to read the samples smultaneously that are transmitted. coming to the reciever end( DAQ2),  i try to read samples from the two channels say Ai1, A2 where the Ao0 of DAQ(1) is connected to Ai1 and Ao1 of DAQ(1) is connected Ai2. the number of samples per channel to be read is given 36000( since each column has 36000 samples ). the same clock which is used on transmitter side is used for recieving end. As i start sending the first colum it should read it (36000 samples) simultaneously for the synchronized clock for both transmitter and receiver. i need to complete this task by tomorrow. i would appreciate if you could call me so that i could solve it faster. my no. 575-405-9457. i will be working in the lab tomorrow from 10am (mountain time). Thanx john.

 

Regards,

Raja

0 Kudos
Message 7 of 10
(4,243 Views)

Hi Raja,

 

Sorry I was not able to get to this post sooner, if you have a support contract you should contact NI and open a service request number for immediate phone support should the need come up in the future.  In the meantime, here is a good example and tutorial regarding how to synchronize multiple devices using DAQmx. 


Using PFI0 for both the sample clock and the trigger would be essentially the same thing as not using a trigger at all (since the board only samples on sample clock edges anyway).  If the120 kHz sample clock is running continuously how can we be sure that the tasks are starting at the same time?  With a trigger source that is running at 120 kHz continuously the tasks will most likely not be synchronized (i.e. while one task is still initializing, the other one may be already waiting for the trigger). 

 

The easiest way to synchronize your boards would be to use a RTSI cable and use the appropriate example in the tutorial linked above.  If you do not have a RTSI cable, you can use a seperate line for the sample clock and trigger.  Use a signal you have more control over for the trigger (you can even export a trigger from one board's PFI line to another) so that you can ensure that both tasks are ready before sending the signal.

 

-John 

 

P.S. Are you receiving any error messages from the DAQmx write call?

John Passiak
Message 8 of 10
(4,200 Views)

thanks john. your idea of using seperates line for clock and trigger works well for me. Also the article links helped me alot. i have one more little problem and i'm how i could do that. here's what the problem is. As i said earlier. i'm sending a text file of around 250MB(400 code words). now, i want another text file(of same size) to be loaded and write this to DAQ immediately after my first is written completely to DAQ without a dealy.  acutally a single file of 800 codewords would solve my problem but unfortunately i only have two seperate text files of 400 codewords. Also,loading such a big file to LabVIEW is taking around 10-15secs. i appreciate if you have any suggestion for how to accomplish the task.

 

0 Kudos
Message 9 of 10
(4,171 Views)

Hi Raja,

 

Provided you have enough available memory, one way you could do this is to read from both of your files before beginning to output data.  The following example is based off of your original code, and should do what you need--it will accept an array of file names and go through each one, appending the data to your array. 

Read Multiple Files 

The function I added is "Build Array", from the Array pallette.  After you add it to your code, you need to expand the function down to include a second input.  Then, right-click on the function and select "concatenate inputs".  You will also need to add an array container on your front panel and drag the file path input inside to create the array of file paths.  Let me know how it goes!

 

-John

Message Edited by John P on 12-12-2008 11:20 AM
John Passiak
0 Kudos
Message 10 of 10
(4,158 Views)