2-1
Section
CPM2A/CPM2C Interrupt Functions
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
Interrupt Program
BEST (71)
#1234
DM0000
DM0010
CMP (20)
DM0000
DM0010
A
25506 (=)
Flow of Processing
The processing that would occur when the BSET instruction above is interrupted
is illustrated below.
Processing interrupted
Interrupt generated
Processing continued
#1234 transferred to DM 0000
#1234 transferred to DM 0001
#1234 transferred to DM 0002
#1234 transferred to DM 0010
Processing
for CMP
DM 0000 read.
DM 0010 read.
DM 0000 and DM 0010 compared
Comparison result output
Interrupt program ended
1234
ABCD
OFF
∗
1
0502
1234
1234
1234
1234
∗
2
OFF
ABCD
1234
1234
003E
0502
1234
ABCD
OFF
DM0010
A
DM0000 DM0001
DM0002
BSET
instruction
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.
Main program
Interrupts
disabled.
Interrupts
enabled.
INT (89)
100
000
000
BEST (71)
#1234
DM0000
DM0010
INT (89)
200
000
000
Manipulating Multiple
Words
Содержание 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 ...