Page 381 - Introduction to Microcontrollers Architecture, Programming, and Interfacing of The Motorola 68HC12
P. 381
358 Chapter 12 Other Microcontrollers
* SUBROUTINE DOTPRD
* GLOBAL VARIABLES USED IN SUBROUTINE AND AS PARAMETERS
TERM: RMB 2
LOCV: RMB 2
LOCW RMB 2
LOCDP: RMB 2
*
DOTPRD: LDAA LOCV
LDX LOCW
MUL
STAA TERM+1 ; Copy first term low byte to local variables
STX TERM ; Copy first term high byte to local variables
LDAA LOCV+1
LDX LOCW+1
MUL
ADD TERM+1 ; Add first term low byte to product
STAA LDCDP+l ; Copy first term low byte to out. param.
TXA ; Move high byte to accumulator
ADC TERM ; Add first term high byte to product
STAA LDCDP ; Copy first term high byte to out. param.
RTS
Figure 12.7. A 6805 Dot Product Subroutine
12.4 The 68300 Series
The preceding sections covered microcomputers that are less powerful than the 6812. We
now present an overview of the 68300 series of microcomputers (the 68332, 68340) to
convey an understanding of the strengths and weaknesses of these microcomputers in
particular and of similar 16-bit microcomputers in general. The next section will
similarly introduce the 500 and M-CORE series of RISC microcontrollers. However, in
these two sections, we will at best be able to prepare you to write a few programs,
similar to those written for the 6812, for these microcomputers. There is much more to
these computers than we can discuss in the short section we can allot to each computer.
The register set for the 68300 series features seventeen 32-bit registers, a 32-bit
program counter, and a 16-bit status register (see Figure 12.8). The eight data registers
are functionally equivalent to the accumulators in the 6812, and the nine address registers
are similar to the index registers.
The low byte of the status register is similar to the 6812 condition code register,
having the familiar N, Z, V, and C condition code bits and a new condition code bit X,
which is very similar to the carry bit C. Bits X and C differ in that C is changed by
many instructions and is tested by conditional branch instructions, while X is changed
only by a few arithmetic instructions and is used as the carry input to multiple-precision
arithmetic operations. Having two carry bits, X and C, avoids some dilemmas in the
design of the computer that are inherent in simpler computers such as the 6812. This

