?? main.lst
字號:
C51 COMPILER V8.17 MAIN 03/26/2009 14:34:03 PAGE 1
C51 COMPILER V8.17, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN .\out-files\main.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE User Files\main.c LARGE BROWSE INCDIR(.\smaRTC;.\SMBus) DEBUG OBJECTEXTEND
-PRINT(.\list-files\main.lst) TABS(2) OBJECT(.\out-files\main.obj)
line level source
1 #include "..\header files\includes.H"
2 #include "smaRTClock.h"
3
4
5 sbit LED3=P1^2;
6 sbit LED4=P1^1;
7
8
9 /***************變量定義***********************/
10
11 int idata sam_p=0;
12 float idata sam_pt100=0.0f;
13
14 /*****************************************************/
15
16 OS_STK Task_Test1_Stk[MaxStkSize];
17 OS_STK Task_Test2_Stk[MaxStkSize];
18
19
20 OS_STK TaskStart_Stk[MaxStkSize];
21
22
23
24 /********************信號量定義***********************/
25 OS_EVENT *UartSem;
26
27 /*****************************************************/
28
29
30 /********************外部變量**************************/
31 extern DATE_INFO event1;
32
33
34 /*****************************************************/
35
36 void TaskStart(void *pdat) reentrant;
37
38 void Task_Test1(void *pdat) reentrant;
39 void Task_Test2(void *pdat) reentrant;
40
41
42 void OSTimeTickHook (void) reentrant;
43 void Timer2_ISR (void) reentrant;
44
45
46
47
48
49
50
51
52
53 /****************************************************************************
54 * 功 能: Timer0鉤子函數
C51 COMPILER V8.17 MAIN 03/26/2009 14:34:03 PAGE 2
55 *---------------------------------------------------------------------------*
56 * 入口參數:
57 * 出口參數:
58 ****************************************************************************/
59 void OSTimeTickHook (void) reentrant
60 {
61 1
62 1
63 1 }
64
65
66
67
68
69 /****************************************************************************
70 * 功 能: 主函數
71 *---------------------------------------------------------------------------*
72 * 入口參數:
73 * 出口參數:
74 ****************************************************************************/
75
76 void main(void)
77 {
78 1 UU32 alarm_interval_second; // Will hold new alarm interval after
79 1 // second_alarm bit set
80 1 config();
81 1
82 1 RTC_Init();
83 1 Init_DateINFO();
84 1
85 1 // Update output_month and output_days for output
86 1 Compute_Month(&event1.output_month, &event1.output_days, event1.days,event1.years);
87 1
88 1 // Output initial time
89 1 printf("Current Time: %d-%d-%d %d:%d:%d\n",
90 1 event1.output_month, event1.output_days, event1.years,
91 1 event1.hours, event1.minutes, event1.seconds);
92 1
93 1 alarm_interval_second.U32 = (RTC_SECOND); // Set alarm to trigger every 1 second
94 1 // Copy the alarm interval to the alarm registers
95 1 RTC_Write (ALARM0, alarm_interval_second.U8[b0]); // LSB
96 1 RTC_Write (ALARM1, alarm_interval_second.U8[b1]);
97 1 RTC_Write (ALARM2, alarm_interval_second.U8[b2]);
98 1 RTC_Write (ALARM3, alarm_interval_second.U8[b3]); // MSB
99 1 RTC_Write (ALARM4, 0X00); // MSB
100 1 RTC_Write (ALARM5, 0X00); // MSB
101 1
102 1
103 1
104 1 OSInit();
105 1
106 1 OSTaskCreate(TaskStart, (void *)0, TaskStart_Stk,0);
107 1
108 1 OSStart();
109 1
110 1 }
111
112
113
114
115 /****************************************************************************
116 * 功 能: 最高優先級任務
C51 COMPILER V8.17 MAIN 03/26/2009 14:34:03 PAGE 3
117 *---------------------------------------------------------------------------*
118 * 入口參數:
119 * 出口參數:
120 ****************************************************************************/
121
122 void TaskStart(void *pdat) reentrant
123 {
124 1
125 1 INT8U err;
126 1
127 1
128 1 pdat=pdat;
129 1
130 1
131 1 printf ("UCOSII Verson=%d\n",OSVersion ());
132 1 printf ("UCOSII Starting OK ...\n");
133 1
134 1
135 1 InitTimer0();
136 1
137 1 ET0=1; //允許T0中斷
138 1
139 1
140 1 UartSem = OSSemCreate(1);
141 1
142 1 OSTaskCreate(Task_Test1, (void *)0, Task_Test1_Stk,2);
143 1
144 1 OSTaskCreate(Task_Test2, (void *)0, Task_Test2_Stk,3);
145 1
146 1
147 1 while(1)
148 1 {
149 2
150 2 sam_p +=1;
151 2
152 2 OSSemPend(UartSem, 0, &err);
153 2
154 2 printf ("TaskStart runing----->:%d\n",sam_p);
155 2
156 2 OSSemPost(UartSem);
157 2
158 2
159 2 OSTimeDly(OS_TICKS_PER_SEC/4);
160 2 }
161 1
162 1 }
163
164
165
166
167 /****************************************************************************
168 * 功 能: 測試任務------------1
169 *---------------------------------------------------------------------------*
170 * 入口參數:
171 * 出口參數:
172 ****************************************************************************/
173
174 void Task_Test1(void *pdat)reentrant
175 {
176 1
177 1 INT8U err;
178 1
C51 COMPILER V8.17 MAIN 03/26/2009 14:34:03 PAGE 4
179 1
180 1 pdat=pdat;
181 1
182 1
183 1 while(1)
184 1 {
185 2
186 2 sam_pt100 += 0.2;
187 2
188 2 OSSemPend(UartSem, 0, &err);
189 2
190 2 printf ("Task Test 1 runing--->: %3.1f \n",sam_pt100);
191 2
192 2 OSSemPost(UartSem);
193 2
194 2 LED4=~LED4;
195 2
196 2 OSTimeDly(OS_TICKS_PER_SEC/4);
197 2
198 2 }
199 1
200 1 }
201
202
203
204
205 /****************************************************************************
206 * 功 能: 測試任務------------2
207 *---------------------------------------------------------------------------*
208 * 入口參數:
209 * 出口參數:
210 ****************************************************************************/
211
212 void Task_Test2(void *pdat) reentrant
213 {
214 1 INT8U err;
215 1
216 1 UU32 RTC_Capture; // Will hold contents of RTC timer when
217 1 // button is pushed
218 1
219 1
220 1 pdat=pdat;
221 1
222 1
223 1 while(1)
224 1 {
225 2
226 2
227 2 OSSemPend(UartSem, 0, &err);
228 2
229 2 printf ("Task Test---2 runing\n");
230 2
231 2 OSSemPost(UartSem);
232 2
233 2 // Compute month and days for output
234 2 Compute_Month(&event1.output_month, &event1.output_days,
235 2 event1.days, event1.years);
236 2
237 2 RTC_Write (RTC0CN, 0xDD); // Initiate smaRTClock timer
238 2 // capture
239 2 // Wait for smaRTClock timer capture valid
240 2 while ((RTC_Read (RTC0CN) & 0x01)== 0x01);
C51 COMPILER V8.17 MAIN 03/26/2009 14:34:03 PAGE 5
241 2
242 2 // Copy the RTC capture timer to the RTC capture variable
243 2 RTC_Capture.U8[b0] = RTC_Read (CAPTURE0); // LSB
244 2 RTC_Capture.U8[b1] = RTC_Read (CAPTURE1);
245 2 RTC_Capture.U8[b2] = RTC_Read (CAPTURE2);
246 2 RTC_Capture.U8[b3] = RTC_Read (CAPTURE3); // MSB
247 2
248 2 RTC_Capture.U32 = (RTC_Capture.U32)+TIME_INIT;
249 2
250 2 event1.hours = (RTC_Capture.U32)/RTC_HOUR;
251 2 (RTC_Capture.U32) = (RTC_Capture.U32)%RTC_HOUR;
252 2 event1.minutes = (RTC_Capture.U32)/RTC_MINUTE;
253 2 (RTC_Capture.U32) = (RTC_Capture.U32)%RTC_MINUTE;
254 2 event1.seconds = (RTC_Capture.U32)/RTC_SECOND;
255 2 (RTC_Capture.U32) = (RTC_Capture.U32)%RTC_SECOND;
256 2 event1.hundreths = (RTC_Capture.U32)/RTC_HUNDRETH;
257 2
258 2
259 2 OSSemPend(UartSem, 0, &err);
260 2
261 2 // Output date
262 2 printf("\nCurrent Time: %d-%d-%d ",
263 2 event1.output_month, event1.output_days, event1.years);
264 2
265 2 printf("%d:%d:%d\n",event1.hours, event1.minutes,event1.seconds);
266 2
267 2 OSSemPost(UartSem);
268 2
269 2 LED3=~LED3;
270 2
271 2 OSTimeDly(OS_TICKS_PER_SEC/4);
272 2
273 2 }
274 1 }
275
276
277
278
279
280
281
282
283
284
285 /****************************************************************************
286 * 功 能:定時器2中斷服務函數
287 *---------------------------------------------------------------------------*
288 * 入口參數:
289 * 出口參數:
290 ****************************************************************************/
291
292 void Timer2_ISR (void) reentrant
293 {
294 1
295 1 TMR2CN &=0x04;//TF2必須由軟件清除,TR2=1
296 1
297 1 }
298
299
300
301
302
C51 COMPILER V8.17 MAIN 03/26/2009 14:34:03 PAGE 6
303 /******************************************************
304 *功能: PCA模塊中斷處理 *
305 *參數: *
306 *******************************************************/
307
308 void PCA0_ISR(void) reentrant
309 {
310 1
311 1
312 1 if(CCF0)
313 1 {
314 2 CCF0=0;
315 2
316 2 }
317 1
318 1 if(CCF1)
319 1 {
320 2 CCF1=0;
321 2
322 2 }
323 1
324 1 if(CCF2)
325 1 {
326 2 CCF2=0;
327 2
328 2 }
329 1
330 1
331 1 }
332
333 void SMBus_ISR(void) reentrant
334 {
335 1
336 1
337 1
338 1 }
339
340
341
342
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1511 ----
CONSTANT SIZE = 192 ----
XDATA SIZE = 303 4
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = 6 ----
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 + -