兼职项目 智能自行车
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

234 lines
7.7 KiB

C51 COMPILER V9.56.0.0 IRIN 04/06/2022 23:56:38 PAGE 1
3 years ago
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; //դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һȦ20<EFBFBD><EFBFBD>
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 * <EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD> : delay
32 * <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>i=1ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD>ʱ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 | 0x20 ;//<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ1
3 years ago
42 1 TH0=0x3C;
43 1 TL0=0xb0;
44 1 ET0=1;
45 1 TR0=1;
46 1 EA=1;
47 1 EX1=1;
48 1 IT1=1;
49 1 }
50
51 void display()
52 {
53 1 if(state==0)
54 1 {
55 2 sudu=At24c02Read(10);
C51 COMPILER V9.56.0.0 IRIN 04/06/2022 23:56:38 PAGE 2
3 years ago
56 2 if(money>7)
57 2 {
58 3 money=At24c02Read(5);
59 3 }
60 2 LcdSetCursor(0,0);
61 2 LcdShowStr(0,0,"Speed:");
62 2 Lcd1602_Write_Data(0x30+sudu/100%10);
63 2 Lcd1602_Write_Data(0x30+sudu/10%10);
64 2 Lcd1602_Write_Data(0x30+sudu%10);
65 2 LcdShowStr(10,0,"KM/h");
66 2
67 2 LcdShowStr(0,1,"L:");
68 2 Lcd1602_Write_Data(journey/10000%10+0x30);
69 2 Lcd1602_Write_Data(journey/1000%10+0x30);
70 2 Lcd1602_Write_Data(journey/100%10+0x30);
71 2 Lcd1602_Write_Data(journey/10%10+0x30);
72 2 Lcd1602_Write_Data(journey%10+0x30);
73 2 LcdShowStr(7,1,"M");
74 2
75 2 if(journey>1000)
76 2 {
77 3 money=(journey-1000)*0.002+7;
78 3 At24c02Write(5,money);
79 3 }
80 2 money=money*10;
81 2 LcdShowStr(9,1,"Q:");
82 2 Lcd1602_Write_Data(money/1000%10+0x30);
83 2 Lcd1602_Write_Data(money/100%10+0x30);
84 2 Lcd1602_Write_Data(money/10%10+0x30);
85 2 LcdShowStr(14,1,".");
86 2 Lcd1602_Write_Data(money%10+0x30);
87 2
88 2 money=money/10;
89 2
90 2 }
91 1 }
92
93
94
95 void keypros()
96 {
97 1 if(k2==0)
98 1 {
99 2 delay11(1000); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
100 2 if(k2==0)
101 2 {
102 3 sudu=At24c02Read(10); //<EFBFBD><EFBFBD>ȡEEPROM<EFBFBD><EFBFBD>ַ1<EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
103 3
104 3 b2=At24c02Read(1);
105 3 c2=At24c02Read(8);
106 3 journey=(b2<<8) | c2;
107 3
108 3 money=At24c02Read(5);
3 years ago
109 3
110 3 }
111 2 while(!k2);
112 2 }
113 1
114 1 if(k1==0)
115 1 {
116 2 delay11(1000); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
117 2 if(k1==0)
C51 COMPILER V9.56.0.0 IRIN 04/06/2022 23:56:38 PAGE 3
3 years ago
118 2 {
119 3 flas=1;
120 3
121 3 }
122 2 while(!k1);
123 2 }
124 1 if(k4==0)
125 1 {
126 2 delay11(1000); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
127 2 if(k4==0)
128 2 {
129 3 if(pwm_left>=20)
130 3 {
131 4 pwm_left=1;
132 4 }
133 3 else
134 3 {
135 4 pwm_left++;
136 4 }
137 3 }
138 2 while(!k4);
139 2 }
140 1
141 1 }
142
143 void time0() interrupt 1 //<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD> 0
144 {
145 1 TH0=0x3C;
146 1 TL0=0xb0; //50ms<EFBFBD><EFBFBD>ʱ
147 1 ms++; //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>50ms<EFBFBD><EFBFBD>һ
148 1 if(ms%5==0) s0=~s0;
149 1
150 1
151 1 if(ms%10==0) //500ms<EFBFBD><EFBFBD>ʱ
152 1 {
153 2
154 2 if(sec!=0) sec--;
155 2 if(sec1!=0) sec1--;
156 2 ms=0; //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
157 2 EX1=0; //<EFBFBD>ر<EFBFBD><EFBFBD>ⲿ<EFBFBD>жϣ<EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>򲻻<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
158 2 r_s=count; //<EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>500ms<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> speed=count*2 ,<EFBFBD><EFBFBD><EFBFBD>ǹ<EFBFBD>դ<EFBFBD><EFBFBD>һȦ2
3 years ago
-0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>20<EFBFBD><EFBFBD>
159 2 //<EFBFBD>ۺ<EFBFBD>һ<EFBFBD>£<EFBFBD>һ<EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> speed=count*2/20 ==<EFBFBD><EFBFBD> speed=counr/10;
160 2 count=0; //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
161 2 EX1=1; //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ⲿ<EFBFBD>ж<EFBFBD>
162 2 speed=speed*0.5+(r_s*6)*0.5; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD>r_s<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD>Ȧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>60<EFBFBD>õ<EFBFBD>60<EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD>Ȧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
3 years ago
- r/min<EFBFBD><EFBFBD> <EFBFBD>ܷ<EFBFBD>ʽ speed=count/10*60; ==>> speed=count*6;
163 2
164 2 if(flas==0)
165 2 {
166 3 sudu=(0.15*speed);
167 3 At24c02Write(10,sudu);
168 3
169 3 journey=journey+(r_s*2.5/20);
170 3 journey1=journey;
171 3 c = journey & 0x00FF;
172 3 At24c02Write(8,c);
173 3
174 3 delay11(1000);
175 3 b=journey1>>8;
176 3 At24c02Write(1,b);
177 3 }
C51 COMPILER V9.56.0.0 IRIN 04/06/2022 23:56:38 PAGE 4
3 years ago
178 2 else
179 2 {
180 3 journey=0;
181 3 money=7;
182 3 At24c02Write(1,journey);
183 3 At24c02Write(8,journey);
184 3 At24c02Write(5,money);
185 3 flas=0;
186 3 }
187 2 }
188 1 }
189
190 void int1() interrupt 2 //<EFBFBD>ⲿ<EFBFBD>ж<EFBFBD> 1
191 {
192 1
193 1 count++; //<EFBFBD>ж<EFBFBD>ÿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>Σ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ
194 1
195 1 }
196
197
198
199
200
201
202
3 years ago
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1006 ----
3 years ago
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)