Microchip AVR® Microcontroller Primer, 3rd Edition

Book description

This textbook provides practicing scientists and engineers a primer on the Microchip AVR® microcontroller.

The revised title of this book reflects the 2016 Microchip Technology acquisition of Atmel Corporation. In this third edition we highlight the popular ATmega164 microcontroller and other pin-for-pin controllers in the family with a complement of flash memory up to 128 KB. The third edition also provides an update on Atmel Studio, programming with a USB pod, the gcc compiler, the ImageCraft JumpStart C for AVR compiler, the Two-Wire Interface (TWI), and multiple examples at both the subsystem and system level. Our approach is to provide readers with the fundamental skills to quickly set up and operate with this internationally popular microcontroller. We cover the main subsystems aboard the ATmega164, providing a short theory section followed by a description of the related microcontroller subsystem with accompanying hardware and software to operate the subsystem. In all examples, we use the C programming language. We include a detailed chapter describing how to interface the microcontroller to a wide variety of input and output devices and conclude with several system level examples including a special effects light-emitting diode cube, autonomous robots, a multi-function weather station, and a motor speed control system.

Table of contents

  1. Preface
  2. Acknowledgments
  3. Microchip AVR® Architecture Overview
    1. ATmega164 Architecture Overview
      1. Reduced Instruction Set Computer
      2. Assembly Language Instruction Set
      3. ATmega164 Architecture Overview
    2. Nonvolatile and Data Memories
      1. In-System Programmable Flash EEPROM
      2. Byte-Addressable EEPROM
      3. Static Random Access Memory
      4. Programmable Lock Bits
    3. Port System
    4. Peripheral Features Internal Subsystems
      1. Time Base
      2. Timing Subsystem
      3. Pulse Width Modulation Channels
      4. Serial Communications
      5. Analog-to-Digital Converter
      6. Interrupts
    5. Physical and Operating Parameters
      1. Packaging
      2. Power Consumption
      3. Speed Grades
    6. Extended Example: ATmega164 Testbench
      1. Hardware Configuration
      2. Software Configuration
    7. Programming the ATmega164
      1. ImageCraft JumpStart C for AVR Compiler Download, Installation, and ATmega164 Programming
      2. Atmel Studio Download, Installation, and ATmega164 Programming
    8. Software Portability
    9. Application
    10. Laboratory Exercise: Testbench
    11. Summary
    12. References and Further Reading
    13. Chapter Problems
  4. Programming
    1. Overview
    2. The Big Picture
    3. Anatomy of a Program
      1. Comments
      2. Include Files
      3. Functions
      4. Program Constants
      5. Interrupt Handler Definitions
      6. Variables
      7. Main Program
    4. Fundamental Programming Concepts
      1. Operators
      2. Programming Constructs
      3. Decision Processing
    5. Application
    6. Laboratory Exercise
    7. Summary
    8. References and Further Reading
    9. Chapter Problems
  5. Serial Communication Subsystem
    1. Overview
    2. Serial Communication Terminology
      1. Asynchronous vs. Synchronous Serial Transmission
      2. Baud Rate
      3. Full Duplex
      4. Nonreturn to Zero Coding Format
      5. The RS-232 Communication Protocol
      6. Parity
      7. American Standard Code for Information Interchange
    3. Serial USART
      1. System Overview
      2. System Operation and Programming
      3. Example: Serial LCD
      4. Example: Voice Chip
      5. Example: PC Serial Monitor
      6. Example: Global Positioning System
      7. Serial Peripheral Interface
      8. Example: ATmega164 Programming
      9. Example: LED Strip
    4. Two-Wire Serial Interface
      1. Example: TWI Compatible LCD (1/2)
      2. Example: TWI Compatible LCD (2/2)
    5. Laboratory Exercise
    6. Summary
    7. References and Further Reading
    8. Chapter Problems
  6. Analog-to-Digital Conversion
    1. Overview
    2. Background Theory
      1. Analog vs. Digital Signals
      2. Sampling, Quantization, and Encoding
      3. Resolution and Data Rate
    3. Analog-to-Digital Conversion Process
      1. Operational Amplifiers
    4. ADC Conversion Technologies
      1. Successive Approximation
      2. Integration
      3. Counter-Based Conversion
      4. Parallel Conversion
    5. The ATmel ATmega164 ADC System
      1. Block Diagram
      2. Registers
      3. Programming the ADC
      4. Digital-to-Analog Conversion (1/2)
      5. Digital-to-Analog Conversion (2/2)
    6. Summary
    7. References and Further Reading
    8. Chapter Problems
  7. Interrupt Subsystem
    1. Interrupt Theory
    2. ATmega164 Interrupt System
    3. Programming an Interrupt
    4. Application
      1. Atmel AVR Visual Studio gcc Compiler Interrupt Template
      2. ImageCraft JumpStart C for AVR Compiler Interrupt Template
      3. External Interrupt Example Using the Atmel AVR Visual Studio gcc Compiler
      4. An Internal Interrupt Example Using the JumpStart C for AVR Compiler
    5. Summary
    6. References and Further Reading
    7. Chapter Problems
  8. Timing Subsystem
    1. Overview
    2. Timing-Related Terminology
      1. Frequency
      2. Period
      3. Duty Cycle
    3. Timing System Overview
    4. Applications
      1. Input Capture—Measuring External Event Timing
      2. Counting Events
      3. Output Compare—Generating Timing Signals to Interface External Devices
      4. Pulse Width Modulation (PWM)
    5. Overview of the Microchip Timers
    6. Timer 0 System
      1. Modes of Operation
      2. Timer 0 Registers
    7. Timer 1
      1. Timer 1 Registers
    8. Timer 2
    9. Programming the Timer System
      1. Precision Delay
      2. Pulse Width Modulation (1/2)
      3. Pulse Width Modulation (2/2)
      4. Input Capture Mode (1/2)
      5. Input Capture Mode (2/2)
    10. Servo Motor Control with the PWM system
    11. Summary
    12. References and Further Reading
    13. Chapter Problems
  9. Microchip AVR® Operating Parameters and Interfacing
    1. Operating Parameters
    2. Input Devices
      1. Switches
      2. Switch Debouncing
      3. Keypads
      4. Sensors
    3. Output Devices
      1. Light-Emitting Diodes
      2. Seven-Segment LED Displays
      3. Tristate LED Indicator
      4. Dot Matrix Display
      5. Liquid Crystal Display
      6. High-Power DC Devices
    4. DC Motor Speed and Direction Control
      1. H-Bridge Direction Control
      2. Servo Motor Interface
      3. Stepper Motor Control
      4. AC Devices
    5. Interfacing to Miscellaneous DC Devices
      1. Sonalerts, Beepers, Buzzers
      2. Vibrating Motor
      3. DC Fan
      4. Bilge Pump
    6. Summary
    7. References and Further Reading
    8. Chapter Problems
  10. Embedded Systems Design
    1. What is an Embedded System?
    2. Embedded System Design Process
      1. Project Description
      2. Background Research
      3. Pre-Design
      4. Design
      5. Implement Prototype
      6. Preliminary Testing
      7. Complete and Accurate Documentation
    3. Special Effects LED Cube
      1. Construction Hints
      2. LED Cube Code
    4. Autonomous Maze Navigating Robots
      1. Dagu Magician Robot
      2. Requirements
      3. Circuit Diagram
      4. Structure Chart
      5. UML Activity Diagrams
      6. Microcontroller Code
    5. Mountain Maze Navigating Robot
      1. Description
      2. Requirements
      3. Circuit Diagram
      4. Structure Chart
      5. UML Activity Diagrams
      6. Microcontroller Code
      7. Mountain Maze
      8. Project Extensions
    6. Weather Station
      1. Requirements
      2. Structure Chart
      3. Circuit Diagram
      4. UML Activity Diagrams
      5. Microcontroller Code (1/3)
      6. Microcontroller Code (2/3)
      7. Microcontroller Code (3/3)
    7. Motor Speed Control
    8. Circuit Diagram
      1. Requirements
      2. Structure Chart
      3. UML Activity Diagrams
      4. Microcontroller Code (1/2)
      5. Microcontroller Code (2/2)
    9. Summary
    10. References and Further Reading
    11. Chapter Problems
  11. ATmega164 Header File (1/4)
  12. ATmega164 Header File (2/4)
  13. ATmega164 Header File (3/4)
  14. ATmega164 Header File (4/4)
  15. Authors' Biographies
  16. Index
  17. Blank Page (1/5)
  18. Blank Page (2/5)
  19. Blank Page (3/5)
  20. Blank Page (4/5)
  21. Blank Page (5/5)

Product information

  • Title: Microchip AVR® Microcontroller Primer, 3rd Edition
  • Author(s): Steven F. Barrett, Daniel J. Pack, Mitchell A. Thornton
  • Release date: September 2019
  • Publisher(s): Morgan & Claypool Publishers
  • ISBN: 9781681732053