📄 lm35.lst
字号:
C51 COMPILER V7.08 LM35 12/11/2005 15:43:14 PAGE 1
C51 COMPILER V7.08, COMPILATION OF MODULE LM35
OBJECT MODULE PLACED IN lm35.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE lm35.c BROWSE DEBUG OBJECTEXTEND
line level source
1 /*= lm35.c =========================================================================================
2 *
3 * Copyright (C) 2004 Nordic Semiconductor
4 *
5 * This file is distributed in the hope that it will be useful, but WITHOUT WARRANTY OF ANY KIND.
6 *
7 * Author(s): Ole Saether
8 *
9 * COMPILER:
10 *
11 * This program has been tested with Keil C51 V7.08 and 7.09
12 *
13 * $Revision: 3 $
14 *
15 *==================================================================================================
16 */
17 #include "reg9e5.h"
18 #include "util.h"
19 #include "lm35.h"
20
21 void InitADC(void)
22 {
23 1 // Configure and turn on ADC
24 1 RACSN = 0;
25 1 SpiReadWrite(WAC); // Write to ADC config
26 1 SpiReadWrite(0x35); // Select AIN3, PWR_UP = 1, VFSEL=0;
27 1 SpiReadWrite(0x0b); // Set RES_CTRL = 3, Right justified
28 1 RACSN = 1;
29 1 }
30
31 unsigned int ReadLM35(void)
32 {
33 1 unsigned char adc0;
34 1 unsigned int adc;
35 1
36 1 // Start ADC conversion
37 1 RACSN = 0;
38 1 SpiReadWrite(SAV | 0x03);
39 1 RACSN = 1;
40 1
41 1 // Wait until ADC conversion complete
42 1 while(EOC == 0)
43 1 ;
44 1 // Read Out ADC Value
45 1 RACSN = 0;
46 1 SpiReadWrite(RAD);
47 1 adc0 = SpiReadWrite(NOP);
48 1 adc = SpiReadWrite(NOP);
49 1 RACSN = 1;
50 1 adc <<= 8;
51 1 adc |= adc0;
52 1 return adc;
53 1 }
54
55
C51 COMPILER V7.08 LM35 12/11/2005 15:43:14 PAGE 2
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 59 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 1
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -