Embedded C Programming
eBook - ePub

Embedded C Programming

Techniques and Applications of C and PIC MCUS

Mark Siegesmund

Share book
  1. 424 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Embedded C Programming

Techniques and Applications of C and PIC MCUS

Mark Siegesmund

Book details
Book preview
Table of contents
Citations

About This Book

This book provides a hands-on introductory course on concepts of C programming using a PICĀ® microcontroller and CCS C compiler. Through a project-based approach, this book provides an easy to understand method of learning the correct and efficient practices to program a PICĀ® microcontroller in C language. Principles of C programming are introduced gradually, building on skill sets and knowledge. Early chapters emphasize the understanding of C language through experience and exercises, while the latter half of the book covers the PICĀ® microcontroller, its peripherals, and how to use those peripherals from within C in great detail.

This book demonstrates the programming methodology and tools used by most professionals in embedded design, and will enable you to apply your knowledge and programming skills for any real-life application. Providing a step-by-step guide to the subject matter, this book will encourage you to alter, expand, and customize code for use in your own projects.

  • A complete introduction to C programming using PIC microcontrollers, with a focus on real-world applications, programming methodology and tools
  • Each chapter includes C code project examples, tables, graphs, charts, references, photographs, schematic diagrams, flow charts and compiler compatibility notes to channel your knowledge into real-world examples
  • Online materials include presentation slides, extended tests, exercises, quizzes and answers, real-world case studies, videos and weblinks

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on ā€œCancel Subscriptionā€ - itā€™s as simple as that. After you cancel, your membership will stay active for the remainder of the time youā€™ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlegoā€™s features. The only differences are the price and subscription period: With the annual plan youā€™ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, weā€™ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Embedded C Programming an online PDF/ePUB?
Yes, you can access Embedded C Programming by Mark Siegesmund in PDF and/or ePUB format, as well as other popular books in Computer Science & Hardware. We have over one million books available in our catalogue for you to explore.

Information

Publisher
Newnes
Year
2014
ISBN
9780128014707
Chapter 1

C Overview and Program Structure

Abstract

This chapter explains the structure of C programs as it pertains to embedded microcontrollers. A short example program is used to introduce the reader to each of the basic C elements.
Compilation units (sometimes called translation units), functions, statements, compound statements, expressions, and data declarations are all introduced. The unique C preprocessor concept is covered with some simple preprocessor directive samples. This chapter shows how constants, variables, operators, and function calls make up the basic components of an expression and how they are used together in the C programming language. The basics of functions calls, including passing and returning data, are included.
Examples and exercises are for the popular PICā„¢ microcontroller manufactured by Microchip.
Keywords
C program structure
Compilation unit
Translation unit
C comments
Functions
Statements
Expressions
Preprocessor

C Source Code

This is what C source code looks like:
image
This program may look very cryptic to you now. When you have finished reading this book and doing the experiments, this program and much more complex ones will no longer seem cryptic. As you read the next few chapters, you can refer to this program to see how the topics relate to this program. For now, letā€™s make some observations about the overall look of the program.

Comments

Comments help anyone (including you) who reads your code understand what it does. There are two styles.
image
Comments between
image
and
image
(can span multiple lines, but may not be nested)
image
Comments between
image
and end of line (one line only).
The compiler ignores all comments. Both styles are shown in the sample program.

Program Structure

C programs are made up of compilation units, sometimes called translation units. A compilation unit is a set of files that are compiled together by a compiler. For most examples in this book we will be using a single compilation unit. A compilation unit is made up of global data and functions. A function is a callable group of code that in some other languages is referred to as a procedure or subroutine. Functions are made up of lo...

Table of contents