Page 138 - Embedded Microprocessor Systems Real World Design
P. 138
Software Design 4
Some will be surprised that this chapter is shorter than the hardware chapters.
However, this one chapter cannot be a complete course on software development
any more than the hardware chapters can be a course on logic design. The goal of
this chapter is to present some basic software concepts while concentrating on the
embedded environment. I have tried to leave general software concepts to the
books written for that purpose, except where those concepts have a unique bearing
on embedded design.
As I mentioned in Chapter 1, software for embedded systems has different
requirements from software running on a PC or workstation. Computer users will
not even notice if your software takes a few tens of milliseconds to respond when
they press a key. However, if the electronic ignition in their car delays firing the
spark plugs by the same amount, they will be very upset as the car stutters to a stop
alongside the interstate. Embedded systems work in real time.
Likewise, when users use their microwave, they do not want to see a message
telling them that thawing the meat requires installation of an additional 32MB of
memory. Embedded systems are self-contained, with memory and other resource
limitations. Software for embedded systems must work within these constraints, and
that is what sets it apart from the software in a PC.
As I mentioned in Chapter 1, there are a number of ways to document software
for an embedded system. The one unforgivable crime is to leave undocumented
code behind you. The level of documentation required depends on the customer
and the complexity of the system.
Before going into the various documentation methods, I want to give you some
background on the pool timer software, which will be used for illustration through-
out this chapter. The pool timer software has a polling loop and a chunk of code
that processes the 250Hz timer interrupt. The timer code will be examined more
closely in the chapter on interrupts. For now, think of it as a “black box” that passes
certain information to the rest of the code.
The polling loop exists in some form in nearly all embedded systems (systems
that use an RTOS are an exception and will be covered in a later chapter).
119