Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Микроконтроллер Motorola 68HC11.pdf
Скачиваний:
38
Добавлен:
26.05.2014
Размер:
985.62 Кб
Скачать

an illegal opcode is detected and the interrupt is recognized, the current value of the program counter is stacked. After interrupt service is complete, reinitialize the stack pointer so repeated execution of illegal opcodes does not cause stack underflow. Left uninitialized, the illegal opcode vector can point to a memory location that contains an illegal opcode. This condition causes an infinite loop that causes stack underflow. The stack grows until the system crashes.

The illegal opcode trap mechanism works for all unimplemented opcodes on all four opcode map pages. The address stacked as the return address for the illegal opcode interrupt is the address of the first byte of the illegal opcode. Otherwise, it would be almost impossible to determine whether the illegal opcode had been one or two bytes. The stacked return address can be used as a pointer to the illegal opcode so the illegal opcode service routine can evaluate the offending opcode.

5.4.4 Software Interrupt

SWI is an instruction, and thus cannot be interrupted until complete. SWI is not inhibited by the global mask bits in the CCR. Because execution of SWI sets the I mask bit,

once an SWI interrupt begins, other interrupts are inhibited until SWI is complete, or 5 until user software clears the I bit in the CCR.

5.4.5 Maskable Interrupts

The maskable interrupt structure of the MCU can be extended to include additional external interrupt sources through the IRQ pin. The default configuration of this pin is a low-level sensitive wired-OR network. When an event triggers an interrupt, a software accessible interrupt flag is set. When enabled, this flag causes a constant request for interrupt service. After the flag is cleared, the service request is released.

5.4.6 Reset and Interrupt Processing

Figure 5-1 and Figure 5-2 illustrate the reset and interrupt process. Figure 5-1 illustrates how the CPU begins from a reset and how interrupt detection relates to normal opcode fetches. Figure 5-2 is an expansion of a block in Figure 5-1 and illustrates interrupt priorities. Figure 5-3 shows the resolution of interrupt sources within the SCI subsystem.

M68HC11 E SERIES

RESETS AND INTERRUPTS

MOTOROLA

TECHNICAL DATA

 

5-11

HIGHEST

PRIORITY

POWER-ON RESET (POR)

DELAY 4064 E CYCLES

EXTERNAL RESET

CLOCK MONITOR FAIL

(WITH CME = 1)

 

 

 

 

 

 

 

 

LOWEST

 

 

 

 

 

 

 

 

PRIORITY

5

 

 

 

 

 

 

COP WATCHDOG

 

 

 

 

 

 

TIMEOUT

 

 

 

 

 

 

(WITH NOCOP = 0)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

LOAD PROGRAM COUNTER

 

LOAD PROGRAM COUNTER

 

LOAD PROGRAM COUNTER

WITH CONTENTS OF

 

WITH CONTENTS OF

 

WITH CONTENTS OF

 

$FFFE, $FFFF

 

$FFFC, $FFFD

 

$FFFA, $FFFB

 

(VECTOR FETCH)

 

(VECTOR FETCH)

 

(VECTOR FETCH)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

SET BITS S, I, AND X

 

RESET MCU

 

HARDWARE

1A

BEGIN INSTRUCTION

 

SEQUENCE

Y

BIT X IN

 

CCR = 1?

 

N

XIRQ

Y

STACK CPU

PIN LOW?

 

 

REGISTERS

 

 

N

 

SET BITS I AND X

 

 

 

 

FETCH VECTOR

2A

 

$FFF4, $FFF5

FLOW OUT OF RESET P1

Figure 5-1 Processing Flow out of Reset (1 of 2)

MOTOROLA

RESETS AND INTERRUPTS

M68HC11 E SERIES

5-12

 

TECHNICAL DATA

STACK CPU

REGISTERS

SET BIT I IN CCR

FETCH VECTOR $FFF8, $FFF9

STACK CPU

REGISTERS

SET BIT I IN CCR

FETCH VECTOR $FFF6, $FFF7

RESTORE CPU

REGISTERS

FROM STACK

2A

Y

BIT I IN

 

 

CCR = 1?

 

 

 

N

 

 

 

 

 

ANY I-BIT

Y

 

INTERRUPT

 

 

PENDING?

 

N

FETCH OPCODE

Y ILLEGAL

OPCODE?

N

WAI Y INSTRUCTION?

N

Y SWI INSTRUCTION?

N

Y RTI INSTRUCTION?

N

EXECUTE THIS

INSTRUCTION

1A

STACK CPU

REGISTERS

5

STACK CPU

REGISTERS

N ANY

INTERRUPT

PENDING?

Y

SET BIT I IN CCR

RESOLVE INTERRUPT

PRIORITY AND FETCH

VECTOR FOR HIGHEST

PENDING SOURCE

SEE FIGURE 5–2

FLOW OUT OF RESET P2

Figure 5-1 Processing Flow out of Reset (2 of 2)

M68HC11 E SERIES

RESETS AND INTERRUPTS

MOTOROLA

TECHNICAL DATA

 

5-13

BEGIN

 

X BIT

YES

IN CCR

 

SET ?

 

NO

 

HIGHEST

YES

PRIORITY

INTERRUPT

?

NO

YES

IRQ ?

NO

5

YES

RTII = 1 ?

NO

YES

IC1I = 1 ?

NO

YES

IC2I = 1 ?

NO

YES

IC3I = 1 ?

NO

YES

OC1I = 1 ?

NO

2A

YES

XIRQ PIN SET X BIT IN CCR

LOW ?

FETCH VECTOR

$FFF4, FFF5

NO

FETCH VECTOR

FETCH VECTOR $FFF2, FFF3

REAL-TIME

YES

FETCH VECTOR

INTERRUPT

 

$FFF0, FFF1

?

 

 

NO

 

 

TIMER

YES

FETCH VECTOR

 

$FFEE, FFEF

IC1F ?

 

 

 

NO

 

 

TIMER

YES

FETCH VECTOR

 

$FFEC, FFED

IC2F ?

 

 

 

NO

 

 

TIMER

YES

FETCH VECTOR

 

$FFEA, FFEB

IC3F ?

 

 

 

NO

 

 

TIMER

YES

FETCH VECTOR

 

$FFE8, FFE9

OC1F ?

 

 

 

NO

 

 

2B

INT PRIORITY RES P1

Figure 5-2 Interrupt Priority Resolution (1 of 2)

MOTOROLA

RESETS AND INTERRUPTS

M68HC11 E SERIES

5-14

 

TECHNICAL DATA

Соседние файлы в предмете Радиоприемные устройства