English
Language : 

MIC74 Datasheet, PDF (14/20 Pages) Micrel Semiconductor – 2-Wire Serial I/O Expander and Fan Controller Advance Information
MIC74
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 straightforward—
simply write the desired bit pattern to DATA. Special precau-
tions 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
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’s, 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
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
Is
interrupt No
from
MIC74
Yes
Service other devices
Read STATUS to
determine source
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
Is
No
STATUS
≠ 00h
?
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
MIC74
14
August 1, 2000