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.
51 lines
719 B
51 lines
719 B
#include "pwm.h" |
|
|
|
unsigned char pwm_val_right =0; |
|
unsigned char push_val_right=0; |
|
|
|
unsigned char pwm_value=0; |
|
|
|
extern uint model; |
|
|
|
bit Right_moto_stop = 0; |
|
|
|
void delay(unsigned int k) |
|
{ |
|
unsigned int x,y; |
|
for(x=0;x<k;x++) |
|
for(y=0;y<2000;y++); |
|
} |
|
|
|
void run(void) |
|
{ |
|
if(model == 0) pwm_value = 0; |
|
else if(model == 1) pwm_value = 2; |
|
else if(model == 2) pwm_value = 5; |
|
else pwm_value = 10; |
|
push_val_right=pwm_value; |
|
Right_moto_back; |
|
} |
|
|
|
void pwm_out_right_moto(void) |
|
{ |
|
pwm_val_right++; |
|
if(~Right_moto_stop){ |
|
if(pwm_val_right <= push_val_right) |
|
{ |
|
Right_moto_pwm=1; |
|
} |
|
else |
|
{ |
|
Right_moto_pwm=0; |
|
} |
|
if(pwm_val_right>=20) pwm_val_right=0; |
|
} |
|
else{ |
|
Right_moto_pwm=0; |
|
} |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|