a different assembly language every time a new processor is to be used. Thirdly, in general, it
is difficult to maintain a program written using the assembly language.
Although the assembly language is still in use in some real-time applications, nowadays
most applications are developed using a high-level language, such as BASIC, C, C++, C#, Vi-
sual BASIC, PASCAL, JAVA, and so on. Perhaps the greatest advantage of the high- level lan-
guages is the ease of learning and fast program development. Large and complex programs
can be developed in much shorter times compared to the assembly language. For example, to
write a piece of assembly language program code to multiply two floating point numbers can
take several hours or even more time and mistakes can easily be made. On the other han d,
using a high-level language we just multiply the two numbers. Additionally, it is much easier
to maintain a program written using a high-level language. High-level languages also have
the benefit that in general the same user program can easily be transported to work on a dif-
ferent processor with little or no modifications. High-level languages are supported by large
number of built-in libraries that make it easy to develop very complex program s in relatively
short times. Finally, another advantage of using the high-level languages is that the devel-
oped program can easily be tested and this feature shortens the development time
considerably.
In this book we shall be using the C language which is perhaps currently the most popular
language used in microcontroller-based applications. As we shal l see in the later chapters, the
Mbed integrated development environment will be used to develop our projects. Mbed is an
online integ rated development environment that is used to develop ARM (Advanced RISC
Machines) processor-based applications. Using Mbed we can write a program in C, then com-
pile the program, and upload the executable code to the target ARM processor. The advantage
of using Mbed is that it is easy to learn and use and is supported by very large number of
library functions. The projects in this book are all based on the ARM processor. There are
many ARM development boards available in the market. In this book we shall be using a
model of the STM32-Nucleo development boards manufactured by STMicroelectronics. As
will be discussed in detail in the later chapters, STM32-Nucleo boards are complete microcon-
troller development boards incorporating fast 32-bit ARM processors together with all the
support circuitry to help develop complex projects. The STM32-Nucleo development boards
are Mbed compatible which makes them ideal boards for developing complex applications in
relatively short times.
1.2 EXAMPLE MICROCONTROLLER-BASED CONTROL SYSTEM
In this section we shall see how a microcontroller can be used in a simple control system
application. Fig. 1.1 shows a liquid control system where the aim is to control the level of
the liquid in the reservoir at a specified point. Water is pumped from the reservoir t o
the tank using a pump and pipes. In Fig. 1.1 the level of the liquid is controlled manually
without using a microcontroller. Here, the person in charge observes the liquid level
inside the tank and turns the pump off when the liquid level reaches the required
prespecified level.
The system shown in Fig. 1.1 is manual and requires constant attention of a person. A sim-
ple microcontroller version of this system is shown in Fig. 1.2. Here, the liquid level is read by
2 1. INTRODUCTION