Embedded C Programming
eBook - ePub

Embedded C Programming

Techniques and Applications of C and PIC MCUS

  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

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

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription.
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn more here.
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
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.
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.
Yes! You can use the Perlego app on both iOS or Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
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
Print ISBN
9780128013144
eBook 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

  1. Cover image
  2. Title page
  3. Table of Contents
  4. Copyright
  5. Introduction
  6. Chapter 1: C Overview and Program Structure
  7. Chapter 2: Constants
  8. Chapter 3: Preprocessor Directives
  9. Chapter 4: Data Variable and Types
  10. Chapter 5: Expressions and Operators
  11. Chapter 6: Statements
  12. Chapter 7: Functions
  13. Chapter 8: Arrays
  14. Chapter 9: Structures
  15. Chapter 10: Memory and Pointers
  16. Chapter 11: Built-in Functions
  17. Chapter 12: Strings
  18. Chapter 13: Function-like Macros
  19. Chapter 14: Conditional Compilation
  20. Chapter 15: PIC® Microcontroller
  21. Chapter 16: Discrete Input and Output
  22. Chapter 17: Interrupts
  23. Chapter 18: Timers/Counters
  24. Chapter 19: Advanced Timing
  25. Chapter 20: Analog Techniques
  26. Chapter 21: Internal Serial Busses
  27. Chapter 22: External Serial Busses
  28. Chapter 23: Multi-Tasking
  29. Chapter 24: Inline Assembly
  30. Chapter 25: Debugging
  31. Bibliography
  32. Appendix-A
  33. Appendix-B
  34. Appendix-C