Rainbow Electronics MAX1618 User Manual
Page 16

MAX1618
Remote Temperature Sensor
with SMBus Serial Interface
16
______________________________________________________________________________________
int Initialization()
{
int ErrorCode
= NoError;
/* Test the SMBus communications path to the MAX1618 by writing the
configuration and initial temperature limits; if SMBus communication
was unsuccessful, power the system down. Note that the MAX1618Write
procedure takes three parameters: the command code of the register to
be written, the data to write, and a pointer to the the error code
variable. If the error code variable does not equal NoError before the
execution of MAX1618Write, MAX1618Write does nothing. If the SMBus
communication fails in MAX1618Write, the error code variable is set to
the type of error (for example a NACK, i.e. MAX1618 did not
acknowledge). This code assumes that the BIOS is already in thermal
state 0 (not throttling, i.e. full CPU clock rate) when the
initialization routine is executed. */
MAX1618Write(WCA, InitConfig, &ErrorCode);
/* MASK=0 and
RUN/STOP=0 */
MAX1618Write(WRLN, LowestTemp, &ErrorCode);
/* TLOW = -65oC
*/
MAX1618Write(WRHA, State[0] + HighAdder, &ErrorCode)
/* THIGH =
72oC */
if (ErrorCode != NoError) then {
/* Power off the system */
}
/* End of if (ErrorCode ... */
return (ErrorCode);
}
/* End of Initialization routine */
Listing 1. Pseudocode Example (continued)