English
Language : 

MAX1618 Datasheet, PDF (17/20 Pages) Maxim Integrated Products – Remote Temperature Sensor with SMBus Serial Interface
Remote Temperature Sensor
with SMBus Serial Interface
Listing 1. Pseudocode Example (continued)
int ALERT_IntHandler()
{
int ErrorCode
= NoError;
int WhoDunnit
= Nobody;
int FoundState = 0;
int StatusInfo = 0;
int TempHigh;
int TempLow;
/* This interrupt handler verifies that the MAX1618 is the source of
the interrupt (and also clears the interrupt) via the SMBus Alert
Response address; checks the status byte to ensure that a temperature
change did indeed cause the interrupt; reads the remote temperature;
programs a corresponding clock-throttling duty cycle, and sets up new
Thigh and Tlow limits. */
ReadAlertResponse(&WhoDunnit, &ErrorCode);
if (WhoDunnit == MAX1618Addr) then {
MAX1618Read(RSL, &StatusInfo, &ErrorCode);
if (((StatusInfo & CollisionMask) != 0) and (ErrorCode ==
NoError)) then
MAX1618Read(RSL, &StatusInfo, &ErrorCode);
if (StatusInfo & DiodeFaultMask) != 0) then {
work */
/* Shut down system because thermal diode doesn't
}
else if ((StatusInfo & TempChangeMask) != 0) then {
FoundState++;
MAX1618Read(RRTE, &TempRead, &ErrorCode);
while ((TempRead >= State[FoundState + 1]) and
(FoundState < (NumStates - 1)) do
if (FoundState == (NumStates - 1)) then {
/* Ahhhhh!!! SHUT SYSTEM OFF!!!! */
}
else {
/* adjust clock duty cycle */
TempHigh = TempRead + HighAdder;
TempLow = TempRead - LowSubtracter;
MAX1618Write(WRHA, TempHigh, &Error);
MAX1618Write(WRLN, TempLow, &Error);
}
/* End of if (FoundState ... */
}
/* End of if (((StatusInfo .. else if ... */
/* Handle local temp status bits if set */
else
}
{
/* Handle cases for other interrupt sources */
}
/* End of if (WhoDunnit ... */
return(ErrorCode);
______________________________________________________________________________________ 17