This is the original version of an article which appeared in the December 2009 issue of Servo Magazine. The published (edited) version of the article was quite similar.
The article text gives an overview of some techniques for implementing different types of timing encountered in embedded systems. The included code examples give C code (ImageCraft) for implementing them. The code snippets are not complete, but are meant as a starting place for developing the kind of timing the user needs.