- 216 -
8. Set a task that is activated at MR100 system startup in the configuration file
7.2.2
Writing Kernel Interrupt Handler
When describing the kernel interrupt handler in assembly language, observe the following precautions
1. At the beginning of file, be sure to include "mr100.inc" which is in the system directory.
2. For the symbol indicating the interrupt handler start address, make the external declara-
tion(Global declaration).
3. Make sure that the registers used in a handler are saved at the entry and are restored after
use.
4. Return to the task by ret_int service call.
.INCLUDE mr100.inc
------(1)
.GLB
inth
------(2)
inth:
; Registers used are saved to a stack
------(3)
iwup_tsk #ID_task1
:
process
:
; Registers used are restored
------(3)
ret_int
------(4)
Figure 7.8 Example of kernel(OS-depend) interrupt handler
7.2.3
Writing Non-kernel Interrupt Handler
1. For the symbol indicating the interrupt handler start address, make the external declaration
(public declaration).
2. Make sure that the registers used in a handler are saved at the entry and are restored after
use.
3. Be sure to end the handler by REIT instruction.
4. No service calls can be issued from a non-kernel interrupt handler.
NOTE: If this restriction is not observed, the software may malfunction.
5. If you want multiple interrupts to be enabled in a non-kernel interrupt handler, always make
sure that the non-kernel interrupt handler is assigned a priority level higher than other
non-kernel interrupt handlers.
.GLB
inthand
-----
(1)
inthand:
; Registers used are saved to a stack
----- (2)
; interrupt process
; Registers used are restored
----- (2)
REIT
-----
(3)
Figure 7.9 Example of Non-kernel Interrupt Handler of Specific Level
7.2.4
Writing Cyclic Handler/Alarm Handler
When describing the cyclic or alarm handler in Assembly Language, observe the following precautions.
48
The relationship between task ID numbers and tasks(program) is defined in the configuration file.
49
Use the .GLB peudo-directive.
50
If you want the non-kernel interrupt handler to be assigned a priority level lower than kernel interrupt handlers, change the description of
the non-kernel interrupt handler to that of the kernel interrupt handler.