simply write the desired bit pattern to DATA. Special precau-
in an interrupt driven system. See the discussion below under
鈥淲riting to the Data Register.鈥?/div>
Micrel
Writing To The Data Register
Multiple software routines may use the various output bits
available on the MIC74 to control individual functions such as
power switches, LED鈥檚, etc. These various functions may be
handled by independent software routines which must ma-
nipulate individual output bits without regard for other bits.
Care must be taken to insure that these various software
routines do not interfere with each other when modifying
output data. The recommended procedure for changing
isolated output bits is as follows:
1. Read DATA
2. Set desired bits by ORing the value read from
DATA with an appropriate mask value
3. Clear desired bits by ANDing the value read
from DATA with an appropriate mask value
4. Write the result back to DATA
Interrupt Service
Routine
A functionally equivalent alternative to this procedure is to
keep an image of the data register in software. Any indepen-
dent routines would make changes to this image using the
procedure above and then call a routine that actually writes
Read alert
response address
Is
interrupt
from
MIC74
Yes
No
Service other devices
Polled
I.S.R.
Read STATUS to
determine source
Read
STATUS
Is
Sn set
?
No
Yes
Service function
n
Is
No
STATUS
鈮?/div>
00
h
?
Yes
Service other devices
Is
Sm set
?
No
Yes
Service function
m
Is
Sn set
?
No
Yes
Service function
n
Is
Sx set
?
No
Yes
Service function
x
Is
Sm set
?
No
Yes
Service function
m
Yes
Interrupts
pending
?
No
Is
Sx set
?
No
Yes
Service function
x
Return from ISR
Return from ISR
Figure 11: Interrupt Service Routine Using the ARA
Figure 12: Interrupt Service Routine Without ARA
MIC74
14
August 1, 2000
                         
                        
                        prev
                        
                        next