📄 接收.lst
字号:
C51 COMPILER V8.02 接收 05/15/2012 17:16:27 PAGE 1
C51 COMPILER V8.02, COMPILATION OF MODULE 接收
OBJECT MODULE PLACED IN 接收.obj
COMPILER INVOKED BY: D:\电子技术\Keil3\C51\BIN\C51.EXE 红外接收2011-5-12\接收.c BROWSE DEBUG OBJECTEXTEND PRINT(.\接收.l
-st) OBJECT(接收.obj)
line level source
1 //*********************************************************//
2 #include <intrins.h>
3 #include <reg52.h>
4 #define ulong unsigned long
5 #define uint unsigned int
6 #define uchar unsigned char
7 uchar temp,num,flag,sum=0,r;
8 /****************************************/
9 uchar code table1[]=" welcome!";
10 uchar code table2[]="0123456789ABCDEF";
11 uchar code table3[]="******";
12 uchar code table4[]="code is wrong!";
13 uchar code table5[]="you are right!";
14 uchar code table6[]="again!";
15 uchar code table7[]="the last time!";
16 uchar code table8[]="Input new number:";
17 uchar code table9[]="Modify right!!!";
18 uchar code table10[]="password:";
19 uchar code table11[]="2012-05-20";
20 uchar code table12[]=" alarming....";
21 uchar code table13[]=" ";
22 uchar code table14[]="Input again:";
23 uchar code table15[]="Modify error!!!";
24 uchar init_pswd[6]={6,6,6,6,6,6};//初始化密码
25 uchar pswd[6]={0};
26 sbit IR=P3^2; //将IR位定义为P3.2引脚
27 sbit lcdrs=P2^0;
28 sbit lcdrw=P2^1;
29 sbit lcden=P2^2;
30 sbit beep=P1^0;
31 sbit leep=P1^1;
32 /*****************************************子函数声明*/
33 void delay(uint z);
34 void init();//初始化子函数
35 void write_com(uchar com);//写指令子函数
36 void write_data(uchar dat1);//写数据子函数
37 void keyscan();
38 void mima();
39 void mima1();
40 void delete();
41 /**********************************液晶驱动*/
42 void init()
43 {
44 1 lcden=0;
45 1 write_com(0x38);
46 1 write_com(0x0e);
47 1 write_com(0x06);
48 1 write_com(0x01);
49 1 write_com(0x80);
50 1 }
51 void write_com(uchar com)
52 {
53 1 lcdrs=0;
54 1 lcdrw=0;
C51 COMPILER V8.02 接收 05/15/2012 17:16:27 PAGE 2
55 1 P0=com;
56 1 delay(5);
57 1 lcden=1;
58 1 delay(5);
59 1 lcden=0;
60 1 }
61 void write_data(uchar dat1)
62 {
63 1 lcdrs=1;
64 1 lcdrw=0;
65 1 P0=dat1;
66 1 delay(5);
67 1 lcden=1;
68 1 delay(5);
69 1 lcden=0;
70 1 }
71 /****************************************延迟函数*/
72 void delay(uint z)
73 {
74 1 uint x,y;
75 1 for(x=z;x>0;x--)
76 1 for(y=110;y>0;y--);
77 1 }
78 /*******************************************键盘编码*/
79 void keyscan()
80 {
81 1 P3=0x7f;
82 1 temp=P3;
83 1 temp=temp&0x0f;
84 1 while(temp!=0x0f)
85 1 {
86 2 delay(5);
87 2 temp=P3;
88 2 temp=temp&0x0f;
89 2 while(temp!=0x0f)
90 2 {
91 3 temp=P3;
92 3 switch(temp)
93 3 {
94 4 case 0x7e:num=0;flag=1;
95 4 break;
96 4 case 0x7d:num=1;flag=1;
97 4 break;
98 4 case 0x7b:num=2;flag=1;
99 4 break;
100 4 case 0x77:num=3;flag=1;
101 4 break;
102 4 }
103 3 while(temp!=0x0f)
104 3 {
105 4 temp=P3;
106 4 temp=temp&0x0f;
107 4 }
108 3 }
109 2 }
110 1 P3=0xbf;
111 1 temp=P3;
112 1 temp=temp&0x0f;
113 1 while(temp!=0x0f)
114 1 {
115 2 delay(5);
116 2 temp=P3;
C51 COMPILER V8.02 接收 05/15/2012 17:16:27 PAGE 3
117 2 temp=temp&0x0f;
118 2 while(temp!=0x0f)
119 2 {
120 3 temp=P3;
121 3 switch(temp)
122 3 {
123 4 case 0xbe:num=4;flag=1;
124 4 break;
125 4 case 0xbd:num=5;flag=1;
126 4 break;
127 4 case 0xbb:num=6;flag=1;
128 4 break;
129 4 case 0xb7:num=7;flag=1;
130 4 break;
131 4 }
132 3 while(temp!=0x0f)
133 3 {
134 4 temp=P3;
135 4 temp=temp&0x0f;
136 4 }
137 3 }
138 2 }
139 1 P3=0xdf;
140 1 temp=P3;
141 1 temp=temp&0x0f;
142 1 while(temp!=0x0f)
143 1 {
144 2 delay(5);
145 2 temp=P3;
146 2 temp=temp&0x0f;
147 2 while(temp!=0x0f)
148 2 {
149 3 temp=P3;
150 3 switch(temp)
151 3 {
152 4 case 0xde:num=8;flag=1;
153 4 break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -