Omron CPM1 - PROGRAMING MANUAL 02-2001 Programming Manual page 65

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

Advertisement

CPM2A/CPM2C Interrupt Functions
Manipulating Multiple
Words
#1234 transferred to DM 0000
#1234 transferred to DM 0001
Processing interrupted
BSET
instruction
Processing continued
#1234 transferred to DM 0002
#1234 transferred to DM 0010
44
A problem can occur in the situation shown below because processing of the
BSET instruction could be interrupted before all of the data for BSET has been
written and the CMP instruction then executed in the interrupt program.
Main Program
Flow of Processing
The processing that would occur when the BSET instruction above is interrupted
is illustrated below.
Interrupt generated
DM 0000 read.
Processing
DM 0010 read.
for CMP
DM 0000 and DM 0010 compared
Comparison result output
Interrupt program ended
Processing is interrupted before #1234 can be written to DM 0010. Bit A in the
interrupt program is thus turned OFF and will remain OFF when execution of the
main program is resumed even though the contents of DM 0000 and DM 0010
will be the same as soon as the main program is resumed, i.e., the result of the
comparison is not correct
Solution
The INT instruction can be used to enable and disable interrupts before and after
the BSET instruction as shown below.
BEST (71)
#1234
DM0000
DM0010
DM0000 DM0001
1234
1234
1234
Main program
INT (89)
100
000
000
BEST (71)
#1234
DM0000
DM0010
INT (89)
200
000
000
Section
Interrupt Program
CMP (20)
DM0000
DM0010
25506 (=)
A
DM0002
DM0010
003E
ABCD
0502
1234
ABCD
0502
1234
ABCD
1234
1234
1234 2
Interrupts
disabled.
Interrupts
enabled.
2-1
A
OFF
OFF 1
OFF

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents