![background image](http://html1.mh-extra.com/html/omron/srm1-programing-02-2001/srm1-programing-02-2001_programming-manual_742414064.webp)
2-1
Section
CPM2A/CPM2C Interrupt Functions
43
A problem can occur in the situation shown below because processing of the
ADD instruction could be interrupted between the 1st and 3rd operands and the
MOV instruction then executed in the interrupt program.
Main Program
Interrupt Program
ADD (30)
DM0000
#0001
DM0000
MOV (21)
#0010
DM0000
Flow of Processing
The processing that would occur when the ADD instruction above is interrupted
is illustrated below.
Contents of DM 0000 read (1234)
BCD add executed (1234 + 1 = 1235)
Processing interrupted
Interrupt generated
Data temporarily buffered
Add result (1235)
MOV executed
#0010 moved to DM 0000
Interrupt program ended
Processing continued
Add result (1235) written
ADD
instruction
DM0000
1234
0010
1235
Processing is interrupted before the result of the add operation can be written to
DM 0000 and the result is buffered. The interrupt program writes #0010 to
DM 0000, but this is immediately overwritten by the result of the add (1235) as
soon as execution of the interrupt program has been completed. In other words,
the result of the interrupt program have been consequently nullified.
Solution
The INT instruction can be used to enable and disable interrupts before and after
the add operation as shown below.
Main program
Interrupts disabled.
Interrupts enabled.
INT (89)
100
000
000
ADD (30)
DM0000
#0001
DM0000
INT (89)
200
000
000
Manipulating One Word
Содержание SRM1 - PROGRAMING 02-2001
Страница 1: ...Programmable Controllers Cat No W353 E1 06 SYSMAC CPM1 CPM1A CPM2A CPM2C SRM1 V2 PROGRAMMING MANUAL ...
Страница 2: ...CPM1 CPM1A CPM2A CPM2C SRM1 V2 Programmable Controllers Programming Manual Revised February 2008 ...
Страница 3: ...iv ...
Страница 5: ...vi ...
Страница 9: ...x ...
Страница 15: ...xvi ...