Reading Temperatures - Lippert Cool SpaceRunner-LX800 Technical Manual

Pc/104-plus cpu board
Table of Contents

Advertisement

4.5 Reading Temperatures

There are temperature sensors available that allow measurement of the CPU's chip temperature as
well as the board's ambient temperature. These are shown in the BIOS setup screens, see above.
This example is meant to be compiled using gcc under Linux. For using the listed libraries the libc6
package should be installed.
#include <stdio.h>
#include <unistd.h>
#include <sys/io.h>
#define LPC_INDEX 0x295
#define LPC_DATA 0x296
int main()
{
signed char cputemp, ambtemp;
iopl(3);
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\n", cputemp, ambtemp); //printout to the screen
fflush(stdout);
sleep(1);
}
//return 0;
}
TME-104P-CSR-LX800-R1V5.doc
Rev 1.5
40 (44)

Advertisement

Table of Contents
loading

Table of Contents