1st Edition

Microcontroller Programming An Introduction

By Syed R. Rizvi Copyright 2012
    548 Pages 229 B/W Illustrations
    by CRC Press

    Microcontroller Programming: An Introduction is a comprehensive one-stop resource that covers the concepts, principles, solution development, and associated techniques involved in microcontroller-based systems. Focusing on the elements and features of the popular and powerful Motorola 68HC11 microcontroller IC as a representative example, this book is unlike others, which are often too broad in scope, delving into every topic of concern regarding microcontroller programmers. Instead, this text concentrates on design, architecture, and development, giving developers the tools to develop solid, effective embedded applications.

    Packaged with helpful examples, projects, and illustrations, this book gives an in-depth assessment of microcontroller design programming in both assembly and C. By illustrating the relatively sophisticated 8-bit 68HC11 microcontroller, the author—who is a consultant for NASA—provides a firsthand exploration and demonstration of the languages, tools, and techniques needed to build embedded applications. Readers can then apply their newly acquired skills to program other 8/16/32-bit microcontrollers.

    For readers who want to do more than just scrape the surface, this book is an enjoyable and immensely beneficial tool to help them cultivate a deeper understanding of microcontroller-based application development. An extensive supplements package is available free of charge to instructors who use the book for a course.

    Number Systems, Operations, and Codes

    Digital versus Analog Quantities

    Digital Numbering System (Base 10)

    Binary Numbering System (Base 2)

    Octal Numbering System (Base 8)

    Hexadecimal Numbering System (Base 16)

    Binary-Coded-Decimal System

    Binary Conversions

    Binary Operations

    Octal Conversions

    Hexadecimal Conversions

    Hexadecimal Operations

    1’s and 2’s Complements of Binary Numbers

    Signed Numbers

    The ASCII Code


    Semiconductors and Digital Logic

    Diode Logic

    The Inverter

    The AND Gate

    The OR Gate

    The NAND Gate

    The NOR Gate

    The Exclusive-OR Gate

    The Exclusive-NOR Gate


    Microcontroller Hardware

    A Transistor as a Switch

    The TTL Integrated Circuit

    The CMOS Integrated Circuit

    Using Integrated-Circuit Logic Gates

    Seven-Segment Displays

    Liquid-Crystal Displays

    Keypads

    The 68HC11/68HC12 Microcontroller

    EVBU/BUFFALO


    Microcontroller Software

    Programming Concepts

    System Software

    Developing a Program

    Flow and State Diagrams

    HC11 Programming Model

    HC11 Memory-Addressing Modes


    Instructions

    Data Movement

    Arithmetic

    Logic

    Shifting and Rotating

    Multiplication and Division

    CCR (Flag) Manipulation

    Bit-Level Operations


    Control Structures and Subroutines

    Indexed Addressing Mode

    Jumping and Branching

    Compare Instructions

    Conditional Flow and Program Loops

    Stack Operation

    Subroutines

    BUFFALO Subroutine


    Hello, World!

    Creating Source Code Files

    Assembling Programs

    Ten Useful Programs


    Input/Output (I/O) Ports

    Data Transfer Mode

    Port A

    Port B

    Port C

    Port D and Port E

    I/O Using Handshaking

    A Project Using Port B


    Interrupts

    Basics of an Interrupt

    Servicing an Interrupt

    Interrupt Control

    Maskable Interrupts

    Output Compare

    Nonmaskable Interrupts

    Interrupts on the EVBU

    A Project with Interrupts


    Analog Capture

    Analog-to-Digital Conversion

    A/D Tools

    A/D Operation

    A Project with Analog Capture


    Input Capture

    Basic Modules of Input Capture

    Input-Capture Registers

    Input Edge Detection Logic

    Interrupt Generation Logic

    A Project with Input Capture


    Higher-Level Programming

    Levels in Programming Languages

    C Programming

    Examples

    A Project with C

     

    Appendix 1—Supplemental Website

    Appendix 2—States and Resolution for Binary Numbers

    Appendix 3—Basic Boolean Theorems and Identities

    Appendix 4—The Resistor Color Code

    Appendix 5—Waterfall Software Development Lifecycle Model

    Appendix 6—Loading Your Program into the EEPROM

    Appendix 7—Pulse-Width Modulation

    Appendix 8—HC11 Instruction Set

    Appendix 9—Comprehensive Glossary

    Biography

    Syed R. Rizvi develops advanced technologies primarily for NASA Langley Research Center. He is the software consultant for the Environmental Management Information Systems at NASA LaRC. He maintains the web site Microcontroller Guide (www.microcontrollerguide.com), which contains hands-on tutorials, discussions, and interesting microcontroller-based projects for both students and hobbyists.

    "... a good framework to the tools and techniques through the assembly and C languages for building embedded applications. There are discussions on the fundamental concepts of microcontroller programming along with the embedded applications like LCD devices. The approach in the book is a simplified one which is targeted to beginning undergraduate students in computer science/electrical engineering with little programming and hardware experience. ... covers all the essential topics in a typical microcontroller programming. ... plenty of exercises, examples and hands-on codes that complement the discussed concepts, and these items definitely help the students."
    —Shaharuddin Salleh, Universiti Teknologi Malaysia,