4-5 application example, Application example – Omron HOME SECURITY SYSTEM - MOTION SENSOR FQM1-MMA21 User Manual

Page 170

Advertising
background image

147

Interval Timer Interrupts

Section 7-4

7-4-5

Application Example

In this example, the interval timer is used to generate an interrupt every
2.4 ms (0.6 ms

× 4). The default System Setup settings are used. (Inputs are

not refreshed for interrupt processing.)

When the program is being executed, the interrupt task will be executed every
2.4 ms while CIO 0002.00 is ON, as shown in the following diagram.

Interval timer

STIM

INTERVAL TIMER

Ladder Program

Generate interrupt.

Execute interrupt task.

END

• Start timer.

One-shot mode
Scheduled interrupt mode

• Read elapsed time.

First Cycle Flag
(ON for 1 cycle)

0002.00

0002.00

MOV

#0004

D00010

MOV

#0006

D00011

@STIM

#0003

D00010

#0023

@STIM

#000A

0000
0000

Interrupt task program

END

END

Interval timer set values:

Every 2.4 ms the interval timer
times out and the interrupt task is
executed.

Sets 4 for the decrementing counter
set value.

Sets 0.6 ms for the decrementing
time interval.

The interval timer stops when
CIO 0002.00 turns OFF.

The interval timer starts when
CIO 0002.00 turns ON.
Task 23 hex = 35 BCD

Interrupt
task 35

Interrupt task

CIO 0002.00

2.4 ms

2.4 ms

2.4 ms

Advertising