You are previewing Designing Embedded Systems with PIC Microcontrollers, 2nd Edition.
O'Reilly logo
Designing Embedded Systems with PIC Microcontrollers, 2nd Edition

Book Description

PIC microcontrollers are used worldwide in commercial and industrial devices. The 8-bit PIC which this book focuses on is a versatile work horse that completes many designs. An engineer working with applications that include a microcontroller will no doubt come across the PIC sooner rather than later. It is a must to have a working knowledge of this 8-bit technology.

Table of Contents

  1. Cover Image
  2. Table of Contents
  3. Copyright
  4. Introduction to the first edition
  5. Introduction to the second edition
  6. Acknowledgements
  7. Section 1 Getting Started with Embedded Systems
  8. CHAPTER 1. Tiny computers, hidden control
    1. 1.1. The main idea – embedded systems in today's world
    2. 1.2. Some example embedded systems
    3. 1.3. Some computer essentials
    4. 1.4. Microprocessors and microcontrollers
    5. 1.5. Microchip and the PIC microcontroller
    6. 1.6. An introduction to PIC microcontrollers using the Baseline Series
  9. Section 2 Minimum Systems and the PIC 16F84A
  10. CHAPTER 2. Introducing the PIC mid-range family and the 16F84A
    1. 2.1. The main idea – the PIC mid-range family
    2. 2.2. An architecture overview of the 16F84A
    3. 2.3. A review of memory technologies
    4. 2.4. The 16F84A memory
    5. 2.5. Some issues of timing
    6. 2.6. Power-up and Reset
    7. 2.7. Taking things further – the 16F84A on-chip reset circuit
  11. CHAPTER 3. Parallel ports, power supply and the clock oscillator
    1. 3.1. The main idea – parallel input/output
    2. 3.2. The technical challenge of parallel input/output
    3. 3.3. Connecting to the parallel port
    4. 3.4. The PIC 16F84A parallel ports
    5. 3.5. The clock oscillator
    6. 3.6. Power supply
    7. 3.7. The hardware design of the electronic ping-pong game
  12. CHAPTER 4. Starting to program – an introduction to Assembler
    1. 4.1. The main idea – what programs do and how we develop them
    2. 4.2. The PIC 16 Series instruction set, with a little more on the ALU
    3. 4.3. Assemblers and Assembler format
    4. 4.4. Adopting a development environment
    5. 4.5. An introductory MPLAB tutorial
    6. 4.6. An introduction to simulation
    7. 4.7. A larger program – using data memory and moving data
    8. 4.8. Programming for a target piece of hardware – a simple data transfer program
    9. 4.9. Downloading to a microcontroller
    10. 4.10. Taking things further: the 16 Series instruction set format
  13. CHAPTER 5. Building Assembler programs
    1. 5.1. The main idea – building structure into programs
    2. 5.2. Conditional branching and working with bits
    3. 5.3. Subroutines
    4. 5.4. Generating time delays and intervals
    5. 5.5. More use of the MPLAB simulator
    6. 5.6. Introducing logical instructions
    7. 5.7. Look-up tables
    8. 5.8. Taming Assembler complexity
    9. 5.9. The ping-pong program
    10. 5.10. Simulating the ping-pong program – tutorial
    11. 5.11. A glance at graphical simulators
    12. 5.12. Taking things further: indirect addressing and the File Select register
  14. CHAPTER 6. Working with time
    1. 6.1. The main idea – interrupts
    2. 6.2. Working with interrupts
    3. 6.3. The main idea – counters and timers
    4. 6.4. Applying the 16F84A Timer 0, with examples using the electronic ping-pong program
    5. 6.5. The Watchdog Timer
    6. 6.6. Sleep mode
    7. 6.7. Taking things further – interrupt latency
  15. Section 3 Larger Systems and the PIC 16F873A
  16. CHAPTER 7. Larger Systems and the PIC 16F873A
    1. 7.1. The main idea – the PIC 16F87XA
    2. 7.2. The 16F873A block diagram and CPU
    3. 7.3. 16F873A memory and memory maps
    4. 7.4. ‘Special’ memory operations
    5. 7.5. The 16F873A interrupts
    6. 7.6. The 16F873A oscillator, reset and power supply
    7. 7.7. The 16F873A parallel ports
    8. 7.8. Test, commission and diagnostic tools
    9. 7.9. The Microchip in-circuit debugger (ICD 2)
    10. 7.10. Applying the 16F873A: the Derbot AGV
    11. 7.11. Downloading, testing and running a simple program with ICD 2
    12. 7.12. Taking things further – the 16F874A/16F877A Ports D and E
  17. CHAPTER 8. The human and physical interfaces
    1. 8.1. The main idea – the human interface
    2. 8.2. From switches to keypads
    3. 8.3. LED displays
    4. 8.4. Liquid crystal displays
    5. 8.5. The main idea – interfacing to the physical world
    6. 8.6. Some simple sensors
    7. 8.7. More on digital input
    8. 8.8. Actuators: motors and servos
    9. 8.9. Interfacing to actuators
    10. 8.10. Building the Derbot
    11. 8.11. Applying sensors and actuators – a ‘blind’ navigation Derbot program
  18. CHAPTER 9. Taking timing further
    1. 9.1. The main ideas – taking counting and timing further
    2. 9.2. The 16F87XA Timer 0 and Timer 1
    3. 9.3. The 16F87XA Timer 2, comparator and PR2 register
    4. 9.4. The capture/compare/pulse width modulation (CCP) modules
    5. 9.5. Pulse width modulation
    6. 9.6. Generating pulse width modulation in software
    7. 9.7. Pulse width modulation used for digital-to-analog conversion
    8. 9.8. Frequency measurement
    9. 9.9. Speed control applied to the Derbot
    10. 9.10. When there is no timer
    11. 9.11. Sleep mode
    12. 9.12. Where do we go from here?
    13. 9.13. Building the Derbot
  19. CHAPTER 10. Starting with serial
    1. 10.1. The main idea – introducing serial
    2. 10.2. Simple serial links – synchronous data communication
    3. 10.3. The 16F87XA Master Synchronous Serial Port module in SPI mode
    4. 10.4. A simple Serial Peripheral Interface example
    5. 10.5. The limitations of Microwire and Serial Peripheral Interface, and of simple synchronous serial transfer
    6. 10.6. Enhancing synchronous serial and the Inter-Integrated Circuit bus
    7. 10.7. The Master Synchronous Serial Port configured for Inter-Integrated Circuit
    8. 10.8. Inter-Integrated Circuit applied in the Derbot Autonomous Guided Vehicle
    9. 10.9. Evaluation of synchronous serial data communication and an introduction to asynchronous serial data communication
    10. 10.10. The 16F87XA Addressable Universal Synchronous Asynchronous Receiver Transmitter (USART)
    11. 10.11. Implementing serial without a serial port – ‘bit banging’
    12. 10.12. Building the Derbot
  20. CHAPTER 11. Data acquisition and manipulation
    1. 11.1. The main idea – analog and digital quantities, their acquisition and use
    2. 11.2. The data acquisition system
    3. 11.3. The PIC 16F87XA ADC module
    4. 11.4. Applying the analog-to-digital converter in the Derbot light meter program
    5. 11.5. Some simple data manipulation techniques
    6. 11.6. The Derbot light-seeking program
    7. 11.7. The comparator module
    8. 11.8. Applying the Derbot circuit for measurement purposes
  21. CHAPTER 12. Some PIC microcontroller advances
    1. 12.1. The main idea – higher performance, more flexibility
    2. 12.2. The 16F87/88
    3. 12.3. The 16F883
    4. 12.4. NanoWatt technology
    5. 12.5. Clock sources and their management
    6. 12.6. Some enhanced peripherals
  22. Section 4 Smarter Systems and the PIC 18F2420
  23. CHAPTER 13. Smarter systems and the PIC 18F2420
    1. 13.1. The main idea – the PIC 18 Series and the 18F2420
    2. 13.2. The 18F2420/2520 block diagram and Status register
    3. 13.3. The 18 Series instruction set
    4. 13.4. Data memory and Special Function Registers
    5. 13.5. Program memory
    6. 13.6. The Stacks
    7. 13.7. The interrupts
    8. 13.8. Power supply and reset
    9. 13.9. The oscillator sources
    10. 13.10. Introductory programming with the 18F2420
    11. 13.13. A peripheral review and the parallel ports
    12. 13.14. The timers
    13. 13.15. The capture/compare/pulse width modulation modules
    14. 13.16. The serial ports
    15. 13.17. The analog-to-digital converter
    16. 13.18. Applying the 18 Series in the Derbot
  24. CHAPTER 14. Introducing C
    1. 14.1. The main idea – why C?
    2. 14.2. An introduction to C
    3. 14.3. Compiling the C program
    4. 14.4. The MPLAB C18 compiler
    5. 14.5. A C18 tutorial
    6. 14.6. Simulating a C program
    7. 14.7. A second C example – the Fibonacci program
    8. 14.8. The MPLAB C18 libraries
    9. 14.9. Further reading
  25. CHAPTER 15. C and the embedded environment
    1. 15.1. The main idea – adapting C to the embedded environment
    2. 15.2. Controlling and branching on bit values
    3. 15.3. More on functions
    4. 15.4. More branching and looping
    5. 15.5. Using the timer and pulse width modulation peripherals
  26. CHAPTER 16. Acquiring and using data with C
    1. 16.1. The main idea – using C for data manipulation
    2. 16.2. Data acquisition in C
    3. 16.3. Pointers, arrays and strings
    4. 16.4. Using the Inter-Integrated Circuit peripheral
    5. 16.5. Formatting data for display
  27. CHAPTER 17. More C and the wider C environment
    1. 17.1. The main idea – more C and the wider C environment
    2. 17.2. Assembler inserts
    3. 17.3. Controlling memory allocation
    4. 17.4. Interrupts
    5. 17.5. Example with interrupt on overflow – flashing LEDs on the Derbot
    6. 17.6. Storage classes and their application
    7. 17.7. Start-up code: c018i.c
    8. 17.8. Structures, unions and bit-fields
    9. 17.9. Processor-specific header files
    10. 17.10. Taking things further – the MPLAB Linker and the .map file
  28. CHAPTER 18. Multi-tasking and the real-time operating system
    1. 18.1. The main ideas – the challenges of multi-tasking and real time
    2. 18.2. Achieving multi-tasking with sequential programming
    3. 18.3. The real-time operating system
    4. 18.4. Scheduling and the scheduler
    5. 18.5. Developing tasks
    6. 18.6. Data and resource protection – the semaphore
    7. 18.7. Where do we go from here?
  29. CHAPTER 19. The Salvo real-time operating system
    1. 19.1. The main idea – Salvo, an example RTOS
    2. 19.2. Configuring the Salvo application
    3. 19.3. Writing Salvo programs
    4. 19.4. A first Salvo example
    5. 19.5. Using interrupts, delays and semaphores with Salvo
    6. 19.6. Using Salvo messages and increasing real-time operating system complexity
    7. 19.7. A program example with messages
    8. 19.8. The real-time operating system overhead
  30. Section 5 Where Can We Go from Here? Distributed Systems, Bigger Systems
  31. CHAPTER 20. Connectivity and networks
    1. 20.1. The main idea – networking and connectivity
    2. 20.2. Infrared connectivity
    3. 20.3. Radio connectivity
    4. 20.4. Controller Area Network and Local Interconnect Network
    5. 20.5. The Universal Serial Bus
    6. 20.6. Embedded systems and the Internet
  32. CHAPTER 21. Moving beyond 8-bit
    1. 21.1. The main idea – why we need more than 8-bit
    2. 21.2. A 16-bit PIC overview
    3. 21.3. The PIC24F family
    4. 21.4. The dsPIC digital signal controller
    5. 21.5. The PIC32 32-bit microcontroller
    6. 21.6. A last and final conclusion
  33. APPENDIX 1. The PIC 16 Series instruction set
  34. APPENDIX 2. The electronic ping-pong program
  35. APPENDIX 3. The Derbot AGV – hardware design details
  36. APPENDIX 4. Some basics of Autonomous Guided Vehicles
  37. APPENDIX 5. The PIC 18 Series instruction set
  38. APPENDIX 6. Essentials of C
  39. Index