Browse Source

Init

master
htujun 3 years ago
commit
558cd76593
  1. 239
      IRIN.LST
  2. BIN
      IRIN.OBJ
  3. 208
      IRIN.c
  4. 25
      IRIN.h
  5. 179
      i2c.LST
  6. BIN
      i2c.OBJ
  7. 152
      i2c.c
  8. 16
      i2c.h
  9. 101
      lcd.LST
  10. BIN
      lcd.OBJ
  11. 76
      lcd.c
  12. 53
      lcd.h
  13. 78
      main.LST
  14. BIN
      main.OBJ
  15. 53
      main.c
  16. BIN
      pro
  17. 880
      pro.M51
  18. 38
      pro.build_log.htm
  19. 214
      pro.hex
  20. 7
      pro.lnp
  21. 20
      pro.plg
  22. 1432
      pro.uvgui.Administrator
  23. 1868
      pro.uvgui.QY
  24. 1931
      pro.uvgui.asus
  25. 252
      pro.uvopt
  26. 410
      pro.uvproj
  27. 1629
      pro_uvopt.bak
  28. 379
      pro_uvproj.bak
  29. 144
      pwm.LST
  30. BIN
      pwm.OBJ
  31. 117
      pwm.c
  32. 40
      pwm.h
  33. 1360
      template.uvgui.Administrator
  34. 185
      template.uvopt

239
IRIN.LST

@ -0,0 +1,239 @@ @@ -0,0 +1,239 @@
C51 COMPILER V9.56.0.0 IRIN 04/06/2022 21:56:10 PAGE 1
C51 COMPILER V9.56.0.0, COMPILATION OF MODULE IRIN
OBJECT MODULE PLACED IN IRIN.OBJ
COMPILER INVOKED BY: D:\Keil_v5\C51\BIN\C51.EXE IRIN.c OPTIMIZE(8,SPEED) BROWSE DEBUG OBJECTEXTEND TABS(2)
line level source
1 #include "IRIN.h"
2 #include "i2c.h"
3
4 uint journey;
5 uint journey1;
6 extern uchar pwm_left;
7 unsigned int b;
8 unsigned int c;
9 extern uint time1;
10 extern uchar pwm_val_left;
11 unsigned int b2;
12 unsigned int c2;
13
14 uint money=7;
15 uint sudu=0;
16
17 uint count=0; //栅格是一圈20个
18
19 uchar ms=0;
20 uint speed=0;
21 uint r_s=0;
22
23 bit state=0;
24 bit s0=0;
25 bit flas=0;
26
27 uchar sec=0;
28 uchar sec1=0;
29
30 /*******************************************************************************
31 * 函 数 名 : delay
32 * 函数功能 : 延时函数,i=1时,大约延时10us
33 *******************************************************************************/
34 void delay11(int i)
35 {
36 1 while(i--);
37 1 }
38
39 void IRIN_Init(void)
40 {
41 1 TMOD=0x01;//定时器1工作方式1
42 1 TH0=0x3C;
43 1 TL0=0xb0;
44 1 ET0=1;
45 1 TH1=0XFc;
46 1 TL1=0X18;
47 1 ET1=1;
48 1 TR1=1;
49 1 TR0=1;
50 1 EA=1;
51 1 EX1=1;
52 1 IT1=1;
53 1
54 1 }
55
C51 COMPILER V9.56.0.0 IRIN 04/06/2022 21:56:10 PAGE 2
56 void display()
57 {
58 1 if(state==0)
59 1 {
60 2 sudu=At24c02Read(10);
61 2 if(money>7)
62 2 {
63 3 money=At24c02Read(5);
64 3 }
65 2 LcdSetCursor(0,0);
66 2 LcdShowStr(0,0,"Speed:");
67 2 Lcd1602_Write_Data(0x30+sudu/100%10);
68 2 Lcd1602_Write_Data(0x30+sudu/10%10);
69 2 Lcd1602_Write_Data(0x30+sudu%10);
70 2 LcdShowStr(10,0,"KM/h");
71 2
72 2 LcdShowStr(0,1,"L:");
73 2 Lcd1602_Write_Data(journey/10000%10+0x30);
74 2 Lcd1602_Write_Data(journey/1000%10+0x30);
75 2 Lcd1602_Write_Data(journey/100%10+0x30);
76 2 Lcd1602_Write_Data(journey/10%10+0x30);
77 2 Lcd1602_Write_Data(journey%10+0x30);
78 2 LcdShowStr(7,1,"M");
79 2
80 2 if(journey>1000)
81 2 {
82 3 money=(journey-1000)*0.002+7;
83 3 At24c02Write(5,money);
84 3 }
85 2 money=money*10;
86 2 LcdShowStr(9,1,"Q:");
87 2 Lcd1602_Write_Data(money/1000%10+0x30);
88 2 Lcd1602_Write_Data(money/100%10+0x30);
89 2 Lcd1602_Write_Data(money/10%10+0x30);
90 2 LcdShowStr(14,1,".");
91 2 Lcd1602_Write_Data(money%10+0x30);
92 2
93 2 money=money/10;
94 2
95 2
96 2 }
97 1 }
98
99
100
101 void keypros()
102 {
103 1 if(k2==0)
104 1 {
105 2 delay11(1000); //消抖处理
106 2 if(k2==0)
107 2 {
108 3 sudu=At24c02Read(10); //读取EEPROM地址1内的数据
109 3
110 3 b2=At24c02Read(1);
111 3 c2=At24c02Read(8);
112 3 journey=(b2<<8) | c2;
113 3
114 3 money=At24c02Read(5);
115 3
116 3 }
117 2 while(!k2);
C51 COMPILER V9.56.0.0 IRIN 04/06/2022 21:56:10 PAGE 3
118 2 }
119 1
120 1 if(k1==0)
121 1 {
122 2 delay11(1000); //消抖处理
123 2 if(k1==0)
124 2 {
125 3 flas=1;
126 3
127 3 }
128 2 while(!k1);
129 2 }
130 1 if(k4==0)
131 1 {
132 2 delay11(1000); //消抖处理
133 2 if(k4==0)
134 2 {
135 3 if(pwm_left>=20)
136 3 {
137 4 pwm_left=1;
138 4 }
139 3 else
140 3 {
141 4 pwm_left++;
142 4 }
143 3 }
144 2 while(!k4);
145 2 }
146 1
147 1 }
148
149 void time0() interrupt 1 //定时器 0
150 {
151 1 TH0=0x3C;
152 1 TL0=0xb0; //50ms定时
153 1 ms++; //变量50ms加一
154 1 if(ms%5==0) s0=~s0;
155 1
156 1
157 1 if(ms%10==0) //500ms定时
158 1 {
159 2
160 2 if(sec!=0) sec--;
161 2 if(sec1!=0) sec1--;
162 2 ms=0; //清零变量
163 2 EX1=0; //关闭外部中断,保证变量在计算的时候不会增加
164 2 r_s=count; //因为是500ms检测一次转动数据,所以要想一秒转动的圈数是 speed=count*2 ,但是光栅是一圈2
-0格,所以还要除以20;
165 2 //综合一下,一秒转动的圈数就是 speed=count*2/20 ==》 speed=counr/10;
166 2 count=0; //清零变量
167 2 EX1=1; //打开外部中断
168 2 speed=speed*0.5+(r_s*6)*0.5; // 这里r_s是一秒走的圈数,然后乘以60得到60秒走的圈数,单位变成了
- r/min; 总方式 speed=count/10*60; ==>> speed=count*6;
169 2
170 2 if(flas==0)
171 2 {
172 3 sudu=(0.15*speed);
173 3 At24c02Write(10,sudu);
174 3
175 3 journey=journey+(r_s*2.5/20);
176 3 journey1=journey;
177 3 c = journey & 0x00FF;
C51 COMPILER V9.56.0.0 IRIN 04/06/2022 21:56:10 PAGE 4
178 3 At24c02Write(8,c);
179 3
180 3 delay11(1000);
181 3 b=journey1>>8;
182 3 At24c02Write(1,b);
183 3 }
184 2 else
185 2 {
186 3 journey=0;
187 3 money=7;
188 3 At24c02Write(1,journey);
189 3 At24c02Write(8,journey);
190 3 At24c02Write(5,money);
191 3 flas=0;
192 3 }
193 2 }
194 1 }
195
196 void int1() interrupt 2 //外部中断 1
197 {
198 1
199 1 count++; //中断每触发一次,变量加一
200 1
201 1 }
202
203
204
205
206
207
208
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1016 ----
CONSTANT SIZE = 22 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 25 ----
IDATA SIZE = ---- ----
BIT SIZE = 3 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)

BIN
IRIN.OBJ

Binary file not shown.

208
IRIN.c

@ -0,0 +1,208 @@ @@ -0,0 +1,208 @@
#include "IRIN.h"
#include "i2c.h"
uint journey;
uint journey1;
extern uchar pwm_left;
unsigned int b;
unsigned int c;
extern uint time1;
extern uchar pwm_val_left;
unsigned int b2;
unsigned int c2;
uint money=7;
uint sudu=0;
uint count=0; //栅格是一圈20个
uchar ms=0;
uint speed=0;
uint r_s=0;
bit state=0;
bit s0=0;
bit flas=0;
uchar sec=0;
uchar sec1=0;
/*******************************************************************************
* : delay
* : i=110us
*******************************************************************************/
void delay11(int i)
{
while(i--);
}
void IRIN_Init(void)
{
TMOD=0x01;//定时器1工作方式1
TH0=0x3C;
TL0=0xb0;
ET0=1;
TH1=0XFc;
TL1=0X18;
ET1=1;
TR1=1;
TR0=1;
EA=1;
EX1=1;
IT1=1;
}
void display()
{
if(state==0)
{
sudu=At24c02Read(10);
if(money>7)
{
money=At24c02Read(5);
}
LcdSetCursor(0,0);
LcdShowStr(0,0,"Speed:");
Lcd1602_Write_Data(0x30+sudu/100%10);
Lcd1602_Write_Data(0x30+sudu/10%10);
Lcd1602_Write_Data(0x30+sudu%10);
LcdShowStr(10,0,"KM/h");
LcdShowStr(0,1,"L:");
Lcd1602_Write_Data(journey/10000%10+0x30);
Lcd1602_Write_Data(journey/1000%10+0x30);
Lcd1602_Write_Data(journey/100%10+0x30);
Lcd1602_Write_Data(journey/10%10+0x30);
Lcd1602_Write_Data(journey%10+0x30);
LcdShowStr(7,1,"M");
if(journey>1000)
{
money=(journey-1000)*0.002+7;
At24c02Write(5,money);
}
money=money*10;
LcdShowStr(9,1,"Q:");
Lcd1602_Write_Data(money/1000%10+0x30);
Lcd1602_Write_Data(money/100%10+0x30);
Lcd1602_Write_Data(money/10%10+0x30);
LcdShowStr(14,1,".");
Lcd1602_Write_Data(money%10+0x30);
money=money/10;
}
}
void keypros()
{
if(k2==0)
{
delay11(1000); //消抖处理
if(k2==0)
{
sudu=At24c02Read(10); //读取EEPROM地址1内的数据
b2=At24c02Read(1);
c2=At24c02Read(8);
journey=(b2<<8) | c2;
money=At24c02Read(5);
}
while(!k2);
}
if(k1==0)
{
delay11(1000); //消抖处理
if(k1==0)
{
flas=1;
}
while(!k1);
}
if(k4==0)
{
delay11(1000); //消抖处理
if(k4==0)
{
if(pwm_left>=20)
{
pwm_left=1;
}
else
{
pwm_left++;
}
}
while(!k4);
}
}
void time0() interrupt 1 //定时器 0
{
TH0=0x3C;
TL0=0xb0; //50ms定时
ms++; //变量50ms加一
if(ms%5==0) s0=~s0;
if(ms%10==0) //500ms定时
{
if(sec!=0) sec--;
if(sec1!=0) sec1--;
ms=0; //清零变量
EX1=0; //关闭外部中断,保证变量在计算的时候不会增加
r_s=count; //因为是500ms检测一次转动数据,所以要想一秒转动的圈数是 speed=count*2 ,但是光栅是一圈20格,所以还要除以20;
//综合一下,一秒转动的圈数就是 speed=count*2/20 ==》 speed=counr/10;
count=0; //清零变量
EX1=1; //打开外部中断
speed=speed*0.5+(r_s*6)*0.5; // 这里r_s是一秒走的圈数,然后乘以60得到60秒走的圈数,单位变成了 r/min; 总方式 speed=count/10*60; ==>> speed=count*6;
if(flas==0)
{
sudu=(0.15*speed);
At24c02Write(10,sudu);
journey=journey+(r_s*2.5/20);
journey1=journey;
c = journey & 0x00FF;
At24c02Write(8,c);
delay11(1000);
b=journey1>>8;
At24c02Write(1,b);
}
else
{
journey=0;
money=7;
At24c02Write(1,journey);
At24c02Write(8,journey);
At24c02Write(5,money);
flas=0;
}
}
}
void int1() interrupt 2 //外部中断 1
{
count++; //中断每触发一次,变量加一
}

25
IRIN.h

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
#ifndef _IRIN_H
#define _IRIN_H
#include "reg51.h"
#include "lcd.h"
#include "pwm.h"
sbit k1=P3^5;
sbit k2=P3^4;
sbit k3=P3^3;
sbit k4=P3^2; //¶¨Òå°´¼ü¶Ë¿Ú
void IRIN_Init(void);
void display();
void keypros();
#endif

179
i2c.LST

@ -0,0 +1,179 @@ @@ -0,0 +1,179 @@
C51 COMPILER V9.56.0.0 I2C 04/06/2022 21:56:10 PAGE 1
C51 COMPILER V9.56.0.0, COMPILATION OF MODULE I2C
OBJECT MODULE PLACED IN i2c.OBJ
COMPILER INVOKED BY: D:\Keil_v5\C51\BIN\C51.EXE i2c.c OPTIMIZE(8,SPEED) BROWSE DEBUG OBJECTEXTEND TABS(2)
line level source
1 #include"i2c.h"
2
3 /*******************************************************************************
4 * 函数名 : Delay10us()
5 * 函数功能 : 延时10us
6 * 输入 : 无
7 * 输出 : 无
8 *******************************************************************************/
9
10 void Delay10us()
11 {
12 1 unsigned char a,b;
13 1 for(b=1;b>0;b--)
14 1 for(a=2;a>0;a--);
15 1
16 1 }
17 /*******************************************************************************
18 * 函数名 : I2cStart()
19 * 函数功能 : 起始信号:在SCL时钟信号在高电平期间SDA信号产生一个下降沿
20 * 输入 : 无
21 * 输出 : 无
22 * 备注 : 起始之后SDA和SCL都为0
23 *******************************************************************************/
24
25 void I2cStart()
26 {
27 1 SDA=1;
28 1 Delay10us();
29 1 SCL=1;
30 1 Delay10us();//建立时间是SDA保持时间>4.7us
31 1 SDA=0;
32 1 Delay10us();//保持时间是>4us
33 1 SCL=0;
34 1 Delay10us();
35 1 }
36 /*******************************************************************************
37 * 函数名 : I2cStop()
38 * 函数功能 : 终止信号:在SCL时钟信号高电平期间SDA信号产生一个上升沿
39 * 输入 : 无
40 * 输出 : 无
41 * 备注 : 结束之后保持SDA和SCL都为1;表示总线空闲
42 *******************************************************************************/
43
44 void I2cStop()
45 {
46 1 SDA=0;
47 1 Delay10us();
48 1 SCL=1;
49 1 Delay10us();//建立时间大于4.7us
50 1 SDA=1;
51 1 Delay10us();
52 1 }
53 /*******************************************************************************
54 * 函数名 : I2cSendByte(unsigned char dat)
55 * 函数功能 : 通过I2C发送一个字节。在SCL时钟信号高电平期间,保持发送信号SDA保持稳定
C51 COMPILER V9.56.0.0 I2C 04/06/2022 21:56:10 PAGE 2
56 * 输入 : num
57 * 输出 : 0或1。发送成功返回1,发送失败返回0
58 * 备注 : 发送完一个字节SCL=0,SDA=1
59 *******************************************************************************/
60
61 unsigned char I2cSendByte(unsigned char dat)
62 {
63 1 unsigned char a=0,b=0;//最大255,一个机器周期为1us,最大延时255us。
64 1 for(a=0;a<8;a++)//要发送8位,从最高位开始
65 1 {
66 2 SDA=dat>>7; //起始信号之后SCL=0,所以可以直接改变SDA信号
67 2 dat=dat<<1;
68 2 Delay10us();
69 2 SCL=1;
70 2 Delay10us();//建立时间>4.7us
71 2 SCL=0;
72 2 Delay10us();//时间大于4us
73 2 }
74 1 SDA=1;
75 1 Delay10us();
76 1 SCL=1;
77 1 while(SDA)//等待应答,也就是等待从设备把SDA拉低
78 1 {
79 2 b++;
80 2 if(b>200) //如果超过2000us没有应答发送失败,或者为非应答,表示接收结束
81 2 {
82 3 SCL=0;
83 3 Delay10us();
84 3 return 0;
85 3 }
86 2 }
87 1 SCL=0;
88 1 Delay10us();
89 1 return 1;
90 1 }
91 /*******************************************************************************
92 * 函数名 : I2cReadByte()
93 * 函数功能 : 使用I2c读取一个字节
94 * 输入 : 无
95 * 输出 : dat
96 * 备注 : 接收完一个字节SCL=0,SDA=1.
97 *******************************************************************************/
98
99 unsigned char I2cReadByte()
100 {
101 1 unsigned char a=0,dat=0;
102 1 SDA=1; //起始和发送一个字节之后SCL都是0
103 1 Delay10us();
104 1 for(a=0;a<8;a++)//接收8个字节
105 1 {
106 2 SCL=1;
107 2 Delay10us();
108 2 dat<<=1;
109 2 dat|=SDA;
110 2 Delay10us();
111 2 SCL=0;
112 2 Delay10us();
113 2 }
114 1 return dat;
115 1 }
116
117
C51 COMPILER V9.56.0.0 I2C 04/06/2022 21:56:10 PAGE 3
118 /*******************************************************************************
119 * 函数名 : void At24c02Write(unsigned char addr,unsigned char dat)
120 * 函数功能 : 往24c02的一个地址写入一个数据
121 * 输入 : 无
122 * 输出 : 无
123 *******************************************************************************/
124
125 void At24c02Write(unsigned char addr,unsigned char dat)
126 {
127 1 I2cStart();
128 1 I2cSendByte(0xa0);//发送写器件地址
129 1 I2cSendByte(addr);//发送要写入内存地址
130 1 I2cSendByte(dat); //发送数据
131 1 I2cStop();
132 1 }
133 /*******************************************************************************
134 * 函数名 : unsigned char At24c02Read(unsigned char addr)
135 * 函数功能 : 读取24c02的一个地址的一个数据
136 * 输入 : 无
137 * 输出 : 无
138 *******************************************************************************/
139
140 unsigned char At24c02Read(unsigned char addr)
141 {
142 1 unsigned char num;
143 1 I2cStart();
144 1 I2cSendByte(0xa0); //发送写器件地址
145 1 I2cSendByte(addr); //发送要读取的地址
146 1 I2cStart();
147 1 I2cSendByte(0xa1); //发送读器件地址
148 1 num=I2cReadByte(); //读取数据
149 1 I2cStop();
150 1 return num;
151 1 }
152
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 201 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)

BIN
i2c.OBJ

Binary file not shown.

152
i2c.c

@ -0,0 +1,152 @@ @@ -0,0 +1,152 @@
#include"i2c.h"
/*******************************************************************************
* : Delay10us()
* : 10us
* :
* :
*******************************************************************************/
void Delay10us()
{
unsigned char a,b;
for(b=1;b>0;b--)
for(a=2;a>0;a--);
}
/*******************************************************************************
* : I2cStart()
* : SCL时钟信号在高电平期间SDA信号产生一个下降沿
* :
* :
* : SDA和SCL都为0
*******************************************************************************/
void I2cStart()
{
SDA=1;
Delay10us();
SCL=1;
Delay10us();//建立时间是SDA保持时间>4.7us
SDA=0;
Delay10us();//保持时间是>4us
SCL=0;
Delay10us();
}
/*******************************************************************************
* : I2cStop()
* : SCL时钟信号高电平期间SDA信号产生一个上升沿
* :
* :
* : SDA和SCL都为1线
*******************************************************************************/
void I2cStop()
{
SDA=0;
Delay10us();
SCL=1;
Delay10us();//建立时间大于4.7us
SDA=1;
Delay10us();
}
/*******************************************************************************
* : I2cSendByte(unsigned char dat)
* : I2C发送一个字节SCL时钟信号高电平期间SDA保持稳定
* : num
* : 0110
* : SCL=0,SDA=1
*******************************************************************************/
unsigned char I2cSendByte(unsigned char dat)
{
unsigned char a=0,b=0;//最大255,一个机器周期为1us,最大延时255us。
for(a=0;a<8;a++)//要发送8位,从最高位开始
{
SDA=dat>>7; //起始信号之后SCL=0,所以可以直接改变SDA信号
dat=dat<<1;
Delay10us();
SCL=1;
Delay10us();//建立时间>4.7us
SCL=0;
Delay10us();//时间大于4us
}
SDA=1;
Delay10us();
SCL=1;
while(SDA)//等待应答,也就是等待从设备把SDA拉低
{
b++;
if(b>200) //如果超过2000us没有应答发送失败,或者为非应答,表示接收结束
{
SCL=0;
Delay10us();
return 0;
}
}
SCL=0;
Delay10us();
return 1;
}
/*******************************************************************************
* : I2cReadByte()
* : 使I2c读取一个字节
* :
* : dat
* : SCL=0,SDA=1.
*******************************************************************************/
unsigned char I2cReadByte()
{
unsigned char a=0,dat=0;
SDA=1; //起始和发送一个字节之后SCL都是0
Delay10us();
for(a=0;a<8;a++)//接收8个字节
{
SCL=1;
Delay10us();
dat<<=1;
dat|=SDA;
Delay10us();
SCL=0;
Delay10us();
}
return dat;
}
/*******************************************************************************
* : void At24c02Write(unsigned char addr,unsigned char dat)
* : 24c02的一个地址写入一个数据
* :
* :
*******************************************************************************/
void At24c02Write(unsigned char addr,unsigned char dat)
{
I2cStart();
I2cSendByte(0xa0);//发送写器件地址
I2cSendByte(addr);//发送要写入内存地址
I2cSendByte(dat); //发送数据
I2cStop();
}
/*******************************************************************************
* : unsigned char At24c02Read(unsigned char addr)
* : 24c02的一个地址的一个数据
* :
* :
*******************************************************************************/
unsigned char At24c02Read(unsigned char addr)
{
unsigned char num;
I2cStart();
I2cSendByte(0xa0); //发送写器件地址
I2cSendByte(addr); //发送要读取的地址
I2cStart();
I2cSendByte(0xa1); //发送读器件地址
num=I2cReadByte(); //读取数据
I2cStop();
return num;
}

16
i2c.h

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
#ifndef __I2C_H_
#define __I2C_H_
#include <reg51.h>
sbit SCL=P0^1;
sbit SDA=P0^0;
void I2cStart();
void I2cStop();
unsigned char I2cSendByte(unsigned char dat);
unsigned char I2cReadByte();
void At24c02Write(unsigned char addr,unsigned char dat);
unsigned char At24c02Read(unsigned char addr);
#endif

101
lcd.LST

@ -0,0 +1,101 @@ @@ -0,0 +1,101 @@
C51 COMPILER V9.56.0.0 LCD 04/06/2022 21:56:10 PAGE 1
C51 COMPILER V9.56.0.0, COMPILATION OF MODULE LCD
OBJECT MODULE PLACED IN lcd.OBJ
COMPILER INVOKED BY: D:\Keil_v5\C51\BIN\C51.EXE lcd.c OPTIMIZE(8,SPEED) BROWSE DEBUG OBJECTEXTEND TABS(2)
line level source
1 #include "lcd.h"
2
3
4 void Read_Busy() //忙检测函数,判断bit7是0,允许执行;1禁止
5 {
6 1 unsigned char sta; //
7 1 LCD1602_DB = 0xff;
8 1 LCD1602_RS = 0;
9 1 LCD1602_RW = 1;
10 1 do
11 1 {
12 2 LCD1602_EN = 1;
13 2 sta = LCD1602_DB;
14 2 LCD1602_EN = 0; //使能,用完就拉低,释放总线
15 2 }while(sta & 0x80);
16 1 }
17
18 void Lcd1602_Write_Cmd(unsigned char cmd) //写命令
19 {
20 1 Read_Busy();
21 1 LCD1602_RS = 0;
22 1 LCD1602_RW = 0;
23 1 LCD1602_DB = cmd;
24 1 LCD1602_EN = 1;
25 1 LCD1602_EN = 0;
26 1 }
27
28 void Lcd1602_Write_Data(unsigned char dat) //写数据
29 {
30 1 Read_Busy();
31 1 LCD1602_RS = 1;
32 1 LCD1602_RW = 0;
33 1 LCD1602_DB = dat;
34 1 LCD1602_EN = 1;
35 1 LCD1602_EN = 0;
36 1 }
37
38 void LcdSetCursor(unsigned char x,unsigned char y) //坐标显示
39 {
40 1 unsigned char addr;
41 1 if(y == 0)
42 1 addr = 0x00 + x;
43 1 else
44 1 addr = 0x40 + x;
45 1
46 1 Lcd1602_Write_Cmd(addr|0x80);
47 1 }
48
49 //按指定位置显示一个字符
50 void DisplayOneChar(unsigned char X, unsigned char Y, unsigned char DData)
51 {
52 1 Y &= 0x1;
53 1 X &= 0xF; //限制X不能大于15,Y不能大于1
54 1 if (Y) X |= 0x40; //当要显示第二行时地址码+0x40;
55 1 X |= 0x80; //算出指令码
C51 COMPILER V9.56.0.0 LCD 04/06/2022 21:56:10 PAGE 2
56 1 Lcd1602_Write_Cmd(X); //发命令字
57 1 Lcd1602_Write_Data(DData); //发数据
58 1 }
59
60
61 void LcdShowStr(unsigned char x,unsigned char y,unsigned char *str) //显示字符串
62 {
63 1 LcdSetCursor(x,y); //当前字符的坐标
64 1 while(*str != '\0')
65 1 {
66 2 Lcd1602_Write_Data(*str++);
67 2 }
68 1 }
69
70 void InitLcd1602() //1602初始化
71 {
72 1 Lcd1602_Write_Cmd(0x38); //打开,5*8,8位数据
73 1 Lcd1602_Write_Cmd(0x0c);
74 1 Lcd1602_Write_Cmd(0x06);
75 1 Lcd1602_Write_Cmd(0x01); //清屏
76 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 157 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 3
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)

BIN
lcd.OBJ

Binary file not shown.

76
lcd.c

@ -0,0 +1,76 @@ @@ -0,0 +1,76 @@
#include "lcd.h"
void Read_Busy() //忙检测函数,判断bit7是0,允许执行;1禁止
{
unsigned char sta; //
LCD1602_DB = 0xff;
LCD1602_RS = 0;
LCD1602_RW = 1;
do
{
LCD1602_EN = 1;
sta = LCD1602_DB;
LCD1602_EN = 0; //使能,用完就拉低,释放总线
}while(sta & 0x80);
}
void Lcd1602_Write_Cmd(unsigned char cmd) //写命令
{
Read_Busy();
LCD1602_RS = 0;
LCD1602_RW = 0;
LCD1602_DB = cmd;
LCD1602_EN = 1;
LCD1602_EN = 0;
}
void Lcd1602_Write_Data(unsigned char dat) //写数据
{
Read_Busy();
LCD1602_RS = 1;
LCD1602_RW = 0;
LCD1602_DB = dat;
LCD1602_EN = 1;
LCD1602_EN = 0;
}
void LcdSetCursor(unsigned char x,unsigned char y) //坐标显示
{
unsigned char addr;
if(y == 0)
addr = 0x00 + x;
else
addr = 0x40 + x;
Lcd1602_Write_Cmd(addr|0x80);
}
//按指定位置显示一个字符
void DisplayOneChar(unsigned char X, unsigned char Y, unsigned char DData)
{
Y &= 0x1;
X &= 0xF; //限制X不能大于15,Y不能大于1
if (Y) X |= 0x40; //当要显示第二行时地址码+0x40;
X |= 0x80; //算出指令码
Lcd1602_Write_Cmd(X); //发命令字
Lcd1602_Write_Data(DData); //发数据
}
void LcdShowStr(unsigned char x,unsigned char y,unsigned char *str) //显示字符串
{
LcdSetCursor(x,y); //当前字符的坐标
while(*str != '\0')
{
Lcd1602_Write_Data(*str++);
}
}
void InitLcd1602() //1602初始化
{
Lcd1602_Write_Cmd(0x38); //打开,5*8,8位数据
Lcd1602_Write_Cmd(0x0c);
Lcd1602_Write_Cmd(0x06);
Lcd1602_Write_Cmd(0x01); //清屏
}

53
lcd.h

@ -0,0 +1,53 @@ @@ -0,0 +1,53 @@
#ifndef __LCD_H_
#define __LCD_H_
/**********************************
使4
使8
**********************************/
//#define LCD1602_4PINS
/**********************************
**********************************/
#include <reg51.h>
//---重定义关键词---//
#ifndef uchar
#define uchar unsigned char
#endif
#ifndef uint
#define uint unsigned int
#endif
/**********************************
PIN口定义
**********************************/
//#define LCD1602_DB P0 //data bus 数据总线
//sbit LCD1602_RS = P2^6;
//sbit LCD1602_RW = P2^5;
//sbit LCD1602_EN = P2^7;
#define LCD1602_DB P2 //data bus 数据总线
sbit LCD1602_RS=P1^6;
sbit LCD1602_RW=P1^5;
sbit LCD1602_EN=P1^4;
/**********************************
**********************************/
/*在51单片机12MHZ时钟下的延时函数*/
void Lcd1602_Delay1ms(uint c); //误差 0us
void Read_Busy(); //忙检测函数,判断bit7是0,允许执行;1禁止
void Lcd1602_Write_Cmd(unsigned char cmd); //写命令
void Lcd1602_Write_Data(unsigned char dat); //写数据
void LcdSetCursor(unsigned char x,unsigned char y); //坐标显示
void LcdShowStr(unsigned char x,unsigned char y,unsigned char *str); //显示字符串
void InitLcd1602(); //1602初始化
void DisplayOneChar(unsigned char X, unsigned char Y, unsigned char DData);
#endif

78
main.LST

@ -0,0 +1,78 @@ @@ -0,0 +1,78 @@
C51 COMPILER V9.56.0.0 MAIN 04/06/2022 21:56:09 PAGE 1
C51 COMPILER V9.56.0.0, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: D:\Keil_v5\C51\BIN\C51.EXE main.c OPTIMIZE(8,SPEED) BROWSE DEBUG OBJECTEXTEND TABS(2)
line level source
1 #include <reg51.h>
2 #include <intrins.h>
3 #include "lcd.h"
4 #include "pwm.h"
5 #include "i2c.h"
6 #include "IRIN.h"
7
8 unsigned char PuZh[]=" Pechin Science ";
9 extern uint journey;
10 extern uint money;
11 extern uchar sudu;
12 unsigned int b12;
13 unsigned int c12;
14
15
16
17 unsigned int b123;
18 unsigned int c123;
19 extern unsigned char pwm_left;
20 unsigned char code ASCII[15] = {'0','1','2','3','4','5','6','7','8','9','.','-','M'};
21
22 void delayms(unsigned int ms)
23 {
24 1 unsigned char i=100,j;
25 1 for(;ms;ms--)
26 1 {
27 2 while(--i)
28 2 {
29 3 j=10;
30 3 while(--j);
31 3 }
32 2 }
33 1 }
34
35 void main(void)
36 {
37 1
38 1 InitLcd1602();
39 1 IRIN_Init();
40 1 pwm_left=10;
41 1 b12=At24c02Read(1);
42 1 c12=At24c02Read(8);
43 1
44 1 money=At24c02Read(5);
45 1 journey = (b12<<8)|c12;
46 1 while(1)
47 1 {
48 2 run();
49 2 display();
50 2 keypros();
51 2 }
52 1
53 1 }
C51 COMPILER V9.56.0.0 MAIN 04/06/2022 21:56:09 PAGE 2
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 86 ----
CONSTANT SIZE = 15 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 25 ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)

BIN
main.OBJ

Binary file not shown.

53
main.c

@ -0,0 +1,53 @@ @@ -0,0 +1,53 @@
#include <reg51.h>
#include <intrins.h>
#include "lcd.h"
#include "pwm.h"
#include "i2c.h"
#include "IRIN.h"
unsigned char PuZh[]=" Pechin Science ";
extern uint journey;
extern uint money;
extern uchar sudu;
unsigned int b12;
unsigned int c12;
unsigned int b123;
unsigned int c123;
extern unsigned char pwm_left;
unsigned char code ASCII[15] = {'0','1','2','3','4','5','6','7','8','9','.','-','M'};
void delayms(unsigned int ms)
{
unsigned char i=100,j;
for(;ms;ms--)
{
while(--i)
{
j=10;
while(--j);
}
}
}
void main(void)
{
InitLcd1602();
IRIN_Init();
pwm_left=10;
b12=At24c02Read(1);
c12=At24c02Read(8);
money=At24c02Read(5);
journey = (b12<<8)|c12;
while(1)
{
run();
display();
keypros();
}
}

BIN
pro

Binary file not shown.

880
pro.M51

@ -0,0 +1,880 @@ @@ -0,0 +1,880 @@
BL51 BANKED LINKER/LOCATER V6.22 04/06/2022 21:56:11 PAGE 1
BL51 BANKED LINKER/LOCATER V6.22, INVOKED BY:
D:\KEIL_V5\C51\BIN\BL51.EXE main.obj, lcd.obj, pwm.obj, i2c.obj, IRIN.obj TO pro DISABLEWARNING (15, 16)
MEMORY MODEL: SMALL WITH FLOATING POINT ARITHMETIC
INPUT MODULES INCLUDED:
main.obj (MAIN)
lcd.obj (LCD)
pwm.obj (PWM)
i2c.obj (I2C)
IRIN.obj (IRIN)
D:\KEIL_V5\C51\LIB\C51FPS.LIB (?C?FPADD)
D:\KEIL_V5\C51\LIB\C51FPS.LIB (?C?FPMUL)
D:\KEIL_V5\C51\LIB\C51FPS.LIB (?C?FPDIV)
D:\KEIL_V5\C51\LIB\C51FPS.LIB (?C?FCAST)
D:\KEIL_V5\C51\LIB\C51FPS.LIB (?C?CASTF)
D:\KEIL_V5\C51\LIB\C51FPS.LIB (?C?FPGETOPN)
D:\KEIL_V5\C51\LIB\C51S.LIB (?C_STARTUP)
D:\KEIL_V5\C51\LIB\C51S.LIB (?C?CLDPTR)
D:\KEIL_V5\C51\LIB\C51S.LIB (?C?IMUL)
D:\KEIL_V5\C51\LIB\C51S.LIB (?C?UIDIV)
D:\KEIL_V5\C51\LIB\C51S.LIB (?C?LNEG)
D:\KEIL_V5\C51\LIB\C51S.LIB (?C_INIT)
LINK MAP OF MODULE: pro (MAIN)
TYPE BASE LENGTH RELOCATION SEGMENT NAME
-----------------------------------------------------
* * * * * * * D A T A M E M O R Y * * * * * * *
REG 0000H 0008H ABSOLUTE "REG BANK 0"
DATA 0008H 0007H UNIT ?DT?PWM
DATA 000FH 0003H UNIT _DATA_GROUP_
0012H 000EH *** GAP ***
BIT 0020H.0 0000H.3 UNIT ?BI?IRIN
BIT 0020H.3 0000H.2 UNIT ?BI?PWM
0020H.5 0000H.3 *** GAP ***
DATA 0021H 0019H UNIT ?DT?MAIN
DATA 003AH 0019H UNIT ?DT?IRIN
IDATA 0053H 0001H UNIT ?STACK
* * * * * * * C O D E M E M O R Y * * * * * * *
CODE 0000H 0003H ABSOLUTE
0003H 0008H *** GAP ***
CODE 000BH 0003H ABSOLUTE
000EH 0005H *** GAP ***
CODE 0013H 0003H ABSOLUTE
0016H 0005H *** GAP ***
CODE 001BH 0003H ABSOLUTE
CODE 001EH 03EBH UNIT ?C?LIB_CODE
CODE 0409H 01EAH UNIT ?PR?DISPLAY?IRIN
CODE 05F3H 016DH UNIT ?PR?TIME0?IRIN
CODE 0760H 008CH UNIT ?C_C51STARTUP
CODE 07ECH 0067H UNIT ?PR?KEYPROS?IRIN
BL51 BANKED LINKER/LOCATER V6.22 04/06/2022 21:56:11 PAGE 2
CODE 0853H 004EH UNIT ?C_INITSEG
CODE 08A1H 0041H UNIT ?PR?_I2CSENDBYTE?I2C
CODE 08E2H 003CH UNIT ?PR?MAIN?MAIN
CODE 091EH 0028H UNIT ?PR?_LCDSHOWSTR?LCD
CODE 0946H 0026H UNIT ?PR?I2CREADBYTE?I2C
CODE 096CH 0022H UNIT ?PR?_AT24C02READ?I2C
CODE 098EH 0020H UNIT ?PR?_DELAY?PWM
CODE 09AEH 001EH UNIT ?PR?PWM_OUT_LEFT_MOTO?PWM
CODE 09CCH 001EH UNIT ?PR?PWM_OUT_RIGHT_MOTO?PWM
CODE 09EAH 001EH UNIT ?PR?IRIN_INIT?IRIN
CODE 0A08H 001DH UNIT ?PR?_DISPLAYONECHAR?LCD
CODE 0A25H 001CH UNIT ?PR?TIMER1?PWM
CODE 0A41H 001AH UNIT ?PR?_DELAYMS?MAIN
CODE 0A5BH 0019H UNIT ?PR?_AT24C02WRITE?I2C
CODE 0A74H 0016H UNIT ?CO?IRIN
CODE 0A8AH 0014H UNIT ?PR?INITLCD1602?LCD
CODE 0A9EH 0012H UNIT ?PR?READ_BUSY?LCD
CODE 0AB0H 0012H UNIT ?PR?_LCDSETCURSOR?LCD
CODE 0AC2H 0010H UNIT ?PR?_LCD1602_WRITE_CMD?LCD
CODE 0AD2H 0010H UNIT ?PR?_LCD1602_WRITE_DATA?LCD
CODE 0AE2H 000FH UNIT ?CO?MAIN
CODE 0AF1H 000FH UNIT ?PR?RUN?PWM
CODE 0B00H 000FH UNIT ?PR?BACKRUN?PWM
CODE 0B0FH 000FH UNIT ?PR?I2CSTART?I2C
CODE 0B1EH 000FH UNIT ?PR?_DELAY11?IRIN
CODE 0B2DH 000EH UNIT ?PR?DELAY10US?I2C
CODE 0B3BH 000DH UNIT ?PR?INT1?IRIN
CODE 0B48H 000BH UNIT ?PR?LEFTRUN?PWM
CODE 0B53H 000BH UNIT ?PR?RIGHTRUN?PWM
CODE 0B5EH 000AH UNIT ?PR?I2CSTOP?I2C
OVERLAY MAP OF MODULE: pro (MAIN)
SEGMENT DATA_GROUP
+--> CALLED SEGMENT START LENGTH
---------------------------------------------------
?PR?TIMER1?PWM ----- -----
+--> ?PR?PWM_OUT_RIGHT_MOTO?PWM
*** NEW ROOT ***************************************************
?PR?TIME0?IRIN ----- -----
+--> ?PR?_AT24C02WRITE?I2C
+--> ?PR?_DELAY11?IRIN
?PR?_AT24C02WRITE?I2C ----- -----
+--> ?PR?I2CSTART?I2C
+--> ?PR?_I2CSENDBYTE?I2C
+--> ?PR?I2CSTOP?I2C
?PR?I2CSTART?I2C ----- -----
+--> ?PR?DELAY10US?I2C
?PR?_I2CSENDBYTE?I2C ----- -----
BL51 BANKED LINKER/LOCATER V6.22 04/06/2022 21:56:11 PAGE 3
+--> ?PR?DELAY10US?I2C
?PR?I2CSTOP?I2C ----- -----
+--> ?PR?DELAY10US?I2C
*** NEW ROOT ***************************************************
?C_C51STARTUP ----- -----
+--> ?PR?MAIN?MAIN
+--> ?C_INITSEG
?PR?MAIN?MAIN ----- -----
+--> ?PR?INITLCD1602?LCD
+--> ?PR?IRIN_INIT?IRIN
+--> ?PR?_AT24C02READ?I2C
+--> ?PR?RUN?PWM
+--> ?PR?DISPLAY?IRIN
+--> ?PR?KEYPROS?IRIN
?PR?INITLCD1602?LCD ----- -----
+--> ?PR?_LCD1602_WRITE_CMD?LCD
?PR?_LCD1602_WRITE_CMD?LCD ----- -----
+--> ?PR?READ_BUSY?LCD
?PR?_AT24C02READ?I2C ----- -----
+--> ?PR?I2CSTART?I2C
+--> ?PR?_I2CSENDBYTE?I2C
+--> ?PR?I2CREADBYTE?I2C
+--> ?PR?I2CSTOP?I2C
?PR?I2CREADBYTE?I2C ----- -----
+--> ?PR?DELAY10US?I2C
?PR?DISPLAY?IRIN ----- -----
+--> ?PR?_AT24C02READ?I2C
+--> ?PR?_LCDSETCURSOR?LCD
+--> ?CO?IRIN
+--> ?PR?_LCDSHOWSTR?LCD
+--> ?PR?_LCD1602_WRITE_DATA?LCD
+--> ?PR?_AT24C02WRITE?I2C
?PR?_LCDSETCURSOR?LCD ----- -----
+--> ?PR?_LCD1602_WRITE_CMD?LCD
?PR?_LCDSHOWSTR?LCD 000FH 0003H
+--> ?PR?_LCDSETCURSOR?LCD
+--> ?PR?_LCD1602_WRITE_DATA?LCD
?PR?_LCD1602_WRITE_DATA?LCD ----- -----
+--> ?PR?READ_BUSY?LCD
?PR?KEYPROS?IRIN ----- -----
+--> ?PR?_DELAY11?IRIN
+--> ?PR?_AT24C02READ?I2C
BL51 BANKED LINKER/LOCATER V6.22 04/06/2022 21:56:11 PAGE 4
SYMBOL TABLE OF MODULE: pro (MAIN)
VALUE TYPE NAME
----------------------------------
------- MODULE MAIN
C:0000H SYMBOL _ICE_DUMMY_
D:0080H PUBLIC P0
D:0090H PUBLIC P1
D:00B0H PUBLIC P3
D:0021H PUBLIC PuZh
C:08E2H PUBLIC main
D:0032H PUBLIC b12
D:0034H PUBLIC c12
C:0AE2H PUBLIC ASCII
C:0A41H PUBLIC _delayms
D:0036H PUBLIC b123
D:0038H PUBLIC c123
------- PROC _DELAYMS
D:0006H SYMBOL ms
------- DO
D:0004H SYMBOL i
D:0005H SYMBOL j
------- ENDDO
C:0A41H LINE# 22
C:0A41H LINE# 23
C:0A41H LINE# 24
C:0A43H LINE# 25
C:0A47H LINE# 26
C:0A47H LINE# 27
C:0A4BH LINE# 28
C:0A4BH LINE# 29
C:0A4DH LINE# 30
C:0A53H LINE# 32
C:0A5AH LINE# 33
------- ENDPROC _DELAYMS
------- PROC MAIN
C:08E2H LINE# 35
C:08E2H LINE# 36
C:08E2H LINE# 38
C:08E5H LINE# 39
C:08E8H LINE# 40
C:08EBH LINE# 41
C:08F5H LINE# 42
C:08FFH LINE# 44
C:0909H LINE# 45
C:0913H LINE# 46
C:0913H LINE# 47
C:0913H LINE# 48
C:0916H LINE# 49
C:0919H LINE# 50
C:091CH LINE# 51
------- ENDPROC MAIN
------- ENDMOD MAIN
------- MODULE LCD
BL51 BANKED LINKER/LOCATER V6.22 04/06/2022 21:56:11 PAGE 5
C:0000H SYMBOL _ICE_DUMMY_
C:0A08H PUBLIC _DisplayOneChar
D:0090H PUBLIC P1
D:00A0H PUBLIC P2
C:0A9EH PUBLIC Read_Busy
B:0090H.4 PUBLIC LCD1602_EN
B:0090H.6 PUBLIC LCD1602_RS
B:0090H.5 PUBLIC LCD1602_RW
C:0AD2H PUBLIC _Lcd1602_Write_Data
C:0AC2H PUBLIC _Lcd1602_Write_Cmd
C:0AB0H PUBLIC _LcdSetCursor
C:091EH PUBLIC _LcdShowStr
C:0A8AH PUBLIC InitLcd1602
------- PROC READ_BUSY
------- DO
D:0007H SYMBOL sta
------- ENDDO
C:0A9EH LINE# 4
C:0A9EH LINE# 5
C:0A9EH LINE# 7
C:0AA1H LINE# 8
C:0AA3H LINE# 9
C:0AA5H LINE# 11
C:0AA5H LINE# 12
C:0AA7H LINE# 13
C:0AA9H LINE# 14
C:0AABH LINE# 15
C:0AAFH LINE# 16
------- ENDPROC READ_BUSY
------- PROC _LCD1602_WRITE_CMD
D:0006H SYMBOL cmd
C:0AC2H LINE# 18
C:0AC4H LINE# 19
C:0AC4H LINE# 20
C:0AC7H LINE# 21
C:0AC9H LINE# 22
C:0ACBH LINE# 23
C:0ACDH LINE# 24
C:0ACFH LINE# 25
C:0AD1H LINE# 26
------- ENDPROC _LCD1602_WRITE_CMD
------- PROC _LCD1602_WRITE_DATA
D:0006H SYMBOL dat
C:0AD2H LINE# 28
C:0AD4H LINE# 29
C:0AD4H LINE# 30
C:0AD7H LINE# 31
C:0AD9H LINE# 32
C:0ADBH LINE# 33
C:0ADDH LINE# 34
C:0ADFH LINE# 35
C:0AE1H LINE# 36
------- ENDPROC _LCD1602_WRITE_DATA
------- PROC _LCDSETCURSOR
D:0007H SYMBOL x
D:0005H SYMBOL y
------- DO
BL51 BANKED LINKER/LOCATER V6.22 04/06/2022 21:56:11 PAGE 6
D:0004H SYMBOL addr
------- ENDDO
C:0AB0H LINE# 38
C:0AB0H LINE# 39
C:0AB0H LINE# 41
C:0AB3H LINE# 42
C:0AB7H LINE# 44
C:0ABBH LINE# 46
------- ENDPROC _LCDSETCURSOR
------- PROC _DISPLAYONECHAR
D:0006H SYMBOL X
D:0005H SYMBOL Y
D:0004H SYMBOL DData
C:0A08H LINE# 50
C:0A0CH LINE# 51
C:0A0CH LINE# 52
C:0A0FH LINE# 53
C:0A12H LINE# 54
C:0A18H LINE# 55
C:0A1BH LINE# 56
C:0A20H LINE# 57
------- ENDPROC _DISPLAYONECHAR
------- PROC _LCDSHOWSTR
D:0007H SYMBOL x
D:0005H SYMBOL y
D:000FH SYMBOL str
C:091EH LINE# 61
C:0924H LINE# 62
C:0924H LINE# 63
C:0927H LINE# 64
C:0932H LINE# 65
C:0932H LINE# 66
C:0943H LINE# 67
C:0945H LINE# 68
------- ENDPROC _LCDSHOWSTR
------- PROC INITLCD1602
C:0A8AH LINE# 70
C:0A8AH LINE# 71
C:0A8AH LINE# 72
C:0A8FH LINE# 73
C:0A94H LINE# 74
C:0A99H LINE# 75
------- ENDPROC INITLCD1602
------- ENDMOD LCD
------- MODULE PWM
C:0000H SYMBOL _ICE_DUMMY_
D:0080H PUBLIC P0
D:0090H PUBLIC P1
D:00B0H PUBLIC P3
C:0B48H PUBLIC leftrun
D:0008H PUBLIC pwm_val_left
C:098EH PUBLIC _delay
C:09CCH PUBLIC pwm_out_right_moto
C:09AEH PUBLIC pwm_out_left_moto
B:0080H.4 PUBLIC IN1
B:0080H.5 PUBLIC IN2
BL51 BANKED LINKER/LOCATER V6.22 04/06/2022 21:56:11 PAGE 7
B:0080H.6 PUBLIC IN3
B:0080H.7 PUBLIC IN4
B:0020H.3 PUBLIC Right_moto_stop
D:008DH PUBLIC TH1
D:008BH PUBLIC TL1
C:0A25H PUBLIC timer1
C:0AF1H PUBLIC run
B:0020H.4 PUBLIC Left_moto_stop
B:00B0H.4 PUBLIC Right_moto_pwm
D:0009H PUBLIC time1
D:000BH PUBLIC pwm_left
B:00B0H.5 PUBLIC Left_moto_pwm
D:000CH PUBLIC push_val_right
C:0B00H PUBLIC backrun
D:000DH PUBLIC push_val_left
C:0B53H PUBLIC rightrun
D:000EH PUBLIC pwm_val_right
------- PROC _DELAY
D:0006H SYMBOL k
------- DO
D:0004H SYMBOL x
D:0002H SYMBOL y
------- ENDDO
C:098EH LINE# 18
C:098EH LINE# 19
C:098EH LINE# 21
C:0998H LINE# 22
C:09ADH LINE# 23
------- ENDPROC _DELAY
------- PROC RUN
C:0AF1H LINE# 26
C:0AF1H LINE# 27
C:0AF1H LINE# 28
C:0AF4H LINE# 29
C:0AF7H LINE# 30
C:0AFBH LINE# 31
C:0AFFH LINE# 32
------- ENDPROC RUN
------- PROC BACKRUN
C:0B00H LINE# 34
C:0B00H LINE# 35
C:0B00H LINE# 36
C:0B03H LINE# 37
C:0B06H LINE# 38
C:0B0AH LINE# 39
C:0B0EH LINE# 40
------- ENDPROC BACKRUN
------- PROC LEFTRUN
C:0B48H LINE# 44
C:0B48H LINE# 45
C:0B48H LINE# 46
C:0B4BH LINE# 47
C:0B4EH LINE# 48
C:0B52H LINE# 49
------- ENDPROC LEFTRUN
------- PROC RIGHTRUN
C:0B53H LINE# 53
BL51 BANKED LINKER/LOCATER V6.22 04/06/2022 21:56:11 PAGE 8
C:0B53H LINE# 54
C:0B53H LINE# 55
C:0B56H LINE# 56
C:0B59H LINE# 57
C:0B5DH LINE# 58
------- ENDPROC RIGHTRUN
------- PROC PWM_OUT_LEFT_MOTO
C:09AEH LINE# 61
C:09AEH LINE# 62
C:09AEH LINE# 63
C:09B1H LINE# 64
C:09B1H LINE# 65
C:09B8H LINE# 66
C:09B8H LINE# 67
C:09BAH LINE# 68
C:09BCH LINE# 70
C:09BCH LINE# 71
C:09BEH LINE# 72
C:09BEH LINE# 73
C:09C5H LINE# 74
C:09C8H LINE# 75
C:09C9H LINE# 77
C:09C9H LINE# 78
C:09CBH LINE# 79
C:09CBH LINE# 80
------- ENDPROC PWM_OUT_LEFT_MOTO
------- PROC PWM_OUT_RIGHT_MOTO
C:09CCH LINE# 83
C:09CCH LINE# 84
C:09CCH LINE# 85
C:09CFH LINE# 86
C:09CFH LINE# 87
C:09D6H LINE# 88
C:09D6H LINE# 89
C:09D8H LINE# 90
C:09DAH LINE# 92
C:09DAH LINE# 93
C:09DCH LINE# 94
C:09DCH LINE# 95
C:09E3H LINE# 96
C:09E6H LINE# 97
C:09E7H LINE# 99
C:09E7H LINE# 100
C:09E9H LINE# 101
C:09E9H LINE# 102
------- ENDPROC PWM_OUT_RIGHT_MOTO
------- PROC TIMER1
C:0A25H LINE# 104
C:0A29H LINE# 106
C:0A2CH LINE# 107
C:0A2FH LINE# 108
C:0A37H LINE# 110
C:0A39H LINE# 112
C:0A3CH LINE# 113
------- ENDPROC TIMER1
------- ENDMOD PWM
BL51 BANKED LINKER/LOCATER V6.22 04/06/2022 21:56:11 PAGE 9
------- MODULE I2C
C:0000H SYMBOL _ICE_DUMMY_
D:0080H PUBLIC P0
C:08A1H PUBLIC _I2cSendByte
C:0B5EH PUBLIC I2cStop
C:0B32H PUBLIC Delay10us
B:0080H.0 PUBLIC SDA
C:096CH PUBLIC _At24c02Read
B:0080H.1 PUBLIC SCL
C:0B0FH PUBLIC I2cStart
C:0A5BH PUBLIC _At24c02Write
C:0946H PUBLIC I2cReadByte
C:0B2DH SYMBOL L?0024
------- PROC L?0023
------- ENDPROC L?0023
C:0B2DH SYMBOL L?0024
------- PROC DELAY10US
------- DO
D:0006H SYMBOL a
D:0007H SYMBOL b
------- ENDDO
C:0B32H LINE# 10
C:0B32H LINE# 11
C:0B32H LINE# 13
C:0B34H LINE# 14
C:0B3AH LINE# 16
------- ENDPROC DELAY10US
------- PROC I2CSTART
C:0B0FH LINE# 25
C:0B0FH LINE# 26
C:0B0FH LINE# 27
C:0B11H LINE# 28
C:0B11H LINE# 29
C:0B11H LINE# 30
C:0B14H LINE# 31
C:0B16H LINE# 32
C:0B19H LINE# 33
C:0B1BH LINE# 34
------- ENDPROC I2CSTART
------- PROC I2CSTOP
C:0B5EH LINE# 44
C:0B5EH LINE# 45
C:0B5EH LINE# 46
C:0B60H LINE# 47
C:0B60H LINE# 48
C:0B60H LINE# 49
C:0B63H LINE# 50
C:0B65H LINE# 51
------- ENDPROC I2CSTOP
------- PROC _I2CSENDBYTE
D:0005H SYMBOL dat
------- DO
D:0003H SYMBOL a
D:0002H SYMBOL b
------- ENDDO
C:08A1H LINE# 61
C:08A3H LINE# 62
BL51 BANKED LINKER/LOCATER V6.22 04/06/2022 21:56:11 PAGE 10
C:08A3H LINE# 63
C:08A6H LINE# 64
C:08A6H LINE# 65
C:08A6H LINE# 66
C:08B1H LINE# 67
C:08B5H LINE# 68
C:08B5H LINE# 69
C:08B5H LINE# 70
C:08B8H LINE# 71
C:08BAH LINE# 72
C:08BDH LINE# 73
C:08C1H LINE# 74
C:08C3H LINE# 75
C:08C6H LINE# 76
C:08C8H LINE# 77
C:08CBH LINE# 78
C:08CBH LINE# 79
C:08CCH LINE# 80
C:08D2H LINE# 81
C:08D2H LINE# 82
C:08D4H LINE# 83
C:08D7H LINE# 84
C:08DAH LINE# 85
C:08DAH LINE# 86
C:08DAH LINE# 87
C:08DCH LINE# 88
C:08DFH LINE# 89
C:08E1H LINE# 90
------- ENDPROC _I2CSENDBYTE
------- PROC I2CREADBYTE
------- DO
D:0005H SYMBOL a
D:0004H SYMBOL dat
------- ENDDO
C:0946H LINE# 99
C:0946H LINE# 100
C:0946H LINE# 101
C:0949H LINE# 102
C:094BH LINE# 103
C:094EH LINE# 104
C:094EH LINE# 105
C:094EH LINE# 106
C:0950H LINE# 107
C:0953H LINE# 108
C:0957H LINE# 109
C:095DH LINE# 110
C:0960H LINE# 111
C:0962H LINE# 112
C:0965H LINE# 113
C:0969H LINE# 114
C:096BH LINE# 115
------- ENDPROC I2CREADBYTE
------- PROC _AT24C02WRITE
D:0001H SYMBOL addr
D:0004H SYMBOL dat
C:0A5BH LINE# 125
C:0A5FH LINE# 126
BL51 BANKED LINKER/LOCATER V6.22 04/06/2022 21:56:11 PAGE 11
C:0A5FH LINE# 127
C:0A62H LINE# 128
C:0A67H LINE# 129
C:0A6CH LINE# 130
C:0A71H LINE# 131
------- ENDPROC _AT24C02WRITE
------- PROC _AT24C02READ
D:0004H SYMBOL addr
------- DO
D:0005H SYMBOL num
------- ENDDO
C:096CH LINE# 140
C:096EH LINE# 141
C:096EH LINE# 143
C:0971H LINE# 144
C:0976H LINE# 145
C:097BH LINE# 146
C:097EH LINE# 147
C:0983H LINE# 148
C:0988H LINE# 149
C:098BH LINE# 150
C:098DH LINE# 151
------- ENDPROC _AT24C02READ
------- ENDMOD I2C
------- MODULE IRIN
C:0000H SYMBOL _ICE_DUMMY_
D:0080H PUBLIC P0
D:0090H PUBLIC P1
D:00B0H PUBLIC P3
B:00A8H.7 PUBLIC EA
D:003AH PUBLIC journey
C:07ECH PUBLIC keypros
D:003CH PUBLIC speed
D:003EH PUBLIC b2
D:0040H PUBLIC c2
B:00B0H.5 PUBLIC k1
B:00B0H.4 PUBLIC k2
B:00B0H.2 PUBLIC k4
B:0020H.0 PUBLIC s0
B:0020H.1 PUBLIC state
B:0020H.2 PUBLIC flas
C:09EAH PUBLIC IRIN_Init
D:0042H PUBLIC money
D:0044H PUBLIC count
D:0089H PUBLIC TMOD
D:0046H PUBLIC sec
D:0047H PUBLIC journey1
D:0049H PUBLIC sudu
D:004BH PUBLIC r_s
B:00A8H.1 PUBLIC ET0
B:00A8H.3 PUBLIC ET1
D:008CH PUBLIC TH0
D:008DH PUBLIC TH1
B:00A8H.2 PUBLIC EX1
B:0088H.2 PUBLIC IT1
D:008AH PUBLIC TL0
BL51 BANKED LINKER/LOCATER V6.22 04/06/2022 21:56:11 PAGE 12
D:008BH PUBLIC TL1
B:0088H.4 PUBLIC TR0
B:0088H.6 PUBLIC TR1
D:004DH PUBLIC ms
C:05F3H PUBLIC time0
D:004EH PUBLIC b
D:0050H PUBLIC c
D:0052H PUBLIC sec1
C:0B22H PUBLIC _delay11
C:0409H PUBLIC display
C:0B3BH PUBLIC int1
C:0B1EH SYMBOL L?0035
------- PROC L?0034
------- ENDPROC L?0034
C:0B1EH SYMBOL L?0035
------- PROC _DELAY11
D:0006H SYMBOL i
C:0B22H LINE# 34
C:0B22H LINE# 35
C:0B22H LINE# 36
C:0B2CH LINE# 37
------- ENDPROC _DELAY11
------- PROC IRIN_INIT
C:09EAH LINE# 39
C:09EAH LINE# 40
C:09EAH LINE# 41
C:09EDH LINE# 42
C:09F0H LINE# 43
C:09F3H LINE# 44
C:09F5H LINE# 45
C:09F8H LINE# 46
C:09FBH LINE# 47
C:09FDH LINE# 48
C:09FFH LINE# 49
C:0A01H LINE# 50
C:0A03H LINE# 51
C:0A05H LINE# 52
C:0A07H LINE# 54
------- ENDPROC IRIN_INIT
------- PROC DISPLAY
C:0409H LINE# 56
C:0409H LINE# 57
C:0409H LINE# 58
C:040FH LINE# 59
C:040FH LINE# 60
C:0419H LINE# 61
C:0424H LINE# 62
C:0424H LINE# 63
C:042EH LINE# 64
C:042EH LINE# 65
C:0434H LINE# 66
C:0440H LINE# 67
C:0459H LINE# 68
C:0472H LINE# 69
C:0484H LINE# 70
C:0491H LINE# 72
C:049EH LINE# 73
BL51 BANKED LINKER/LOCATER V6.22 04/06/2022 21:56:11 PAGE 13
C:04B7H LINE# 74
C:04D0H LINE# 75
C:04E9H LINE# 76
C:0502H LINE# 77
C:0514H LINE# 78
C:0521H LINE# 80
C:052CH LINE# 81
C:052CH LINE# 82
C:0556H LINE# 83
C:055DH LINE# 84
C:055DH LINE# 85
C:056CH LINE# 86
C:0579H LINE# 87
C:0592H LINE# 88
C:05ABH LINE# 89
C:05C4H LINE# 90
C:05D1H LINE# 91
C:05E3H LINE# 93
C:05F2H LINE# 96
C:05F2H LINE# 97
------- ENDPROC DISPLAY
------- PROC KEYPROS
C:07ECH LINE# 101
C:07ECH LINE# 102
C:07ECH LINE# 103
C:07EFH LINE# 104
C:07EFH LINE# 105
C:07F2H LINE# 106
C:07F5H LINE# 107
C:07F5H LINE# 108
C:07FFH LINE# 110
C:0809H LINE# 111
C:0813H LINE# 112
C:081DH LINE# 114
C:0827H LINE# 116
C:0827H LINE# 117
C:082AH LINE# 118
C:082AH LINE# 120
C:082DH LINE# 121
C:082DH LINE# 122
C:0830H LINE# 123
C:0833H LINE# 124
C:0833H LINE# 125
C:0835H LINE# 127
C:0835H LINE# 128
C:0838H LINE# 129
C:0838H LINE# 130
C:083BH LINE# 131
C:083BH LINE# 132
C:083EH LINE# 133
C:0841H LINE# 134
C:0841H LINE# 135
C:0848H LINE# 136
C:0848H LINE# 137
C:084BH LINE# 138
C:084DH LINE# 140
C:084DH LINE# 141
BL51 BANKED LINKER/LOCATER V6.22 04/06/2022 21:56:11 PAGE 14
C:084FH LINE# 142
C:084FH LINE# 143
C:084FH LINE# 144
C:0852H LINE# 145
C:0852H LINE# 147
------- ENDPROC KEYPROS
------- PROC TIME0
C:05F3H LINE# 149
C:0610H LINE# 151
C:0613H LINE# 152
C:0616H LINE# 153
C:0618H LINE# 154
C:0624H LINE# 157
C:0631H LINE# 158
C:0631H LINE# 160
C:0637H LINE# 161
C:063DH LINE# 162
C:0640H LINE# 163
C:0642H LINE# 164
C:0648H LINE# 166
C:064EH LINE# 167
C:0650H LINE# 168
C:0697H LINE# 170
C:069DH LINE# 171
C:069DH LINE# 172
C:06B7H LINE# 173
C:06BEH LINE# 175
C:06FCH LINE# 176
C:0702H LINE# 177
C:0708H LINE# 178
C:070FH LINE# 180
C:0712H LINE# 181
C:0719H LINE# 182
C:0720H LINE# 183
C:0722H LINE# 185
C:0722H LINE# 186
C:0728H LINE# 187
C:072EH LINE# 188
C:0735H LINE# 189
C:073CH LINE# 190
C:0743H LINE# 191
C:0745H LINE# 192
C:0745H LINE# 193
C:0745H LINE# 194
------- ENDPROC TIME0
------- PROC INT1
C:0B3BH LINE# 196
C:0B3DH LINE# 199
C:0B45H LINE# 201
------- ENDPROC INT1
------- ENDMOD IRIN
------- MODULE ?C?FPADD
C:0025H PUBLIC ?C?FPADD
C:0021H PUBLIC ?C?FPSUB
------- ENDMOD ?C?FPADD
BL51 BANKED LINKER/LOCATER V6.22 04/06/2022 21:56:11 PAGE 15
------- MODULE ?C?FPMUL
C:0116H PUBLIC ?C?FPMUL
------- ENDMOD ?C?FPMUL
------- MODULE ?C?FPDIV
C:021FH PUBLIC ?C?FPDIV
------- ENDMOD ?C?FPDIV
------- MODULE ?C?FCAST
C:02C6H PUBLIC ?C?FCASTC
C:02C1H PUBLIC ?C?FCASTI
C:02BCH PUBLIC ?C?FCASTL
------- ENDMOD ?C?FCAST
------- MODULE ?C?CASTF
C:02FAH PUBLIC ?C?CASTF
------- ENDMOD ?C?CASTF
------- MODULE ?C?CLDPTR
C:037BH PUBLIC ?C?CLDPTR
------- ENDMOD ?C?CLDPTR
------- MODULE ?C?IMUL
C:0394H PUBLIC ?C?IMUL
------- ENDMOD ?C?IMUL
------- MODULE ?C?UIDIV
C:03A6H PUBLIC ?C?UIDIV
------- ENDMOD ?C?UIDIV
------- MODULE ?C?LNEG
C:03FBH PUBLIC ?C?LNEG
------- ENDMOD ?C?LNEG
Program Size: data=69.5 xdata=0 code=2902
LINK/LOCATE RUN COMPLETE. 0 WARNING(S), 0 ERROR(S)

38
pro.build_log.htm

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
<html>
<body>
<pre>
<h1>礦ision Build Log</h1>
<h2>Tool Versions:</h2>
IDE-Version: μVision V5.25.2.0
Copyright (C) 2018 ARM Ltd and ARM Germany GmbH. All rights reserved.
License Information: sasasa QY, asas, LIC=14RDY-I2Q34-B1DP0-B3MQL-18VH6-7EFQD
Tool Versions:
Toolchain: PK51 Prof. Developers Kit Version: 9.56.0.0
Toolchain Path: D:\Keil_v5\C51\BIN
C Compiler: C51.exe V9.56.0.0
Assembler: A51.exe V8.2.5.0
Linker/Locator: BL51.exe V6.22
Library Manager: LIB51.exe V4.30.1.0
Hex Converter: OH51.exe V2.7.0.0
CPU DLL: S8051.DLL V3.106.0.0
Dialog DLL: DP51.DLL V2.63.0.0
<h2>Project:</h2>
E:\项目\兼职项目\20220406-智能健身直行车\pro.uvproj
Project File Date: 05/31/2019
<h2>Output:</h2>
Build target 'Target 1'
compiling main.c...
compiling lcd.c...
compiling pwm.c...
compiling i2c.c...
compiling IRIN.c...
linking...
Program Size: data=69.5 xdata=0 code=2902
creating hex file from "pro"...
"pro" - 0 Error(s), 0 Warning(s).
Build Time Elapsed: 00:00:02
</pre>
</body>
</html>

214
pro.hex

@ -0,0 +1,214 @@ @@ -0,0 +1,214 @@
:0F0AE200303132333435363738392E2D4D000050
:1008530011212050656368696E20536369656E6377
:030863006520000D
:100A41007C64EF4E60131CEC60087D0A1DED60F6BE
:090A510080FAEF1F70EC1E80E931
:010A5A002279
:1008E200120A8A1209EA750B0A7F0112096C753223
:1008F200008F337F0812096C7534008F357F051223
:10090200096C7542008F43E5334534F53AE535F518
:0C0912003B120AF11204091207EC80F5F8
:100A9E0075A0FFC296D295D294AFA0C294EF20E774
:010AAE00F651
:010AAF002224
:100AC200AE07120A9EC296C2958EA0D294C29422FA
:100AD200AE07120A9ED296C2958EA0D294C29422DA
:100AB000ED7004AC078004EF2440FCEC4480FF029E
:020AC0000AC268
:100A0800AE07AC0353050153060FED6003430640E0
:0D0A1800430680AF06120AC2AF04020AD2E4
:10091E008B0F8A108911120AB0AB0FAA10A91112EF
:10092E00037B60130511E5117002051014F9120313
:08093E007BFF120AD280E222C5
:100A8A007F38120AC27F0C120AC27F06120AC27F7C
:040A9A0001020AC289
:10086600010800010D00010E00010C00010B00C182
:0708760083C18402090000A8
:10098E00E4FDFCC3ED9FEC9E5015E4FBFA0BBB009F
:0F099E00010ABA07F8BBD0F50DBD00010C80E4CB
:0109AD002227
:0F0AF100750D03850B0CC286D287D284C2852275
:0F0B0000750D03750C04D286C287C284D285227C
:0B0B4800E4F50D750C04D284C2852278
:0B0B5300E4F50C750D04C286D2872269
:1009AE00300418E508D3950D5004D2B58002C2B5B7
:0E09BE00E508C394144006E4F50822C2B522F1
:1009CC00300318E50ED3950C5004D2B48002C2B497
:0E09DC00E50EC394144006E4F50E22C2B422C8
:03001B00020A25B1
:100A2500C0E0C0D0758DFC758B18050AE50A70020B
:0C0A35000509050E1209CCD0D0D0E0322B
:050B2D00120B32D28121
:080B32007F017E02DEFEDFFA06
:010B3A002298
:0F0B0F00D280120B2DC280120B32C281020B3228
:0A0B5E00C280120B2DD280020B3270
:0208A100AD07A1
:1008A300E4FBFAEDC4131313540124FF9280ED25E6
:1008B300E0FD120B2DC281120B320BBB08E5D28077
:1008C300120B32D28130800F0AEAD394C840F6C2A9
:0E08D30081120B327F0022C281120B327F0194
:0108E10022F4
:10094600E4FDFCD280120B32D281120B32EC25E090
:10095600FCA280E4334204120B32C281120B320D28
:05096600BD08E5AF042F
:01096B002269
:100A5B00AC05A907120B0F7FA01208A1AF0112085A
:090A6B00A1AF041208A1020B5E08
:02096C00AC07D6
:10096E00120B0F7FA01208A1AF041208A1120B0FD9
:0F097E007FA11208A1120946AD07120B5EAF054B
:01098D002247
:100A740053706565643A004B4D2F68004C3A004D45
:060A840000513A002E00B3
:10087D00024200070249000002440000014D00023F
:10088D003C0000024B0000C101C100C10201460045
:03089D0001520005
:040B1E007FE87E03EB
:0B0B2200EF1FAC0670011E4C70F622A5
:1009EA00758901758C3C758AB0D2A9758DFC758B99
:0E09FA0018D2ABD28ED28CD2AFD2AAD28A2221
:100409003001030205F27F0A12096C7549008F4A0F
:10041900D3E5439407E5429400400A7F0512096C2D
:100429007542008F43E4FDFF120AB07BFF7A0A7917
:1004390074E4FDFF12091EAE49AF4A7C007D6412C7
:1004490003A67C007D0A1203A6ED2430FF120AD20E
:10045900AE49AF4A7C007D0A1203A67C007D0A12D0
:1004690003A6ED2430FF120AD2AE49AF4A7C007DC3
:100479000A1203A6ED2430FF120AD27BFF7A0A7909
:100489007BE4FD7F0A12091E7BFF7A0A79807D01D0
:10049900E4FF12091EAE3AAF3B7C277D101203A67A
:1004A9007C007D0A1203A6ED2430FF120AD2AE3A6F
:1004B900AF3B7C037DE81203A67C007D0A1203A6EC
:1004C900ED2430FF120AD2AE3AAF3B7C007D6412B4
:1004D90003A67C007D0A1203A6ED2430FF120AD27E
:1004E900AE3AAF3B7C007D0A1203A67C007D0A125E
:1004F90003A6ED2430FF120AD2AE3AAF3B7C007D51
:100509000A1203A6ED2430FF120AD27BFF7A0A7978
:10051900837D017F0712091ED3E53B94E8E53A94F0
:10052900034031E53B2418FDE53A34FCFCE41202B2
:10053900C17B6F7A127903783B120116E4FBFA79D1
:10054900E078401200251202FA8E428F43AD437FB4
:1005590005120A5BAE42AF437C007D0A1203948EFA
:10056900428F437BFF7A0A79857D017F0912091E33
:10057900AE42AF437C037DE81203A67C007D0A12DC
:1005890003A6ED2430FF120AD2AE42AF437C007DB0
:10059900641203A67C007D0A1203A6ED2430FF1223
:1005A9000AD2AE42AF437C007D0A1203A67C007DCD
:1005B9000A1203A6ED2430FF120AD27BFF7A0A79C8
:1005C900887D017F0E12091EAE42AF437C007D0A71
:1005D9001203A6ED2430FF120AD2AE42AF437C00CB
:0A05E9007D0A1203A68E428F432202
:1007EC0020B43B120B1E20B4327F0A12096C7549DF
:1007FC00008F4A7F0112096C753E008F3F7F0812F3
:10080C00096C7540008F41E53F4540F53AE541F5EF
:10081C003B7F0512096C7542008F4330B4FD20B547
:10082C000B120B1E20B502D20230B5FD20B21712EE
:10083C000B1E20B20EE50BC394144005750B018002
:07084C0002050B30B2FD2292
:03000B000205F3F8
:1005F300C0E0C0F0C083C082C0D075D000C000C0CE
:1006030001C002C003C004C005C006C007758C3C0E
:10061300758AB0054DE54D75F00584E5F07002B2BD
:1006230000E54D75F00A84E5F06003020745E546F1
:1006330060021546E55260021552754D00C2AA8547
:10064300444B85454C754400754500D2AAAE4BAF6B
:100653004C7C007D06120394AC06AD07E41202C184
:10066300E4FBFAF9783F120116C004C005C006C0C6
:1006730007AC3CAD3DE41202C1E4FBFAF9783F124A
:100683000116D003D002D001D0001200251202FAC5
:100693008E3C8F3D300203020722AC3CAD3DE41299
:1006A30002C17B9A7A997919783E1201161202FADD
:1006B3008E498F4AAD4A7F0A120A5BAC4BAD4CE4BC
:1006C3001202C1E4FBFA79207840120116E4FBFA26
:1006D30079A0784112021FC004C005C006C007AC50
:1006E3003AAD3BE41202C1D003D002D001D00012D4
:1006F30000251202FA8E3A8F3B853A47853B4875AF
:100703005000853B51AD517F08120A5B120B1EE569
:1007130047F54F754E00AD4F7F01120A5B8023757D
:100723003A00753B00754200754307AD3B7F0112EC
:100733000A5BAD3B7F08120A5BAD437F05120A5B80
:10074300C202D007D006D005D004D003D002D00116
:0D075300D000D0D0D082D083D0F0D0E032E2
:03001300020B3BA2
:0D0B3B00C0E00545E54570020544D0E032FC
:10001E00020366E86480F8E933E83360110460F0A7
:10002E00ED33EC337009E8FCE9FDEAFEEBFF220448
:10003E0060DED3EB9FEA9EE99DE8C2E78CF0C2F743
:10004E0095F0400CE8CCF8E9CDF9EACEFAEBCFFB0F
:10005E0012033185D0F05804700320D5B3E8047034
:10006E00075002B2D502037092D5EC0460F7E4CCCF
:10007E00C0E0C398F8603B94186008400DD0E0FBD8
:10008E00020348E4FBFAC9FC8028E830E406E4C920
:10009E00FBE4CAFCE830E305E4C9CACBFCE854072C
:1000AE006010F8C3E913F9EA13FAEB13FBEC13FC37
:1000BE00D8F130F52FC3E49CFCEF9BFFEE9AFEEDDA
:1000CE0099FDD0E0FBEF4E4D4C701222DB03020384
:1000DE006DEC2CFCEF33FFEE33FEED33FDED30E730
:1000EE00EB020348EF2BFFEE3AFEED39FDD0E0FBBD
:1000FE0050130BBB0003020370ED13FDEE13FEEF66
:08010E0013FFEC13FC0203488F
:10011600EC4D6011E8497017ED33EC3304600DE4E3
:10012600FCFFFEFD22E933E8330470F80203661291
:10013600033158046009E4CC248150062850090292
:10014600037028400302036DC0E0EB4A7044B98097
:1001560006D0E0FB02035CEF4E701CBD8008EBFF8F
:10016600EAFEE9FD80EBE98DF0A4FEE5F00201FF71
:10017600E9CDF9EAFEEBFFEF89F0A4FCE5F0CE89C4
:10018600F0A42EFFE435F0CD89F0A42DFEE435F081
:100196008067EF4E7005BD80D780C3EF8BF0A4ACAF
:1001A600F0EE8BF0A42CFCE435F0F8EF8AF0A42CEA
:1001B600E5F038FCE433CB8DF0A42CFCE5F03BF8FD
:1001C600EE8AF0A42CFCE5F038F8E433CF89F0A4ED
:1001D6002CFCE5F038CF3400CE89F0A42FFFE5F0F3
:1001E6003EFEE433C98DF0A42EFEE5F039CD8AF04B
:1001F600A42FFFE5F03EFEE43DFD33D0E0FB5007C3
:100206000BBB000F020370EC2CFCEF33FFEE33FE4A
:06021600ED33FD02034878
:10021C00020370EC5D046005E85904700302036688
:10022C00120331580460F6EC4860F2EC7004FDFEE9
:10023C00FF22C860DB2481C85009C39860025006B5
:10024C0002036D9850CAF582E9294B4A7005AB82BE
:10025C0002035C75F0007C1A7880C3EF9BEE9AED7C
:10026C0099400DC3EF9BFFEE9AFEED99FDE842F02D
:10027C00DC23ACF0D0E0FFD0E0FED0E0FDAB822080
:10028C00E7101BEB60BAEC2CFCEF33FFEE33FEED0A
:10029C0033FD020348E803F830E705C0F075F000C1
:1002AC00EF2FFFEE33FEED33FD40B830E7C280AAEE
:1002BC0075F020800E75F010800575F0087D007EBD
:1002CC00007F003392D530D5031203FBEC33401082
:1002DC00EF33FFEE33FEED33FDEC33FCD5F0ED22C6
:0E02EC00E5F0247EA2D513CC92E7CDCEFF2202
:1002FA00EDD2E7CD33EC3392D524814006E4FFFEFC
:10030A00FDFC22FCE4CFCECDCC24E0501174FF805A
:10031A00EDC3CC13CCCD13CDCE13CECF13CF0470F7
:07032A00F030D5DE0203FBF9
:10033100E9D2E7C933E833F892D5EDD2E7CD33EC12
:0703410033FC5002B2D5228B
:10034800EC30E7100FBF000C0EBE00080DBD000416
:100358000BEB6014A2D5EB13FCED92E7FD2274FFC2
:10036800FCFDFEFF22E480F8A2D574FF13FC7D801B
:03037800E480EF2F
:0300000002076094
:0C076000787FE4F6D8FD7581520207A7EF
:10037B00BB010689828A83E0225002E722BBFE0280
:09038B00E32289828A83E49322B3
:10039400EF8DF0A4A8F0CF8CF0A428CE8DF0A42E7D
:0203A400FE2237
:1003A600BC000BBE0029EF8DF084FFADF022E4CC3B
:1003B600F875F008EF2FFFEE33FEEC33FCEE9DEC04
:1003C600984005FCEE9DFE0FD5F0E9E4CEFD22ED4A
:1003D600F8F5F0EE8420D21CFEADF075F008EF2F94
:1003E600FFED33FD4007985006D5F0F222C398FD85
:0503F6000FD5F0EA2222
:0E03FB00C3E49FFFE49EFEE49DFDE49CFC2213
:10076C000208E2E493A3F8E493A34003F68001F2B9
:10077C0008DFF48029E493A3F85407240CC8C3338E
:10078C00C4540F4420C8834004F456800146F6DF5D
:10079C00E4800B0102040810204080900853E47E92
:1007AC00019360BCA3FF543F30E509541FFEE49352
:1007BC00A360010ECF54C025E060A840B8E493A319
:1007CC00FAE493A3F8E493A3C8C582C8CAC583CA44
:1007DC00F0A3C8C582C8CAC583CADFE9DEE780BEFC
:0108A0000057
:00000001FF

7
pro.lnp

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
"main.obj",
"lcd.obj",
"pwm.obj",
"i2c.obj",
"IRIN.obj"
TO "pro"
DISABLEWARNING (15,16)

20
pro.plg

@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
<html>
<body>
<pre>
<h1>礦ision Build Log</h1>
<h2>Project:</h2>
E:\学习\51教程\CH6800-ES V2.0光盘资料(新)\实验程序\高级应用例程\超声波测距(LCD1602显示)\程序\pro.uvproj
Project File Date: 12/16/2018
<h2>Output:</h2>
Build target 'Target 1'
linking...
Program Size: data=40.1 xdata=0 code=1689
creating hex file from "pro"...
"pro" - 0 Error(s), 0 Warning(s).
Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=40.1 xdata=0 code=1689
creating hex file from "pro"...
"pro" - 0 Error(s), 0 Warning(s).

1432
pro.uvgui.Administrator

File diff suppressed because one or more lines are too long

1868
pro.uvgui.QY

File diff suppressed because one or more lines are too long

1931
pro.uvgui.asus

File diff suppressed because one or more lines are too long

252
pro.uvopt

@ -0,0 +1,252 @@ @@ -0,0 +1,252 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_opt.xsd">
<SchemaVersion>1.0</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<Extensions>
<cExt>*.c</cExt>
<aExt>*.s*; *.src; *.a*</aExt>
<oExt>*.obj; *.o</oExt>
<lExt>*.lib</lExt>
<tExt>*.txt; *.h; *.inc</tExt>
<pExt>*.plm</pExt>
<CppX>*.cpp</CppX>
<nMigrate>0</nMigrate>
</Extensions>
<DaveTm>
<dwLowDateTime>0</dwLowDateTime>
<dwHighDateTime>0</dwHighDateTime>
</DaveTm>
<Target>
<TargetName>Target 1</TargetName>
<ToolsetNumber>0x0</ToolsetNumber>
<ToolsetName>MCS-51</ToolsetName>
<TargetOption>
<CLK51>24000000</CLK51>
<OPTTT>
<gFlags>1</gFlags>
<BeepAtEnd>1</BeepAtEnd>
<RunSim>1</RunSim>
<RunTarget>0</RunTarget>
<RunAbUc>0</RunAbUc>
</OPTTT>
<OPTHX>
<HexSelection>0</HexSelection>
<FlashByte>65535</FlashByte>
<HexRangeLowAddress>0</HexRangeLowAddress>
<HexRangeHighAddress>0</HexRangeHighAddress>
<HexOffset>0</HexOffset>
</OPTHX>
<OPTLEX>
<PageWidth>120</PageWidth>
<PageLength>65</PageLength>
<TabStop>8</TabStop>
<ListingPath>.\</ListingPath>
</OPTLEX>
<ListingPage>
<CreateCListing>1</CreateCListing>
<CreateAListing>1</CreateAListing>
<CreateLListing>1</CreateLListing>
<CreateIListing>0</CreateIListing>
<AsmCond>1</AsmCond>
<AsmSymb>1</AsmSymb>
<AsmXref>0</AsmXref>
<CCond>1</CCond>
<CCode>0</CCode>
<CListInc>0</CListInc>
<CSymb>0</CSymb>
<LinkerCodeListing>0</LinkerCodeListing>
</ListingPage>
<OPTXL>
<LMap>1</LMap>
<LComments>1</LComments>
<LGenerateSymbols>1</LGenerateSymbols>
<LLibSym>1</LLibSym>
<LLines>1</LLines>
<LLocSym>1</LLocSym>
<LPubSym>1</LPubSym>
<LXref>0</LXref>
<LExpSel>0</LExpSel>
</OPTXL>
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget>
</OPTFL>
<CpuCode>255</CpuCode>
<Books>
<Book>
<Number>0</Number>
<Title>Data Sheet</Title>
<Path>DATASHTS\ATMEL\AT89C51_DS.PDF</Path>
</Book>
<Book>
<Number>1</Number>
<Title>Instruction Set Manual</Title>
<Path>DATASHTS\ATMEL\AT_C51ISM.PDF</Path>
</Book>
</Books>
<DebugOpt>
<uSim>1</uSim>
<uTrg>0</uTrg>
<sLdApp>1</sLdApp>
<sGomain>1</sGomain>
<sRbreak>1</sRbreak>
<sRwatch>1</sRwatch>
<sRmem>1</sRmem>
<sRfunc>1</sRfunc>
<sRbox>1</sRbox>
<tLdApp>1</tLdApp>
<tGomain>0</tGomain>
<tRbreak>1</tRbreak>
<tRwatch>1</tRwatch>
<tRmem>1</tRmem>
<tRfunc>0</tRfunc>
<tRbox>1</tRbox>
<tRtrace>0</tRtrace>
<sRSysVw>1</sRSysVw>
<tRSysVw>1</tRSysVw>
<sRunDeb>0</sRunDeb>
<sLrtime>0</sLrtime>
<bEvRecOn>1</bEvRecOn>
<bSchkAxf>0</bSchkAxf>
<bTchkAxf>0</bTchkAxf>
<nTsel>-1</nTsel>
<sDll></sDll>
<sDllPa></sDllPa>
<sDlgDll></sDlgDll>
<sDlgPa></sDlgPa>
<sIfile></sIfile>
<tDll></tDll>
<tDllPa></tDllPa>
<tDlgDll></tDlgDll>
<tDlgPa></tDlgPa>
<tIfile></tIfile>
<pMon></pMon>
</DebugOpt>
<TargetDriverDllRegistry>
<SetRegEntry>
<Number>0</Number>
<Key>DLGDP51</Key>
<Name>(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)(80=-1,-1,-1,-1,0)(91=-1,-1,-1,-1,0)(92=-1,-1,-1,-1,0)</Name>
</SetRegEntry>
</TargetDriverDllRegistry>
<Breakpoint/>
<Tracepoint>
<THDelay>0</THDelay>
</Tracepoint>
<DebugFlag>
<trace>0</trace>
<periodic>1</periodic>
<aLwin>1</aLwin>
<aCover>0</aCover>
<aSer1>0</aSer1>
<aSer2>0</aSer2>
<aPa>0</aPa>
<viewmode>1</viewmode>
<vrSel>0</vrSel>
<aSym>0</aSym>
<aTbox>0</aTbox>
<AscS1>0</AscS1>
<AscS2>0</AscS2>
<AscS3>0</AscS3>
<aSer3>0</aSer3>
<eProf>0</eProf>
<aLa>0</aLa>
<aPa1>0</aPa1>
<AscS4>0</AscS4>
<aSer4>0</aSer4>
<StkLoc>0</StkLoc>
<TrcWin>0</TrcWin>
<newCpu>0</newCpu>
<uProt>0</uProt>
</DebugFlag>
<LintExecutable></LintExecutable>
<LintConfigFile></LintConfigFile>
<bLintAuto>0</bLintAuto>
<bAutoGenD>0</bAutoGenD>
<LntExFlags>0</LntExFlags>
<pMisraName></pMisraName>
<pszMrule></pszMrule>
<pSingCmds></pSingCmds>
<pMultCmds></pMultCmds>
<pMisraNamep></pMisraNamep>
<pszMrulep></pszMrulep>
<pSingCmdsp></pSingCmdsp>
<pMultCmdsp></pMultCmdsp>
</TargetOption>
</Target>
<Group>
<GroupName>Source Group 1</GroupName>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>1</FileNumber>
<FileType>1</FileType>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\main.c</PathWithFileName>
<FilenameWithoutPath>main.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>2</FileNumber>
<FileType>1</FileType>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\lcd.c</PathWithFileName>
<FilenameWithoutPath>lcd.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>3</FileNumber>
<FileType>1</FileType>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\pwm.c</PathWithFileName>
<FilenameWithoutPath>pwm.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>4</FileNumber>
<FileType>1</FileType>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\i2c.c</PathWithFileName>
<FilenameWithoutPath>i2c.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>5</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\IRIN.c</PathWithFileName>
<FilenameWithoutPath>IRIN.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
</ProjectOpt>

410
pro.uvproj

@ -0,0 +1,410 @@ @@ -0,0 +1,410 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_proj.xsd">
<SchemaVersion>1.1</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<Targets>
<Target>
<TargetName>Target 1</TargetName>
<ToolsetNumber>0x0</ToolsetNumber>
<ToolsetName>MCS-51</ToolsetName>
<uAC6>0</uAC6>
<TargetOption>
<TargetCommonOption>
<Device>AT89C51</Device>
<Vendor>Atmel</Vendor>
<Cpu>IRAM(0-0x7F) IROM(0-0xFFF) CLOCK(24000000)</Cpu>
<FlashUtilSpec></FlashUtilSpec>
<StartupFile>"LIB\STARTUP.A51" ("Standard 8051 Startup Code")</StartupFile>
<FlashDriverDll></FlashDriverDll>
<DeviceId>2976</DeviceId>
<RegisterFile>REGX51.H</RegisterFile>
<MemoryEnv></MemoryEnv>
<Cmp></Cmp>
<Asm></Asm>
<Linker></Linker>
<OHString></OHString>
<InfinionOptionDll></InfinionOptionDll>
<SLE66CMisc></SLE66CMisc>
<SLE66AMisc></SLE66AMisc>
<SLE66LinkerMisc></SLE66LinkerMisc>
<SFDFile></SFDFile>
<bCustSvd>0</bCustSvd>
<UseEnv>0</UseEnv>
<BinPath></BinPath>
<IncludePath></IncludePath>
<LibPath></LibPath>
<RegisterFilePath>Atmel\</RegisterFilePath>
<DBRegisterFilePath>Atmel\</DBRegisterFilePath>
<TargetStatus>
<Error>0</Error>
<ExitCodeStop>0</ExitCodeStop>
<ButtonStop>0</ButtonStop>
<NotGenerated>0</NotGenerated>
<InvalidFlash>1</InvalidFlash>
</TargetStatus>
<OutputDirectory>.\</OutputDirectory>
<OutputName>pro</OutputName>
<CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib>
<CreateHexFile>1</CreateHexFile>
<DebugInformation>1</DebugInformation>
<BrowseInformation>1</BrowseInformation>
<ListingPath>.\</ListingPath>
<HexFormatSelection>0</HexFormatSelection>
<Merge32K>0</Merge32K>
<CreateBatchFile>0</CreateBatchFile>
<BeforeCompile>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopU1X>0</nStopU1X>
<nStopU2X>0</nStopU2X>
</BeforeCompile>
<BeforeMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopB1X>0</nStopB1X>
<nStopB2X>0</nStopB2X>
</BeforeMake>
<AfterMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopA1X>0</nStopA1X>
<nStopA2X>0</nStopA2X>
</AfterMake>
<SelectedForBatchBuild>0</SelectedForBatchBuild>
<SVCSIdString></SVCSIdString>
</TargetCommonOption>
<CommonProperty>
<UseCPPCompiler>0</UseCPPCompiler>
<RVCTCodeConst>0</RVCTCodeConst>
<RVCTZI>0</RVCTZI>
<RVCTOtherData>0</RVCTOtherData>
<ModuleSelection>0</ModuleSelection>
<IncludeInBuild>1</IncludeInBuild>
<AlwaysBuild>0</AlwaysBuild>
<GenerateAssemblyFile>0</GenerateAssemblyFile>
<AssembleAssemblyFile>0</AssembleAssemblyFile>
<PublicsOnly>0</PublicsOnly>
<StopOnExitCode>3</StopOnExitCode>
<CustomArgument></CustomArgument>
<IncludeLibraryModules></IncludeLibraryModules>
<ComprImg>1</ComprImg>
<BankNo>65535</BankNo>
</CommonProperty>
<DllOption>
<SimDllName>S8051.DLL</SimDllName>
<SimDllArguments></SimDllArguments>
<SimDlgDll>DP51.DLL</SimDlgDll>
<SimDlgDllArguments>-p51</SimDlgDllArguments>
<TargetDllName>S8051.DLL</TargetDllName>
<TargetDllArguments></TargetDllArguments>
<TargetDlgDll>TP51.DLL</TargetDlgDll>
<TargetDlgDllArguments>-p51</TargetDlgDllArguments>
</DllOption>
<DebugOption>
<OPTHX>
<HexSelection>0</HexSelection>
<HexRangeLowAddress>0</HexRangeLowAddress>
<HexRangeHighAddress>0</HexRangeHighAddress>
<HexOffset>0</HexOffset>
<Oh166RecLen>16</Oh166RecLen>
</OPTHX>
<Simulator>
<UseSimulator>1</UseSimulator>
<LoadApplicationAtStartup>1</LoadApplicationAtStartup>
<RunToMain>1</RunToMain>
<RestoreBreakpoints>1</RestoreBreakpoints>
<RestoreWatchpoints>1</RestoreWatchpoints>
<RestoreMemoryDisplay>1</RestoreMemoryDisplay>
<RestoreFunctions>1</RestoreFunctions>
<RestoreToolbox>1</RestoreToolbox>
<LimitSpeedToRealTime>0</LimitSpeedToRealTime>
<RestoreSysVw>1</RestoreSysVw>
</Simulator>
<Target>
<UseTarget>0</UseTarget>
<LoadApplicationAtStartup>1</LoadApplicationAtStartup>
<RunToMain>0</RunToMain>
<RestoreBreakpoints>1</RestoreBreakpoints>
<RestoreWatchpoints>1</RestoreWatchpoints>
<RestoreMemoryDisplay>1</RestoreMemoryDisplay>
<RestoreFunctions>0</RestoreFunctions>
<RestoreToolbox>1</RestoreToolbox>
<RestoreTracepoints>0</RestoreTracepoints>
<RestoreSysVw>1</RestoreSysVw>
</Target>
<RunDebugAfterBuild>0</RunDebugAfterBuild>
<TargetSelection>-1</TargetSelection>
<SimDlls>
<CpuDll></CpuDll>
<CpuDllArguments></CpuDllArguments>
<PeripheralDll></PeripheralDll>
<PeripheralDllArguments></PeripheralDllArguments>
<InitializationFile></InitializationFile>
</SimDlls>
<TargetDlls>
<CpuDll></CpuDll>
<CpuDllArguments></CpuDllArguments>
<PeripheralDll></PeripheralDll>
<PeripheralDllArguments></PeripheralDllArguments>
<InitializationFile></InitializationFile>
<Driver></Driver>
</TargetDlls>
</DebugOption>
<Utilities>
<Flash1>
<UseTargetDll>0</UseTargetDll>
<UseExternalTool>0</UseExternalTool>
<RunIndependent>0</RunIndependent>
<UpdateFlashBeforeDebugging>0</UpdateFlashBeforeDebugging>
<Capability>0</Capability>
<DriverSelection>-1</DriverSelection>
</Flash1>
<bUseTDR>0</bUseTDR>
<Flash2></Flash2>
<Flash3></Flash3>
<Flash4></Flash4>
<pFcarmOut></pFcarmOut>
<pFcarmGrp></pFcarmGrp>
<pFcArmRoot></pFcArmRoot>
<FcArmLst>0</FcArmLst>
</Utilities>
<Target51>
<Target51Misc>
<MemoryModel>0</MemoryModel>
<RTOS>0</RTOS>
<RomSize>2</RomSize>
<DataHold>0</DataHold>
<XDataHold>0</XDataHold>
<UseOnchipRom>0</UseOnchipRom>
<UseOnchipArithmetic>0</UseOnchipArithmetic>
<UseMultipleDPTR>0</UseMultipleDPTR>
<UseOnchipXram>0</UseOnchipXram>
<HadIRAM>1</HadIRAM>
<HadXRAM>0</HadXRAM>
<HadIROM>1</HadIROM>
<Moda2>0</Moda2>
<Moddp2>0</Moddp2>
<Modp2>0</Modp2>
<Mod517dp>0</Mod517dp>
<Mod517au>0</Mod517au>
<Mode2>0</Mode2>
<useCB>0</useCB>
<useXB>0</useXB>
<useL251>0</useL251>
<useA251>0</useA251>
<Mx51>0</Mx51>
<ModC812>0</ModC812>
<ModCont>0</ModCont>
<Lp51>0</Lp51>
<useXBS>0</useXBS>
<ModDA>0</ModDA>
<ModAB2>0</ModAB2>
<Mx51P>0</Mx51P>
<hadXRAM2>0</hadXRAM2>
<uocXram2>0</uocXram2>
<hadXRAM3>0</hadXRAM3>
<ModC2>0</ModC2>
<ModH2>0</ModH2>
<Mdu_R515>0</Mdu_R515>
<Mdu_F120>0</Mdu_F120>
<Psoc>0</Psoc>
<hadIROM2>0</hadIROM2>
<hadIROM3>0</hadIROM3>
<ModSmx2>0</ModSmx2>
<cBanks>0</cBanks>
<xBanks>0</xBanks>
<OnChipMemories>
<RCB>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0xffff</Size>
</RCB>
<RXB>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</RXB>
<Ocm1>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm1>
<Ocm2>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm2>
<Ocm3>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm3>
<Ocr1>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocr1>
<Ocr2>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocr2>
<Ocr3>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocr3>
<IRO>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x1000</Size>
</IRO>
<IRA>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x80</Size>
</IRA>
<XRA>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</XRA>
<XRA512>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</XRA512>
<IROM512>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</IROM512>
<XRA513>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</XRA513>
<IROM513>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</IROM513>
</OnChipMemories>
</Target51Misc>
<C51>
<RegisterColoring>0</RegisterColoring>
<VariablesInOrder>0</VariablesInOrder>
<IntegerPromotion>1</IntegerPromotion>
<uAregs>0</uAregs>
<UseInterruptVector>1</UseInterruptVector>
<Fuzzy>3</Fuzzy>
<Optimize>8</Optimize>
<WarningLevel>2</WarningLevel>
<SizeSpeed>1</SizeSpeed>
<ObjectExtend>1</ObjectExtend>
<ACallAJmp>0</ACallAJmp>
<InterruptVectorAddress>0</InterruptVectorAddress>
<VariousControls>
<MiscControls></MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath></IncludePath>
</VariousControls>
</C51>
<Ax51>
<UseMpl>0</UseMpl>
<UseStandard>1</UseStandard>
<UseCase>0</UseCase>
<UseMod51>0</UseMod51>
<VariousControls>
<MiscControls></MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath></IncludePath>
</VariousControls>
</Ax51>
<Lx51>
<useFile>0</useFile>
<linkonly>0</linkonly>
<UseMemoryFromTarget>1</UseMemoryFromTarget>
<CaseSensitiveSymbols>0</CaseSensitiveSymbols>
<WarningLevel>2</WarningLevel>
<DataOverlaying>1</DataOverlaying>
<OverlayString></OverlayString>
<MiscControls></MiscControls>
<DisableWarningNumbers>15,16</DisableWarningNumbers>
<LinkerCmdFile></LinkerCmdFile>
<Assign></Assign>
<ReserveString></ReserveString>
<CClasses></CClasses>
<UserClasses></UserClasses>
<CSection></CSection>
<UserSection></UserSection>
<CodeBaseAddress></CodeBaseAddress>
<XDataBaseAddress></XDataBaseAddress>
<PDataBaseAddress></PDataBaseAddress>
<BitBaseAddress></BitBaseAddress>
<DataBaseAddress></DataBaseAddress>
<IDataBaseAddress></IDataBaseAddress>
<Precede></Precede>
<Stack></Stack>
<CodeSegmentName></CodeSegmentName>
<XDataSegmentName></XDataSegmentName>
<BitSegmentName></BitSegmentName>
<DataSegmentName></DataSegmentName>
<IDataSegmentName></IDataSegmentName>
</Lx51>
</Target51>
</TargetOption>
<Groups>
<Group>
<GroupName>Source Group 1</GroupName>
<Files>
<File>
<FileName>main.c</FileName>
<FileType>1</FileType>
<FilePath>.\main.c</FilePath>
</File>
<File>
<FileName>lcd.c</FileName>
<FileType>1</FileType>
<FilePath>.\lcd.c</FilePath>
</File>
<File>
<FileName>pwm.c</FileName>
<FileType>1</FileType>
<FilePath>.\pwm.c</FilePath>
</File>
<File>
<FileName>i2c.c</FileName>
<FileType>1</FileType>
<FilePath>.\i2c.c</FilePath>
</File>
<File>
<FileName>IRIN.c</FileName>
<FileType>1</FileType>
<FilePath>.\IRIN.c</FilePath>
</File>
</Files>
</Group>
</Groups>
</Target>
</Targets>
</Project>

1629
pro_uvopt.bak

File diff suppressed because it is too large Load Diff

379
pro_uvproj.bak

@ -0,0 +1,379 @@ @@ -0,0 +1,379 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_proj.xsd">
<SchemaVersion>1.1</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<Targets>
<Target>
<TargetName>Target 1</TargetName>
<ToolsetNumber>0x0</ToolsetNumber>
<ToolsetName>MCS-51</ToolsetName>
<TargetOption>
<TargetCommonOption>
<Device>AT89C51</Device>
<Vendor>Atmel</Vendor>
<Cpu>IRAM(0-0x7F) IROM(0-0xFFF) CLOCK(24000000)</Cpu>
<FlashUtilSpec></FlashUtilSpec>
<StartupFile>"LIB\STARTUP.A51" ("Standard 8051 Startup Code")</StartupFile>
<FlashDriverDll></FlashDriverDll>
<DeviceId>2976</DeviceId>
<RegisterFile>REGX51.H</RegisterFile>
<MemoryEnv></MemoryEnv>
<Cmp></Cmp>
<Asm></Asm>
<Linker></Linker>
<OHString></OHString>
<InfinionOptionDll></InfinionOptionDll>
<SLE66CMisc></SLE66CMisc>
<SLE66AMisc></SLE66AMisc>
<SLE66LinkerMisc></SLE66LinkerMisc>
<SFDFile></SFDFile>
<bCustSvd>0</bCustSvd>
<UseEnv>0</UseEnv>
<BinPath></BinPath>
<IncludePath></IncludePath>
<LibPath></LibPath>
<RegisterFilePath>Atmel\</RegisterFilePath>
<DBRegisterFilePath>Atmel\</DBRegisterFilePath>
<TargetStatus>
<Error>0</Error>
<ExitCodeStop>0</ExitCodeStop>
<ButtonStop>0</ButtonStop>
<NotGenerated>0</NotGenerated>
<InvalidFlash>1</InvalidFlash>
</TargetStatus>
<OutputDirectory>.\</OutputDirectory>
<OutputName>pro</OutputName>
<CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib>
<CreateHexFile>1</CreateHexFile>
<DebugInformation>1</DebugInformation>
<BrowseInformation>1</BrowseInformation>
<ListingPath>.\</ListingPath>
<HexFormatSelection>0</HexFormatSelection>
<Merge32K>0</Merge32K>
<CreateBatchFile>0</CreateBatchFile>
<BeforeCompile>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopU1X>0</nStopU1X>
<nStopU2X>0</nStopU2X>
</BeforeCompile>
<BeforeMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
</BeforeMake>
<AfterMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
</AfterMake>
<SelectedForBatchBuild>0</SelectedForBatchBuild>
<SVCSIdString></SVCSIdString>
</TargetCommonOption>
<CommonProperty>
<UseCPPCompiler>0</UseCPPCompiler>
<RVCTCodeConst>0</RVCTCodeConst>
<RVCTZI>0</RVCTZI>
<RVCTOtherData>0</RVCTOtherData>
<ModuleSelection>0</ModuleSelection>
<IncludeInBuild>1</IncludeInBuild>
<AlwaysBuild>0</AlwaysBuild>
<GenerateAssemblyFile>0</GenerateAssemblyFile>
<AssembleAssemblyFile>0</AssembleAssemblyFile>
<PublicsOnly>0</PublicsOnly>
<StopOnExitCode>3</StopOnExitCode>
<CustomArgument></CustomArgument>
<IncludeLibraryModules></IncludeLibraryModules>
<ComprImg>1</ComprImg>
<BankNo>65535</BankNo>
</CommonProperty>
<DllOption>
<SimDllName>S8051.DLL</SimDllName>
<SimDllArguments></SimDllArguments>
<SimDlgDll>DP51.DLL</SimDlgDll>
<SimDlgDllArguments>-p51</SimDlgDllArguments>
<TargetDllName>S8051.DLL</TargetDllName>
<TargetDllArguments></TargetDllArguments>
<TargetDlgDll>TP51.DLL</TargetDlgDll>
<TargetDlgDllArguments>-p51</TargetDlgDllArguments>
</DllOption>
<DebugOption>
<OPTHX>
<HexSelection>0</HexSelection>
<HexRangeLowAddress>0</HexRangeLowAddress>
<HexRangeHighAddress>0</HexRangeHighAddress>
<HexOffset>0</HexOffset>
<Oh166RecLen>16</Oh166RecLen>
</OPTHX>
<Simulator>
<UseSimulator>1</UseSimulator>
<LoadApplicationAtStartup>1</LoadApplicationAtStartup>
<RunToMain>1</RunToMain>
<RestoreBreakpoints>1</RestoreBreakpoints>
<RestoreWatchpoints>1</RestoreWatchpoints>
<RestoreMemoryDisplay>1</RestoreMemoryDisplay>
<RestoreFunctions>1</RestoreFunctions>
<RestoreToolbox>1</RestoreToolbox>
<LimitSpeedToRealTime>0</LimitSpeedToRealTime>
<RestoreSysVw>1</RestoreSysVw>
</Simulator>
<Target>
<UseTarget>0</UseTarget>
<LoadApplicationAtStartup>1</LoadApplicationAtStartup>
<RunToMain>0</RunToMain>
<RestoreBreakpoints>1</RestoreBreakpoints>
<RestoreWatchpoints>1</RestoreWatchpoints>
<RestoreMemoryDisplay>1</RestoreMemoryDisplay>
<RestoreFunctions>0</RestoreFunctions>
<RestoreToolbox>1</RestoreToolbox>
<RestoreTracepoints>0</RestoreTracepoints>
<RestoreSysVw>1</RestoreSysVw>
<UsePdscDebugDescription>1</UsePdscDebugDescription>
</Target>
<RunDebugAfterBuild>0</RunDebugAfterBuild>
<TargetSelection>-1</TargetSelection>
<SimDlls>
<CpuDll></CpuDll>
<CpuDllArguments></CpuDllArguments>
<PeripheralDll></PeripheralDll>
<PeripheralDllArguments></PeripheralDllArguments>
<InitializationFile></InitializationFile>
</SimDlls>
<TargetDlls>
<CpuDll></CpuDll>
<CpuDllArguments></CpuDllArguments>
<PeripheralDll></PeripheralDll>
<PeripheralDllArguments></PeripheralDllArguments>
<InitializationFile></InitializationFile>
<Driver></Driver>
</TargetDlls>
</DebugOption>
<Utilities>
<Flash1>
<UseTargetDll>0</UseTargetDll>
<UseExternalTool>0</UseExternalTool>
<RunIndependent>0</RunIndependent>
<UpdateFlashBeforeDebugging>0</UpdateFlashBeforeDebugging>
<Capability>0</Capability>
<DriverSelection>-1</DriverSelection>
</Flash1>
<bUseTDR>0</bUseTDR>
<Flash2></Flash2>
<Flash3></Flash3>
<Flash4></Flash4>
<pFcarmOut></pFcarmOut>
<pFcarmGrp></pFcarmGrp>
<pFcArmRoot></pFcArmRoot>
<FcArmLst>0</FcArmLst>
</Utilities>
<Target51>
<Target51Misc>
<MemoryModel>0</MemoryModel>
<RTOS>0</RTOS>
<RomSize>2</RomSize>
<DataHold>0</DataHold>
<XDataHold>0</XDataHold>
<UseOnchipRom>0</UseOnchipRom>
<UseOnchipArithmetic>0</UseOnchipArithmetic>
<UseMultipleDPTR>0</UseMultipleDPTR>
<UseOnchipXram>0</UseOnchipXram>
<HadIRAM>1</HadIRAM>
<HadXRAM>0</HadXRAM>
<HadIROM>1</HadIROM>
<Moda2>0</Moda2>
<Moddp2>0</Moddp2>
<Modp2>0</Modp2>
<Mod517dp>0</Mod517dp>
<Mod517au>0</Mod517au>
<Mode2>0</Mode2>
<useCB>0</useCB>
<useXB>0</useXB>
<useL251>0</useL251>
<useA251>0</useA251>
<Mx51>0</Mx51>
<ModC812>0</ModC812>
<ModCont>0</ModCont>
<Lp51>0</Lp51>
<useXBS>0</useXBS>
<ModDA>0</ModDA>
<ModAB2>0</ModAB2>
<Mx51P>0</Mx51P>
<hadXRAM2>0</hadXRAM2>
<uocXram2>0</uocXram2>
<ModC2>0</ModC2>
<ModH2>0</ModH2>
<Mdu_R515>0</Mdu_R515>
<Mdu_F120>0</Mdu_F120>
<Psoc>0</Psoc>
<hadIROM2>0</hadIROM2>
<ModSmx2>0</ModSmx2>
<cBanks>0</cBanks>
<xBanks>0</xBanks>
<OnChipMemories>
<RCB>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x10000</Size>
</RCB>
<RXB>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</RXB>
<Ocm1>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm1>
<Ocm2>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm2>
<Ocm3>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm3>
<Ocr1>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocr1>
<Ocr2>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocr2>
<Ocr3>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocr3>
<IRO>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x1000</Size>
</IRO>
<IRA>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x80</Size>
</IRA>
<XRA>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</XRA>
<XRA512>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</XRA512>
<IROM512>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</IROM512>
</OnChipMemories>
</Target51Misc>
<C51>
<RegisterColoring>0</RegisterColoring>
<VariablesInOrder>0</VariablesInOrder>
<IntegerPromotion>1</IntegerPromotion>
<uAregs>0</uAregs>
<UseInterruptVector>1</UseInterruptVector>
<Fuzzy>3</Fuzzy>
<Optimize>8</Optimize>
<WarningLevel>2</WarningLevel>
<SizeSpeed>1</SizeSpeed>
<ObjectExtend>1</ObjectExtend>
<ACallAJmp>0</ACallAJmp>
<InterruptVectorAddress>0</InterruptVectorAddress>
<VariousControls>
<MiscControls></MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath></IncludePath>
</VariousControls>
</C51>
<Ax51>
<UseMpl>0</UseMpl>
<UseStandard>1</UseStandard>
<UseCase>0</UseCase>
<UseMod51>0</UseMod51>
<VariousControls>
<MiscControls></MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath></IncludePath>
</VariousControls>
</Ax51>
<Lx51>
<useFile>0</useFile>
<linkonly>0</linkonly>
<UseMemoryFromTarget>1</UseMemoryFromTarget>
<CaseSensitiveSymbols>0</CaseSensitiveSymbols>
<WarningLevel>2</WarningLevel>
<DataOverlaying>1</DataOverlaying>
<OverlayString></OverlayString>
<MiscControls></MiscControls>
<DisableWarningNumbers></DisableWarningNumbers>
<LinkerCmdFile></LinkerCmdFile>
<Assign></Assign>
<ReserveString></ReserveString>
<CClasses></CClasses>
<UserClasses></UserClasses>
<CSection></CSection>
<UserSection></UserSection>
<CodeBaseAddress></CodeBaseAddress>
<XDataBaseAddress></XDataBaseAddress>
<PDataBaseAddress></PDataBaseAddress>
<BitBaseAddress></BitBaseAddress>
<DataBaseAddress></DataBaseAddress>
<IDataBaseAddress></IDataBaseAddress>
<Precede></Precede>
<Stack></Stack>
<CodeSegmentName></CodeSegmentName>
<XDataSegmentName></XDataSegmentName>
<BitSegmentName></BitSegmentName>
<DataSegmentName></DataSegmentName>
<IDataSegmentName></IDataSegmentName>
</Lx51>
</Target51>
</TargetOption>
<Groups>
<Group>
<GroupName>Source Group 1</GroupName>
<Files>
<File>
<FileName>main.c</FileName>
<FileType>1</FileType>
<FilePath>.\main.c</FilePath>
</File>
<File>
<FileName>lcd.c</FileName>
<FileType>1</FileType>
<FilePath>.\lcd.c</FilePath>
</File>
</Files>
</Group>
</Groups>
</Target>
</Targets>
</Project>

144
pwm.LST

@ -0,0 +1,144 @@ @@ -0,0 +1,144 @@
C51 COMPILER V9.56.0.0 PWM 04/06/2022 21:56:10 PAGE 1
C51 COMPILER V9.56.0.0, COMPILATION OF MODULE PWM
OBJECT MODULE PLACED IN pwm.OBJ
COMPILER INVOKED BY: D:\Keil_v5\C51\BIN\C51.EXE pwm.c OPTIMIZE(8,SPEED) BROWSE DEBUG OBJECTEXTEND TABS(2)
line level source
1 #include "pwm.h"
2
3 unsigned char pwm_val_left =0;//变量定义
4 unsigned char push_val_left =0;// 左电机占空比N/20
5 unsigned char pwm_val_right =0;
6 unsigned char push_val_right=0;// 右电机占空比N/20
7 unsigned char pwm_left=0;
8
9 bit Right_moto_stop=1;
10 bit Left_moto_stop =1;
11
12 unsigned int time1=0;
13
14
15
16 /************************************************************************/
17 //延时函数
18 void delay(unsigned int k)
19 {
20 1 unsigned int x,y;
21 1 for(x=0;x<k;x++)
22 1 for(y=0;y<2000;y++);
23 1 }
24 /************************************************************************/
25 //前速前进
26 void run(void)
27 {
28 1 push_val_left=3; //速度调节变量 0-20。。。0最小,20最大
29 1 push_val_right=pwm_left;
30 1 Left_moto_go ; //左电机往前走
31 1 Right_moto_go ; //右电机往前走
32 1 }
33
34 void backrun(void)
35 {
36 1 push_val_left=3; //速度调节变量 0-20。。。0最小,20最大
37 1 push_val_right=4;
38 1 Left_moto_back; //左电机往前走
39 1 Right_moto_back; //右电机往前走
40 1 }
41
42
43 //左转
44 void leftrun(void)
45 {
46 1 push_val_left=0;
47 1 push_val_right=4;
48 1 Right_moto_go ; //右电机往前走
49 1 }
50
51
52 //右转
53 void rightrun(void)
54 {
55 1 push_val_right=0;
C51 COMPILER V9.56.0.0 PWM 04/06/2022 21:56:10 PAGE 2
56 1 push_val_left=4;
57 1 Left_moto_go ; //左电机往前走
58 1 }
59
60
61 void pwm_out_left_moto(void)
62 {
63 1 if(Left_moto_stop)
64 1 {
65 2 if(pwm_val_left<=push_val_left)
66 2 {
67 3 Left_moto_pwm=1;
68 3 }
69 2 else
70 2 {
71 3 Left_moto_pwm=0;
72 3 }
73 2 if(pwm_val_left>=20)
74 2 pwm_val_left=0;
75 2 }
76 1 else
77 1 {
78 2 Left_moto_pwm=0;
79 2 }
80 1 }
81 /******************************************************************/
82 /* 右电机调速 */
83 void pwm_out_right_moto(void)
84 {
85 1 if(Right_moto_stop)
86 1 {
87 2 if(pwm_val_right<=push_val_right)
88 2 {
89 3 Right_moto_pwm=1;
90 3 }
91 2 else
92 2 {
93 3 Right_moto_pwm=0;
94 3 }
95 2 if(pwm_val_right>=20)
96 2 pwm_val_right=0;
97 2 }
98 1 else
99 1 {
100 2 Right_moto_pwm=0;
101 2 }
102 1 }
103
104 void timer1()interrupt 3
105 {
106 1 TH1=0XFc; //1Ms定时
107 1 TL1=0X18;
108 1 time1++;
109 1 // pwm_val_left++;
110 1 pwm_val_right++;
111 1 // pwm_out_left_moto();
112 1 pwm_out_right_moto();
113 1 }
114
115
116
117
C51 COMPILER V9.56.0.0 PWM 04/06/2022 21:56:10 PAGE 3
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 172 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 7 ----
IDATA SIZE = ---- ----
BIT SIZE = 2 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)

BIN
pwm.OBJ

Binary file not shown.

117
pwm.c

@ -0,0 +1,117 @@ @@ -0,0 +1,117 @@
#include "pwm.h"
unsigned char pwm_val_left =0;//变量定义
unsigned char push_val_left =0;// 左电机占空比N/20
unsigned char pwm_val_right =0;
unsigned char push_val_right=0;// 右电机占空比N/20
unsigned char pwm_left=0;
bit Right_moto_stop=1;
bit Left_moto_stop =1;
unsigned int time1=0;
/************************************************************************/
//延时函数
void delay(unsigned int k)
{
unsigned int x,y;
for(x=0;x<k;x++)
for(y=0;y<2000;y++);
}
/************************************************************************/
//前速前进
void run(void)
{
push_val_left=3; //速度调节变量 0-20。。。0最小,20最大
push_val_right=pwm_left;
Left_moto_go ; //左电机往前走
Right_moto_go ; //右电机往前走
}
void backrun(void)
{
push_val_left=3; //速度调节变量 0-20。。。0最小,20最大
push_val_right=4;
Left_moto_back; //左电机往前走
Right_moto_back; //右电机往前走
}
//左转
void leftrun(void)
{
push_val_left=0;
push_val_right=4;
Right_moto_go ; //右电机往前走
}
//右转
void rightrun(void)
{
push_val_right=0;
push_val_left=4;
Left_moto_go ; //左电机往前走
}
void pwm_out_left_moto(void)
{
if(Left_moto_stop)
{
if(pwm_val_left<=push_val_left)
{
Left_moto_pwm=1;
}
else
{
Left_moto_pwm=0;
}
if(pwm_val_left>=20)
pwm_val_left=0;
}
else
{
Left_moto_pwm=0;
}
}
/******************************************************************/
/* 右电机调速 */
void pwm_out_right_moto(void)
{
if(Right_moto_stop)
{
if(pwm_val_right<=push_val_right)
{
Right_moto_pwm=1;
}
else
{
Right_moto_pwm=0;
}
if(pwm_val_right>=20)
pwm_val_right=0;
}
else
{
Right_moto_pwm=0;
}
}
void timer1()interrupt 3
{
TH1=0XFc; //1Ms定时
TL1=0X18;
time1++;
// pwm_val_left++;
pwm_val_right++;
// pwm_out_left_moto();
pwm_out_right_moto();
}

40
pwm.h

@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
#ifndef _PWM_H
#define _PWM_H
#include <reg51.h>
#include "IRIN.h"
void delay(unsigned int k);
void run(void);
void backrun(void);
void leftrun(void);
void rightrun(void);
void pwm_out_left_moto(void);
void pwm_out_right_moto(void);
//定义小车驱动模块输入IO口
sbit IN1=P0^4;
sbit IN2=P0^5;
sbit IN3=P0^6;
sbit IN4=P0^7;
sbit EN1=P3^4;
sbit EN2=P3^5;
sbit Left_moto_pwm=P3^5; //PWM信号端
sbit Right_moto_pwm=P3^4; //PWM信号端
#define Left_moto_go {IN3=0,IN4=1;} //左电机向前走
#define Left_moto_back {IN3=1,IN4=0;} //左边电机向后转
#define Left_moto_Stop {EN1=0;} //左边电机停转
#define Right_moto_go {IN1=1,IN2=0;} //右边电机向前走
#define Right_moto_back {IN1=0,IN2=1;} //右边电机向后走
#define Right_moto_Stop {EN2=0;} //右边电机停转
#endif

1360
template.uvgui.Administrator

File diff suppressed because one or more lines are too long

185
template.uvopt

@ -0,0 +1,185 @@ @@ -0,0 +1,185 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_opt.xsd">
<SchemaVersion>1.0</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<Extensions>
<cExt>*.c</cExt>
<aExt>*.s*; *.src; *.a*</aExt>
<oExt>*.obj</oExt>
<lExt>*.lib</lExt>
<tExt>*.txt; *.h; *.inc</tExt>
<pExt>*.plm</pExt>
<CppX>*.cpp</CppX>
<nMigrate>0</nMigrate>
</Extensions>
<DaveTm>
<dwLowDateTime>0</dwLowDateTime>
<dwHighDateTime>0</dwHighDateTime>
</DaveTm>
<Target>
<TargetName>Target 1</TargetName>
<ToolsetNumber>0x0</ToolsetNumber>
<ToolsetName>MCS-51</ToolsetName>
<TargetOption>
<CLK51>24000000</CLK51>
<OPTTT>
<gFlags>0</gFlags>
<BeepAtEnd>1</BeepAtEnd>
<RunSim>1</RunSim>
<RunTarget>0</RunTarget>
<RunAbUc>0</RunAbUc>
</OPTTT>
<OPTHX>
<HexSelection>0</HexSelection>
<FlashByte>65535</FlashByte>
<HexRangeLowAddress>0</HexRangeLowAddress>
<HexRangeHighAddress>0</HexRangeHighAddress>
<HexOffset>0</HexOffset>
</OPTHX>
<OPTLEX>
<PageWidth>120</PageWidth>
<PageLength>65</PageLength>
<TabStop>8</TabStop>
<ListingPath>.\</ListingPath>
</OPTLEX>
<ListingPage>
<CreateCListing>1</CreateCListing>
<CreateAListing>1</CreateAListing>
<CreateLListing>1</CreateLListing>
<CreateIListing>0</CreateIListing>
<AsmCond>1</AsmCond>
<AsmSymb>1</AsmSymb>
<AsmXref>0</AsmXref>
<CCond>1</CCond>
<CCode>0</CCode>
<CListInc>0</CListInc>
<CSymb>0</CSymb>
<LinkerCodeListing>0</LinkerCodeListing>
</ListingPage>
<OPTXL>
<LMap>1</LMap>
<LComments>1</LComments>
<LGenerateSymbols>1</LGenerateSymbols>
<LLibSym>1</LLibSym>
<LLines>1</LLines>
<LLocSym>1</LLocSym>
<LPubSym>1</LPubSym>
<LXref>0</LXref>
<LExpSel>0</LExpSel>
</OPTXL>
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget>
</OPTFL>
<CpuCode>0</CpuCode>
<DebugOpt>
<uSim>1</uSim>
<uTrg>0</uTrg>
<sLdApp>1</sLdApp>
<sGomain>1</sGomain>
<sRbreak>1</sRbreak>
<sRwatch>1</sRwatch>
<sRmem>1</sRmem>
<sRfunc>1</sRfunc>
<sRbox>1</sRbox>
<tLdApp>1</tLdApp>
<tGomain>0</tGomain>
<tRbreak>1</tRbreak>
<tRwatch>1</tRwatch>
<tRmem>1</tRmem>
<tRfunc>0</tRfunc>
<tRbox>1</tRbox>
<tRtrace>0</tRtrace>
<sRSysVw>1</sRSysVw>
<tRSysVw>1</tRSysVw>
<sRunDeb>0</sRunDeb>
<sLrtime>0</sLrtime>
<nTsel>-1</nTsel>
<sDll></sDll>
<sDllPa></sDllPa>
<sDlgDll></sDlgDll>
<sDlgPa></sDlgPa>
<sIfile></sIfile>
<tDll></tDll>
<tDllPa></tDllPa>
<tDlgDll></tDlgDll>
<tDlgPa></tDlgPa>
<tIfile></tIfile>
<pMon></pMon>
</DebugOpt>
<Breakpoint/>
<Tracepoint>
<THDelay>0</THDelay>
</Tracepoint>
<DebugFlag>
<trace>0</trace>
<periodic>0</periodic>
<aLwin>0</aLwin>
<aCover>0</aCover>
<aSer1>0</aSer1>
<aSer2>0</aSer2>
<aPa>0</aPa>
<viewmode>0</viewmode>
<vrSel>0</vrSel>
<aSym>0</aSym>
<aTbox>0</aTbox>
<AscS1>0</AscS1>
<AscS2>0</AscS2>
<AscS3>0</AscS3>
<aSer3>0</aSer3>
<eProf>0</eProf>
<aLa>0</aLa>
<aPa1>0</aPa1>
<AscS4>0</AscS4>
<aSer4>0</aSer4>
<StkLoc>0</StkLoc>
<TrcWin>0</TrcWin>
<newCpu>0</newCpu>
<uProt>0</uProt>
</DebugFlag>
<LintExecutable></LintExecutable>
<LintConfigFile></LintConfigFile>
</TargetOption>
</Target>
<Group>
<GroupName>Source Group 1</GroupName>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>1</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\main.c</PathWithFileName>
<FilenameWithoutPath>main.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>2</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\i2c.c</PathWithFileName>
<FilenameWithoutPath>i2c.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
</ProjectOpt>
Loading…
Cancel
Save