main.lst
来自「本程序是针对Infineon公司的XC167CI处理器而编写的CAN网络程序。C」· LST 代码 · 共 405 行 · 第 1/2 页
LST
405 行
189 1 /// Initialization of EBC
190 1 /// ---------------------------------------------------------------------
191 1
192 1 //// this register must be set in the start-up file
193 1 //// EBCMOD1 = 0x007F
194 1
195 1 /// EBC is disabled
196 1 //// -----------------------------------------------------------------------
197 1 //// End of Important Settings for the Start-Up File
198 1 //// -----------------------------------------------------------------------
199 1
200 1
201 1 // -----------------------------------------------------------------------
202 1 // Initialization of the Peripherals:
203 1 // -----------------------------------------------------------------------
204 1
205 1 // initializes the TwinCAN Module (CAN)
206 1 CAN_vInit();
207 1
208 1 // USER CODE BEGIN (Init,3)
209 1
210 1 // USER CODE END
211 1
212 1 // globally enable interrupts
213 1 PSW_IEN = 1;
214 1
215 1 } // End of function MAIN_vInit
216
217
218 //****************************************************************************
219 // @Function void MAIN_vUnlockProtecReg(void)
220 //
221 //----------------------------------------------------------------------------
222 // @Description This function makes it possible to write one protected
223 // register. After calling of this function and write on the
224 // protected register is the security level set to low
225 // protected mode.
226 //
227 //----------------------------------------------------------------------------
228 // @Returnvalue None
229 //
230 //----------------------------------------------------------------------------
231 // @Parameters None
232 //
233 //----------------------------------------------------------------------------
234 // @Date 2006-12-9
235 //
236 //****************************************************************************
237
238 // USER CODE BEGIN (UnlockProtecReg,1)
239
240 // USER CODE END
241
C166 COMPILER V6.04, MAIN 04/27/2008 18:41:46 PAGE 5
242 void MAIN_vUnlockProtecReg(void)
243 {
244 1 ubyte ubPASSWORD;
245 1
246 1 if((SCUSLS & 0x1800) == 0x0800) // if low protected mode
247 1 {
248 2
249 2 ubPASSWORD = SCUSLS & 0x00FF;
*** WARNING C192 IN LINE 249 OF MAIN.C: '=': value truncated
250 2 ubPASSWORD = ~ubPASSWORD;
251 2 SCUSLC = 0x8E00 | ubPASSWORD; // command 4
252 2
253 2 } // end if low protected mode
254 1
255 1 if((SCUSLS & 0x1800) == 0x1800) // if write protected mode
256 1 {
257 2 SCUSLC = 0xAAAA; // command 0
258 2 SCUSLC = 0x5554; // command 1
259 2
260 2 ubPASSWORD = SCUSLS & 0x00FF;
*** WARNING C192 IN LINE 260 OF MAIN.C: '=': value truncated
261 2 ubPASSWORD = ~ubPASSWORD;
262 2
263 2 SCUSLC = 0x9600 | ubPASSWORD; // command 2
264 2 SCUSLC = 0x0800; // command 3; new PASSWOR is 0x00
265 2
266 2 ubPASSWORD = SCUSLS & 0x00FF;
*** WARNING C192 IN LINE 266 OF MAIN.C: '=': value truncated
267 2 ubPASSWORD = ~ubPASSWORD;
268 2 SCUSLC = 0x8E00 | ubPASSWORD; // command 4
269 2
270 2 } // end if write protected mode
271 1
272 1 } // End of function MAIN_vUnlockProtecReg
273
274
275 //****************************************************************************
276 // @Function void main(void)
277 //
278 //----------------------------------------------------------------------------
279 // @Description This is the main function.
280 //
281 //----------------------------------------------------------------------------
282 // @Returnvalue None
283 //
284 //----------------------------------------------------------------------------
285 // @Parameters None
286 //
287 //----------------------------------------------------------------------------
288 // @Date 2006-12-9
289 //
290 //****************************************************************************
291
292 // USER CODE BEGIN (Main,1)
293 ubyte ch[8]="hello";
294 ubyte cha[8]="world";
295 int k,m,n;
296 // USER CODE END
297
298 void main(void)
299 {
300 1 // USER CODE BEGIN (Main,2)
C166 COMPILER V6.04, MAIN 04/27/2008 18:41:46 PAGE 6
301 1 DP1L=0xff;
302 1 P1L=0xff;
303 1 // USER CODE END
304 1
305 1 MAIN_vInit();
306 1
307 1 // USER CODE BEGIN (Main,4)
308 1
309 1
310 1
311 1
312 1 /* for(k=0;k<100;k++)
313 1 for(m=0;m<1000;m++)
314 1 for(n=0;n<1000;n++)
315 1 if(CAN_ubRequestMsgObj(1))
316 1 {
317 1 CAN_vLoadData(1,cha);
318 1
319 1 CAN_vTransmit(1);
320 1
321 1 } */
322 1
323 1 while(1)
324 1 {
325 2 // for(k=0;k<100;k++)
326 2 // for(m=0;m<1000;m++)
327 2 // for(n=0;n<10000;n++) ;
328 2
329 2 if(CAN_ubRequestMsgObj(1))
330 2 {
331 3 CAN_vLoadData(1,ch);
332 3
333 3 CAN_vTransmit(1);
334 3 }
335 2
336 2
337 2 for(m=0;m<1000;m++)
338 2 for(n=0;n<10000;n++) ;
339 2
340 2 if(CAN_ubRequestMsgObj(2))
341 2 {
342 3 CAN_vLoadData(2,ch);
343 3
344 3 CAN_vTransmit(2);
345 3 }
346 2
347 2 for(m=0;m<1000;m++)
348 2 for(n=0;n<10000;n++) ;
349 2 }
350 1 // USER CODE END
351 1
352 1 } // End of function main
353
354
355
356 // USER CODE BEGIN (MAIN_General,10)
357
358 // USER CODE END
359
MODULE INFORMATION: INITIALIZED UNINITIALIZED
C166 COMPILER V6.04, MAIN 04/27/2008 18:41:46 PAGE 7
CODE SIZE = 266 --------
NEAR-CONST SIZE = -------- --------
FAR-CONST SIZE = -------- --------
HUGE-CONST SIZE = -------- --------
XHUGE-CONST SIZE = -------- --------
NEAR-DATA SIZE = 22 --------
FAR-DATA SIZE = -------- --------
XHUGE-DATA SIZE = -------- --------
IDATA-DATA SIZE = -------- --------
SDATA-DATA SIZE = -------- --------
BDATA-DATA SIZE = -------- --------
HUGE-DATA SIZE = -------- --------
BIT SIZE = -------- --------
INIT'L SIZE = 24 --------
END OF MODULE INFORMATION.
C166 COMPILATION COMPLETE. 3 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?