How-to articles about the C programming language.

How to Minimize Interrupt Service Routine (ISR) Overhead

With all the automation available today, it's easy for programmers to overlook costly overhead introduced into machine code by the compiler. Interrupt handlers are one key area worthy of a closer inspection.

The Perils of Preemptive Multitasking

 Printable PDF

Every commercial RTOS employs a priority-based preemptive scheduler. This despite the fact that real-time systems vary in their requirements and real-time scheduling doesn't have to be so uniform. Multitasking and meeting deadlines is certainly not a one-size-fits-all problem.

How to Use C's offsetof() Macro

C's offsetof() macro can be a helpful addition to your bag of tricks, including for packing data structures and describing how EEPROM data are stored.

Portable Fixed-Width Integers in C

For embedded software developers, the most significant improvements to the C programming language made in the ISO C99 standard update are in the new <stdint.h> header file. Learn the typedef names for the new fixed width integer data types, to make hardware interfacing in C easier. 

Add-Ons for Graphical User Interfaces (GUIs)

Printable PDF

Should you integrate a GUI into an embedded system by adding a dedicated processor or upgrading the existing one? Here are some options and trade-offs.

Introduction to Finite Impulse Response Filters for DSP

Finite impulse response (FIR) filters are the most popular type of filters implemented in software. This introduction will help you understand them both on a theoretical and a practical level.

Optimal C Constructs for 8051 Microcontrollers

The limitations of an 8-bit microcontroller (MCU) can sometimes make conventional C constructs produce suboptimal code. In this article we look at common problems on the 8051 family and discuss workarounds in C.

MISRA-C Guidelines for Safety Critical Software

In 1998, the UK's Motor Industry Software Reliability Association established a set of 127 guidelines for the use of C in safety-critical systems. Here's a look at the rules, what they mean, and how they can work for you.

How to Use Lint for Static Code Analysis

Language specifications, including those for C and C++, are often loosely written. A static analysis tool called lint can help you find dangerous and non-portable constructs in your code before your compiler turns them into run-time bugs.

How to Detect Memory Leaks

 Printable PDF

Memory leaks can be particularly risky for long-running embedded systems. Here are some tools to identify, track, and analyze memory leaks in embedded C and C++ programs.

Pages