C51 COMPILER V9.56.0.0 IRIN 04/08/2022 03:09:39 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 6 uint count=0; 7 8 uchar ms=0; 9 uint speed=0; 10 uint r_s=0; 11 12 extern uint model; 13 extern uchar set; 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 LcdSetCursor(0,0); 35 1 LcdShowStr(0,0,""); 36 1 Lcd1602_Write_Data(0x30+speed/100%10); 37 1 Lcd1602_Write_Data(0x30+speed/10%10); 38 1 Lcd1602_Write_Data(0x30+speed%10); 39 1 LcdShowStr(3,0,"KM/h "); 40 1 41 1 LcdShowStr(8,0,""); 42 1 Lcd1602_Write_Data(0x30+mileage/100%10); 43 1 Lcd1602_Write_Data(0x30+mileage/10%10); 44 1 Lcd1602_Write_Data(0x30+mileage%10); 45 1 LcdShowStr(11,0,"m "); 46 1 47 1 if(model == 0) LcdShowStr(13,0," "); 48 1 else if(model == 1) LcdShowStr(13, 0, "L"); 49 1 else if(model == 2) LcdShowStr(13, 0, "M"); 50 1 else LcdShowStr(13, 0, "H"); 51 1 } 52 53 54 void Key_scan(){ 55 1 if(k1==0) C51 COMPILER V9.56.0.0 IRIN 04/08/2022 03:09:39 PAGE 2 56 1 { 57 2 delay11(1000); //消抖处理 58 2 if(k1==0){ 59 3 model++; 60 3 if(model >= 4) model = 0; 61 3 } 62 2 while(!k1); 63 2 } 64 1 65 1 if(k2==0) 66 1 { 67 2 delay11(1000); //消抖处理 68 2 if(k2==0){ 69 3 set = 1; 70 3 } 71 2 while(!k2); 72 2 } 73 1 74 1 } 75 76 void time0() interrupt 1 77 { 78 1 static int time = 0; 79 1 TH0=0XFc; 80 1 TL0=0X18; 81 1 time++; 82 1 pwm_out_right_moto(); 83 1 if(time >= 500){ 84 2 EX1=0; 85 2 time = 0; 86 2 r_s=count; 87 2 count=0; 88 2 EX1=1; 89 2 speed=speed*0.5+(r_s*6)*0.5; 90 2 speed=(0.15*speed); 91 2 mileage = mileage+(r_s*2.5/20); 92 2 } 93 1 } 94 95 void int1() interrupt 2 96 { 97 1 count++; 98 1 } 99 100 101 102 103 104 105 MODULE INFORMATION: STATIC OVERLAYABLE CODE SIZE = 623 ---- CONSTANT SIZE = 26 ---- XDATA SIZE = ---- ---- PDATA SIZE = ---- ---- DATA SIZE = 11 ---- IDATA SIZE = ---- ---- BIT SIZE = ---- ---- END OF MODULE INFORMATION. C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)