兼职项目 智能自行车
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.
 
 
 

142 lines
4.7 KiB

C51 COMPILER V9.56.0.0 IRIN 04/09/2022 17:31:01 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 mileage = 0;
5 uint count=0;
6 uchar ms=0;
7 uint speed=0;
8 uint r_s=0;
9
10 extern uchar play;
11 extern uint Seep_model;
12 extern struct UserInfo usr;
13 extern uchar model;
14
15 void delay11(int i)
16 {
17 1 while(i--);
18 1 }
19
20 void IRIN_Init(void)
21 {
22 1 TMOD=0x01 | 0x20;
23 1 TH0=0XFc;
24 1 TL0=0X18;
25 1 ET0=1;
26 1 TR0=1;
27 1 EA=1;
28 1 EX1=1;
29 1 IT1=1;
30 1 }
31
32 void display()
33 {
34 1 // 显示速度
35 1 LcdWriteCom(0x80 + 2);
36 1 LcdWriteData(0x30+speed/100%10);
37 1 LcdWriteData(0x30+speed/10%10);
38 1 LcdWriteData(0x30+speed%10);
39 1
40 1 // 显示里程
41 1 LcdWriteCom(0x80 + 8);
42 1 LcdWriteData(0x30+mileage/1000%10);
43 1 LcdWriteData(0x30+mileage/100%10);
44 1 LcdWriteData(0x30+mileage/10%10);
45 1 LcdWriteData(0x30+mileage%10);
46 1 LcdWriteData('m');
47 1
48 1 LcdWriteCom(0x80 + 14);
49 1 if(Seep_model == 0) LcdWriteData('N');
50 1 else if(Seep_model == 1) LcdWriteData('L');
51 1 else if(Seep_model == 2) LcdWriteData('M');
52 1 else if(Seep_model == 3) LcdWriteData('H');
53 1
54 1 // 显示目标里程
55 1 LcdWriteCom(0x80 + 0x40);
C51 COMPILER V9.56.0.0 IRIN 04/09/2022 17:31:01 PAGE 2
56 1 LcdWriteData(0x30+usr.target_mileage/1000%10);
57 1 LcdWriteData(0x30+usr.target_mileage/100%10);
58 1 LcdWriteData(0x30+usr.target_mileage/10%10);
59 1 LcdWriteData(0x30+usr.target_mileage%10);
60 1 LcdWriteData('m');
61 1
62 1 LcdWriteCom(0x80 + 0x40 + 8);
63 1 LcdWriteData(0x30+usr.Remaining_mileage/1000%10);
64 1 LcdWriteData(0x30+usr.Remaining_mileage/100%10);
65 1 LcdWriteData(0x30+usr.Remaining_mileage/10%10);
66 1 LcdWriteData(0x30+usr.Remaining_mileage%10);
67 1 LcdWriteData('m');
68 1
69 1 LcdWriteCom(0x80 + 0x40 + 14);
70 1 if(model == 0) LcdWriteData('D');
71 1 else LcdWriteData('S');
72 1 }
73
74 void Key_scan(){
75 1 if(k1==0){
76 2 delay11(1000);
77 2 if(k1==0){
78 3 Seep_model++;
79 3 if(Seep_model >= 4) Seep_model = 0;
80 3 }
81 2 while(!k1);
82 2 }
83 1 }
84
85 void time0() interrupt 1
86 {
87 1 static int time = 0;
88 1 TH0=0XFc;
89 1 TL0=0X18;
90 1 time++;
91 1 pwm_out_right_moto();
92 1 if(time >= 500){
93 2 EX1=0;
94 2 time = 0;
95 2 r_s = count * 3 / 20; // 500ms计算一次 求每秒钟的圈数,珊格数为20 r_s = count * 2 / 2
-0
96 2 speed= (r_s * 6) * 2;
97 2 mileage = mileage + (count / 20 * 3);
98 2 if(mileage > 9999) mileage = 9999;
99 2 count=0;
100 2 EX1 = 1;
101 2 }
102 1 }
103
104 void int1() interrupt 2
105 {
106 1 count++;
107 1 }
108
109
110
111
112
113
114
C51 COMPILER V9.56.0.0 IRIN 04/09/2022 17:31:01 PAGE 3
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 712 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 11 ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)