📄 dhbj.lst
字号:
C51 COMPILER V7.50 DHBJ 02/19/2007 18:52:27 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE DHBJ
OBJECT MODULE PLACED IN dhbj.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE dhbj.c BROWSE DEBUG OBJECTEXTEND
line level source
1 #include <AT89x051.H> //器件配置文件
*** WARNING C318 IN LINE 1 OF dhbj.c: can't open file 'AT89x051.H'
2 #define uchar unsigned char //变量类型的宏定义
3 #define uint unsigned int
4 uchar code DATA_7SEG[10]={0xC0,0xF9,0xA4,0xB0,0x99,
5 0x92,0x82,0xF8,0x80,0x90,};/*0-9数码管段码*/
6 uchar DATA[20]; /* 存放电话号码的数组*/
7 uchar X[3]; /*存放时间t1数组*/
8 uchar Y[3]; /*存放时间t2数组*/
9 uchar flag; /*RAM区防干扰标志*/
10 uchar data_flag=0; /*输入电话号码计数器(最长二十位)*/
11 uchar set=0; /*功能键值*/
12 uchar m=0; //全局变量
13 uchar n=0;
14 uint f;
15 uchar t1_flag=0; /*输入时间1计数器(最长三位)*/
16 uchar t2_flag=0; /*输入时间2计数器(最长三位)*/
17 uchar cnt_1=0; /*时间t1单元数学运算后暂存单元*/
18 uchar cnt_2=0; /*时间t2单元数学运算后暂存单元*/
19 /*****************************************************/
20 void delay(uint k); /*延时子函数声明*/
21 void stop(); /*关机子函数声明*/
22 void bh(); /*拨号子函数声明*/
23 /***************************************************/
24 /*定时器T0初始化*/
25 void init_timer()
26 {
27 1 TMOD=0x01;
*** ERROR C202 IN LINE 27 OF DHBJ.C: 'TMOD': undefined identifier
28 1 TH0=-(50000/256);
*** ERROR C202 IN LINE 28 OF DHBJ.C: 'TH0': undefined identifier
29 1 TL0=-(50000%256);
*** ERROR C202 IN LINE 29 OF DHBJ.C: 'TL0': undefined identifier
30 1 IE=0x82;
*** ERROR C202 IN LINE 30 OF DHBJ.C: 'IE': undefined identifier
31 1 }
32 /***************************************************/
33 /*100mS定时中断服务子函数*/
34 void zd0()interrupt 1
35 {
36 1 P3_0=!P3_0; //P3.0每100ms取反一次,送出脉冲
*** ERROR C202 IN LINE 36 OF DHBJ.C: 'P3_0': undefined identifier
37 1 P1_7=!P1_7; //数码管小数点同步闪烁
*** ERROR C202 IN LINE 37 OF DHBJ.C: 'P1_7': undefined identifier
38 1 n++;
39 1 TH0=-(50000/256);
*** ERROR C202 IN LINE 39 OF DHBJ.C: 'TH0': undefined identifier
40 1 TL0=-(50000%256);
*** ERROR C202 IN LINE 40 OF DHBJ.C: 'TL0': undefined identifier
41 1 }
42 /***************************************************/
43 /*INT0中断服务子函数*/
44 void zd_int0()interrupt 0
45 {
46 1 delay(10);
C51 COMPILER V7.50 DHBJ 02/19/2007 18:52:27 PAGE 2
47 1 if(P3_2==0)set++; //功能键值递增
*** ERROR C202 IN LINE 47 OF DHBJ.C: 'P3_2': undefined identifier
48 1 if(set>=5)set=0; //键值的范围0~4
49 1 if(set==1)flag=0x55; //向RAM区的标志flag写入55H
50 1 PCON=0x00;f=8;
*** ERROR C202 IN LINE 50 OF DHBJ.C: 'PCON': undefined identifier
51 1 again:if(P3_2==0)goto again; //若按键未释放,则等待
*** ERROR C202 IN LINE 51 OF DHBJ.C: 'P3_2': undefined identifier
52 1 }
53 /******************************************************/
54 /*INT1中断服务子函数*/
55 void zd_int1()interrupt 2
56 {uchar h;
57 1 f=0;
58 1 for(h=0;h<10;h++) /*检查磁性开关(P3_3状态)10次,共1秒*/
59 1 {
60 2 delay(100);
61 2 if(P3_3==0)f++;
*** ERROR C202 IN LINE 61 OF DHBJ.C: 'P3_3': undefined identifier
62 2 }
63 1 }
64 /********************************************************/
65 /*---关机---*/
66 void stop()
67 {if(flag==0x55)P1=0xfb;
*** ERROR C202 IN LINE 67 OF DHBJ.C: 'P1': undefined identifier
68 1 else P1=0x86; //数码管右下角显示"1"。
*** ERROR C202 IN LINE 68 OF DHBJ.C: 'P1': undefined identifier
69 1 delay(1);
70 1 if(flag==0x55)PCON=0x01; /*进入节电待机状态*/
*** ERROR C202 IN LINE 70 OF DHBJ.C: 'PCON': undefined identifier
71 1 delay(1);
72 1 }
73 /********************************************************/
74 /*延时1ms*K子函数*/
75 void delay(uint k)
76 {
77 1 uint i,j;
78 1 for(i=0;i<k;i++){
79 2 for(j=0;j<60;j++)
80 2 {;}}
81 1 }
82 /********************************************************/
83 /*----输入时间t1----*/
84 void in_time1()
85 {
86 1 P1=0xf7;delay(1); /*数码管显示"一"*/
*** ERROR C202 IN LINE 86 OF DHBJ.C: 'P1': undefined identifier
87 1 if(P3_5==0)
*** ERROR C202 IN LINE 87 OF DHBJ.C: 'P3_5': undefined identifier
88 1 {
89 2 delay(10); /*按下OK键确认并点亮小数点*/
90 2 if(P3_5==0){P1=0x7f;m=0;t1_flag=0;delay(500);}
*** ERROR C202 IN LINE 90 OF DHBJ.C: 'P3_5': undefined identifier
*** ERROR C202 IN LINE 90 OF DHBJ.C: 'P1': undefined identifier
91 2 while(t1_flag<3)
92 2 {
93 3 if(P3_4==0)
*** ERROR C202 IN LINE 93 OF DHBJ.C: 'P3_4': undefined identifier
94 3 {delay(10);if(P3_4==0) /*按下UP键数码管作0-9递增显示*/
*** ERROR C202 IN LINE 94 OF DHBJ.C: 'P3_4': undefined identifier
95 4 {m++;if(m==10)m=0;P1=DATA_7SEG[m];delay(300);}
C51 COMPILER V7.50 DHBJ 02/19/2007 18:52:27 PAGE 3
*** ERROR C202 IN LINE 95 OF DHBJ.C: 'P1': undefined identifier
96 4 }
97 3 P1=DATA_7SEG[m];delay(1); /*若不按下UP键数码管也作0-9显示*/
*** ERROR C202 IN LINE 97 OF DHBJ.C: 'P1': undefined identifier
98 3 if(P3_5==0)
*** ERROR C202 IN LINE 98 OF DHBJ.C: 'P3_5': undefined identifier
99 3 {delay(10);if(P3_5==0) /*按下OK键显示的数据存入数组X中*/
*** ERROR C202 IN LINE 99 OF DHBJ.C: 'P3_5': undefined identifier
100 4 {X[t1_flag]=m;t1_flag++;P1=0x7f;delay(500);}
*** ERROR C202 IN LINE 100 OF DHBJ.C: 'P1': undefined identifier
101 4
102 4 }
103 3 }
104 2 }
105 1 if(t1_flag>=3)t1_flag=0; /*时间1计数器>=3时归零*/
106 1 }
107 /***********************************************************************/
108 /*----输入时间t2----*/
109 void in_time2()
110 {
111 1 P1=0xb7;delay(1); /*数码管显示"二"*/
*** ERROR C202 IN LINE 111 OF DHBJ.C: 'P1': undefined identifier
112 1 if(P3_5==0)
*** ERROR C202 IN LINE 112 OF DHBJ.C: 'P3_5': undefined identifier
113 1 {
114 2 delay(10); /*按下OK键确认并点亮小数点*/
115 2 if(P3_5==0){P1=0x7f;m=0;t2_flag=0;delay(500);}
*** ERROR C202 IN LINE 115 OF DHBJ.C: 'P3_5': undefined identifier
*** ERROR C202 IN LINE 115 OF DHBJ.C: 'P1': undefined identifier
116 2 while(t2_flag<3)
117 2 {
118 3 if(P3_4==0)
*** ERROR C202 IN LINE 118 OF DHBJ.C: 'P3_4': undefined identifier
119 3 {delay(10);if(P3_4==0) /*按下UP键数码管作0-9递增显示*/
*** ERROR C202 IN LINE 119 OF DHBJ.C: 'P3_4': undefined identifier
120 4 {m++;if(m==10)m=0;P1=DATA_7SEG[m];delay(300);}
*** ERROR C202 IN LINE 120 OF DHBJ.C: 'P1': undefined identifier
121 4 }
122 3 P1=DATA_7SEG[m];delay(1); /*若不按下UP键数码管也作0-9显示*/
*** ERROR C202 IN LINE 122 OF DHBJ.C: 'P1': undefined identifier
123 3 if(P3_5==0)
*** ERROR C202 IN LINE 123 OF DHBJ.C: 'P3_5': undefined identifier
124 3 {delay(10);if(P3_5==0) /*按下OK键显示的数据存入数组Y中*/
*** ERROR C202 IN LINE 124 OF DHBJ.C: 'P3_5': undefined identifier
125 4 {Y[t2_flag]=m;t2_flag++;P1=0x7f;delay(500);}
*** ERROR C202 IN LINE 125 OF DHBJ.C: 'P1': undefined identifier
126 4
127 4 }
128 3 }
129 2 }
130 1 if(t2_flag>=3)t2_flag=0; /*时间2计数器>=3时归零*/
131 1 }
132 /***********************************************************************/
133 /*----输入电话号码----*/
134 void in_data()
135 {uchar g;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -