05-04-2011 04:09 PM
I am having issues trying to access the circular buffer that is being filled and overwritten when my task is waiting for a trigger. I am essentially trying to replicate some of the functionality that matlab provides in its Data Acquisition Toolbox. The function I am attempting to recreate is matlab's peekdata function which "peeks" at the task's buffer and pulls out a certain number of samples without removing them from the buffer. My principle engineer is requiring me to use matlab to do all data acquisition. So essentially I am loading in the DAQmx libraries and making calls to the functions I would use if I was to create a .VI. I have no problem getting any of this to work. My issue comes in when we do data acquisition runs in our facility, it is critical to monitor the data as well as log the data. We have multiple data acquisition devices that all use an external sampling clock and trigger pulse that synchronize our systems. Currently I use a start trigger and a reference trigger (stop trigger). The start trigger I assign is essentially nothing other than beginning pretrigger samples. The reference trigger I am using is my external trigger between all my systems. Since I assign this as a reference trigger I have a way for determining the number of samples I need to presample and post sample with respect to this trigger. This allows me to log all information I need but does not allow me to access any of the information until the reference trigger is recieved. This eliminates my critical capability of monitoring the signals in our facility.
I have an easy solution, wire my external trigger to an unused analog input voltage and manually start and stop my acquisition while using a continuous acquisition flow. I can now look at what instant in time my trigger happened and reference the rest of my signals around that trigger. This continuous acquisition allows me to view whenever I feel like it a certain number of samples. This is easy but not satisfying for me. I assume there is some way to access the circular buffer. I was wondering if there are examples or anyone with more expertise that is capable of helping. Since I have no issues with code or vi's I do not think it is real pertinent to post any code or vi's. If it would be helpful I can make up vi's to show what I am currently doing, or I can post matlab code to show what I am currently doing though. The vi's would be very similar to example vi's that is included in the LabVIEW developer suite. Continuous Log and Read Data using TDMS is essentially what I am doing with a few modifications. Thanks in advance.
05-06-2011 11:36 AM
Hello ktklabtech,
Thank you for the complete description, I think I have an idea of your overall situation. I took a look at the TDMS streaming cont log and read data example you referenced, are you also using the Nchannel read option? Any key differences? Are you working with any cards that have a counter not in use that we could configure to be a trigger along any unused channel? Also, have you checked out our community example section? Here's one regarding circular buffers and a possible producer consumer architecture example at the bottom of this knowledge base article.
Thank you,
Deborah Y.
06-01-2011 11:33 AM
Thanks for getting back, I apologize for not responding quicker. I do have a counter not in use and it looks like I may be taking that road to get this to work how I would like it. I am using the Nchannel read option. Currently I am working on a few other projects related to this one so I will have to get back to you on whether or not I finally get this to work. I will take a look at the links you posted to see if I can achieve my desired operation using one of those two options. Thanks again.
06-02-2011 11:03 AM
Hello ktklabtech,
I appreciate the update, please let us know how the suggestions work when you get a chance to try them out.
Regards,
Deborah Y.