Fujitsu F2MC-8FX Manual Do Utilizador

Página de 272
34
CHAPTER 4  INTERRUPT PROCESSING
4.3
Creating an Interrupt Processing Program
In the F
2
MC-8FX series, basically, interrupt requests from resources are issued by 
hardware and cleared by software.
Creating an Interrupt Processing Program
The interrupt processing control flow is as follows:
1. Initialize resources before operation.
2. Wait until an interrupt occurs.
3. In the event of an interrupt, if the interrupt can be accepted, perform interrupt processing to branch to
the interrupt processing routine.
4. First, set software so as to clear the interrupt source at the beginning of the interrupt processing routine.
This is done so that the resource causing an interrupt can regenerate the interrupt during the interrupt
processing program.
5. Next, perform interrupt processing to transfer the necessary data.
6. Use the interrupt release instruction to release the interrupt from interrupt processing.
7. Then, continue to execute the main program until an interrupt recurs. The typical interrupt processing
flow is shown in Figure 4.3-1.
The numbers in the figure correspond to the numbers above.
Figure 4.3-1  Interrupt Processing Flow
The time to transfer control to the interrupt processing routine after the occurrence of an interrupt 3 in
Figure 4.3-1) is 9 instruction cycles. An interrupt can only be processed in the last cycle of each instruction.
The time shown in Figure 4.3-2 is required to transfer control to the interrupt processing routine after an
interrupt occurs.
The longest cycle (17 + 9 = 26 instruction cycles) is required when an interrupt request is issued
immediately after starting the execution of the DIVU instruction.
S
et the interr
u
pt re
qu
e
s
t from 
the re
s
o
u
rce in h
a
rdw
a
re 
a
nd 
i
ssu
a
n interr
u
pt re
qu
e
s
t.
M
a
in progr
a
m
Initi
a
lize the 
re
s
o
u
rce.
S
et he interr
u
pt level 
to the IL 
b
it.
Interr
u
pt proce
ss
ing progr
a
m
Cle
a
r the interr
u
pt 
s
o
u
rce:  To 
a
ccept 
a
 m
u
ltiple interr
u
pt
s
 
                                            from the 
sa
me re
s
o
u
rce.
Interr
u
pt proce
ss
ing progr
a
m:  Tr
a
n
s
fer the 
a
ct
ua
                                                 proce
ss
ing d
a
t
a
.
Rele
as
e the interr
u
pt from the interr
u
pt proce
ss
ing.
Prevent m
u
ltiple 
interr
u
pt
s
 of the 
sa
me level.