📄 adc.lst
字号:
C51 COMPILER V8.04b ADC 04/26/2008 19:04:54 PAGE 1
C51 COMPILER V8.04b, COMPILATION OF MODULE ADC
OBJECT MODULE PLACED IN ADC.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ADC.C BROWSE DEBUG OBJECTEXTEND
line level source
1 //****************************************************************************
2 // @Module Analog / Digital Converter (ADC)
3 // @Filename ADC.C
4 // @Project ADC.dav
5 //----------------------------------------------------------------------------
6 // @Controller Infineon XC888CLM-8FF
7 //
8 // @Compiler Keil
9 //
10 // @Codegenerator 1.4
11 //
12 // @Description: This file contains functions that use the ADC module.
13 //
14 //----------------------------------------------------------------------------
15 // @Date 2008-3-22 上午 10:53:08
16 //
17 //****************************************************************************
18
19 // USER CODE BEGIN (ADC_General,1)
20
21 // USER CODE END
22
23
24
25 //****************************************************************************
26 // @Project Includes
27 //****************************************************************************
28
29 #include "MAIN.H"
30
31 // USER CODE BEGIN (ADC_General,2)
32
33 // USER CODE END
34
35
36 //****************************************************************************
37 // @Macros
38 //****************************************************************************
39
40 // USER CODE BEGIN (ADC_General,3)
41
42 // USER CODE END
43
44
45 //****************************************************************************
46 // @Defines
47 //****************************************************************************
48
49 // USER CODE BEGIN (ADC_General,4)
50
51 // USER CODE END
52
53
54 //****************************************************************************
55 // @Typedefs
C51 COMPILER V8.04b ADC 04/26/2008 19:04:54 PAGE 2
56 //****************************************************************************
57
58 // USER CODE BEGIN (ADC_General,5)
59
60 // USER CODE END
61
62
63 //****************************************************************************
64 // @Imported Global Variables
65 //****************************************************************************
66
67 // USER CODE BEGIN (ADC_General,6)
68
69 // USER CODE END
70
71
72 //****************************************************************************
73 // @Global Variables
74 //****************************************************************************
75
76 // USER CODE BEGIN (ADC_General,7)
77
78 // USER CODE END
79
80
81 //****************************************************************************
82 // @External Prototypes
83 //****************************************************************************
84
85 // USER CODE BEGIN (ADC_General,8)
86
87 // USER CODE END
88
89
90 //****************************************************************************
91 // @Prototypes Of Local Functions
92 //****************************************************************************
93
94 // USER CODE BEGIN (ADC_General,9)
95
96 // USER CODE END
97
98
99 //****************************************************************************
100 // @Function void ADC_vInit(void)
101 //
102 //----------------------------------------------------------------------------
103 // @Description This is the initialization function of the ADC function
104 // library. It is assumed that the SFRs used by this library
105 // are in their reset state.
106 //
107 // Following SFR fields will be initialized:
108 // GLOBCTR - Global Control
109 // PRAR - Priority and Arbitration Register
110 // ETRCR - External Trigger Control Register
111 // CHCTRx - Channel Control Register x
112 // RCRx - Result Control Register x
113 //
114 //----------------------------------------------------------------------------
115 // @Returnvalue None
116 //
117 //----------------------------------------------------------------------------
C51 COMPILER V8.04b ADC 04/26/2008 19:04:54 PAGE 3
118 // @Parameters None
119 //
120 //----------------------------------------------------------------------------
121 // @Date 2008-3-22
122 //
123 //****************************************************************************
124
125 // USER CODE BEGIN (ADC_Init,1)
126
127 // USER CODE END
128
129 void ADC_vInit(void)
130 {
131 1 // USER CODE BEGIN (ADC_Init,2)
132 1
133 1 // USER CODE END
134 1
135 1 /// -----------------------------------------------------------------------
136 1 /// Configuration of Global Control:
137 1 /// -----------------------------------------------------------------------
138 1 /// - the ADC module clock is enabled
139 1 /// - the ADC module clock = 24.00 MHz
140 1 ///
141 1 /// - the result is 8 bits wide
142 1 /// --- Conversion Timing -----------------
143 1 /// - conversion time (CTC) = 01.42 us
144 1
145 1 /// - Configure global control functions
146 1
147 1 SFR_PAGE(_ad0, noSST); // switch to page 0
148 1
149 1 ADC_GLOBCTR = 0x50; // load global control register
150 1
151 1 /// -----------------------------------------------------------------------
152 1 /// Configuration of Priority and Arbitration:
153 1 /// -----------------------------------------------------------------------
154 1 /// - the priority of request source 0 is low
155 1 /// - the wait-for-start mode is selected for source 0
156 1 /// - the priority of request source 1 is low
157 1 /// - the wait-for-start mode is selected for source 1
158 1 /// - the permanent arbitration mode is selected
159 1 /// - Arbitration Slot 0 is disabled
160 1 /// - Arbitration Slot 1 is enabled
161 1
162 1 ADC_PRAR = 0x80; // load Priority and Arbitration register
163 1
164 1 SFR_PAGE(_ad1, noSST); // switch to page 1
165 1
166 1 /// -----------------------------------------------------------------------
167 1 /// Configuration of Channel Control Registers:
168 1 /// -----------------------------------------------------------------------
169 1 /// Configuration of Channel 7
170 1 /// - the result register0 is selected
171 1 /// - the limit check 0 is selected
172 1
173 1 ADC_CHCTR7 = 0x00; // load channel control register
174 1
175 1 SFR_PAGE(_ad0, noSST); // switch to page 0
176 1
177 1 /// -----------------------------------------------------------------------
178 1 /// Configuration of Sample Time Control:
179 1 /// -----------------------------------------------------------------------
C51 COMPILER V8.04b ADC 04/26/2008 19:04:54 PAGE 4
180 1
181 1 ADC_INPCR0 = 0x00; // load input class register
182 1
183 1 SFR_PAGE(_ad4, noSST); // switch to page 4
184 1
185 1 /// -----------------------------------------------------------------------
186 1 /// Configuration of Result Control Registers:
187 1 /// -----------------------------------------------------------------------
188 1 /// Configuration of Result Control Register 0
189 1 /// - the data reduction filter is disabled
190 1 /// - the event interrupt is enabled
191 1 /// - the wait-for-read mode is disabled
192 1 /// - the VF reset by read access to RESRxH/RESRAxH
193 1
194 1 ADC_RCR0 = 0x90; // load result control register 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -