Page 13 - Introduction to Microcontrollers Architecture, Programming, and Interfacing of The Motorola 68HC12
P. 13

.v/7                                                              Preface


         different addressing modes are introduced with a goal of explaining why these modes are
        useful as well as how they work. Examples at the end of the chapter illustrate the use of
        these modes with the instructions introduced in Chapter 2.
             The end of Chapter 3 shows the use of program-relative addressing for position
        independence and the use of stack addressing for recursion and reentrancy.
             Chapters 4 to 6 show how a program can be more easily written in assembler and
        the high-level C language and translated into machine code by an assembler. Chapter 4
        introduces the assembler, explains assembler directives and symbolic addresses, and
        introduces limitations of forward referencing in a two-pass assembler. Assembly
        language examples that build on the examples from previous chapters conclude Chapter
        4. Chapter 5, which may be omitted if the reader is not going to write assembler
        language programs, provides insights needed by programmers who write large assembler
        language programs. A general discussion of related programs, including macro,
        conditional, and relocatable assemblers and linkers, is given.
             Chapter 6 develops assembler language subroutines. It illustrates techniques used
        in assembler language at an implementation level (such as passing arguments in
        registers). The tradeoffs between macros and subroutines as a means to insert the same
        program segment into different places in a program are discussed.
             Chapter 7 covers arithmetic routines. An implementation is shown for unsigned
        and signed multiplication and division. Conversion between different bases is discussed
        and examples are given illustrating conversion from ASCII decimal to binary and vice
        versa. Stack operation and Polish notation are shown to be useful in realizing arithmetic
        routines of any complexity. Multiple-precision integer arithmetic is discussed by means
        of examples of 32-bit operations including multiplication and division. Floating-point
        representations are introduced, and the mechanics of common floating- point operations
        are discussed. Finally, a 6812-oriented introduction of fuzzy logic is presented.
             Chapter 8, which may be omitted if the reader is already familiar with C, discusses
        compilers and interpreters, and briefly introduces C programming to provide a
        background for later chapters.
             Chapter 9 introduces the implementation of C procedures. Several constructs in C,
        such as switch statements, are shown implemented in assembler language. The
        techniques C uses to hold local variables and to pass arguments to a subroutine on the
        stack are shown implemented in assembler language.
             Chapter 10 covers elementary data structures. The simplest, including the character
        string used in earlier chapters, and the more involved deque and linked list structures are
        related to the addressing modes available in the 6812. The main theme of this chapter is
        that the correct storage of data can significantly improve the efficiency of a program.
             Chapter 11 introduces input/output programming. Input and output devices are
        characterized. Then the 6812's parallel ports are described. Input and output software is
        illustrated with some examples. We then show 6812 synchronization hardware, to
        introduce gadfly and interrupt synchronization. Finally we show how D-to-A and A-to-D
        conversion is done.
             Chapter 12 shows how the assembly language of a different microcontroller might
        be learned once that of the 6812 has been learned. Although we would like to discuss
        other popular microcontrollers, we believe that we could fill another book doing that. To
        illustrate the idea, we look at the near relatives less costly than the 6812, in particular,
        the 6805,6808, and 6811. We also discuss briefly more powerful microcontrollers such
   8   9   10   11   12   13   14   15   16   17   18