|
|
|
|
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; //դ<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;//<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ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); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
106 2 if(k2==0)
|
|
|
|
|
107 2 {
|
|
|
|
|
108 3 sudu=At24c02Read(10); //<EFBFBD><EFBFBD>ȡEEPROM<EFBFBD><EFBFBD>ַ1<EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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 //<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD> 0
|
|
|
|
|
150 {
|
|
|
|
|
151 1 TH0=0x3C;
|
|
|
|
|
152 1 TL0=0xb0; //50ms<EFBFBD><EFBFBD>ʱ
|
|
|
|
|
153 1 ms++; //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>50ms<EFBFBD><EFBFBD>һ
|
|
|
|
|
154 1 if(ms%5==0) s0=~s0;
|
|
|
|
|
155 1
|
|
|
|
|
156 1
|
|
|
|
|
157 1 if(ms%10==0) //500ms<EFBFBD><EFBFBD>ʱ
|
|
|
|
|
158 1 {
|
|
|
|
|
159 2
|
|
|
|
|
160 2 if(sec!=0) sec--;
|
|
|
|
|
161 2 if(sec1!=0) sec1--;
|
|
|
|
|
162 2 ms=0; //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
163 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>
|
|
|
|
|
164 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
|
|
|
|
|
-0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>20<EFBFBD><EFBFBD>
|
|
|
|
|
165 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;
|
|
|
|
|
166 2 count=0; //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
167 2 EX1=1; //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ⲿ<EFBFBD>ж<EFBFBD>
|
|
|
|
|
168 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>
|
|
|
|
|
- r/min<EFBFBD><EFBFBD> <EFBFBD>ܷ<EFBFBD>ʽ 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 //<EFBFBD>ⲿ<EFBFBD>ж<EFBFBD> 1
|
|
|
|
|
197 {
|
|
|
|
|
198 1
|
|
|
|
|
199 1 count++; //<EFBFBD>ж<EFBFBD>ÿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>Σ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ
|
|
|
|
|
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)
|