主要实现在C8051F020的平台上完成在12864液晶OCMG4C8上画正弦函数特性曲线。
源代码在线查看: keyscan.lst
C51 COMPILER V8.02 KEYSCAN 04/12/2009 20:19:23 PAGE 1
C51 COMPILER V8.02, COMPILATION OF MODULE KEYSCAN
OBJECT MODULE PLACED IN KeyScan.OBJ
COMPILER INVOKED BY: E:\学习软件安装程序\Keil3\C51\BIN\C51.EXE KeyScan.c BROWSE DEBUG OBJECTEXTEND
line level source
1 #include
2 #include
3 void Kdelay(uint x)
4 {
5 1 uint a,b;
6 1 for(a=0;a 7 1 for(b=0;b 8 1 }
9 uchar KeyScan()
10 {
11 1 uchar i=0;
12 1 uchar temp;
13 1 P1=0xfe;
14 1 temp=P1;
15 1 temp=temp&0xf0;
16 1 if(temp!=0xf0)
17 1 {
18 2 Kdelay(20);
19 2 if(temp!=0xf0)
20 2 {
21 3 switch(temp)
22 3 {
23 4 case 0xe0: i=0;
24 4 break;
25 4 case 0xd0: i=1;
26 4 break;
27 4 case 0xb0: i=2;
28 4 break;
29 4 case 0x70: i=3;
30 4 break;
31 4 }
32 3 }
33 2 while(temp!=0xf0)
34 2 {
35 3 temp=P1;
36 3 temp=temp&0xf0;
37 3 }
38 2 }
39 1 P1=0xfd;
40 1 temp=P1;
41 1 temp=temp&0xf0;
42 1 if(temp!=0xf0)
43 1 {
44 2 Kdelay(20);
45 2 if(temp!=0xf0)
46 2 {
47 3 switch(temp)
48 3 {
49 4 case 0xe0: i=4;
50 4 break;
51 4 case 0xd0: i=5;
52 4 break;
53 4 case 0xb0: i=6;
54 4 break;
55 4 case 0x70: i=7;
C51 COMPILER V8.02 KEYSCAN 04/12/2009 20:19:23 PAGE 2
56 4 break;
57 4 }
58 3 }
59 2 while(temp!=0xf0)
60 2 {
61 3 temp=P1;
62 3 temp=temp&0xf0;
63 3 }
64 2 }
65 1 P1=0xfb;
66 1 temp=P1;
67 1 temp=temp&0xf0;
68 1 if(temp!=0xf0)
69 1 {
70 2 Kdelay(20);
71 2 if(temp!=0xf0)
72 2 {
73 3 switch(temp)
74 3 {
75 4 case 0xe0: i=8;
76 4 break;
77 4 case 0xd0: i=9;
78 4 break;
79 4 case 0xb0: i=10;
80 4 break;
81 4 case 0x70: i=11;
82 4 break;
83 4 }
84 3 }
85 2 while(temp!=0xf0)
86 2 {
87 3 temp=P1;
88 3 temp=temp&0xf0;
89 3 }
90 2 }
91 1 P1=0xf7;
92 1 temp=P1;
93 1 temp=temp&0xf0;
94 1 if(temp!=0xf0)
95 1 {
96 2 Kdelay(20);
97 2 if(temp!=0xf0)
98 2 {
99 3 switch(temp)
100 3 {
101 4 case 0xe0: i=12;
102 4 break;
103 4 case 0xd0: i=13;
104 4 break;
105 4 case 0xb0: i=14;
106 4 break;
107 4 case 0x70: i=15;
108 4 break;
109 4 }
110 3 }
111 2 while(temp!=0xf0)
112 2 {
113 3 temp=P1;
114 3 temp=temp&0xf0;
115 3 }
116 2 }
117 1 return(i);
C51 COMPILER V8.02 KEYSCAN 04/12/2009 20:19:23 PAGE 3
118 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 338 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 2
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)