02-06-2008 12:51 PM
02-06-2008 02:55 PM
02-06-2008 03:26 PM
02-07-2008 08:29 AM
02-07-2008 09:26 AM
02-07-2008 10:31 AM
Circular buffer is a common efficient implementation of a data buffer.
init - allocate array of size N set write index I to 0
to update data with new sub array of size M
if N-M is Greater than I-> Replace subset starting at I then update I=I+M % N where % is modulus operation
If N-M is Less than I relpace the subset of the new data from 0 to N-M at index I and then replace the rest starting at I=0.
This acts like a circular array where you do not have to change your memory allocation and works for valuse where the update array is less then the buffer size N.
You can also use queues and set a max queue size (= samples/20 seconds * number of reads/set) this is less efficient but easier to implement since it is already done.
Paul
02-07-2008 02:24 PM
Hi,
Depending on which memory option you have it may be possible to set up a single record acquisition and use 100% pretrigger samples such that your entire acquisition will consist of the samples acquired before the trigger is sent, using the formula: [(Record length* × 2† × number of enabled channels) + 480‡] rounded up to nearest 128 bytes, which is found in the NI-5105 specifications document page 15/24. Using one channel you will need about 41Mb of on board memory to accommodate this. For more information on setting up this acquisition I suggest looking at this knowledgebase entry, as well as the examples which can be found at Start>> All Programs>> National Instruments>>NI-Scope>> Examples I suggest the niScope EX Configured Acquisition.vi which details the basic program flow for setting up a trigger. I hope this helps!!!
02-07-2008 09:37 PM