08-24-2006 12:25 PM
I'm looking for some example code to help me collect analog data to a buffer and then write a portion of the buffered data to a file when an event occurs. The event occurs about once a week but I need to be able to examine data from about 5 hours BEFORE the event up to the event itself. Collecting two points a second would be often enough to assure event capture. Dumping data older than 5 hours is ok. I've been through numerous forum discussions and online code examples but can't find the pieces to solve my problem. A search for "buffered event" seemed promising but didn't solve it. BTW I pretty new to LabView so far my knowledge of data structures is pretty limited. TIA
Bruce
08-24-2006 12:46 PM
08-25-2006 08:43 AM
08-29-2006 08:02 AM
08-29-2006 08:11 AM
Kevin, your postings are real gems!
The circular buffer you described as
"
"
was code I developed back in LV 6.0 and I have used in many projects since that time (sorry, no-can-post! I sell that critter).
LV would definatley benefit from having a native version available.
Ben
08-11-2009 07:12 AM
Hi,
I find your example very interesting but I don't understand everything... How can I define what kind of event I want to save?
For my application I need a scan rate of 300kHz. The voltage is more or less stable (due to the noise) and I have to record data when an event occurs. This one is a small variation in voltage. I want to record the values 10ms before the event until 10ms after the event and read continuously the data from the acquisition card in order to catch the following event.
My problem is I don't know where I can define the event. circular buffer is really new for me and even by reading the application note I don't understand everything....
thanks a lot for your help!
Sophie
PS: LV 8.2 and PCI-6281
08-11-2009 07:24 AM
Things have changed since then.
Rahter than write a round-robin buffer you can use queues.Queue up new data in the DAQ loop and let the logging function monitor the queue and maintain its most recent history in its own queue. As new updates come in to the logger, check the update for your trigger condition. if not found toss the oldest stuff in the logers private queue and add in the new update info. When a trigger is found in an update, go back and get the pre-trigger info from the loggers private queue etc.
Ben