Acquiring Data Continuously
- Updated2023-09-20
- 4 minute(s) read
Acquiring Data Continuously
Continuous acquisition is the ability to transfer data from the digitizer to the host computer memory while the digitizer is still acquiring data, which can be useful for the following applications:
- Acquiring records larger than available memory
- Fetching triggered records while other records are being acquired
- Acquiring more records than fit in digitizer memory
- Fetching the most recent data
- Acquiring waveforms at hardware-timed intervals
How Continuous Acquisition Works
NI digitizers contain a large amount of onboard memory, generally 8, 16, 32, or 256 MB per channel. This memory is divided into individual records when acquiring data. For example, if you are acquiring two records, 8 MB of memory is divided into two 4 MB records. Each record is treated as a circular buffer. When the digitizer starts acquiring data, the samples are placed in the beginning of the buffer. The digitizer acquires the requested number of pretrigger samples—that is, the actual record length times the reference position divided by 100. After the pretrigger samples are complete, the digitizer waits for a trigger. While waiting, the digitizer continues to acquire and store data. This data is placed in the circular buffer, so after the buffer is filled, the digitizer starts overwriting data at the beginning. If a trigger never occurs, the digitizer waits for a trigger forever. After the trigger occurs, the digitizer samples the requested number of posttrigger samples, and the record is complete. If another record is requested, the digitizer restarts the acquisition, moving to the next record in memory.
Continuous acquisition refers to the digitizer's ability to fetch data from its own circular buffer to the host computer's memory while it is acquiring data. When you call Initiate Acquisition, the digitizer starts acquiring data into its circular buffer, as shown in the following figure.
You can then use a Fetch function to send the first chunk of data to the host computer while the digitizer continues to acquire more samples, as shown in the following figure.
When the circular buffer is filled on the digitizer, it starts to overwrite the data at the beginning of the buffer, as shown in the following figure.
Ideally, you have already copied and saved the data that is being overwritten in the host computer.
If you do not send a trigger, the digitizer continues to acquire data forever or until you call Abort, Reset, or Close.
Fetching Continuous Acquisition Data
No special configuration is necessary for continuous acquisition programs. The only difference is how the data is fetched. The Fetch functions all work for continuous acquisition, but additional attributes are available to specify what data to fetch. In particular, the Fetch Relative To attribute supports values of Read Pointer, Now, and Start in addition to the standard Trigger and Pretrigger values. These values allow specifying different locations within the record from which to start fetching. When fetching data continuously, the possibility always exists that the data has been overwritten in the onboard memory before you attempt to fetch it. NI-SCOPE returns an error in this situation.
When fetching data continuously, the relative initial x value returned in the waveform info structure is not valid until the trigger occurs. Often, the trigger never occurs during continuous acquisitions. However, the waveform info structure also contains an absolute initial x value, which is a free-running timestamp counter on the digitizer. Additional status information about your acquisition is available by using the Fetch Points Done and Fetch Records Done attributes. The points done is the number of samples available in the record specified by the Fetch Record Number attribute, starting at the Fetch Offset attribute that is relative to the Fetch Relative To attribute. NI-SCOPE also supports a Fetch Backlog attribute, which is the number of samples that have not been fetched when performing a continuous acquisition.