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

50                                             Chapter 2 The Instruction Set

         Table 2.10. Special Instructions


























        in either the register or the memory at the effective address. EMACS is a multiply-and-
        accumulate instruction similar to such instructions used in digital signal processors
        (DSPs).
            The following examples use pointer addressing, in which the effective address is the
        contents of an index register, without adding any other value to it.
            We are about to output the contents of accumulator D to an output device, but the
        output must be limited to be at least Vmin, and at most Vmax. Suppose location $803
        has the address of Vmax and location $805 has the address of Vmin. Pointer addressing
        (§3.2) is one of the modes usable with the EMAXD and EMIND instructions. Figure 2.22
        limits the value of accumulator D to be Vmin & D sVmax.
            Figure 2.23 illustrates the use of index registers in the multiply-and-accumulate
        instruction to evaluate the expression: A = A + (B * C), where A is a signed 32-bit
        number at $910, B is a signed 16-bit number at $914, and C is a signed 16-bit number at
        $916. Pointer addressing is the only mode that can be used with the EMACS instruction.
        From Table 2.10, the EMACS instruction executes the expression (X):(X+1) x (Y):(Y+1)
        + (E):(E+l):(E+2):(E+3) -> (E):(E+ l):(E+2):(E+3); from the CPU12RG/D manual, it
        executes this operation in thirteen clock cycles, a little under 2 ptsec.














               Figure 2.22. Program Segment for Ensuring a Value Is between Limits
   68   69   70   71   72   73   74   75   76   77   78