Embedded Systems Building Blocks, Second Edition

This chapter provides you with an example on how to use some of the embedded systems building blocks described in this book. I decided to include this chapter early in the book to allow you to start using the code as soon as possible. Before getting into the sample code, I will describe some of the conventions I use throughout the book.
The sample code was compiled using the Borland International (now called Inprise) C/C++ compiler V4.51 and options were selected to generate code for an Intel/AMD 80186 processor (large memory model) although the compiler was also instructed to generate floating-point instructions. I realize that the 80186 doesn't have hardware assisted but most PCs nowadays contain at least a 80486 processor which has floating-point hardware. The code was actually run and tested on a 300 MHz Intel Pentium-II based PC which can be viewed as a super fast 80186 processor (at least for my purpose). I chose a PC as my target system for a number of reasons. First and foremost, it's a lot easier to test code on a PC than on any other embedded environment (i.e., evaluation board, emulator etc.) there are no EPROMs to burn, no downloads to EPROM emulators, CPU emulators, etc. You simply compile, link, and run. Second, the 80186 object code (Real Mode, Large Model) generated using the Borland C/C++ compiler is compatible with all 80x86 derivative processors from Intel or AMD.
Embedded Systems Building Blocks assumes the presence of a real-time kernel. For your convenience, I included a...