Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Introduction to Microcontrollers. Architecture, Programming, and Interfacing of the Motorola 68HC12 (G.J. Lipovski, 1999).pdf
Скачиваний:
190
Добавлен:
12.08.2013
Размер:
29.57 Mб
Скачать

358

Chapter 12 OtherMicrocontrollers

*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

Appendix 1 NumberRepresentations and Binary Arithmetic

385

46 = $2E and the 16's-complement of $2E is $D1 + 1 = $D2, the desired result. You should try to understandhow this works. (See the problems at the end of this appendix.)

A1.3 Remarks

The material discussed here can be found in any introductory text on logic design. We recommend the book Fundamentals of Logic Design, 4th ed., by C. H. Roth (PWS Publishing Co., Boston MA, 1995).