|
|
|
|
C51 COMPILER V9.56.0.0 PWM 04/09/2022 17:15:06 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 #include <math.h>
|
|
|
|
|
3
|
|
|
|
|
4 unsigned char pwm_val_right =0;
|
|
|
|
|
5 unsigned char push_val_right=0;
|
|
|
|
|
6 unsigned char pwm_value=0;
|
|
|
|
|
7
|
|
|
|
|
8 extern uint Seep_model;
|
|
|
|
|
9 extern struct UserInfo usr;
|
|
|
|
|
10 extern uchar model;
|
|
|
|
|
11 extern uint mileage;
|
|
|
|
|
12
|
|
|
|
|
13 bit Right_moto_stop = 0;
|
|
|
|
|
14
|
|
|
|
|
15 void delay(unsigned int k)
|
|
|
|
|
16 {
|
|
|
|
|
17 1 unsigned int x,y;
|
|
|
|
|
18 1 for(x=0;x<k;x++)
|
|
|
|
|
19 1 for(y=0;y<2000;y++);
|
|
|
|
|
20 1 }
|
|
|
|
|
21
|
|
|
|
|
22 void run(void)
|
|
|
|
|
23 {
|
|
|
|
|
24 1 if(model){
|
|
|
|
|
25 2 Seep_model = usr.Seep_model;
|
|
|
|
|
26 2 usr.Remaining_mileage = usr.target_mileage - mileage;
|
|
|
|
|
27 2 if(usr.Remaining_mileage < 0) usr.Remaining_mileage = 0;
|
|
|
|
|
28 2 if(usr.Remaining_mileage == 0) Seep_model = 0;
|
|
|
|
|
29 2 }else{
|
|
|
|
|
30 2 usr.Remaining_mileage = 0;
|
|
|
|
|
31 2 }
|
|
|
|
|
32 1
|
|
|
|
|
33 1
|
|
|
|
|
34 1 if(Seep_model == 0) pwm_value = 0;
|
|
|
|
|
35 1 else if(Seep_model == 1) pwm_value = 2;
|
|
|
|
|
36 1 else if(Seep_model == 2) pwm_value = 5;
|
|
|
|
|
37 1 else pwm_value = 7;
|
|
|
|
|
38 1 push_val_right=pwm_value;
|
|
|
|
|
39 1 Right_moto_back;
|
|
|
|
|
40 1 }
|
|
|
|
|
41
|
|
|
|
|
42 void pwm_out_right_moto(void)
|
|
|
|
|
43 {
|
|
|
|
|
44 1 pwm_val_right++;
|
|
|
|
|
45 1 if(~Right_moto_stop){
|
|
|
|
|
46 2 if(pwm_val_right <= push_val_right)
|
|
|
|
|
47 2 {
|
|
|
|
|
48 3 Right_moto_pwm=1;
|
|
|
|
|
49 3 }
|
|
|
|
|
50 2 else{
|
|
|
|
|
51 3 Right_moto_pwm=0;
|
|
|
|
|
52 3 }
|
|
|
|
|
53 2 if(pwm_val_right>=20) pwm_val_right=0;
|
|
|
|
|
54 2 }
|
|
|
|
|
55 1 else{
|
|
|
|
|
C51 COMPILER V9.56.0.0 PWM 04/09/2022 17:15:06 PAGE 2
|
|
|
|
|
|
|
|
|
|
56 2 Right_moto_pwm=0;
|
|
|
|
|
57 2 }
|
|
|
|
|
58 1 }
|
|
|
|
|
59
|
|
|
|
|
60
|
|
|
|
|
61
|
|
|
|
|
62
|
|
|
|
|
63
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MODULE INFORMATION: STATIC OVERLAYABLE
|
|
|
|
|
CODE SIZE = 164 ----
|
|
|
|
|
CONSTANT SIZE = ---- ----
|
|
|
|
|
XDATA SIZE = ---- ----
|
|
|
|
|
PDATA SIZE = ---- ----
|
|
|
|
|
DATA SIZE = 3 ----
|
|
|
|
|
IDATA SIZE = ---- ----
|
|
|
|
|
BIT SIZE = 1 ----
|
|
|
|
|
END OF MODULE INFORMATION.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
|