Electronic Design

Graphical Programming For Embedded Systems

I've always been a fan of pot pie. Why have a chicken breast, a side of mixed vegetables, and pie for dessert when you can just cram them all into one neat little package? Besides, if I eat pot pie for dinner, there's more room on my plate for cranberry sauce.

Technology appears to share my fondness for the elegance of pot pie. As cell phones metamorphose into media players, PDAs, and even high-definition TVs, the features required by the underlying processors begin to add up. Signal-processing tasks such as noise cancellation and modulation are combined with more general-purpose processing tasks like network connectivity.

To address these converging needs, the industry produced a new form of hybrid processor that combines the features of a DSP with the features of a general-purpose microprocessor. Analog Devices offers the Blackfin microprocessor, which the company has dubbed a ?convergent processor.? Meanwhile, Microchip offers its dsPIC, also called a ?Digital Signal Controller (DSC).? You say ?poh-tay-toe? and I say ?poh-tah-toe.? These are just two examples of single-core, multifunctional processors that address the diverse needs of today's technology.

As hardware evolves and becomes more streamlined, the development tools used to program these devices need to keep up. Traditionally, DSP programmers handled tasks like determining the proper coefficients for a Butterworth filter, while MCU programmers managed the Ethernet stack. To develop code for these new devices in C, developers must collaborate or hire one (probably expensive) über programmer to take the reins.

An alternative (and more cost-effective) option is to improve the programming tools and raise the level of abstraction by using a graphical development platform that makes these features more generally accessible to programmers. National Instruments' LabVIEW allows programmers to access hundreds of signal-processing blocks, like filters and transforms alongside blocks for proportional-integral differential control loops (PID) and motor control, network connectivity, and analog/digital I/O, while still offering a fully featured programming language.

Here's an example that uses the LabVIEW graphical programming environment to develop a Web-enabled recording device on an ADI Blackfin Processor. In this application, LabVIEW Embedded blends typical DSP tasks — interfacing with analog-to-digital converters and digital-to-analog converters (ADCs/DACs) and audio filtering — with the typical MPU task of network connectivity to implement a simple Web server.

In C, communicating with an ADC typically requires extensive driver development and testing. When dealing with high-quality audio sampling rates in the 48-kHz range, this involves hand-optimized interrupt service routines, buffer allocation and management, and DMA channel assignments and transfers — all over a low-level protocol like SPI or I2C .

With the LabVIEW Embedded Module for ADI Blackfin, however, National Instruments and Analog Devices developed LabVIEW component drivers for many of ADI's most popular converters. With these LabVIEW blocks, all low-level driver programming is handled behind the scenes. The programmer need only configure the key parameters like sampling rate and buffer size, and then read and write the data in a loop (Fig. 1).

Now that we've acquired the signal, we should filter out high-frequency noise and store it to some memory location. In C, you first will need to locate a signal-processing library, copy/download all required files, and include all necessary components in your application before you can use the IP. With LabVIEW, hundreds of signal-processing and analysis libraries are already included, many of which were hand-tuned and optimized for the ADI Blackfin processor (Fig. 2).

Writing to and reading from memory is easy in C — you can simply call a memcpy function. For situations like these in which it's easier to write a few lines of C code, LabVIEW Embedded provides the Inline C Node. This node offers a simple way to incorporate snippets of C code into your LabVIEW application (Fig. 3).

Finally, to control this application remotely, you will need to develop a simple Web server to provide a user interface. In C, this would require the building and/or management of the Ethernet stack. The embedded operating system often handles this on more general-purpose processors. But since DSCs typically run optimized microkernels that don't include Ethernet stacks, more development time (or more money) is needed to acquire or incorporate another solution. The LabVIEW Embedded Module for Blackfin includes TCP/IP and UDP blocks with an integrated Ethernet stack for easy networking (Fig. 4).

Graphical programming languages like LabVIEW handle the low-level programming details, relieving the programmer of the task. As the number of low-level details increases with more features, this proposition becomes more and more valuable. Who knows what delicious ingredients pot pies of the future might hold?

For more information on LabVIEW Embedded, visit www.ni.com/embedded.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.