Programming 8-bit PIC Microcontrollers in C,
Edition 1 with Interactive Hardware Simulation
By Martin P. Bates

Publication Date: 22 Aug 2008

Microcontrollers are present in many new and existing electronic products, and the PIC microcontroller is a leading processor in the embedded applications market. Students and development engineers need to be able to design new products using microcontrollers, and this book explains from first principles how to use the universal development language C to create new PIC based systems, as well as the associated hardware interfacing principles.

The book includes many source code listings, circuit schematics and hardware block diagrams. It describes the internal hardware of 8-bit PIC microcontroller, outlines the development systems available to write and test C programs, and shows how to use CCS C to create PIC firmware. In addition, simple interfacing principles are explained, a demonstration program for the PIC mechatronics development board provided and some typical applications outlined.

Key Features

  • Focuses on the C programming language which is by far the most popular for microcontrollers (MCUs)
  • Features Proteus VSMg the most complete microcontroller simulator on the market, along with CCS PCM C compiler, both are highly compatible with Microchip tools
  • Extensive downloadable content including fully worked examples
About the author
By Martin P. Bates, Martin Bates, Lecturer in Microelectronics (retired), Sussex Coast College, UK and formerly Course Leader, Foundation Degree Engineering (University of Brighton) and Course Manager, PIC Microcontroller Short Courses, Hastings Innovation Centre
Table of Contents
Part 1 PIC Microcontroller Systems 1.1 PIC16 Microcontrollers 1MCU Features Program Execution RAM File Registers Other PIC Chips 1.2 PIC16 MCU Configuration Clock Options Configuration Options Configuration in C 1.3 PIC16 MCU Peripherals Timers A/D Converter Comparator Parallel Slave Port Interrupts 1.4 PIC16 Serial Interfaces USART SPI Bus I2C Bus 1.5 PIC16 MPLAB Projects MPLAB C Project Project Files 1.6 PIC16 Program and Debug Programming Debugging Design Package Assessment 1 Assignments 1 Part 2 C Programming Essentials 2.1 PIC16 C Getting Started Simple Program Program Creation Program Testing Program Analysis 2.2 PIC16 C Program Basics Variables Looping Decision Making Loop Control FOR Loop SIREN Program Blank Program 2.3 PIC16 C Data Operations Variable Types Assignment Operations Conditional Operations 2.4 PIC16 C Sequence Control While Loops Break, Continue, and Goto If..Else and Switch..Case 2.5 PIC16 C Functions and Structure Basic Functions Global and Local Variables 2.6 PIC16 C Input and Output Serial LCD Keypad and Calculator 2.7 PIC16 C More Data Types Arrays Indirect Addressing Operators Enumeration 2.8 PIC16 C Compiler Directives Program Directives Header File 2.9 PIC16 C Assembler Routines Program Compilation Assembler Block PIC Assembly Language Assessment 2 Assignments 2 Part 3 C Peripheral Interfaces 3.1 PIC16 C Analog Input Analog Setup Voltage Measurement 3.2 PIC16 C Interrupts C Interrupts Interrupt Example Interrupt Statements 3.3 PIC16 C Hardware Timers Counter/Timer Operation PWM Mode Compare ModeCapture Mode 3.4 PIC16 C UART Serial Link 3.5 PIC16 C SPI Serial Bus 3.6 PIC16 C I 2 C Serial Bus 3.7 PIC16 C Parallel and Serial Interfaces Parallel Slave Port Comparison of Communication Links 3.8 PIC16 C EEPROM Interface 3.9 PIC16 C Analog Output Assessment 3 Assignments 3Part 4 C Mechatronics Applications 4.1 PICDEM Mechatronics Board Overview PICDEM Hardware Motor Drives Test Program Debugging 4.2 PICDEM Liquid Crystal Display LCD Connections LCD Test Program BCD Count Program 4.3 PICDEM DC Motor Test Programs Basic Control Rev Counter 4.4 PICDEM Stepper Motor Control Construction Stepper Motor Test Direction Control 4.5 PICDEM Analog Sensors Light Sensor Temperature Measurement 4.6 PICDEM Temperature Controller Specification I/O Allocation Implementation 4.7 PICDEM Board Simulation Circuit Description Demo Applications Assessment 4 Assignments 4 Part 5 PIC16 C Applications and Systems 5.1 PIC16 C Application Design Hardware Design Software Design Application Debugging and Testing 5.2 PIC16 C Temperature Controller System Operation Software Design and Implementation 5.3 PIC16 C Data Logger System BASE Board Program Outline 5.4 PIC16 C Operating Systems Polled I/O Interrupts PC Operating System Real-Time Operating System 5.5 PIC16 C System Design Hardware Selection Microcontrollers Hardware Design Software Design Assessment 5 Assignments 5 Appendix A Hardware Design Using ISIS Schematic Capture Design Specification Schematic Circuit Schematic Edit Appendix B Software Design Using CCS C BAR1 Source Code PIC Registers BAR1 List File Appendix C System Testing Using Proteus VSM Attaching the Program Program Debugging Typical Errors Appendix D C Compiler Comparison Microchip C18 Hi-Tech PIC C Mikro C Matrix C Summary of C Compilers Appendix E CCS C Programming Syntax Summary Compiler Directives Program Blocks Punctuation Basic I/O Functions Appendix F CCS C Programming Function Reference Answers
Book details
ISBN: 9780750689601
Page Count: 304
Retail Price : £34.99
Di Jasio: Programming 16-bit Microcontrollers in C (Newnes, 3/07) ISBN: 9780750682923 $49.95, £29.99. 400 pages.Bates: Interfacing PIC Microcontrollers: Embedded Design by Interactive Simulation (Newnes, 9/06) ISBN: 9780750680288 $39.95, £21.99. Morton: The PIC Microcontroller: Your Personal Introductory Course (Newnes, 9/2005) ISBN: 9780750666640 $28.95, £17.99. 320 pages.
Engineers new to working with PICs, Students, Hobbyists