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.
|
|
|
|
#ifndef __MOTOR_H
|
|
|
|
|
#define __MOTOR_H
|
|
|
|
|
#include "sys.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define ENA PBout(0)//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
#define ENB PBout(5)
|
|
|
|
|
|
|
|
|
|
#define IN1 PBout(12)
|
|
|
|
|
#define IN2 PBout(13)
|
|
|
|
|
#define IN3 PBout(14)
|
|
|
|
|
#define IN4 PBout(15)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define Right_moto_go {IN3=0,IN4=1;} //<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD>
|
|
|
|
|
#define Right_moto_back {IN3=1,IN4=0;} //<EFBFBD>ұߵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת
|
|
|
|
|
#define Left_moto_Stop {ENA=0;} //<EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD><EFBFBD><EFBFBD>ͣת
|
|
|
|
|
#define Left_moto_go {IN1=0,IN2=1;} //<EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD>
|
|
|
|
|
#define Left_moto_back {IN1=1,IN2=0;} //<EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
#define Right_moto_Stop {ENB=0;} //<EFBFBD>ұߵ<EFBFBD><EFBFBD><EFBFBD>ͣת
|
|
|
|
|
|
|
|
|
|
void motor_Init(void);//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>IO<EFBFBD>ڳ<EFBFBD>ʼ<EFBFBD><EFBFBD>
|
|
|
|
|
void PWM_init(void);//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٶȳ<EFBFBD>ʼ<EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
void run(void);//ǰ<EFBFBD><EFBFBD>
|
|
|
|
|
void backrun(void);//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void leftrun(void);//<EFBFBD><EFBFBD>ת
|
|
|
|
|
void rightrun(void);//<EFBFBD><EFBFBD>ת
|
|
|
|
|
void stop(void);//ֹͣ
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|