Product Cover Image

Microcontroller Theory and Applications: HC12 and S12, Coursesmart eTextbook, 2nd Edition

By Daniel J Pack, Steven F Barrett

Published by Prentice Hall

Published Date: Jan 8, 2008

More Product Info

Description

For undergraduate students taking a Microcontroller or Microprocessor course, frequently found in electrical engineering and computer engineering curricula.

 

This text provides the reader with fundamental assembly language programming skills, an understanding of the functional hardware components of a microcontroller, and skills to interface a variety of external devices with microcontrollers

Table of Contents

CONTENTS

 

 

1 Introduction To The HC 12 Microcontrollers

   1.1  Brief History of Computers

   1.2  Computers and Embedded Controllers

   1.3  Applications of Embedded Controllers

   1.4  Overview of the HC12

            1.4.1  Software Instruction Set

           1.4.2  Hardware

   1.5  Overview of the S12

           1.5.1  Software Instruction Set

           1.5.2  Hardware

   1.6  Summary

   1.7 Further Reading

 

2  HC12 And S12 Assembly Language Programming

   2.1  Programmer’s Model

   2.2  Freescale Assembly Language

   2.3  Instruction Execution Cycle

   2.4  Instruction Set

           2.4.1  Data Transfer and Manipulation Instructions

           2.4.2  Arithmetic Operations

           2.4.3  Logical and Bit Operations

           2.4.4  Data Test Instructions

           2.4.5  Optional: Fuzzy Logic Instructions

   2.5  Addressing Modes

          2.5.1  Inherent Addressing Mode

          2.5.2  Immediate Addressing Mode

          2.5.3  Direct Addressing Mode

          2.5.4  Extended Addressing Mode

          2.5.5  Index Addressing Mode

          2.5.6  Relative Addressing Mode

   2.6  Branch Instructions

   2.7  Directives (pseudo-op code) and a Good Programming Approach

          2.7.1  Directives

          2.7.2  A Good Programming Approach

   2.8  Laboratory Applications

   2.9  Summary

   2.10 Chapter Problems

 

3 Advanced Assembly Programming

   3.1  Assembly Process

   3.2  Loops

   3.3  Stack

          3.3.1  Definition of Stack

          3.3.2  Use of a Stack

          3.3.3  Access to a Stack

   3.4  Subroutines

          3.4.1  Subroutine Calls and Returns

          3.4.2  Parameter-Passing Techniques

   3.5  68HC12 D-Bug12 Utility Subroutines

   3.6  Programming Modules

          3.6.1  Programming Techniques

   3.7  Applications

   3.8  Laboratory Applications

   3.9  Summary

   3.10 Further Reading

   3.11 Chapters Problems

 

4 Fuzzy Logic 

   4.1  Conventional Controller versus Fuzzy Logic Controller

   4.2  Fuzzy Logic Controller for a Balancing Robot

          4.2.1  Background

          4.2.2  Optional: Dynamic Model for the Robot

          4.2.3  Fuzzy Logic Controller

   4.3  The 68HC12 Fuzzy Logic Operations

          4.3.1  Membership Function Design Process

          4.3.2  FuzzyRule Implementation

          4.3.3  68HC12 Fuzzification Process

          4.3.4  Unweighted Rule Evaluation (REV) and Weighted Rule Evaluation (REVW)

          4.3.5  68HC12 Defuzzification Process

          4.3.6  Other Fuzzy Logic Controller-Related Instructions

   4.4  Application

   4.5  Some Comments on Fuzzy Logic Controller Design

   4.6  Laboratory Application

   4.7  Summary

   4.8  Further Reading

   4.9  Chapter Problems

 

5 HC12 and S12 Hardware Configuration

   5.1  The Maze Following Robot

   5.2  The HC12 Hardware System

   5.3  The S12 Hardware System

   5.4  Modes

          5.4.1  Normal Operating Modes

   5.5  Hardware Pin Assignments

   5.6  HC12 Subsystems

          5.6.1  Register Block

          5.6.2  Port System

          5.6.3  A Few More Details on Ports

          5.6.4  The Timing System-The Standard Timer Module

          5.6.5  The Memory System

          5.6.6  Interrupts

          5.6.7  Clock Functions

          5.6.8  Serial Communications-The Multiple Serial Interface

          5.6.9  The Data Conversion-The Analog-to-Digital Converter

   5.7  S12 Subsystem

          5.7.1  S12 Register Block

          5.7.2  S12 Memory System

          5.7.3  S12 Port System

          5.7.4  S12 Interrupts

   5.8  Application-Switches, Keypads, Indicators-Oh My!

          5.8.1  HC12 Electrical Compatibility

          5.8.2  Input Switches

          5.8.3  Switch Bank

          5.8.4  Keypads

          5.8.5  Indicators-Light Emitting Diodes

          5.8.6  Indicators-Seven-Segment Displays

          5.8.7  Programming Switches and Indicators

          5.8.8  Interfacing High Power AC and DC Devices

          5.8.9  Optical Isolation

          5.8.10 H-bridge

   5.9  Application-Wall Following Robot

   5.10 Laboratory Application

   5.11 Summary

   5.12 Chapter Problems

 

6 Exceptions-Resets and Interrupts

   6.1  Overview

   6.2  What Is an Interrupt

   6.3  General Interrupt Response

   6.4  Reset and Exception Systems Aboard the HC12

          6.4.1  HC12 Resets

          6.4.2  HC12 Interrupts

          6.4.3  HC12 Exception Vector

          6.4.4  HC12 Exception Priority

          6.4.5  HC12 Interrupt Systems-Associated Registers

   6.5  Reset and Exception Systems Aboard the S12 Microcontroller

   6.6  How Does HC12 Respond to an Interrupt?

   6.7  Writing Interrupt Service Routines

          6.7.1  ISRs with the 68HC812A4 EVB RAM-Set User Vector Technique

          6.7.2  The S12 RAM based ISR-Set User Vector Technique

          6.7.3  How to Program an HC12 ISR-An Example for Flash EEPROM

          6.7.4  Programming the HC12 Real-Time Interrupt (RTI) System

          6.7.5  The S12 Real-Time Interrupt (RTI)

          6.7.6  Another RAM Based Method of Initializing the Interrupt Vector Table

   6.8  A Few More Details

   6.9  Advanced Interrupt Topics

   6.10 Laboratory Application

   6.11 Summary

   6.12 Further Reading

   6.13 Chapter Problems

 

7 The HC12 and S12 Clock and Timer System

   7.1  Overview

   7.2  Background Theory

   7.3  The HC12 Clock Module

   7.4  HC12 Clock Divider Chain Serving the TIM

   7.5  The HC12 Timer Module

   7.6  Components of the HC12 Timer Module

          7.6.1  HC12 Free-Running Counter

          7.6.2  HC12 Free-Running Counter-Associated Registers

          7.6.3  Input Capture/Output Compare Channels

          7.6.4  The HC12 Pulse Accumulator

   7.7  The HC12 Real-Time Interrupt

   7.8  Programming the HC12 Input Capture, Output Compare, and the Pulse Accumulator

          Features of the TIM

7.8.1  Programming the Input Capture System

7.8.2  Programming the Input Capture System with an Interrupts

7.8.3  Programming the Output Compare System

7.8.4  Programming the Output Compare System with Interrupts

7.8.5  Programming the CH12 Pulse Accumulator System               

7.9    The HC12 Pulse Width Modulation System (PWM) System

7.9.1  Fundamentals and Features

7.9.2  PWM Channel Alignment

7.9.3  PWM Clock System

7.9.4  PWM Registers

7.9.5  Programming the PWM

7.10   The S12 Clock and Timing System

7.11   The S12 Clock and Reset Generator

7.12   The Enhanced Capture Timer

7.12.1 S12 Timer Related Registers

7.12.2 Enhanced Capabilities of the ECT System

7.12.3      Non-Buffered Input Capture Channels

7.12.4      Buffered Input Capture Channels

7.12.5      Pulse Accumulator Features

7.12.6      ECT Related Registers

7.13      The S12 Pulse Width Modulation System

7.14      Example: An S12 Based Maze Navigating Robot

7.14.1      The Robot Platform

7.14.2      Motor Control

7.14.3      IR Sensor

7.14.4      Interface Electronics

7.14.5      Power Subsystems

7.14.6      S12 Evaluation Board-the Minidragon+

7.14.7      Motor Control Using the S12 PWM System

7.15      Applications

7.16      Laboratory Applications

7.17      Summary

7.18      References

7.19      Chapter Problems

 

8 The HC12 and S12 Memory System

   8.1  Overview

   8.2  Background

          8.2.1  HC12 Memory Variants

          8.2.2  S12 Memory Variants

   8.3  Basic Memory Concepts

          8.3.1  Memory Capacity and Control Signals

          8.3.2  Memory Buses

          8.3.3  Memory Technologies: ROM versus RAM

          8.3.4  Memory Map

          8.3.5  The A4 Memory System

   8.4  Linear Memory Expansion: HC12 Case Study

          8.4.1  Memory Layout Design

          8.4.2  68HC12 and Memory Chip Control Signal Connections

          8.4.3  Timing Analysis of Basic Memory Operations

          8.4.4  Electrical Compatibility

          8.4.5  HC12 Memory Paging

          8.4.6  EEPROM Modification

   8.5  S12 Memory System

          8.5.1  The S12 Paged Memory System

          8.5.2  Programming Flash and Paged Memory

   8.6  Applications

   8.7  Case Study: and 671GST LCD Character Display Interface

          8.7.1  Hardware Interface

          8.7.2  Timing Interface

          8.7.3  Software Interface

   8.8  Further Reading

   8.9  Summary

   8.10 Chapter Problems 

 

9 Analog-to-Digital (ATD) Converter

   9.1  Overview

   9.2  Transducer Interface Design

   9.3  Analog-to-Digital Conversion Background Theory

          9.3.1  Sampling Rate

          9.3.2  Transducer Interface Design

          9.3.3  Quantizing and Resolution

          9.3.4  Data Rate

   9.4  Analog-to-Digital Converter Technologies

          9.4.1  Successive-Approximation Converters

          9.4.2  Integration-Based Converters

          9.4.3  Counter-Type Converters

          9.4.4  Parallel Converters

   9.5  The HC12 Analog-to-Digital (ATD) Conversion System

          9.5.1  HC12 ATD System

          9.5.2  HC12 ATD System Control Registers

          9.5.3  Programming the HC12 ATD System

          9.5.4  Programming the HC12 ATD System using Interrupts

   9.6  S12 Analog-to-Digital (ATD) Conversion System

          9.6.1  Selectable 8 or 10 Bit Resolution

          9.6.2  Lest/Right Justified and Signed/Unsigned Result Data

          9.6.3  External Trigger Control

          9.6.4  Flexible 1 to 8 Conversion Sequence Length Configuration

          9.6.5  Multiple ATD Channels

          9.6.6  S12 ATD Registers

          9.6.7  Programming the S12 ATD System

   9.7  HC12 Application

   9.8  Laboratory Application

   9.9  Summary

   9.10 Further Reading

   9.11 Chapter Problems

 

10 Microcontroller Communication Systems

   10.1  Need for Serial Communication Features

   10.2  Fundamentals of Serial Communication

          10.2.1  Serial Communication Terminology

          10.2.2  Serial Communication Signals

   10.3  Multiple Serial Interface

   10.4  The Serial Communication Interface

          10.4.1  Hardware Description-The SCI Transmitter

          10.4.2  Hardware Description-The SCI Receiver

          10.4.3  SCI Registers

          10.4.4  SCI Transmitter and Receiver Operation

          10.4.5  Programming the Serial Communication Interface

   10.5  HC12 and S12 SPI-Serial Peripheral Interface

          10.5.1  SPI Concepts

          10.5.2  SPI General Description

          10.5.3  HC12 SPI Registers

          10.5.4  S12 SPI System     

          10.5.5  Programming the HC12 SPI

          10.5.6  Programming the S12 SPI System

          10.5.7  SPI Applications

   10.6  Inter-IC Communication: The I2C Bus

          10.6.1  I2C Bus Configuration

          10.6.2  I2C Basic Protocol

          10.6.3  I2C Registers

          10.6.4  Key Activity Description

          10.6.5  I2C Related Interrupts

          10.6.6  Assembly Language Code Examples

          10.6.7  I2C Configured Devices

   10.7  Controller Area Networks

          10.7.1  Computer Networks

          10.7.2  Controller Area Network

   10.8  Laboratory Application

   10.9  Summary

   10.10 Further Reading

   10.11  Chapter Problems

 

A  HC12 / S12 Instruction Set

 

B  68HC812A4 Register Set

 

C  MC9S12DP256 Register Set

 

D  Number Systems and Number Arithmetic

    D.1 Number Representations

    D.2 Binary Number Arithmetic

          D.2.1  The 2’s Complement Number Representation

          D.2.2  Arithmetic

    D.3 Changing the Base of Numbers

    D.4 Summary and Further Readings

 

E  Digital Logic Fundamentals

    E.1 Overview

    E.2 Basic Combinational Logic

          E.2.1  Medium-Scale Integration Combinational Circuits

    E.3 Sequential Logic Circuit Component

          E.3.1  Flip-Flops

          E.3.2  MSI Sequential Circuit Components

    E.4 Summary

 

F  Mobile Robot and Related Products For The HC12/S12

    F.1 Building Your Own Mobile Robot

    F.2 68HC12-Related Hardware and Software Products

          F.2.1  Hardware

          F.2.2  Software

 

INDEX

  

Purchase Info ?

With CourseSmart eTextbooks and eResources, you save up to 60% off the price of new print textbooks, and can switch between studying online or offline to suit your needs.

Once you have purchased your eTextbooks and added them to your CourseSmart bookshelf, you can access them anytime, anywhere.

Buy Access

Microcontroller Theory and Applications: HC12 and S12, Coursesmart eTextbook, 2nd Edition
Format: Safari Book

$73.99 | ISBN-13: 978-0-13-604171-9