📄 usermain.lst
字号:
C51 COMPILER V7.06 USERMAIN 12/18/2007 11:18:09 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE USERMAIN
OBJECT MODULE PLACED IN usermain.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE usermain.c BROWSE DEBUG OBJECTEXTEND
stmt level source
1 //包含文件如下
2
3 #include "c51base.h"
4
5
6 uchar password[4];
7
8 uchar *I2c_pw =(uchar xdata *)0x8130;
9 struct SlineTable *I2c_humtable = (struct SlineTable xdata *)0x8100;
10 struct Scheck *I2c_mhumtable = (struct Scheck xdata *)0x8110;
11 struct Scheck *I2c_mtemptable = (struct Scheck xdata *)0x8120;
12 struct Scheck *I2c_yalitable = (struct Scheck xdata *)0x8140;
13 struct Stimer *I2c_timertable = (struct Stimer xdata *)0x8200;
14
15
16 /*************************
17 初始化函数。
18 *************************/
19 void DeviceInit()
20 {
21 1 InitSFR_SM89516();
22 1 CommInit();
23 1 TimerInit();
24 1 InitEPROM();
25 1 EA = 1;
26 1 }
27
28
29 void GetData(uchar *Data_buf)
30 {
31 1 uchar idata time[7],i,temp;
32 1 static uint temp_count=0,temp_buf[5];
33 1 WDTReset_SM89516();
34 1 GetTime(7,time);
35 1 Data_buf[0] = time[4];
36 1 Data_buf[1] = time[5];
37 1 Data_buf[2] = time[6];
38 1 Data_buf[3] = time[0];
39 1 Data_buf[4] = time[1];
40 1 Data_buf[5] = time[2];
41 1 Data_buf[6] = time[3];
42 1
43 1 // printf("电压= %d伏特",(int)Data_buf[8]);
44 1 temp_buf[temp_count++] = GetTemper(10);
45 1 if(temp_count>4)
46 1 temp_count = 0;
47 1
48 1 temp = temp_buf[i];
49 1 for(i=0;i<3;i++)
50 1 {
51 2 if(temp <= temp_buf[i+1])
52 2 temp = temp_buf[i+1];
53 2 }
54 1
55 1 Data_buf[7] = (temp_buf[0]+temp_buf[1]+temp_buf[2]+temp_buf[3]+temp_buf[4])/5;
C51 COMPILER V7.06 USERMAIN 12/18/2007 11:18:09 PAGE 2
56 1 }
57
58
59 void ProcessData(uchar *Data_buf)
60 {
61 1 uchar temp;
62 1 temp = Data_buf[0];
63 1 }
64
65
66
67 /*******************************************
68 主界面显示函数,主要显示为:
69 1,时间显示,在液晶最上面一行显示当前的时间
70 2,温度显示,在液晶的第二行显示当前的温度
71 3,湿度显示,在液晶的第二行显示当前的湿度
72 4,下一个启动的定时器编号和时间
73 *******************************************/
74
75 void MainDisplay(uchar *Data_buf)
76 {
77 1 uint value;
78 1 uchar vol[4];
79 1 DisplayStr(6,2,":");
80 1 DisplayStr(9,2,":"); //时间显示
81 1 DisplayType(4,2,(Data_buf[0]%100)/10+'0');
82 1 DisplayType(5,2,Data_buf[0]%10+'0');
83 1 DisplayType(7,2,(Data_buf[1]%100)/10+'0');
84 1 DisplayType(8,2,Data_buf[1]%10+'0');
85 1 DisplayType(10,2,(Data_buf[2]%100)/10+'0');
86 1 DisplayType(11,2,Data_buf[2]%10+'0');
87 1
88 1 // printf("value = %d\n",(int)Data_buf[6]);
89 1 DisplayStr(0,0,"20");
90 1 DisplayStr(4,0,"年");
91 1 DisplayStr(8,0,"月");
92 1 DisplayStr(12,0,"日");
93 1 DisplayStr(0,1,"星期");
94 1 DisplayStr(0,2,"时间");
95 1 DisplayStr(6,2,":");
96 1 DisplayStr(9,2,":");
97 1 DisplayType(2,0,(Data_buf[3]%100)/10+'0');
98 1 DisplayType(3,0,Data_buf[3]%10+'0');
99 1 DisplayType(6,0,(Data_buf[4]%100)/10+'0');
100 1 DisplayType(7,0,Data_buf[4]%10+'0');
101 1 DisplayType(10,0,(Data_buf[5]%100)/10+'0');
102 1 DisplayType(11,0,Data_buf[5]%10+'0');
103 1 switch(Data_buf[6])
104 1 {
105 2 case 0:DisplayStr(4,1,"一");
106 2 break;
107 2 case 1:DisplayStr(4,1,"二");
108 2 break;
109 2 case 2:DisplayStr(4,1,"叁");
110 2 break;
111 2 case 3:DisplayStr(4,1,"四");
112 2 break;
113 2 case 4:DisplayStr(4,1,"五");
114 2 break;
115 2 case 5:DisplayStr(4,1,"六");
116 2 break;
117 2 case 6:DisplayStr(4,1,"日");
C51 COMPILER V7.06 USERMAIN 12/18/2007 11:18:09 PAGE 3
118 2 break;
119 2 default:
120 2 break;
121 2 }
122 1
123 1 DisplayStr(0,3,"室内温度 ");
124 1 DisplayStr(10,3,"~ ");
125 1 // printf("温度通道 %d\n",(int)Data_buf[7]);
126 1 if(Data_buf[7]<=90 && Data_buf[7]>=0)
127 1 {
128 2 if(Data_buf[7]>=10)
129 2 DisplayType(8,3,(Data_buf[7]%100)/10+'0');
130 2 else
131 2 DisplayStr(8,3," ");
132 2 DisplayType(9,3,Data_buf[7]%10+'0');
133 2 }
134 1
135 1
136 1 value = ADCRead(1);
137 1 value = value/6;
138 1 vol[0] = ((int)value)%100/10+'0';
139 1 // printf("vol[0]=%d\n",(int)vol[0]);
140 1 vol[1] = ((int)value)%100%10+'0';
141 1 DisplayStr(7,1,"湿度");
142 1 DisplayStr(12,1,vol);
143 1 DisplayStr(14,1,"%");
144 1 }
145
146
147 void SendData()
148 {
149 1 uchar key_value,temper;
150 1 CLEAR_SCREEN();
151 1 DisplayStr(3,0,"DATA CHECK");
152 1 while(1)
153 1 {
154 2 key_value = WaitKey(1000);
155 2 if(key_value == 'x' || key_value == 0xff)
156 2 return;
157 2 if(key_value == 'e')
158 2 {
159 3 temper = GetTemper(10);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -