Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
8XC196Kx,8XC196Jx,87C196CA microcontroller family user's manual.1995.pdf
Скачиваний:
68
Добавлен:
23.08.2013
Размер:
3.97 Mб
Скачать

CHAPTER 5

STANDARD AND PTS INTERRUPTS

This chapter describes the interrupt control circuitry, priority scheme, and timing for standard and peripheral transaction server (PTS) interrupts. It discusses the three special interrupts and the five PTS modes, two of which are used with the EPA to produce pulse-width modulated (PWM) outputs. It also explains interrupt programming and control.

5.1OVERVIEW

The interrupt control circuitry within a microcontroller permits real-time events to control program flow. When an event generates an interrupt, the device suspends the execution of current instructions while it performs some service in response to the interrupt. When the interrupt is serviced, program execution resumes at the point where the interrupt occurred. An internal peripheral, an external signal, or an instruction can request an interrupt. In the simplest case, the device receives the request, performs the service, and returns to the task that was interrupted.

This microcontroller’s flexible interrupt -handling system has two main components: the programmable interrupt controller and the peripheral transaction server (PTS). The programmable interrupt controller has a hardware priority scheme that can be modified by your software. Interrupts that go through the interrupt controller are serviced by interrupt service routines that you provide. The upper and lower interrupt vectors in special-purpose memory (see Chapter 4, “Memory Partitions”) contain the interrupt service routines’ addresses. The peripheral transaction server (PTS), a microcoded hardware interrupt processor, provides high-speed, low-over- head interrupt handling; it does not modify the stack or the PSW. You can configure most interrupts (except NMI, trap, and unimplemented opcode) to be serviced by the PTS instead of the interrupt controller.

The PTS supports five special microcoded routines that enable it to complete specific tasks in much less time than an equivalent interrupt service routine can. It can transfer bytes or words, either individually or in blocks, between any memory locations; manage multiple analog-to-dig- ital (A/D) conversions; and generate pulse-width modulated (PWM) signals. PTS interrupts have a higher priority than standard interrupts and may temporarily suspend interrupt service routines.

A block of data called the PTS control block (PTSCB) contains the specific details for each PTS routine (see “Initializing the PTS Control Blocks” on page 5-18). When a PTS interrupt occurs, the priority encoder selects the appropriate vector and fetches the PTS control block (PTSCB).

Figure 5-1 illustrates the interrupt processing flow. In this flow diagram, “INT_MASK” represents both the INT_MASK and INT_MASK1 registers, and “INT_PEND” represents both the INT_PEND and INT_PEND1 registers.

5-1

8XC196Kx, Jx, CA USER’S MANUAL

Interrupt Pending or PTSSRV Bit Set

NMI

Yes

 

 

Pending

 

 

 

?

 

 

 

No

 

 

 

INT_MASK.x

No

Return

 

 

 

= 1?

 

 

 

Yes

 

 

 

PTS

No

Interrupts

No

Enabled?

 

Return

 

Enabled

 

 

 

 

 

?

 

Yes

 

Yes

 

 

 

 

PTSSEL.x

No

 

 

 

 

 

Bit = 1?

 

Priority

 

 

 

 

Yes

 

Encoder

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Highest Priority Interrupt

 

 

 

Priority

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Encoder

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Highest Priority PTS Interrupt

 

 

 

Yes

 

 

 

 

 

No

 

 

 

 

PTSSRV.x

 

 

 

 

 

 

Reset INT_PEND.x

 

 

 

 

 

= 1?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Bit

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Reset PTSSRV.x

 

 

 

 

Reset INT_PEND.x

 

 

 

Execute 1 PTS Cycle

 

Bit

 

 

 

 

 

 

Bit

 

 

 

 

(Microcoded)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Decrement

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PUSH PC

 

 

 

 

 

 

PTSCOUNT

 

 

 

 

 

 

 

 

 

 

 

 

 

 

on Stack

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

No

 

 

 

 

LJMP to

 

 

Return

 

 

 

 

 

 

ISR

 

 

 

 

 

PTSCOUNT

 

 

 

 

 

 

 

 

 

= 0?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Yes

Clear PTSSEL.x Bit

Execute Interrupt

Service Routine

POP PC from Stack

Set PTSSRV.x Bit

Return

Return

A0320-02

Figure 5-1. Flow Diagram for PTS and Standard Interrupts

5-2

STANDARD AND PTS INTERRUPTS

5.2INTERRUPT SIGNALS AND REGISTERS

Table 5-1 describes the external interrupt signals and Table 5-2 describes the control and status registers for both the interrupt controller and PTS.

Table 5-1. Interrupt Signals

PWM Signal

Port Pin

Type

Description

 

 

 

 

EXTINT

P2.2

I

External Interrupt

 

 

 

In normal operating mode, a rising edge on EXTINT sets the

 

 

 

EXTINT interrupt pending flag. EXTINT is sampled during

 

 

 

phase 2 (CLKOUT high). The minimum high time is one state

 

 

 

time.

 

 

 

If the chip is in idle mode and if EXTINT is enabled, a rising

 

 

 

edge on EXTINT brings the chip back to normal operation,

 

 

 

where the first action is to execute the EXTINT service

 

 

 

routine. After completion of the service routine, execution

 

 

 

resumes at the the IDLPD instruction following the one that

 

 

 

put the device into idle mode.

 

 

 

In powerdown mode, asserting EXTINT causes the chip to

 

 

 

return to normal operating mode. If EXTINT is enabled, the

 

 

 

EXTINT service routine is executed. Otherwise, execution

 

 

 

continues at the instruction following the IDLPD instruction

 

 

 

that put the device into powerdown mode.

NMI

I

Nonmaskable Interrupt

 

 

 

In normal operating mode, a rising edge on NMI causes a

 

 

 

vector through the NMI interrupt at location 203EH. NMI must

 

 

 

be asserted for greater than one state time to guarantee that

 

 

 

it is recognized.

 

 

 

In idle mode, a rising edge on the NMI pin causes the device

 

 

 

to return to normal operation, where the first action is to

 

 

 

execute the NMI service routine. After completion of the

 

 

 

service routine, execution resumes at the instruction following

 

 

 

the IDLPD instruction that put the device into idle mode.

 

 

 

In powerdown mode, a rising edge on the NMI pin does not

 

 

 

cause the device to exit powerdown.

This signal is not implemented on the 8XC196Jx (see “Design Considerations for 8XC196JQ, JR, JT, and JV Devices” on page 2-14).

Table 5-2. Interrupt and PTS Control and Status Registers

Register

Register

Description

Mnemonic

Name

 

 

 

 

CAN_INT

1E5FH

CAN Interrupt Pending

(CA only)

 

This read-only register indicates the source of the highest-priority

 

 

pending CAN interrupt.

 

 

 

5-3

Соседние файлы в предмете Электротехника