The Analog Input Elemental I/O Node and the Analog Output Elemental I/O Node use double buffering, also known as ping-pong buffering, to achieve real-time data acquisition processing on DSP targets. Double buffering involves creating and using dual storage buffers of equal memory allocation for analog input and analog output.
When you run a DSP application that contains analog input or analog output, the DSP application initializes the DSP target to respond to interrupts at the sample rate you specify in the Elemental I/O Node Properties dialog box. Interrupt processing and foreground processing operate from these double buffers.
As the DSP interrupt processing on the DSP target acquires and generates new data, the Analog Input Elemental I/O Node and the Analog Output Elemental I/O Node sequentially store the data in one of the buffers, while the DSP foreground processing operates from the other buffer.
Because analog input on the DSP target is non-blocking, downstream foreground processing can occur. If you read from the analog input too fast, you receive old data that remains in the buffer. For example, if the buffer takes one second to fill 128 points and you read the data every .5 seconds, you only receive completely new data every other time. Use the AI Property Node to avoid reading old data again and to synchronize the analog input.
The analog output on the DSP target is blocking and does not allow further DSP foreground processing until the target hardware empties the current buffer. The DSP heap memory allocates the double buffer memory.
Double buffers allow you to process faster sample rates without losing data, but at the expense of a larger delay. The framesize determines the size of the double buffer. The size of one buffer is equal to the framesize you set in the Elemental I/O Node Properties dialog box. If the DSP target has stereo capability, the size of one buffer is equal to twice the framesize you set in the dialog box. For example, if you configure the framesize of an Analog Input Elemental I/O Node for 128 samples, the size of the double buffer is as follows:
![]() |
Tip Refer to the NI Developer Zone at ni.com for more information about how to implement blocking on an Analog Input Elemental I/O Node. |