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

40 lines
832 B

3 years ago
#ifndef _PWM_H
#define _PWM_H
#include <reg51.h>
#include "IRIN.h"
void delay(unsigned int k);
void run(void);
void backrun(void);
void leftrun(void);
void rightrun(void);
void pwm_out_left_moto(void);
void pwm_out_right_moto(void);
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IO<EFBFBD><EFBFBD>
sbit IN1=P0^4;
sbit IN2=P0^5;
sbit IN3=P0^6;
sbit IN4=P0^7;
sbit EN1=P3^4;
sbit EN2=P3^5;
sbit Left_moto_pwm=P3^5; //PWM<EFBFBD>źŶ<EFBFBD>
sbit Right_moto_pwm=P3^4; //PWM<EFBFBD>źŶ<EFBFBD>
#define Left_moto_go {IN3=0,IN4=1;} //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD>
#define Left_moto_back {IN3=1,IN4=0;} //<EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת
#define Left_moto_Stop {EN1=0;} //<EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD><EFBFBD><EFBFBD>ͣת
#define Right_moto_go {IN1=1,IN2=0;} //<EFBFBD>ұߵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD>
#define Right_moto_back {IN1=0,IN2=1;} //<EFBFBD>ұߵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define Right_moto_Stop {EN2=0;} //<EFBFBD>ұߵ<EFBFBD><EFBFBD><EFBFBD>ͣת
#endif