2-3 disabling and enabling all interrupts, Disabling and enabling all interrupts, Disabling all interrupts – Omron HOME SECURITY SYSTEM - MOTION SENSOR FQM1-MMA21 User Manual

Page 164: Enabling all interrupts

Advertising
background image

141

Interrupt Functions

Section 7-2

This situation can be avoided with the programming methods shown in the fol-
lowing diagram.

Note

Only one interrupt task number is recorded for pulse output and high-speed
counter interrupts. When a pulse output or high-speed counter interrupt is on
standby (because another interrupt is being executed or interrupts are dis-
abled) and another interrupt occurs, the earlier interrupt task number is
replaced with the most recent interrupt task number. Design the system to
allow sufficient time between interrupts for the length of the interrupt tasks to
prevent unwanted conflicts between interrupts.

7-2-3

Disabling and Enabling All Interrupts

All interrupts can be disabled using the DI(802) instruction, as shown below.
The following interrupts are disabled and enabled by DI(802) and EI(694).

• Input interrupts
• Interval timer interrupts
• High-speed counter interrupts
• Pulse output interrupts

Observe the following precautions when using DI(802).

• DI(802) and EI(694) cannot be used within an interrupt task to disable or

enable interrupts.

• Do not use DI(802) to disable all interrupts unless there is a specific need

to do so.

Disabling All
Interrupts

The DI(802) instruction will disable all interrupts.

Note

Interrupt processing will not be executed for an interrupt that occurs while
interrupts are disabled, but the interrupt event will be recorded for each type of
interrupt and interrupt processing will be executed when interrupts are
enabled.

Enabling All
Interrupts

The EI(694) instruction clears the prohibition on all interrupts that was set with
the DI(802) instruction.

Note

Executing the EI(694) instruction merely returns the interrupts to the status
they were in before all interrupts were prohibited (disabled by DI(802)).

Method 1:
Disabling all interrupts
in the main program

MSKS

0100
0000
0000

@PLS2

0001
0000

D00010

MSKS

0200
0000
0000

PRV

0001
0002

D00000

@CTBL

0001
0000

D00000

RSET 0002.00

0002.00

SET 0002.00

CTBL

0001
0000

D00000

P_On

P_ER

(Interrupt task)

ER Flag

Always

ON

Method 2:
Executing the routine in the main program instead of
the interrupt task, where it could not be executed.

(Main program)

(@)DI

(@)EI

Advertising