Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
8xC196EA microcontroller user's manual.1998.pdf
Скачиваний:
52
Добавлен:
23.08.2013
Размер:
8.29 Mб
Скачать

STANDARD AND PTS INTERRUPTS

The following code is a simplified example of an interrupt service routine that uses the TIJMP instruction to service the PIH0_INT interrupt. This routine services all active PIH0_INT interrupt sources in order of their priority. The TIJMP instruction calculates an offset to fetch a word from a jump table (JTBASE in this example) which contains the start addresses of the interrupt service routines.

INIT_INTERRUPTS:

LD JTBASE_PTR,#LSW JTBASE;store jump table base address

PIH0_INT_ISR:

LD PIH0_VEC_IDX_PTR,#PIH0_VEC_IDX;read PIH0_VEC_IDX

PUSHA

;save INT_MASK/INT_MASK1/WSR/PSW

TIJMP JTBASE_PTR,[PIH0_VEC_IDX_PTR],#1FH;initiate jump to correct ISR

EPA0_ISR:

;EPA0 interrupts service routine

.

;

.

;

TIJMP JTBASE_PTR,[PIH0_VEC_IDX_PTR],#1FH

 

;check for pending

 

;interrupts, exit

PIH0_DONE:

 

 

POPA

 

 

RET

 

;exit, all PIHx

 

 

;interrupts serviced

JTBASE:

 

 

DCW

LSW EPA0_ISR

;0 (EPA0)

DCW

LSW EPA1_ISR

;1 (EPA1)

DCW

LSW EPA2_ISR

;2 (EPA2)

DCW .

 

DCW .

 

DCW .

 

DCW

LSW PIH0_DONE

;0010H (no pending interrupts)

Notice that the interrupt service routine ends with another TIJMP instruction instead of a RET instruction. The TIJMP instruction checks the PIH0_VEC_IDX register for any other pending PIH0 interrupts. When PIH0_VEC_IDX contains a 0010H (no pending interrupts) the routine vectors to PIH0_DONE and executes a RET instruction.

6.3.1.2Providing the Vector Address in Response to a CPU Request

If the CPU requests the interrupt vector address as part of an interrupt request acknowledge cycle, the PIH provides the address in the following format:

zzzz zzzz zzxxxxy0

where:

 

zzzz zzzz zz

is the ten address bits from the base-address register (Figure 6-4).

xxxx

is the hex value of the highest priority interrupt request pending

y

is zero if the request is for standard interrupt service and one if the request is for

 

PTS service.

6-11

8XC196EA USER’S MANUAL

The last bit is always zero. The CPU automatically adds FF0000H to the 16-bit vector because all interrupt vectors are located in page FFH.

NOTE

Always initialize the base-address registers with the starting address of the appropriate PIH vectors in special-purpose memory (i.e., PIH0_VEC_BASE = 20C0H and PIH1_VEC_BASE = 2100H).

If no PIH interrupt request is active when the CPU requests the interrupt vector address, the PIH responds with 2014H for a standard interrupt cycle or 2016H for a PTS interrupt cycle as shown in the following example.

0010 0000 0001 01y0

where:

 

y

is zero if the request is for standard interrupt service and one if the request is for

 

PTS service.

These vectors are reserved for dummy interrupt or PTS cycles. Initialize address FF2014H to point to a simple routine that contains only a RET instruction and address FF2016H to point to the zero register (0000H).

6-12

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