📄 menu.lst
字号:
204 1 }
205 //--------------------------------------------------------------------
206 void d0(void)
207 {
208 1 d0_3(0);
209 1
210 1 }
211 //--------------------------------------------------------------------
212 void d1(void)
213 {
214 1 d0_3(1);
215 1 }
216 //--------------------------------------------------------------------
217 void d2(void)
218 {
219 1 d0_3(2);
220 1 }
221 //--------------------------------------------------------------------
222 void d3()
223 {
224 1 d0_3(3);
225 1 }
226 //--------------------------------------------------------------------
227 void d4()
228 {
229 1 dis_cls();
230 1 pwm();
231 1 }
232 //--------------------------------------------------------------------
233 void d5()
234 {
235 1 dis_cls();
236 1 dis_one_zi(0,0,x19,1,1);
237 1 dis_one_zi(0,1,x20,1,1);
238 1 dis_one_char(0,4,':',1);
239 1 dis_one_char(0,5,' ',1);
240 1 dis_one_char(0,6,'V',1);
241 1 dis_one_char(0,7,'1',1);
C51 COMPILER V8.05a MENU 08/21/2007 12:58:00 PAGE 5
242 1 dis_one_char(0,8,'.',1);
243 1 dis_one_char(0,9,'0',1);
244 1 dis_one_char(0,10,'.',1);
245 1 dis_one_char(0,11,'0',1);
246 1
247 1 dis_one_zi(1,0,x25,1,1);
248 1 dis_one_zi(1,1,x26,1,1);
249 1 dis_one_zi(1,2,x27,1,1);
250 1 dis_one_zi(1,3,x28,1,1);
251 1 dis_one_char(1,8,':',1);
252 1 dis_one_zi(2,4,x32,1,1);
253 1 dis_one_zi(2,5,x33,1,1);
254 1 dis_one_zi(2,6,x34,1,1);
255 1 dis_one_zi(2,7,x35,1,1);
256 1
257 1 dis_one_zi(3,4,x29,1,1);
258 1 dis_one_zi(3,5,x30,1,1);
259 1 dis_one_zi(3,6,x31,1,1);
260 1
261 1 }
262 //--------------------------------------------------------------------
263 void d6()
264 {
265 1 dis_cls();
266 1 freq();
267 1 }
268 //--------------------------------------------------------------------
269 void d7()
270 {
271 1 dis_cls();
272 1 wave();
273 1 }
274 //--------------------------------------------------------------------
275 typedef struct
276 {
277 uchar keystateindex;
278 uchar keydnstate;
279 uchar keyupstate;
280 uchar keycrstate;
281 void(*currentoperate)();
282 } kbdtabstruct;
283 //--------------------------------------------------------------------
284 kbdtabstruct code keytab[size_of_keybd_menu]=
285 { //第一行表示在0级菜单时按下向下键则转到1级菜单
286 //按下向上键则转1级菜单,按下回车键则转5级菜单
287 // 下 上 回车
288
289 { 0, 1, 3, 6, (* d0)},
290 { 1, 2, 0, 7, (* d1)},
291 { 2, 3, 1, 4, (* d2)},
292 { 3, 0, 2, 5, (* d3)},
293
294 { 4, 2, 2, 2, (* d4)},//PWM分析子程序
295 { 5, 3, 3, 3, (* d5)},//版本信息
296 { 6, 0, 0, 0, (* d6)},//频率计子程序
297 { 7, 0, 1, 1, (* d7)},//示波器子程序
298 };
299 //--------------------------------------------------------------------
300 void getkeyinput(void)
301 {
302 1
303 1 uchar key_value,temp;
C51 COMPILER V8.05a MENU 08/21/2007 12:58:00 PAGE 6
304 1 re: temp=P3;
305 1 temp|=0x03;
306 1 P3=temp;
307 1 key_value=P3&0x03;
308 1 delay(50000);
309 1 //0:下键 2:中键 1:上键
310 1 switch(key_value)
311 1 {
312 2 case 1:
313 2 {
314 3 keyfuncindex=keytab[keyfuncindex].keycrstate;
315 3 beep(6500);
316 3 break;
317 3 }
318 2 case 2:
319 2 {
320 3 keyfuncindex=keytab[keyfuncindex].keyupstate;
321 3 beep(6500);
322 3 break;
323 3 }
324 2 case 0:
325 2 {
326 3 keyfuncindex=keytab[keyfuncindex].keydnstate;
327 3 beep(6500);
328 3 break;
329 3 }
330 2 default:
331 2 goto re;
332 2 }
333 1
334 1 keyfuncptr=keytab[keyfuncindex].currentoperate;
335 1 (*keyfuncptr)();
336 1 delay(65535);
337 1 delay(65535);
338 1 }
339 //--------------------------------------------------------------------
340 void beep(uint time)
341 {
342 1 beep_port=0;
343 1 delay(time);
344 1 delay(time);
345 1 delay(time);
346 1 delay(time);
347 1 beep_port=1;
348 1 }
349 //--------------------------------------------------------------------
350 void sys_auto_check(void)
351 {
352 1 uchar xx,c=3;
353 1
354 1 dis_one_zi(0,2,x36,1,1);
355 1 dis_one_zi(0,3,x37,1,1);
356 1 dis_one_zi(0,4,x38,1,1);
357 1 dis_one_zi(0,5,x39,1,1);
358 1 dis_one_zi(1,1,x40,1,1);
359 1 dis_one_zi(1,2,x41,1,1);
360 1 dis_one_zi(1,3,x42,1,1);
361 1 dis_one_zi(1,4,x7,1,1);
362 1 dis_one_zi(1,5,x8,1,1);
363 1 dis_one_zi(1,6,x9,1,1);
364 1 while(--c!=0)
365 1 {
C51 COMPILER V8.05a MENU 08/21/2007 12:58:00 PAGE 7
366 2 for(xx=3;xx<13;xx++)
367 2 {
368 3 dis_one_char(2,xx-1,'>',1);
369 3 dis_one_char(2,xx ,'>',1);
370 3 dis_one_char(2,xx+1,'>',1);
371 3 delay(50000);
372 3 delay(50000);
373 3
374 3 dis_one_char(2,xx-1,' ',1);
375 3 dis_one_char(2,xx ,' ',1);
376 3 dis_one_char(2,xx+1,' ',1);
377 3 }
378 2 }
379 1 beep(60000);
380 1 }
381 //--------------------------------------------------------------------
382 void main(void) using 0
383 {
384 1
385 1 beep_port=1;
386 1 EA=0;
387 1 SP=0x7f;
388 1 lcd_init();
389 1 f_in=1;
390 1 sys_auto_check();
391 1 AD_init(7);
392 1 keyfuncindex=0;
393 1 d0();
394 1 while(1)
395 1 {
396 2 getkeyinput();
397 2 }
398 1 }
399 //--------------------------------------------------------------------
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1964 ----
CONSTANT SIZE = 72 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 18 7
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 + -