How-to articles about the C programming language.

Assembly vs. C: Which is Best for Microcontrollers?

Given a particular programming problem, what language should you use to realize the solution? Your choice could very well affect the success or failure of the project. So you'd better choose wisely.

CRC Series, Part 3: CRC Implementation Code in C/C++

CRCs are among the best checksums available to detect and/or correct errors in communications transmissions. This article shows how to implement an efficient CRC in C or C++.

How to Use the C Preprocessor's #error Directive

 Printable PDF

One of the least used but potentially most useful features of the C preprocessor is the ANSI-specified #error directive. Here's a look at a couple of clever uses for #error that have proven invaluable in embedded software development.

The syntax of #error is very straightforward:

RS-485 Transmit Enable Signal Control

Quite a few embedded systems include multiple processors. Sometimes these processors stand in isolation, but more often they're required to communicate over a multidrop bus such as EIA RS-485 or RS-422.

How to Create Jump Tables via Function Pointer Arrays in C and C++

Jump tables, also called branch tables, are an efficient means of handling similar events in software. Here's a look at the use of arrays of function pointers in C/C++ as jump tables.

How to Choose an C Compiler for Embedded Systems

 Printable PDF

Let's face it, there's nothing sexy about the topic of cross compilers. Embedded programmers couldn't get the job done without one, but spend very little time thinking about how they work or how they could make our work easier.

Efficient C Code for 8-bit Microcontrollers

The 8051, 68HC11, and Microchip PIC are popular microcontrollers, but they aren't necessarily easy to program. This article shows how the use of ANSI C and compiler-specific constructs can help generate tighter code.