Reading Temperatures - Lippert 702-0008-10 Technical Manual

Cool literunner pc/104 cpu board
Table of Contents

Advertisement

4.6 Reading Temperatures

There are temperature sensors available that allow measurement of the CPU's chip temperature as
well as the boards ambient temperature. These are shown in the BIOS setup screens, see above.
This example is meant to be compiled using gcc under Linux.
#include <stdio.h>
#include <unistd.h>
#include <sys/io.h>
#define LPC_INDEX 0x295
#define LPC_DATA 0x296
int main()
{
char cputemp = 0;
char ambtemp = 0;
iopl(3);
//******* needed with BIOS prior version 7 ******
outb(0x51,LPC_INDEX); //thermal diode mode
outb(0x03,LPC_DATA);
outb(0x5C,LPC_INDEX); //unlock offset regs
outb(0x80,LPC_DATA);
outb(0x56,LPC_INDEX); //offset adjustment CPU
outb(0x70,LPC_DATA);
outb(0x57,LPC_INDEX); //offset adjustment Ambient
outb(0x3C,LPC_DATA);
outb(0x5C,LPC_INDEX); //lock offset regs
outb(0x00,LPC_DATA);
//******************************************
printf("Press CTRL+C to cancel!\nCPU AMBIENT\n");
while(1)
{
outb( 0x29,LPC_INDEX); //read out CPU temp
cputemp = inb(LPC_DATA);
outb( 0x2A,LPC_INDEX); //read out Ambient temp
ambtemp = inb(LPC_DATA);
printf("%3d %3d\r", cputemp, ambtemp); //printout to the screen
fflush(stdout);
sleep(1);
}
return 0;
}
TME-104-CLR-LX800-R1V3.doc
Rev. 1.3
48(53)

Advertisement

Table of Contents
loading

This manual is also suitable for:

802-0008-10Clr-lx800902-0008-10

Table of Contents