Embedded Systems with PIC Microcontrollers: Principles and Applications is a hands-on introduction to the principles and practice of embedded system design using the PIC microcontroller. Packed with helpful examples and illustrations, the book provides an in-depth treatment of microcontroller design as well as programming in both assembly language and C, along with advanced topics such as techniques of connectivity and networking and real-time operating systems. In this one book students get all they need to know to be highly proficient at embedded systems design.
This text combines embedded systems principles with applications, using the16F84A, 16F873A and the 18F242 PIC microcontrollers. Students learn how to apply the principles using a multitude of sample designs and design ideas, including a robot in the form of an autonomous guide vehicle. Coverage between software and hardware is fully balanced, with full presentation given to microcontroller design and software programming, using both assembler and C. The book is accompanied by a companion website containing copies of all programs and software tools used in the text and a ‘student’ version of the C compiler.
This textbook will be ideal for introductory courses and lab-based courses on embedded systems, microprocessors using the PIC microcontroller, as well as more advanced courses which use the 18F series and teach C programming in an embedded environment. Engineers in industry and informed hobbyists will also find this book a valuable resource when designing and implementing both simple and sophisticated embedded systems using the PIC microcontroller.
*Gain the knowledge and skills required for developing today's embedded systems, through use of the PIC microcontroller.
*Explore in detail the 16F84A, 16F873A and 18F242 microcontrollers as examples of the wider PIC family.
*Learn how to program in Assembler and C.
*Work through sample designs and design ideas, including a robot in the form of an autonomous guided vehicle.
*Accompanied by a CD-ROM containing copies of all programs and software tools used in the text and a ‘student' version of the C complier.
Professional engineers developing embedded systems, informed hobbyists and engineering students.
Section 1 Getting started with embedded systems
- Tiny computers, hidden control 1.1 The main idea-embedded systems in today's world 1.2 Some example embedded systems 1.3 Some computer essentials 1.4 Microprocessors and microcontrollers 1.5 Microchip and the PIC microcontroller 1.6 An introduction to PIC microcontrollers using the 12 series 1.7 What others do- a Freescale microcontroller Summary References
Section 2 Minimum systems and the PIC 16F84A
Introducing the PIC 16 series and the 16F84A 2.1 The main idea- the PIC 16 series family 2.2 An architecture overview of the 16F84A 2.3 A review of memory technologies 2.4 The 16F84A memory 2.5 Some issues of timing 2.6 Power up and reset 2.7 What others do- the Atmel AT89C2051 2.8 Taking things further- the 16F84A on-chip reset circuit Summary References
Parallel ports, power supply and the clock oscillator 3.1 The main idea- parallel input/output 3.2 The technical challenge of parallel input/output 3.3 Connecting to the parallel port 3.4 The PIC 16F84A parallel ports 3.5 The clock oscillator 3.6 Power supply 3.7 The hardware design of the electronic ping-pong Summary References
Starting to program- an introduction to Assembler 4.1 The main idea- what programs do and how we develop them 4.2 The PIC 16 series instruction set, with a little more on the ALU 4.3 Assemblers and the assembler format 4.4 Creating simple programs 4.5 Adopting a development environment 4.6 An introductory MPLAB tutorial 4.7 An introduction to simulation 4.8 Downloading the program to a microcontroller 4.9 What others do- a brief comparison of CISC and RISC instruction sets 4.10 Taking things further- the 16 series instruction set format Summary References
Building assembler programs 5.1 The main idea- building structured programs 5.2 Flow control- branching and subroutines 5.3 Generating time delays and intervals 5.4 Dealing with data 5.5 Introducing logical systems 5.6 Introducing arithmetic instructions and the Carry flag 5.7 Taming assembler complexity 5.8 More use of the MPLAB simulator 5.9 The ping-pong program 5.10 Simulating the ping-pong program- tutorial 5.11 What others do- graphical simulators Summary References
Working with time: interrupts, counters & timers 6.1 The main idea- interrupts 6.2 Working with interrupts 6.3 The main idea- counters and timers 6.4 Applying the 16F84A Timer 0, with examples using the electronic ping-pong 6.5 The watchdog timer 6.6 Sleep mode 6.7 What others do 6.8 Taking things further- interrupt latency Summary References
Section 3 Larger systems & the PIC 16F873A
Larger systems and the PIC 16F873A 7.1 The main idea- the PIC 16F87XA 7.2 The 16F873A block diagram and CPU 7.3 16F873A memory and memory maps 7.4 'Special' memory operations 7.5 The 16F873A interrupts 7.6 The 16F873A oscillator, reset and power supply 7.7 The 16F873A parallel ports 7.8 Test, commission and diagnostic tools 7.9 The Microchip in-circuit debugger (ICD2) 7.10 Applying the 16F873A: the Derbot AGV 7.11 Downloading, testing and running a simple program with ICD 2 7.12 Taking things further- the 16F874A/16F877A Summary References
The human and physical interfaces 8.1 The main idea- the human interface 8.2 From switches to keypads 8.3 LED displays 8.4 Liquid crystal displays 8.5 The main idea- interfacing to the physical world 8.6 Some simple sensors 8.7 More on digital input 8.8 Actuators: motors and servos 8.9 Interfacing to actuators 8.10 Building up the Derbot 8.11 Applying sensors and actuators- a 'blind' navigation Derbot program Summary References
Taking timing further 9.1 The main ideas- taking counting and timing further 9.2 The 16F87XA Timer 0 and Timer 1 9.3 The 16F87XA Timer 2, comparator and PR2 register 9.4 The capture/compare/PWM (CCP) modules 9.5 Pulse width modulation 9.6 Generating PWM in software 9.7 PWM used for digital-to-analog conversion 9.8 Frequency measurement 9.9 Speed control applied to the Derbot 9.10 Where there is no timer 9.11 Sleep mode 9.12 Where do we go from here? 9.13 Building up the Derbot Summary References
Starting with serial 10.1 The main idea- introducing serial 10.2 Simple serial links- synchronous data communication 10.3 The 16F87XA Master Synchronous Serial Port (MSSP) module in SPI mode 10.4 A simple SPI example 10.5 The limitations of Microwire and SPI, and of simple synchronous serial transfer 10.6 Enhancing synchronous serial, and the Inter-Integrated Circuit bus 10.7 The MSSP configured for IC 10.8 IC applied in the Derbot AGV 10.9 Evaluation of synchronous serial data communication 10.10 The 16F87XA Addressable Universal Synchronous Asynchronous Receiver Transmitter (USART) 10.11 Implementing serial with a serial port- 'bit banging' 10.12 Building up the Derbot Summary References
Data acquisition and manipulation 11.1 The main idea- analog and digital quantities, their acquisition and use 11.2 The data acquisition system 11.3 The PIC 16F87XA ADC module 11.4 Applying the ADC in the Derbot light meter program 11.5 Some simple data manipulation techniques 11.6 The Derbot light-seeking program 11.7 The comparator module 11.8 Applying the Derbot circuit for measurement purposes 11.9 Configuring the Derbot AGV as a light-seeking robot Summary References
Section 4 Smarter systems and the PIC 18FXX2
- Smarter systems and the PIC 18FXX2 12.1 The main idea- the PIC 18 series and the 18FXX2 12.2 The 18F2X2 block diagram and Staus register 12.3 The 18 series instruction set 12.4 Data memory and Special Function Registers 12.5 Program memory 12.6 The Stacks 12.7 The interrupts 12.8 Power supply and reset 12.9 The oscillator sources 12.10 Introductory programming with the 18F242 Summary References
13 The PIC 18FXX2 peripherals 13.1 The main idea- the 18FXX2 peripherals 13.2 The parallel ports 13.3 The timers 13.4 The capture/compare/PWM (CCP) modules 13.5 The serial ports 13.6 The analog-to-digital converter (ADC) 13.7 Low-voltage detect 13.8 Applying the 18 series in the Derbot-18 13.9 The 18F2420 and the extended instruction set Summary References
14 Introducing C 14.1 The main idea- why C? 14.2 An introduction to C 14.3 Compiling the C program 14.4 The MPLAB C18 compiler 14.5 A C18 tutorial 14.6 Simulating a C program 14.7 A second C example- the Fibonacci program 14.8 The MPLAB C18 libraries 14.9 Further reading Summary References
15 C and the embedded environment 15.1 The main idea- adapting C to the embedded environment 15.2 Controlling and branching on bit values 15.3 More on functions 15.4 More branching and looping 15.5 Using the timer and PWM peripherals Summary References
16 Acquiring and using data with C 16.1 The main idea- using C for data manipulation 16.2 Using the 18FXX2 ADC 16.3 Pointers, arrays and strings 16.4 Using the IC peripheral 16.5 Formatting data for display Summary References
17 More C and the wider C environment 17.1 The main idea- more C and the wider C environment 17.2 Assembler inserts 17.3 Controlling memory allocation 17.4 Interrupts 17.5 Example with interrupt on overflow- flashing LEDs on the Durbot 17.6 Storage classes and their application 17.7 Start-up code: c018i.c 17.8 Structures, unions and bit-fields 17.9 Processor-specific header files 17.10 Taking things further- the MPLAB Linker and the .map file Summary References
18 Multi-tasking and the Real Time Operating System 18.1 The main ideas- the challenge of multi-tasking and real time 18.2 Achieving multi-tasking with sequential programming 18.3 The Real Time Operating System (RTOS) 18.4 Scheduling and the scheduler 18.5 Developing tasks 18.6 Data and resource protection- the semaphore 18.7 Where do we go from here? Summary References
19 The Salvo Real Time Operating System 19.1 The main idea- Salvo, an example RTOS 19.2 Configuring the Salvo application 19.3 Writing Salvo programs 19.4 A first Salvo example 19.5 Using interrupts, delays and semaphores with Salvo 19.6 Using Salvo messages and increasing RTOS complexity 19.7 A program example with messages 19.8 The RTOS overhead Summary References
Section 5 Techniques of connectivity and networking 20 Connectivity and networks 20.1 The main idea-networking and connectivity 20.2 Infrared connectivity 20.3 Radio connectivity 20.4 Controller Area Network (CAN) and Local Interconnect Network (LIN) 20.5 Embedded systems and the Internet 20.6 Conclusion Summary References
Appendix 1 The PIC 16 series instruction set Appendix 2 The electronic ping-pong Appendix 3 The Derbot AGV- hardware design details Appendix 4 Some basics of Autonomous Guided Vehicles Appendix 5 PIC 18 series instruction set (non-extended) Appendix 6 Essentials of C
- No. of pages:
- © Newnes 2007
- 24th October 2006
- eBook ISBN:
- Paperback ISBN:
Tim Wilmshurst is the author of Designing Embedded Systems with PIC Microcontrollers. He has been designing embedded systems since the early days of microcontrollers. For many years this was for Cambridge University, where he led a development team building original systems for research applications – for example in measurement of bullet speed, wind tunnel control, simulated earthquakes, or seeking a cure to snoring. Now he is Head of Electronic Systems at the University of Derby, where he aims to share his love of engineering design with his students.
Head of Electronics, University of Derby, UK