?? scob.lst
字號:
C51 COMPILER V7.02a SCOB 09/11/2007 14:06:41 PAGE 1
C51 COMPILER V7.02a, COMPILATION OF MODULE SCOB
OBJECT MODULE PLACED IN SCOB.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE SCOB.C BROWSE DEBUG OBJECTEXTEND
stmt level source
1 #include <reg52.h>
2 #include <stdio.h>
3 #include <string.h>
4 #include "SCON.h"
5
6
7 unsigned char sent_data[3] , re_data[12] , _sign=1 ;
8 void mp3_stop( );
9 void delay( );
10 void small_delay( );
11
12 void file_selec( );
13 void WaitTF0( void );
14 void UART_INT( )
15 {
16 1
17 1 SCON = 0x50;
18 1 PCON = 0x80;
19 1 TMOD = 0x22;
20 1 TL1 = 0xf3;
21 1 TH1 = 0xf3; /* 20MHz晶振, 9600bps */
22 1 TR1 = 1;
23 1 TI = 1;
24 1 RI =0;
25 1 ES = 1;
26 1 }
27
28 void S2INI(void)
29 { ET0=1;
30 1 TL0=0x30;
31 1 TH0=0x30; //開始計數
32 1 TF0=0;
33 1 P1_0=0;
34 1 EA=1;
35 1 }
36
37 void WByte(unsigned char input)
38 {
39 1 //發送啟始位
40 1 unsigned char j=8;
41 1 TR0=1;
42 1 P1_5 = 0 ;
43 1 WaitTF0();
44 1 //發送8位數據位
45 1 for(j=8;j>0;j--)
46 1 {
47 2 P1_5 = (input&0x01); //先傳低位
48 2 WaitTF0();
49 2 input=input>>1;
50 2 }
51 1 //發送校驗位(無)
52 1 //發送結束位
53 1 P1_5=1;
54 1 WaitTF0();
55 1 TR0=0;
C51 COMPILER V7.02a SCOB 09/11/2007 14:06:41 PAGE 2
56 1 }
57 //查詢計數器溢出標志位
58 void WaitTF0( void )
59 {
60 1 while(!TF0);
61 1 TF0=0;
62 1 }
63 /***************************************************************
64 2007.8.17. 加入WDT
65 2007.8.20.加第0首歌曲可以播放
66 2007.8.27.加USB自動發送進入功能
67 2007.9.7. 加USB自動進入退出不會自動進去!
68
69
70
71
72 ****************************************************************/
73
74 void main ( )
75 {
76 1
77 1
78 1 unsigned char i, address , usb_sign=1,back_count=0;
79 1 unsigned int m_big_count=0 ;
80 1 WDT=0x06;
81 1 UART_INT( );
82 1 S2INI( );
83 1
84 1
85 1 delay( );
86 1 delay( );
87 1
88 1 delay( );
89 1
90 1 delay( );
91 1 delay( );
92 1
93 1
94 1 if(P1_0==1)
95 1 {
96 2 delay( );
97 2 delay( );
98 2 delay( );
99 2 delay( );
100 2 delay( );
101 2 delay( );
102 2 delay( );
103 2 delay( );
104 2 sent_data[0]=0;
105 2 sent_data[1]=0;
106 2 sent_data[2]=3;
107 2 for(i=0;i<3;i++)
108 2 {
109 3 WByte(sent_data[i]);
110 3 }
111 2 delay( );
112 2
113 2
114 2
115 2 while(1)
116 2 {
117 3 if((P3_2==0)&&(back_count<9))
C51 COMPILER V7.02a SCOB 09/11/2007 14:06:41 PAGE 3
118 3 {
119 4 delay( );
120 4
121 4 P1_1=0;
122 4 delay( );
123 4 P1_1=1;
124 4 delay( );
125 4 P1_1=0;
126 4 delay( );
127 4 P1_1=1;
128 4 sent_data[0]=0;
129 4 sent_data[1]=0;
130 4 sent_data[2]=2;
131 4 for(i=0;i<3;i++)
132 4 {
133 5 WByte(sent_data[i]);
134 5 }
135 4 delay( );
136 4 delay( );
137 4 delay( );
138 4
139 4 }
140 3
141 3
142 3 m_big_count++;
143 3 if(m_big_count==60000)
144 3 {
145 4 m_big_count=0;
146 4 back_count++ ;
147 4 }
148 3
149 3 }
150 2
151 2
152 2
153 2 }
154 1 while(1)
155 1 {
156 2 for(i=0;i<12;i++)
157 2 {
158 3 while(RI!=1)
159 3 {
160 4 }
161 3 RI=0;
162 3 WDT= WDT|0x20;
163 3 re_data[i]=SBUF;
164 3
165 3 WDT= WDT|0x10;
166 3 }
167 2
168 2 WDT= WDT|0x30;
169 2
170 2
171 2
172 2 address = P2;
173 2 WDT = WDT&0xDF;
174 2 if((re_data[0]==254)&(re_data[1]==1)&(re_data[2]==0)&(re_data[3]==8)&(address==re_data[5])) //10 da
-ta input address
175 2 {
176 3 mp3_stop( ); //停止正在播放的歌曲
177 3 small_delay( );
178 3
C51 COMPILER V7.02a SCOB 09/11/2007 14:06:41 PAGE 4
179 3
180 3
181 3
182 3 if((re_data[6]!=65)&&(_sign==1))
183 3 {
184 4 if(((re_data[10]&0x81)==0x81)&&((re_data[10]&0x82)!=0x82))
185 4 {
186 5 sent_data[0]=0;
187 5 sent_data[1]=re_data[8];
188 5
189 5 file_selec( );
190 5 }
191 4 if(((re_data[10]&0x82)==0x82)&&((re_data[10]&0x81)!=0x81))
192 4 {
193 5 sent_data[0]=re_data[7];
194 5 sent_data[1]=0;
195 5 file_selec( );
196 5 }
197 4 if((re_data[10]&0x83)==0x83)
198 4 {
199 5 sent_data[0]=re_data[7];
200 5 sent_data[1]=re_data[8];
201 5 file_selec( );
202 5 }
203 4
204 4
205 4 }
206 3 if(re_data[6]==65)
207 3 {
208 4
209 4 _sign=!_sign;
210 4 /*
211 4 sent_data[0]=0;
212 4 sent_data[1]=0;
213 4 sent_data[2]=2;
214 4 for(i=0;i<3;i++)
215 4 {
216 4 WByte(sent_data[i]);
217 4 }
218 4 */
219 4 }
220 3
221 3 }
222 2
223 2 if( (re_data[0]==0)&(re_data[1]==0)&(re_data[2]==0)&(re_data[3]==0)) //in USB
224 2 {
225 3
226 3 P1_1=0;
227 3 delay( );
228 3 P1_1=1;
229 3 delay( );
230 3 P1_1=0;
231 3 delay( );
232 3 P1_1=1;
233 3 sent_data[0]=0;
234 3 sent_data[1]=0;
235 3 sent_data[2]=2;
236 3 for(i=0;i<3;i++)
237 3 {
238 4 WByte(sent_data[i]);
239 4 }
240 3 delay( );
C51 COMPILER V7.02a SCOB 09/11/2007 14:06:41 PAGE 5
241 3 delay( );
242 3 delay( );
243 3 delay( );
244 3 delay( );
245 3 }
246 2
247 2
248 2 if( (re_data[0]==0xaa)&&(re_data[6]==0xaa )&&(re_data[1]==re_data[7]))
249 2 {
250 3
251 3 if( re_data[1]==0x18)
252 3 {
253 4 if((re_data[2]<=0x1f)&&(re_data[3]<=0x1f))
254 4 {
255 5 sent_data[0]=re_data[2];
256 5 sent_data[1]=re_data[3];
257 5 sent_data[2]=9; // voice change 9
258 5 for(i=0;i<3;i++)
259 5 {
260 6 WByte(sent_data[i]);
261 6 }
262 5
263 5 }
264 4
265 4
266 4 }
267 3 if( re_data[1]==0x15)
268 3 {
269 4 sent_data[0]=0;
270 4 sent_data[1]=0;
271 4 sent_data[2]=8;
272 4 for(i=0;i<3;i++)
273 4 {
274 5 WByte(sent_data[i]);
275 5 }
276 4 }
277 3 }
278 2
279 2 for(i=0;i<12;i++)
280 2 {
281 3 SBUF=re_data[i];
282 3
283 3 while(TI!=1);
284 3 TI=0;
285 3 }
286 2
287 2
288 2 }
289 1
290 1 }
291 void delay( )
292 {
293 1 unsigned char a ,b,c;
294 1 for(a=0;a<201;a++)
295 1 for(b=0;b<90;b++)
296 1 for(c=0;c<2;c++);
297 1
298 1
299 1 }
300 void small_delay( )
301 {
302 1
C51 COMPILER V7.02a SCOB 09/11/2007 14:06:41 PAGE 6
303 1 unsigned char a ,b,c;
304 1 for(a=0;a<200;a++)
305 1 for(b=0;b<90;b++)
306 1 for(c=0;c<1;c++);
307 1
308 1
309 1
310 1 }
311
312
313 void file_selec( )
314 {
315 1 unsigned int song_num=0 ;
316 1 unsigned char i ,j;
317 1 song_num=sent_data[0]*256+sent_data[1];
318 1
319 1
320 1 if((song_num>=0)&(song_num<1025))
321 1 {
322 2 sent_data[2]=0; //0 song
323 2 for(i=0;i<3;i++)
324 2 {
325 3 WByte(sent_data[i]);
326 3 }
327 2 sent_data[0]=0;
328 2 sent_data[1]=0;
329 2 sent_data[2]=2; //fun 2
330 2 delay( );
331 2 for(i=0;i<2;i++)
332 2 {
333 3 for(j=0;j<3;j++)
334 3 {
335 4 WByte(sent_data[j]);
336 4
337 4 }
338 3 delay( );
339 3 }
340 2
341 2
342 2 }
343 1
344 1
345 1 }
346
347 void mp3_stop( )
348 {
349 1 char j ;
350 1
351 1 sent_data[0]=0;
352 1 sent_data[1]=0;
353 1 sent_data[2]=8;
354 1
355 1
356 1 for(j=0;j<3;j++)
357 1 {
358 2 WByte(sent_data[j]);
359 2 }
360 1
361 1
362 1
363 1 }
C51 COMPILER V7.02a SCOB 09/11/2007 14:06:41 PAGE 7
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 893 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 16 10
IDATA SIZE = ---- ----
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 + -