PIC Projects and Applications using C

1st Edition

A Project-based Approach


  • David W Smith
    • Electronic ISBN 9780080999548


    PIC Projects and Applications Using C details how to program the PIC microcontroller in the C language. The book takes a learn-by-doing approach, with applications covering topics such as inputs, outputs, keypads, alphanumeric displays, analogue-to-digital conversion, radio transmitters and receivers, data EEPROM, interrupts and timing. To aid debugging, the book provides a section detailing the use of the simulator and in-circuit debugger.

    With this book you will learn:

    • How to program the PIC microcontroller in C
    • Techniques for using the simulator and debuggers to find faults on your code
    • The ins and outs of interfacing circuits, such as radio modules and liquid crystal displays
    • How to use the PIC on-board functions, such as interrupts and timing modules, and make analogue measurements

    Key Features

    • Relevant parts of the language are introduced and explained when required for those new to the subject
    • Core principles are introduced gradually for self-paced learning
    • Explains how and why a software program works, and how to alter and expand the code


    Electronics engineers, including embedded systems designers and control engineers, technicians in industry, hobbyists needing a more complete grounding in microcontroller principles and applications. Students taking introductory level classes in courses in electronics / microelectronics.

    Table of Contents

    • Preface
    • Chapter 1: Introduction to the Microcontroller and C
    • Chapter 2: First C Program
      • MPLAB and MPLABX Installation
      • A Brief Introduction to C for the Microcontroller
      • Writing the Code Using MPLAB IDE
      • Types of Errors
      • Programming the Microcontroller
      • Writing the Code Using MPLABX
      • Creating a New Project
    • Chapter 3: Using Eight Outputs
      • Explanation of the Code
      • Looping in a Program
      • The Disco Code
      • The Header Program
    • Chapter 4: Inputs
      • IF Statement
      • If–Else
      • Using Several Inputs
    • Chapter 5: Keypad Scanning
      • Four Digit Code
      • Putting the Scan Routine in a Header File, dwsScan.h
    • Chapter 6: Analogue to Digital Conversion
      • Configuring the A/D Device
      • ADCON0 A–D Control Register 0
      • ADCON1 A–D Control Register 1
      • ADCON2 A–D Control Register 2
      • ADRESH and ADRESL: A/D Result Registers High and Low Byte
      • The Thermistor
      • Making an A/D Reading with the Thermistor
      • The LM335 Temperature Sensing IC
      • Operation of the LM335
      • A/D Application
      • Question
      • Using Several A–D Inputs
      • Solar Panel Heating System
      • Microcontrollers with More A/D Inputs
      • The PIC18(L)F43K22 28A/D Inputs
    • Chapter 7: Alpha Numeric Display
      • Configuring the Display
      • Program LCD.C
      • Using Header: dwsLCD.h
      • Program LCDh.C
      • Character Display Address
      • Displaying Measurements
      • Displaying Room Temperature
      • RoomTemperature.C
    • Chapter 8: Porting Code to Other Microcontrollers
      • The Header Code
    • Chapter 9: Timer/Counter Modules
      • TMR0 Prescaler
      • Timing an Event
      • An Accurate 1 s


    No. of pages:
    © 2013
    Electronic ISBN:

    About the author

    David W Smith

    David Smith has had 30 years experience in the Electronics Industry. Before arriving at MMU he worked as an Electronics Design Engineer for ICL and Marconi. His teaching interests are focused on enabling Design and Technology students to implement microcontroller designs into their projects.

    Affiliations and Expertise

    Senior Lecturer, Technology Centre, Manchester Metropolitan University, UK


    “…the presentation is first-class: concepts are explained very clearly, code is commented on almost line by line, and constant reference to the environment greatly simplifies learning. For all of these reasons, this is undoubtedly a book for beginners: they can use it either on their own, as self-teaching material, or in a class of some sort.”--ComputingReviews.com,June 18,2014