Skip to content

Commit 1019373

Browse files
committed
Refactor the project tree.
1 parent 50523d4 commit 1019373

39 files changed

+7834
-7813
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*.dylib
1717

1818
# Executables
19-
*.exe
19+
#*.exe
2020
*.out
2121
*.app
2222
*.hex

Data/192.168.1.100.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<html>
2+
<meta http-equiv=refresh content=3>
3+
<body>
4+
<center>
5+
<h1>基于WEB的监控系统设计测试页面</h1>
6+
<h3>开关量控制:</h3>
7+
<br><p>点击按钮以开启或关闭LED 1对应LED灭 0对应LED亮</p>
8+
</center>
9+
<form action=swc.html>
10+
<table align=center>
11+
<tr align=center>
12+
<td>P1_7:&nbsp<input type=submit name=sw7 value=1></td>
13+
<td>P1_6:&nbsp<input type=submit name=sw6 value=1></td>
14+
</tr>
15+
</table>
16+
</form>
17+
<center>
18+
<h3>环境温度: 29.93&degC</h3>
19+
</body>
20+
</html>
21+

Data/arp.exe

3.23 MB
Binary file not shown.

Data/get_answer.cap

2.09 KB
Binary file not shown.

Data/ping.exe

1.81 MB
Binary file not shown.

Data/uIP.vsd

58.5 KB
Binary file not shown.

Data/web.exe

2.42 MB
Binary file not shown.

Data/web_client_server.vsd

45 KB
Binary file not shown.

Data/web_server.exe

3.39 MB
Binary file not shown.

18b20.c renamed to Source/18b20.c

Lines changed: 132 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -1,133 +1,133 @@
1-
//对18b20进行预操作步骤:1、复位 2、发送一条ROM指令 3、发送一条RAM指令
2-
//默认12位,最长转换时间750ms
3-
4-
#include <reg52.h>
5-
#include <intrins.h>
6-
7-
/* crystal 22.1184M */
8-
9-
//unsigned char code led_tbl[]={0X3F,0X6,0X5B,0X4F,0X66,0X6D,0X7D,0X7,0X7F,0X6F}; //数码管共阳码
10-
11-
code unsigned char decimalH[]={00,06,12,18,25,31,37,43,50,56,62,68,75,81,87,93}; //查表:小数高位
12-
13-
code unsigned char decimalL[]={00,25,50,75,00,25,50,75,00,25,50,75,00,25,50,75}; //查表:小数低位
14-
15-
//unsigned char code scan_tbl[]={0x01,0x02,0x04,0x08}; //数码管扫描码
16-
//unsigned char display_buffer[4]={1,2,3,4}; //显示缓冲
17-
18-
//----------------------------------------------------------------------
19-
#define SCAN_PORT P0 //扫描口 低有效 P0_0->NUM3 ~P0_3->NUM0
20-
#define DATA_PORT P2 //数据口 低点亮
21-
sbit P1_0=P1^0;
22-
#define DQ P1_0 //定义通信端口
23-
//----------------------------------------------------------------------
24-
#define delay delay18b20
25-
//功能:延时函数
26-
void delay(unsigned int i)
27-
{
28-
while(i--);
29-
}
30-
//-----------------------------------------------------------------------
31-
//功能:18B20复位函数
32-
unsigned char DS18B20_RST(void)
33-
{
34-
unsigned char temp;
35-
DQ = 1; //DQ复位
36-
delay(16); //稍做延时
37-
DQ = 0; //单片机将DQ拉低
38-
delay(100); //精确延时 大于 480us 精确延时:505us
39-
DQ = 1; //拉高总线 input(RX)
40-
delay(16); // 精确延时: 96us
41-
temp=DQ;
42-
delay(80); // 精确延时: 408us 408+96=504us>480us 满足时序
43-
44-
//为什么用delay(4);return DQ;时检测到18B20 而转换不对,而加delay(14);return DQ;没检
45-
//测到18B20,而转换正确 因为回复时间至少480us
46-
47-
return temp; //返回1,复位失败 返回0,复位成功
48-
}
49-
//------------------------------------------------------------------------
50-
//功能:读一个字节
51-
unsigned char ReadOneChar(void)
52-
{
53-
unsigned char i=0;
54-
unsigned char dat = 0;
55-
for (i=8;i>0;i--)
56-
{
57-
DQ = 0; // 拉底总线,读slot开始
58-
dat>>=1;
59-
DQ = 1; // 释放总线
60-
if(DQ)
61-
dat|=0x80; //LSB first
62-
delay(8);
63-
}
64-
return(dat);
65-
}
66-
67-
//功能:写一个字节
68-
WriteOneChar(unsigned char dat)
69-
{
70-
unsigned char i=0;
71-
for (i=8; i>0; i--)
72-
{
73-
DQ = 0;
74-
_nop_();
75-
DQ = dat&0x01; //LSB first
76-
delay(10); //6.6ms
77-
DQ = 1;
78-
dat>>=1;
79-
}
80-
81-
}
82-
//---------------------------------------------------------------------------
83-
//读取温度
84-
unsigned int ReadTemperature(void)
85-
{
86-
unsigned int tp=0;
87-
unsigned char temp_L,temp_H; //高位 和 低位
88-
89-
DS18B20_RST(); // 步骤 1
90-
WriteOneChar(0xCC); // 跳过读序号列号的操作 步骤 2
91-
WriteOneChar(0x44); // 启动温度转换 步骤 3
92-
while(DQ==0); //等待转换完成 DQ=0表示正在转换,DQ=1表示转换完成 12位需要最多750ms
93-
94-
DS18B20_RST();
95-
WriteOneChar(0xCC); //跳过读序号列号的操作
96-
WriteOneChar(0xBE); //读取温度寄存器等(共可读9个寄存器) 前两个就是温度
97-
98-
temp_L = ReadOneChar(); //低8位(先低后高的发过来的)
99-
100-
temp_H = ReadOneChar(); //高八位
101-
tp|=temp_H;
102-
tp<<=8;
103-
tp|=temp_L;
104-
return tp;
105-
}
106-
107-
unsigned int get_t(void)
108-
{
109-
unsigned int t,return_t;
110-
unsigned char temp1,temp2;
111-
112-
t=ReadTemperature();
113-
114-
if(t&0x8000)
115-
{
116-
//温度为负
117-
}
118-
else
119-
{
120-
temp1=(unsigned char)(t>>4);
121-
temp2=(unsigned char)(t&0x000f);
122-
return_t=decimalH[temp2];
123-
124-
temp1%=100;
125-
return_t|=(temp1<<8);
126-
}
127-
return return_t;
128-
}
129-
130-
131-
132-
#undef delay
1+
//对18b20进行预操作步骤:1、复位 2、发送一条ROM指令 3、发送一条RAM指令
2+
//默认12位,最长转换时间750ms
3+
4+
#include <reg52.h>
5+
#include <intrins.h>
6+
7+
/* crystal 22.1184M */
8+
9+
//unsigned char code led_tbl[]={0X3F,0X6,0X5B,0X4F,0X66,0X6D,0X7D,0X7,0X7F,0X6F}; //数码管共阳码
10+
11+
code unsigned char decimalH[]={00,06,12,18,25,31,37,43,50,56,62,68,75,81,87,93}; //查表:小数高位
12+
13+
code unsigned char decimalL[]={00,25,50,75,00,25,50,75,00,25,50,75,00,25,50,75}; //查表:小数低位
14+
15+
//unsigned char code scan_tbl[]={0x01,0x02,0x04,0x08}; //数码管扫描码
16+
//unsigned char display_buffer[4]={1,2,3,4}; //显示缓冲
17+
18+
//----------------------------------------------------------------------
19+
#define SCAN_PORT P0 //扫描口 低有效 P0_0->NUM3 ~P0_3->NUM0
20+
#define DATA_PORT P2 //数据口 低点亮
21+
sbit P1_0=P1^0;
22+
#define DQ P1_0 //定义通信端口
23+
//----------------------------------------------------------------------
24+
#define delay delay18b20
25+
//功能:延时函数
26+
void delay(unsigned int i)
27+
{
28+
while(i--);
29+
}
30+
//-----------------------------------------------------------------------
31+
//功能:18B20复位函数
32+
unsigned char DS18B20_RST(void)
33+
{
34+
unsigned char temp;
35+
DQ = 1; //DQ复位
36+
delay(16); //稍做延时
37+
DQ = 0; //单片机将DQ拉低
38+
delay(100); //精确延时 大于 480us 精确延时:505us
39+
DQ = 1; //拉高总线 input(RX)
40+
delay(16); // 精确延时: 96us
41+
temp=DQ;
42+
delay(80); // 精确延时: 408us 408+96=504us>480us 满足时序
43+
44+
//为什么用delay(4);return DQ;时检测到18B20 而转换不对,而加delay(14);return DQ;没检
45+
//测到18B20,而转换正确 因为回复时间至少480us
46+
47+
return temp; //返回1,复位失败 返回0,复位成功
48+
}
49+
//------------------------------------------------------------------------
50+
//功能:读一个字节
51+
unsigned char ReadOneChar(void)
52+
{
53+
unsigned char i=0;
54+
unsigned char dat = 0;
55+
for (i=8;i>0;i--)
56+
{
57+
DQ = 0; // 拉底总线,读slot开始
58+
dat>>=1;
59+
DQ = 1; // 释放总线
60+
if(DQ)
61+
dat|=0x80; //LSB first
62+
delay(8);
63+
}
64+
return(dat);
65+
}
66+
67+
//功能:写一个字节
68+
WriteOneChar(unsigned char dat)
69+
{
70+
unsigned char i=0;
71+
for (i=8; i>0; i--)
72+
{
73+
DQ = 0;
74+
_nop_();
75+
DQ = dat&0x01; //LSB first
76+
delay(10); //6.6ms
77+
DQ = 1;
78+
dat>>=1;
79+
}
80+
81+
}
82+
//---------------------------------------------------------------------------
83+
//读取温度
84+
unsigned int ReadTemperature(void)
85+
{
86+
unsigned int tp=0;
87+
unsigned char temp_L,temp_H; //高位 和 低位
88+
89+
DS18B20_RST(); // 步骤 1
90+
WriteOneChar(0xCC); // 跳过读序号列号的操作 步骤 2
91+
WriteOneChar(0x44); // 启动温度转换 步骤 3
92+
while(DQ==0); //等待转换完成 DQ=0表示正在转换,DQ=1表示转换完成 12位需要最多750ms
93+
94+
DS18B20_RST();
95+
WriteOneChar(0xCC); //跳过读序号列号的操作
96+
WriteOneChar(0xBE); //读取温度寄存器等(共可读9个寄存器) 前两个就是温度
97+
98+
temp_L = ReadOneChar(); //低8位(先低后高的发过来的)
99+
100+
temp_H = ReadOneChar(); //高八位
101+
tp|=temp_H;
102+
tp<<=8;
103+
tp|=temp_L;
104+
return tp;
105+
}
106+
107+
unsigned int get_t(void)
108+
{
109+
unsigned int t,return_t;
110+
unsigned char temp1,temp2;
111+
112+
t=ReadTemperature();
113+
114+
if(t&0x8000)
115+
{
116+
//温度为负
117+
}
118+
else
119+
{
120+
temp1=(unsigned char)(t>>4);
121+
temp2=(unsigned char)(t&0x000f);
122+
return_t=decimalH[temp2];
123+
124+
temp1%=100;
125+
return_t|=(temp1<<8);
126+
}
127+
return return_t;
128+
}
129+
130+
131+
132+
#undef delay
133133

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
1-
### uVision2 Project, (C) Keil Software
2-
### Do not modify !
3-
4-
cExt (*.c)
5-
aExt (*.s*; *.src; *.a*)
6-
oExt (*.obj)
7-
lExt (*.lib)
8-
tExt (*.txt; *.h; *.inc)
9-
pExt (*.plm)
10-
CppX (*.cpp)
11-
DaveTm { 0,0,0,0,0,0,0,0 }
12-
13-
Target (Target 1), 0x0000 // Tools: 'MCS-51'
14-
GRPOPT 1,(Source Group 1),1,0,0
15-
16-
OPTFFF 1,1,1,218103808,0,0,0,0,<.\uip_arch.c><uip_arch.c>
17-
OPTFFF 1,2,1,721420288,0,0,0,0,<.\etherdev.c><etherdev.c>
18-
OPTFFF 1,3,1,0,0,0,0,0,<.\main.c><main.c>
19-
OPTFFF 1,4,1,0,0,0,0,0,<.\uip.c><uip.c>
20-
OPTFFF 1,5,1,855638018,0,411,411,0,<.\uip_arp.c><uip_arp.c> { 44,0,0,0,2,0,0,0,3,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,0,0,0,0,0,0,0,0,193,2,0,0,238,0,0,0 }
21-
OPTFFF 1,6,1,301989888,0,0,0,0,<.\uart.c><uart.c>
22-
OPTFFF 1,7,1,369098752,0,0,0,0,<.\app.c><app.c>
23-
OPTFFF 1,8,1,0,0,0,0,0,<.\18b20.c><18b20.c>
24-
25-
26-
TARGOPT 1, (Target 1)
27-
CLK51=22118400
28-
OPTTT 1,1,1,0
29-
OPTHX 0,65535,0,0,0
30-
OPTLX 120,65,8,<.\debug\>
31-
OPTOX 16
32-
OPTLT 1,1,1,0,1,1,0,1,0,0,0,0
33-
OPTXL 1,1,1,1,1,1,1,0,0
34-
OPTFL 1,0,1
35-
OPTDL (S8051.DLL)()(DP51.DLL)(-p51AC2)(S8051.DLL)()(TP51.DLL)(-p51AC2)
36-
OPTDBG 509,0,()()()()()()()()()() ()()()()
37-
OPTKEY 0,(DLGDP51)((98=-1,-1,-1,-1,0)(82=-1,-1,-1,-1,0)(83=-1,-1,-1,-1,0)(84=-1,-1,-1,-1,0)(85=-1,-1,-1,-1,0)(5056=-1,-1,-1,-1,0)(99=-1,-1,-1,-1,0)(91=-1,-1,-1,-1,0)(92=-1,-1,-1,-1,0)(94=-1,-1,-1,-1,0)(95=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(5008=-1,-1,-1,-1,0)(5016=-1,-1,-1,-1,0)(2003=-1,-1,-1,-1,0)(5061=-1,-1,-1,-1,0)(5033=-1,-1,-1,-1,0))
38-
OPTWA 0,1,(htmlpage)
39-
OPTDF 0x80
40-
OPTLE <>
41-
OPTLC <>
42-
EndOpt
43-
1+
### uVision2 Project, (C) Keil Software
2+
### Do not modify !
3+
4+
cExt (*.c)
5+
aExt (*.s*; *.src; *.a*)
6+
oExt (*.obj)
7+
lExt (*.lib)
8+
tExt (*.txt; *.h; *.inc)
9+
pExt (*.plm)
10+
CppX (*.cpp)
11+
DaveTm { 0,0,0,0,0,0,0,0 }
12+
13+
Target (Target 1), 0x0000 // Tools: 'MCS-51'
14+
GRPOPT 1,(Source Group 1),1,0,0
15+
16+
OPTFFF 1,1,1,218103808,0,0,0,0,<.\uip_arch.c><uip_arch.c>
17+
OPTFFF 1,2,1,721420288,0,0,0,0,<.\etherdev.c><etherdev.c>
18+
OPTFFF 1,3,1,0,0,0,0,0,<.\main.c><main.c>
19+
OPTFFF 1,4,1,0,0,0,0,0,<.\uip.c><uip.c>
20+
OPTFFF 1,5,1,855638018,0,411,411,0,<.\uip_arp.c><uip_arp.c> { 44,0,0,0,2,0,0,0,3,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,0,0,0,0,0,0,0,0,193,2,0,0,238,0,0,0 }
21+
OPTFFF 1,6,1,301989888,0,0,0,0,<.\uart.c><uart.c>
22+
OPTFFF 1,7,1,369098752,0,0,0,0,<.\app.c><app.c>
23+
OPTFFF 1,8,1,0,0,0,0,0,<.\18b20.c><18b20.c>
24+
25+
26+
TARGOPT 1, (Target 1)
27+
CLK51=22118400
28+
OPTTT 1,1,1,0
29+
OPTHX 0,65535,0,0,0
30+
OPTLX 120,65,8,<.\debug\>
31+
OPTOX 16
32+
OPTLT 1,1,1,0,1,1,0,1,0,0,0,0
33+
OPTXL 1,1,1,1,1,1,1,0,0
34+
OPTFL 1,0,1
35+
OPTDL (S8051.DLL)()(DP51.DLL)(-p51AC2)(S8051.DLL)()(TP51.DLL)(-p51AC2)
36+
OPTDBG 509,0,()()()()()()()()()() ()()()()
37+
OPTKEY 0,(DLGDP51)((98=-1,-1,-1,-1,0)(82=-1,-1,-1,-1,0)(83=-1,-1,-1,-1,0)(84=-1,-1,-1,-1,0)(85=-1,-1,-1,-1,0)(5056=-1,-1,-1,-1,0)(99=-1,-1,-1,-1,0)(91=-1,-1,-1,-1,0)(92=-1,-1,-1,-1,0)(94=-1,-1,-1,-1,0)(95=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(5008=-1,-1,-1,-1,0)(5016=-1,-1,-1,-1,0)(2003=-1,-1,-1,-1,0)(5061=-1,-1,-1,-1,0)(5033=-1,-1,-1,-1,0))
38+
OPTWA 0,1,(htmlpage)
39+
OPTDF 0x80
40+
OPTLE <>
41+
OPTLC <>
42+
EndOpt
43+

0 commit comments

Comments
 (0)