ST7565_Driver_menu.rar
源代码在线查看: keyscan.lst
C51 COMPILER V8.05a KEYSCAN 09/22/2009 20:36:59 PAGE 1
C51 COMPILER V8.05a, COMPILATION OF MODULE KEYSCAN
OBJECT MODULE PLACED IN KEYSCAN.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE KEYSCAN.C BROWSE DEBUG OBJECTEXTEND
line level source
1 #include "AT89X52.H"
2 #include "SysFunction.h"
3
4
5 //按键音输出端
6 #define port_alarmout P2_0
7 //自动键延时计数
8 #define Autoclick 10
9
10
11
12 #define uchar unsigned char
13 sbit k_ok=P0^6;
14 sbit k_cancel=P0^7;
15 sbit k_up=P0^4;
16 sbit k_down=P0^5;
17
18 #define key_NoKey 0
19 #define key_ok 0x05
20 #define key_cancel 0x06
21 #define key_up 0x07
22 #define key_down 0x08
23
24 #define key_ok_L 0x85
25 #define key_cancel_L 0x86
26 #define key_up_L 0x87
27 #define key_down_L 0x88
28
29 unsigned char key_scan()
30 {
31 1
32 1 uchar key,clc=Autoclick;
33 1 key=key_NoKey;
34 1 k_ok=1;
35 1 k_cancel=1;
36 1 k_up=1;
37 1 k_down=1;
38 1
39 1 if(k_ok==0)
40 1 {
41 2 key=key_ok;
42 2 };
43 1
44 1 if(k_cancel==0)
45 1 {
46 2
47 2 key=key_cancel;
48 2 };
49 1 if(k_up==0)
50 1 {
51 2 key=key_up;
52 2 };
53 1 if(k_down==0)
54 1 {
55 2 key=key_down;
C51 COMPILER V8.05a KEYSCAN 09/22/2009 20:36:59 PAGE 2
56 2 };
57 1
58 1 if (key!=key_NoKey)
59 1 {
60 2 port_alarmout=0;
61 2 delayms(20);
62 2 port_alarmout=1;
63 2 }
64 1 while(!(k_ok==1 && k_cancel==1 && k_up==1 && k_down==1) && clc!=0)
65 1 {
66 2 delayms(1);
67 2 // P1=0xf0;
68 2 k_ok=1;
69 2 k_cancel=1;
70 2 k_up=1;
71 2 k_down=1;
72 2 clc--;
73 2 }
74 1 if(clc==0)
75 1 {
76 2 return 0x80|key;
77 2 }
78 1 else
79 1 {
80 2 return key;
81 2 }
82 1 }
83
84 unsigned char key_scanW()
85 {
86 1 unsigned char keytmp;
87 1
88 1 do
89 1 {
90 2 keytmp=key_scan();
91 2 //WTD();
92 2 }
93 1 while(keytmp==key_NoKey);
94 1
95 1
96 1 return keytmp;
97 1
98 1
99 1 }
100 /*
101 //获得取消键
102 unsigned char key_Cancle()
103 {
104
105 }
106 */
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 108 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 2
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILER V8.05a KEYSCAN 09/22/2009 20:36:59 PAGE 3
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)