Precautions On Programming Interrupts - Omron CPM1 - PROGRAMING MANUAL 02-2001 Programming Manual

Hide thumbs Also See for CPM1 - PROGRAMING MANUAL 02-2001:
Table of Contents

Advertisement

CPM2A/CPM2C Interrupt Functions
Scheduled-interrupt Mode

2-1-4 Precautions on Programming Interrupts

42
Explanation
In this example, the timer is started when the execution condition (00005) turns
from OFF to ON. Then the interrupt subroutine is executed each time that the set
time (approx. 1 s) elapses. Each time the interrupt subroutine is executed, 1 is
added to DM 0000.
Elapsed time: 100 x 100 x 0.1 = 1,000 ms
Programming
ON for 1 cycle at beginning
of operation
(Execution condition)
Always ON
If words in memory are being manipulated both in the main program and in an
interrupt program, the interrupts must be masked when the words are being ma-
nipulated in the main program.
When an interrupt occurs, any instruction being executed in the main program
will be interrupted and processing data will be temporarily stored while the inter-
rupt program is being executed. When execution of the interrupt program has
been completed, the original execution status of the main program will be re-
stored and execution will be continued. Thus, if the manipulation of words in the
main program is interrupted and the same words are altered in the interrupt pro-
gram, the words altered in the interrupt program will simply be restored to the
status that was in the process of being written in the main program, effectively
canceling the result of the interrupt program. If there are instructions that should
not be interrupted during processing in the main program, disable interrupts be-
fore and after executing them.
The are two cases in which the above problem can occur: When manipulating
the contents of one word and when manipulating the contents of multiple words.
Clears Increment Area (DM 0000).
Decrement counter setting
Count: 100 (0000 to 9999 BCD)
Count interval setting
Count interval setting: 10 ms (0005 to 0320 BCD)
Starts interval timer in scheduled-interrupt mode.
(69)
Executes interrupt each time the set time elapses.
Section
2-1

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents