Digital I/O devices often use multiple megabytes of onboard memory to acquire and generate data. Onboard memory allows much higher data rates than streaming from system memory across a communication bus, like the PCI bus. In general, acquisition memory and generation memory are separate; for example, a 64 MS device has two 64 MS memory blocks - one for acquisition and one for generation.
Waveforms and scripts are stored together in device memory. They are stored in contiguous blocks, appearing in memory in the order they were written to the device. You can delete individual waveforms from the device, freeing up the space they occupy for other waveforms to be written.
Deleting waveforms that are not at the end of the used space causes memory fragmentation. The following scenario demonstrates how memory fragmentation can occur. First, assume four waveforms are currently in memory as shown in the following figure (sizes, in megasamples, are shown for clarity).
In the previous figure, there is enough memory to write an additional 22 MS waveform to the device. If Waveform C is deleted, that memory is freed, as shown in the following figure.
However, because waveforms are always stored contiguously in memory, the largest waveform that can be stored in memory is still 22 MS. Writing Waveform C last would have been advantageous because deleting Waveform C would have created a single block of free space, as shown in the following figure.
In this situation, you can write a 37 MS waveform to your device. Notice that when you create a script for your dynamic generation operation, it consumes some space in memory, as shown in the following figure.
When you initiate an acquisition operation, the device begins waiting for the start trigger. Once the start trigger is received, the device begins acquiring data and storing the samples into device memory. The first sample acquired marks the beginning of the acquired record, as shown in the following figure.
If no start trigger has been configured, acquisition begins immediately after the operation is initiated. After the device has recognized the start trigger and has acquired the configured number of pretrigger samples, the device can now recognize a reference trigger. While waiting for the reference trigger, the device is still sampling data into the device memory. If the record overflows, the newest samples overwrite the oldest samples in the record. After it receives the reference trigger, the device acquires enough posttrigger samples and finishes the acquisition, as shown in the following figure.
If no reference trigger has been configured, a single record of data is acquired.
You also can fetch data acquired between the start trigger and the first pretrigger sample. The following figure shows the four common fetch positions.
In cases where no reference trigger has been configured, the first pretrigger sample and reference trigger are equivalent to the first sample.
In the case of multirecord acquisitions, the advance trigger initiates the acquisition or fetch operation for the second and all subsequent records. Therefore, for multirecord acquisitions, the start trigger shown in the previous figures is replaced by an advance trigger for all records after the initial one.
Customers interested in this topic were also interested in the following NI products:
For the complete list of tutorials, return to the NI Measurement Fundamentals main page.