📄 key.lst
字号:
C51 COMPILER V8.05a KEY 11/09/2008 23:18:20 PAGE 1
C51 COMPILER V8.05a, COMPILATION OF MODULE KEY
OBJECT MODULE PLACED IN key.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE key.c BROWSE DEBUG OBJECTEXTEND
line level source
1 #include "ExtDef.h"
2
3 uchar xdata RowOut _at_ 0x8000;
4 uchar xdata ColIn _at_ 0x8003;
5 uchar Key=Nothing; //键盘缓冲寄存器(公有数据)
6 uchar Fn_Key; //功能键
7
8 extern void delay(int c);
9 //*********************************************************************
10 //= 函数原型: void KEYPAD_Scan(char* const Key, char* const Fn_Key)
11 //= 功 能: 扫描键盘
12 //= 参 数: 普通键New_Key,功能键New_FuncKey,缓存器的指针
13 //= 返 回 值:
14 //= 函数性质:私有函数
15 //**********************************************************************
16
17 void KEYPAD_Scan(char* const Key, char* const Fn_Key)
18 {
19 1 RowOut = 0x70; //Scan Row4
20 1 // delay(1);
21 1 if ((ColIn&0xF0) == 0xE0) *Fn_Key = 'o'; //ON键
22 1 if ((ColIn&0xF0) == 0xD0) *Key = 0;
23 1 if ((ColIn&0xF0) == 0xB0) *Fn_Key = '=';
24 1 if ((ColIn&0xF0) == 0x70) *Key = '+';
25 1
26 1 RowOut = 0xB0; //Scan Row3
27 1 // delay(1);
28 1 if ((ColIn&0xF0) == 0xE0) *Key = 1;
29 1 if ((ColIn&0xF0) == 0xD0) *Key = 2;
30 1 if ((ColIn&0xF0) == 0xB0) *Key = 3;
31 1 if ((ColIn&0xF0) == 0x70) *Key = '-';
32 1
33 1 RowOut = 0xD0; //Scan Row2
34 1 // delay(1);
35 1 if ((ColIn&0xF0) == 0xE0) *Key = 4;
36 1 if ((ColIn&0xF0) == 0xD0) *Key = 5;
37 1 if ((ColIn&0xF0) == 0xB0) *Key = 6;
38 1 if ((ColIn&0xF0) == 0x70) *Key = '*';
39 1
40 1 RowOut = 0xE0; //Scan Row1
41 1 // delay(1);
42 1 if ((ColIn&0xF0) == 0xE0) *Key = 7;
43 1 if ((ColIn&0xF0) == 0xD0) *Key = 8;
44 1 if ((ColIn&0xF0) == 0xB0) *Key = 9;
45 1 if ((ColIn&0xF0) == 0x70) *Key = '/';
46 1
47 1 RowOut = 0xF0;
48 1 // delay(1);
49 1 }
50 //*********************************************************************
51 //= 函数原型: void KEY_Update()
52 //= 功 能: 键盘缓冲寄存器更新程序. 普通键Key, 功能键Fn_Key
53 //= 参 数:
54 //= 返 回 值:
55 //= 函数性质:公有函数
C51 COMPILER V8.05a KEY 11/09/2008 23:18:20 PAGE 2
56 //**********************************************************************
57 void KEY_Update()
58 {
59 1 static uchar delay=20; //去抖动延时
60 1 static bit delaying=0; //标识是否正在延时
61 1
62 1 if(delaying==0)
63 1 {
64 2 if(Key==Nothing) //如果Key缓存器中的数据未被读取,则不扫描键盘
65 2 {
66 3 KEYPAD_Scan(&Key,&Fn_Key); //扫描键盘
67 3 if(Key!=Nothing)
68 3 {
69 4 delaying=1;
70 4 Key=Nothing;
71 4
72 4 }
73 3 }
74 2 }
75 1 else
76 1 {
77 2 if(delay==0) //延时结束
78 2 {
79 3 KEYPAD_Scan(&Key,&Fn_Key); //读取键盘
80 3 delay=20;
81 3 delaying=0;
82 3 }
83 2 else delay--; //延时减一
84 2 }
85 1 }
86
87
88
89
90
91
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 425 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 3 6
IDATA SIZE = ---- ----
BIT SIZE = 1 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -