📄 main.lst
字号:
C166 COMPILER V6.04, MAIN 09/04/2006 10:03:41 PAGE 1
C166 COMPILER V6.04, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: C:\Keil\C166\BIN\C166.EXE main.c MODV2 LARGE BROWSE MODV2 DEBUG CODE
stmt lvl source
1
2 #include "includes.h"
3
4 /*
5 *********************************************************************************************************
6 CPU Configuration
7 *********************************************************************************************************
8 */
9 void MAIN_vInit(void)
10 {
11 1 // USER CODE BEGIN (Init,2)
12 1
13 1 // USER CODE END
14 1
15 1 /// -----------------------------------------------------------------------
16 1 /// Configuration of the System Clock:
17 1 /// -----------------------------------------------------------------------
18 1 /// - VCO clock used, input clock is connected
19 1 /// - input frequency is 12 MHz
20 1 /// - VCO output frequency 100 .. 150 MHz
21 1 /// - system clock is 30 MHz
22 1
23 1 MAIN_vUnlockProtecReg(); // unlock write security
24 1 PLLCON = 0x7814; // load PLL control register
25 1 //OSTickISRInit(); // RTC initiates as timertick;
26 1 PSW_IEN = 1;
27 1
28 1 }
29
30 /*
31 *********************************************************************************************************
32 @Function void MAIN_vUnlockProtecReg(void)
33
34 ---------------------------------------------------------------------------------------------------------
35 @Description This function makes it possible to write one protected
36 register. After calling of this function and write on the
37 protected register is the security level set to low
38 protected mode.
39
40
41 *********************************************************************************************************
42 */
43
44
45 void MAIN_vUnlockProtecReg(void)
46 {
47 1 INT8U ubPASSWORD;
48 1
49 1 if((SCUSLS & 0x1800) == 0x0800) // if low protected mode
50 1 {
51 2
52 2 ubPASSWORD = SCUSLS & 0x00FF;
*** WARNING C192 IN LINE 52 OF MAIN.C: '=': value truncated
53 2 ubPASSWORD = ~ubPASSWORD;
54 2 SCUSLC = 0x8E00 | ubPASSWORD; // command 4
C166 COMPILER V6.04, MAIN 09/04/2006 10:03:41 PAGE 2
55 2
56 2 } // end if low protected mode
57 1
58 1 if((SCUSLS & 0x1800) == 0x1800) // if write protected mode
59 1 {
60 2 SCUSLC = 0xAAAA; // command 0
61 2 SCUSLC = 0x5554; // command 1
62 2
63 2 ubPASSWORD = SCUSLS & 0x00FF;
*** WARNING C192 IN LINE 63 OF MAIN.C: '=': value truncated
64 2 ubPASSWORD = ~ubPASSWORD;
65 2
66 2 SCUSLC = 0x9600 | ubPASSWORD; // command 2
67 2 SCUSLC = 0x0800; // command 3; new PASSWOR is 0x00
68 2
69 2 ubPASSWORD = SCUSLS & 0x00FF;
*** WARNING C192 IN LINE 69 OF MAIN.C: '=': value truncated
70 2 ubPASSWORD = ~ubPASSWORD;
71 2 SCUSLC = 0x8E00 | ubPASSWORD; // command 4
72 2
73 2 }
74 1
75 1 }
76
77 /*
78 *********************************************************************************************************
79 Task's parameters declaration
80 *********************************************************************************************************
81 */
82
83 #define TimeTick1Prio 11 /* define task's priority */
84 #define TimeTick2Prio 12
85
86 #define TimeTick1Stk_Num 100 /*define task's stack */
87 #define TimeTick2Stk_Num 100
88
89 OS_STK TimeTick1Stk[TimeTick1Stk_Num];
90 OS_STK TimeTick2Stk[TimeTick2Stk_Num];
91
92 /*
93 *********************************************************************************************************
94 @Function void TimeTick1(void *pdata)
95 ----------------------------------------------------------------------------------------------------------
96 @Description 使P1L=0x0F,并通过OSTimeDly(1)来实现与TimeTick2的切换
97
98 *********************************************************************************************************
99 */
100
101
102 void TimeTick1(void *pdata)
103 {
104 1 INT32U i;
105 1 pdata = pdata;
106 1 while (1)
107 1 {
108 2 P1L = 0x0F; /* cotrol P1L0 */
109 2 for(i=0; i<3000000; i++); /* delay time */
110 2 OSTimeDly(1); /* Set ticks = 40 , excute OSSched; */
111 2 }
112 1 }
113
114 /*
C166 COMPILER V6.04, MAIN 09/04/2006 10:03:41 PAGE 3
115 *********************************************************************************************************
116
117 @Function void TimeTick1(void *pdata)
118 ---------------------------------------------------------------------------------------------------------
119 @Description 使P1L=0xF0,一个时钟节拍后,自动切换到TimeTick1
120
121 *********************************************************************************************************
122 */
123
124 void TimeTick2(void *pdata)
125 {
126 1
127 1 pdata = pdata;
128 1
129 1 while(1)
130 1 {
131 2 P1L = 0xF0;
132 2 }
133 1 }
134
135 /*
136 *********************************************************************************************************
137 @Function void Port1_init(void)
138 ---------------------------------------------------------------------------------------------------------
-
139 @Description P1口的初始化,输出方向
140
141 *********************************************************************************************************
142 */
143
144 void Port1_init(void)
145 {
146 1 DP1L = 0x0000; //Port direction : output ;
147 1 DP1H = 0x0000;
148 1 P1L = 0x00AA;
149 1 P1H = 0x00AA;
150 1 }
151
152
153 /*
154 *********************************************************************************************************
155 @Function void main(void)
156 ---------------------------------------------------------------------------------------------------------
157 @Description 主函数
158
159 *********************************************************************************************************
160 */
161 void main(void)
162 {
163 1
164 1
165 1 MAIN_vInit();
166 1 Port1_init();
167 1
168 1 OSInit(); /* initiate Ucos-II */
169 1 OSTaskCreate(TimeTick1, (void*)0, &TimeTick1Stk[TimeTick1Stk_Num-1], TimeTick1Prio); /* Create TimeTick1
-*/
170 1 OSTaskCreate(TimeTick2, (void*)0, &TimeTick2Stk[TimeTick2Stk_Num-1], TimeTick2Prio); /* Create TimeTick2
-*/
171 1 OSStart(); /* Start Ucso-II */
172 1 }
173
C166 COMPILER V6.04, MAIN 09/04/2006 10:03:41 PAGE 4
174
C166 COMPILER V6.04, MAIN 09/04/2006 10:03:41 PAGE 5
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -