beautypg.com

Rainbow Electronics MAX1618 User Manual

Page 15

background image

MAX1618

Remote Temperature Sensor

with SMBus Serial Interface

______________________________________________________________________________________

15

/* Beginning of the header file which sets the constants */

int

NumStates

= 10;

int

RRTE

= 1;

/* 0x01, command for reading remote temp

register */
int

WCA

= 9;

/* 0x09, command for writing configuration

register */
int

RSL

= 2;

/* 0x02, command for reading status register */

int

WRHA

= 13; /* 0x0D, command for writing remote THIGH limit

register */
int

WRLN

= 14; /* 0x0E, command for writing remote TLOW limit

register */
int

NoError

= 0;

int

Nobody

= 0;

int

MAX1618Addr = 84; /* 0x54, default address for MAX1618,

ADD0,ADD1=open */

int

InitConfig

= 8; /* 0x08

, configure MAX1618 to MASK=0 and

RUN/STOP=0 */
int

HighAdder

= 2;

/* 2oC offset for calculating THIGH limit */

int

LowSubtracter

= 4;

/* 4oC offset for calculating TLOW limit

*/
int

CollisionMask

= 1;

/* 0x01, mask for status bit that

indicates collision */
int

DiodeFaultMask

= 4;

/* 0x04, mask for the OPEN diode fault

status bit */
int

TempChangeMask

= 24; /* 0x18, mask for RHIGH and RLOW status

bits */

array State[0..NumStates] of int;

State[0] = -65 oC /* At or above this temperature CPU duty cycle is
100% */
State[1] = 72 oC /* At or above this temperature CPU duty cycle is
87.5% */
State[2] = 74 oC /* At or above this temperature CPU duty cycle is 75%
*/
State[3] = 76 oC /* At or above this temperature CPU duty cycle is
62.5% */
State[4] = 78 oC /* At or above this temperature CPU duty cycle is 50%
*/
State[5] = 80 oC /* At or above this temperature CPU duty cycle is
37.5% */
State[6] = 82 oC /* At or above this temperature CPU duty cycle is 25%
*/
State[7] = 84 oC /* At or above this temperature CPU duty cycle is
12.5% */
State[8] = 86 oC /* At or above this temperature CPU duty cycle is
0.0% */
State[9] = 88 oC /* At or above this temperature SHUT SYSTEM OFF! */
State[10] = 127 oC

/* Extra array location so looping is easier */

/* End of the header file */

Listing 1. Pseudocode Example