📄 target.lst
字号:
100 void Timer0_Exception(void)
101 {
102 T0IR = 0x01;
103 VICVectAddr = 0; //interrupt close 通知中断控制器中断结束
104 OSTimeTick();
105 }
106
107 /*********************************************************************************************************
108 ** Function name: Timer0Init
109 **
110 ** Descriptions: Initialize the Time0
111 **
112 ** input parameters: None
113 ** Returned value: None
114 **
115 ** Used global variables: None
116 ** Calling modules: None
117 **
118 ** Created by: Chenmingji
119 ** Created Date: 2004/02/02
C51 COMPILER V8.08 TARGET 08/04/2008 21:49:56 PAGE 4
120 **-------------------------------------------------------------------------------------------------------
121 ** Modified by:
122 ** Modified date:
123 **------------------------------------------------------------------------------------------------------
124 ********************************************************************************************************/
125 void Timer0Init(void)
126 {
127 T0IR = 0xffffffff;
128 T0TC = 0;
129 T0TCR = 0x01;
130 T0MCR = 0x03;
131 T0MR0 = (Fpclk / OS_TICKS_PER_SEC);
132 }
133 /*********************************************************************************************************
134 ** Function name: VICInit
135 **
136 ** Descriptions: Initialize the Interrupt Vevtor Controller
137 **
138 ** input parameters: None
139 ** Returned value: None
140 **
141 ** Used global variables: None
142 ** Calling modules: None
143 **
144 ** Created by: Chenmingji
145 ** Created Date: 2004/02/02
146 **-------------------------------------------------------------------------------------------------------
147 ** Modified by:
148 ** Modified date:
149 **------------------------------------------------------------------------------------------------------
150 ********************************************************************************************************/
151 void VICInit(void)
152 {
153 extern void IRQ_Handler(void);
154 extern void Timer0_Handler(void);
155 extern void UART0_Handler(void);
156 extern void I2C0_Handler(void);
157 extern void SPI0_Handler(void);
158 extern void EInt2_Handler(void);
159 extern void Timer1_Handler(void);
160 extern void SPI1_Handler(void);
161
162 VICIntEnClr = 0xffffffff;
163 VICDefVectAddr = (uint32)IRQ_Handler;
164
165 VICVectAddr0 = (uint32)Timer0_Handler;
166 VICVectCntl0 = (0x20 | 0x04);
167 VICIntEnable = 1 << 4;
168
169 VICVectCntl1 = 0x26;
170 VICVectAddr1 = (uint32)UART0_Handler;
171 ///// VICIntEnable=1<<0x06; // 使能UART0中断
172
173 VICVectCntl2=(0x20|0x09);//I2C 通道分配到IRQ Slot2
174 //VICVectAddr2=(uint32)IRQ_I2C;//设置I2C中断向量
175 VICVectAddr2 = (uint32)I2C0_Handler;
176 VICIntEnable=(1<<9);//使能I2C中断
177
178 VICVectCntl3 = (0x20 | 10);//SPI
179 VICVectAddr3 = (uint32)SPI0_Handler;//
180
181 VICVectCntl4 = (0x20|16);
C51 COMPILER V8.08 TARGET 08/04/2008 21:49:56 PAGE 5
182 VICVectAddr4 = (uint32) EInt2_Handler;
183 EXTPOLAR = 0;
184 EXTMODE = 4;
185 EXTINT = 4;
186 ///// VICIntEnable = 1<<16;//外部中断2
187
188 VICVectCntl5 = (0x20 | 5);
189 VICVectAddr5 = (uint32) Timer1_Handler;
190 T1TCR = 1;
191 //// VICIntEnable = 1 << 5;
192
193 S0PINT = 1;//
194 //// VICIntEnable = (1 << 10);//
195
196 SSPIMSC = 0;//DisableSPI1Interrupt();
197 VICVectCntl6 = (0x20 | 11);
198 VICVectAddr6 = (uint32) SPI1_Handler;
199 // VICIntEnable = 1 << 11;
200
201 }
202
203 /*********************************************************************************************************
204 ** Function name: TargetInit
205 **
206 ** Descriptions: Initialize the target board; it is called in a necessary place, change it as
207 ** needed
208 **
209 ** input parameters: None
210 ** Returned value: None
211 **
212 ** Used global variables: None
213 ** Calling modules: None
214 **
215 ** Created by: Chenmingji
216 ** Created Date: 2004/02/02
217 **-------------------------------------------------------------------------------------------------------
218 ** Modified by:
219 ** Modified date:
220 **------------------------------------------------------------------------------------------------------
221 ********************************************************************************************************/
222 void TargetInit(void)
223 {
224 OS_ENTER_CRITICAL();
225 PINSEL0 = 0;//0x00005555 //| (3<<14); //设置管脚连接GPIO
226 // | (2<<18); //PWM6
227 PINSEL1 = (2<<2)|(2<<6)|(2<<8)|(1<<10); //PWM5
228 IO0DIR = 0xFFFFFFF0; //方向控制位,0输入,1输出
229 PINSEL2&=~(1<<3);
230 IO1DIR=(1 << 16) | (1 << 17) | (1 << 18) | (1 << 19) | (1 << 20) | (1 << 21) | (1 << 22) | (1 << 23) |
- (1 << 24) | (1 << 25);
231 VICInit();
232 Timer0Init();
233 OS_EXIT_CRITICAL();
234 }
235 /*********************************************************************************************************
236 ** Function name: InitialiseUART0
237 **
238 ** Descriptions: Initialize the Uart0
239 **
240 ** input parameters: None
241 ** Returned value: None
242 **
C51 COMPILER V8.08 TARGET 08/04/2008 21:49:56 PAGE 6
243 ** Used global variables: None
244 ** Calling modules: None
245 **
246 ** Created by: Chenmingji
247 ** Created Date: 2004/02/02
248 **-------------------------------------------------------------------------------------------------------
249 ** Modified by:
250 ** Modified date:
251 **------------------------------------------------------------------------------------------------------
252 ********************************************************************************************************/
253 void InitialiseUART0(uint32 bps)
254 {
255 uint16 Fdiv;
256
257 PINSEL0 = (PINSEL0 & 0xfffffff0) | 0x05; /* Select the pins for Uart 选择管脚为UART0 */
258
259 U0LCR = 0x80; /* Enable to access the frequenc regecter 允许访问分频因子
-寄存器 */
260 Fdiv = (Fpclk / 16) / bps; /* Set the baudrate设置波特率 */
261 U0DLM = Fdiv / 256;
262 U0DLL = Fdiv % 256;
263 U0LCR = 0x03; /* Disable to access the frequenc regecter 禁止访问分频因
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -