English
Language : 

MIC74_06 Datasheet, PDF (15/18 Pages) Micrel Semiconductor – 2-Wire Serial I/O Expander and Fan Controller
Micrel, Inc.
The act of reading STATUS clears it in preparation for
detecting future events. The status bits corresponding to
I/O’s configured as outputs or corresponding to P[7:4]
when in fan mode will not be set by state changes on
these pins. It is always good practice, however, for the
interrupt service routine to mask the value obtained
when reading STATUS to eliminate any bits, output or
otherwise, that are not of immediate concern. This will
help avoid problems if software changes are made in the
future.
The process for writing output data is straight-forward—
simply write the desired bit pattern to DATA. Special
precautions may be required, however, when changing
output data in an interrupt driven system. See the
discussion below under “Writing to the Data Register.”
Interrupt Service
Routine
Read alert
response address
Is
interrupt No
from
MIC74
Yes
Service other devices
Read STATUS to
determine source
MIC74
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’s, etc. These various
functions may be handled by independent software
routines which must manipulate 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
A functionally equivalent alternative to this procedure is
to keep an image of the data register in software. Any
independent routines would make changes to this image
using the procedure above and then call a routine that
actually writes the new image to DATA. Interrupts would
be disabled briefly while DATA is being modified.
Polled
I.S.R.
Read
STATUS
Is
Yes
Sn set
?
No
Service function n
Is
Yes
Sm set
?
No
Service function m
Is
Yes
Sx set
?
No
Service function x
Yes Interrupts
pending
?
No
Return from ISR
Figure 11: Interrupt Service Routine Using the ARA
October 2006
15
Is
No
STATUS
h
?
Yes
Service other devices
Is
Yes
Sn set
?
No
Service function n
Is
Yes
Sm set
?
No
Service function m
Is
Yes
Sx set
?
No
Service function x
Return from ISR
Figure 12: Interrupt Service Routine Without ARA
M9999-101006