⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lm75.h

📁 this document is source code for arm9 of atmel
💻 H
字号:
/*-----------------------------------------------------------------------------
*         ATMEL Microcontroller Software Support  -  ROUSSET  -
*------------------------------------------------------------------------------
* The software is delivered "AS IS" without warranty or condition of any
* kind, either express, implied or statutory. This includes without
* limitation any warranty or condition with respect to merchantability or
* fitness for any particular purpose, or against the infringements of
* intellectual property rights of others.
*------------------------------------------------------------------------------
* File Name           : lm75.h
* Object              : LM75 Temperature Sensor definition
* Creation            :
* 1.0 19/Sept/06 PFi   : Creation
*----------------------------------------------------------------------------*/
#ifndef lm75_h
#define lm75_h
#include <stdio.h>

/* Internal addr: "1001" + A0=A1=A2= +VDD */
#define AT91C_LM75_I2C_ADDRESS (0x4F<<16)

/* Temperature data can be read from the Temperature, TOS
Set Point, and THYST Set Point registers; and written to the
TOS Set Point, and THYST Set Point registers. Temperature
data is represented by a 9-bit, two抯 complement word with
an LSB (Least Significant Bit) equal to 0.5癈 */

/* Temperature below are given in degree celsius */
#define TEMP_PLUS_125  0xFA  // +125癈
#define TEMP_PLUS_25   0x32  // +25癈
#define TEMP_PLUS_0_5  0x1   // +0.5癈
#define TEMP_PLUS_0    0x0   // +0癈
#define TEMP_MINUS_0_5  0x1   // -0.5癈
#define TEMP_MINUS_25   0x32  // -25癈
#define TEMP_MINUS_55  0xFA  // -55癈

/* Register definition */

/*****************
Pointer register *
******************
P7 | P6 | P5 | P4 | P3 | P2 | P1   |    P0 |
00 | 00 | 00 | 00 | 00 | 00 |Register Select

P0-P1: Register Select:
P1 | P0 : Register
0 |  0 Temperature (Read only) (Power-up default)
0 |  1 Configuration (Read/Write)
1 |  0 THYST (Read/Write)
1 |  1 TOS (Read/Write) */
#define TEMP_REG  0x0
#define CONFIG_REG 0x1
#define THYST_REG 0x2
#define TOS_REG 0x3

/*********************
TEMPERATURE REGISTER *
**********************
(Read Only):
D15 | D14 | D13 | D12 | D11 | D10 | D9  | D8 | D7 | D6| D5| D4| D3| D2| D1| D0 |
MSB |Bit7 |Bit6 |Bit5 |Bit4 |Bit3 |Bit2 |Bit1|LSB | X | X | X | X | X | X |  X |
D0朌6: Undefined
D7朌15: Temperature Data. One LSB = 0.5癈. Two抯
complement format.*/

#define TEMP_REG_MASK 0xFF80

/***********************
CONFIGURATION REGISTER *
************************
(Read/Write):
D7 | D6| D5| D4  |   D3 | D2 | D1     | D0       |
 0 | 0 | 0 |Fault Queue |O.S |Cmp/Int | Shutdown |
Power up default is with all bits 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -