ARM-Based
Microcontroller
Multitasking
Projects
Using the FreeRTOS
Multitasking Kernel
D
ogan
I
brahIm
Newnes is an imprint of Elsevier
The Boulevard, Langford Lane, Kidlington, Oxford OX5 1GB, United Kingdom
50 Hampshire Street, 5th Floor, Cambridge, MA 02139, United States
Copyright © 2020 Elsevier Ltd. All rights reserved.
No part of this publication may be reproduced or transmitted in any form or by any means, electronic or mechanical, including
photocopying, recording, or any information storage and retrieval system, without permission in writing from the publisher.
Details on how to seek permission, further information about the Publisher’s permissions policies and our arrangements with
organizations such as the Copyright Clearance Center and the Copyright Licensing Agency, can be found at our website:
www.
elsevier.com/permissions.
This book and the individual contributions contained in it are protected under copyright by the Publisher (other than as may
be noted herein).
Notices
Knowledge and best practice in this field are constantly changing. As new research and experience broaden our understanding,
changes in research methods, professional practices, or medical treatment may become necessary.
Practitioners and researchers must always rely on their own experience and knowledge in evaluating and using any informa-
tion, methods, compounds, or experiments described herein. In using such information or methods they should be mindful of
their own safety and the safety of others, including parties for whom they have a professional responsibility.
To the fullest extent of the law, neither the Publisher nor the authors, contributors, or editors, assume any liability for any injury
and/or damage to persons or property as a matter of products liability, negligence or otherwise, or from any use or operation
of any methods, products, instructions, or ideas contained in the material herein.
Library of Congress Cataloging-in-Publication Data
A catalog record for this book is available from the Library of Congress
British Library Cataloguing-in-Publication Data
A catalogue record for this book is available from the British Library
ISBN: 978-0-12-821227-1
For information on all Newnes publications
visit our website at
https://www.elsevier.com/books-and-journals
Publisher:
Mara Conner
Acquisitions Editor:
Tim Pitts
Editorial Project Manager:
Rafael G. Trombaco
Production Project Manager:
Nirmala Arumugam
Designer:
Matthew Limbert
Typeset by Thomson Digital
About the author
Prof. Dr. Dogan Ibrahim has a BSc degree
in electronic engineering, an MSc degree in
automatic control engineering, and a PhD
degree in digital signal processing. Dogan
has worked in many industrial organiza-
tions before he returned to academic life.
Prof. Ibrahim is the author of over 80 tech-
nical books and over 200 technical articles
on microcontrollers, microprocessors, and
related fields. He is a Chartered electrical
engineer and a Fellow of the Institution of
Engineering Technology.
xi
Preface
A microcontroller is a single-chip micro-
processor system which contains data and
program memory, serial and parallel I/O,
timers, external and internal interrupts,
all integrated into a single chip that can
be purchased for as little as $2.00. About
40% of microcontroller applications are in
office automation, such as PCs, laser print-
ers, fax machines, intelligent telephones,
and so forth. About one-third of microcon-
trollers are found in consumer electronic
goods. Products like CD and DVD play-
ers, hi-fi equipment, video games, wash-
ing machines, cookers, and so on fall into
this category. The communications market,
automotive market, and the military share
the rest of the application areas.
Microcontrollers have traditionally been
programmed using the assembly language
of the target processor. Although the assem-
bly language is fast, it has the disadvantages
that it is difficult to develop and maintain
large projects using the assembly language.
Additionally, microcontrollers from differ-
ent manufacturers have different assembly
language instruction sets which makes it
very time consuming for the programmers
to learn new assembly languages every time
a different microcontroller is to be used. The
assembly code developed for one type of
microcontroller cannot be ported to another
type of microcontroller. Nowadays micro-
controllers are programmed using high-level
languages, such as C, C++, Pascal, or Basic.
Perhaps the biggest advantage of using a
high-level language is that the developed
code can easily be ported to other types of
microcontrollers. Additionally, it is easier to
maintain a program developed using a high-
level programming language.
There are many different types of micro-
controllers available from many manufactur-
ers. Most manufacturers offer development
kits (or development boards), which are
invaluable tools during the early stages
of project development. In this book the
Clicker 2 for STM32 development board is
used. This board is based on the STM32F407
type ARM Cortex-M4 processor that can
operate at up to 168MHz. The highly popu-
lar mikroC Pro for ARM compiler and IDE is
used for software development.
The topic of this book is FreeRTOS kernel
and multitasking. Multitasking has become
one of the important topics in microcon-
troller-based systems, namely in automation
applications. As the complexity of the proj-
ects grow, more functionality is demanded
from the projects and such projects require
the use of several inter-related tasks running
on the same processor and sharing the CPU in
order to implement the required operations.
As a result of this, the importance of mul-
titasking operation in microcontroller-based
applications has been growing steadily over
the last several years and many complex
automation projects nowadays make use of
some form of a multitasking kernel. In this
book the FreeRTOS multitasking kernel is
used in the projects. FreeRTOS is a market
leading real time multitasking kernel with
millions of deployments in all market sec-
tors. FreeRTOS is free of charge and is fully
documented and supported. It is available
to run on many hardware and software plat-
forms, including the ARM processors and
xiii
评论