Embedded Systems: Department of Electrical & Computer Engineering (College of Engineering) Wolaita Sodo University
Embedded Systems: Department of Electrical & Computer Engineering (College of Engineering) Wolaita Sodo University
Embedded Systems: Department of Electrical & Computer Engineering (College of Engineering) Wolaita Sodo University
A HANDBOOK
ON
EMBEDDED SYSTEMS
(FOR 5TH YEAR II SEMESTER CONTROL AND COMPUTER STREAM)
Prepared by
Dr. Parvendra Kumar
2
CHAPTER 1 INTRODUCTION
1.1 Why Study Embedded System
What is less familiar to many people is the idea that instead of putting a microprocessor in a general-
purpose computer, it can also be placed inside a product which has nothing to do with computing, like a
washing machine, toaster, or camera. The microprocessor is then customized to control that product. The
computer is there, inside the product; but it can’t be seen, and the user probably doesn’t even know it’s
there. Moreover, those addons which we normally associate with a computer, like a keyboard, screen, or
mouse, are also nowhere to be seen. We call such products embedded systems, because the microprocessor
that controls them is embedded right inside. Because such a microprocessor is developed to control the
device, in many cases, those used in embedded systems have different characteristics from the ones used in
more general purpose computing machines. We end up calling these embedded ones microcontrollers.
Though much less visible than their microprocessor cousins, microcontrollers sell in far greater volume, and
their impact has been enormous. To the electronic and system designer they offer huge opportunities.
Embedded systems come in many forms and guises. They are extremely common in the home, the
motor vehicle, and the workplace. Most modern domestic appliances, like a washing machine, dishwasher,
oven, central heating, and burglar alarm, are embedded systems. The motor car is full of them, in engine
management, security (for example, locking and antitheft devices), air-conditioning, brakes, radio, and so
on. They are found across industry and commerce, in machine control, factory automation, robotics,
electronic commerce, and office equipment. The list has almost no end, and it continues to grow.
The series of instructions is called a program, normally held in an area of memory called program memory.
This memory needs to be permanent. If it is, then the program is retained indefinitely, whether power is
applied or not, and it is ready to run as soon as power is applied. Memory like this, which keeps its contents
when power is removed, is called nonvolatile memory. The old fashioned name for this is ROM read only
memory. The data that the ALU works on may be drawn from the data memory, with the result placed there
after the calculation is complete. Usually this is temporary data.
This memory type therefore need not be permanent, although there is no harm if it is. Memory which loses
its contents when power is removed is called volatile memory. The old-fashioned name for this type of
memory is RAM random access memory.
3
One of the defining features of any computer is the size of its ALU. Simple old processors were 8-bit, and
some of that size still has useful roles to play. This means that, with their 8 bits, they can represent a number
between 0 and 255. (Check Appendix A if you’re unfamiliar with binary numbers.) More recent machines
are 32-bit or 64-bit. This gives them far greater processing power, but of course adds to their complexity.
The Microcontroller
A microcontroller takes the essential features of a computer as just described and adds to these the features
that are needed for it to perform its control functions. It’s useful to think of it as being made up of three
parts: core, memory, and peripherals, as shown in the block diagram of Fig. 1.5A. The core is the CPU and
its control circuitry. Alongside this goes the program and data memory. Finally, there are the peripherals.
These are the elements which distinguish a microcontroller from a microprocessor, for they are the elements
which allow the wide-ranging interaction with the outside world that the microcontroller needs. Peripherals
can include digital or analog IO, serial ports, timers, counters, and many other useful subsystems.
Using today’s wonderful semiconductor technology, the whole complex circuit of Fig. 1.5A is integrated
onto one IC. An example is shown in Fig. 1.5B.
A first step toward sanity in programming is called assembly language, or simply Assembler. In Assembler,
each instruction gets its own mnemonic, a little word which a human can remember and work with. The
instruction set is represented by a set of mnemonics. The program is then written in these mnemonics, plus
the bits of data which need to go with them. A computer program called a cross-assembler converts all those
mnemonics into the actual binary code that is loaded into program memory. Assembler has its uses, for one
it allows us to work very closely with the CPU capabilities; Assembler programs can therefore be very fast
and efficient. Yet it’s easy to make mistakes in Assembler and hard to find them, and the programming
process is time consuming.
A further step to programming sanity is to use a high level language (HLL). In this case we use a language
like C, Java, or Python to write the program, following the rules of that language. Then a computer program
called a compiler reads the program we have written and converts (compiles) that into a listing of
instructions from the instruction set.
4
In the early days of embedded systems, the microcontrollers were very simple, without on chip memory and
with few peripherals. It took a lot of effort just to design and build the hardware. Moreover, memory was
very limited, so programs had to be short. The main development effort was spent on hardware design and
programming consisted of writing rather simple programs in Assembler. Over the years, however, the
microcontrollers became more and more sophisticated, and memory much more plentiful. Many suppliers
started selling predesigned circuit boards containing the microcontroller and all associated circuitry. Where
these were used there was very little development effort needed for the hardware. Now attention could be
turned to writing complex and sophisticated programs, using all the memory which had become available.
This tends to be the situation we find ourselves in nowadays.