This document has been archived and is no longer updated by your friends at NI.
The LabVIEW Embedded Module for ADI Blackfin Processors allows you to program the Analog Devices Blackfin Processor using LabVIEW. In many designs, the processor must monitor an external device for a signal, such as a push button press, and when that signal is received, some reaction is needed. In this document, we will discuss the two primary ways -- polling and callbacks -- you can use to respond to external signals in an embedded application.
Polling and callbacks are the two primary ways a processor responds to an external signal. With polling, the processor constantly monitors the signal and waits for a change. When a change is detected, the processor continues its execution and handles the change accordingly. The major benefit of using polling is that the application has the fastest possible response to the signal. However, polling requires that some of the processor's computation time be dedicated to the polling operation. Therefore, any additional operations that occur in parallel to the polling does not have full use of the processor.
With callbacks, also known as interrupts, the processor does not need to explicitly monitor the signal in the application. Instead, the application registers the signal with the embedded operating system, which for the Blackfin processor is the Visual DSP++ Kernel (VDK). When the OS detects the signal, the OS temporary halts the embedded application and executes an interrupt service routine (ISR). Once the ISR completes, the execution returns to the embedded application. The main benefit of using callbacks is that the main embedded application does not have to spend processor resources on monitoring a signal. Therefore, parallel applications are more efficient. However, callbacks do introduce a delay, or latency, between when the signal is detected and the corresponding reaction.
In general, if the application is performing a single task, or if minimizing latency is critical, polling is probably the most appropriate. If the application has many parallel operations or if latency is tolerable, callbacks are most suitable.