⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 motor.h

📁 基于Cortex-M3的全自动焊接机
💻 H
字号:
#ifndef _MOTOR_H
#define _MOTOR_H
#include "hw_types.h"
#include "hw_memmap.h"
#include "gpio.h"



#define CON_485         SYSCTL_PERIPH_GPIOA
#define CON_485_BASE    GPIO_PORTA_BASE
#define CON_485_PIN     GPIO_PIN_2

//1号电机使能端口设置PD2
#define  Motor1_Enable_PERIPH             SYSCTL_PERIPH_GPIOD
#define  Motor1_Enable_PORT               GPIO_PORTD_BASE
#define  Motor1_Enable_PIN                GPIO_PIN_2


//2号电机使能端口设置PD2
#define  Motor2_Enable_PERIPH             SYSCTL_PERIPH_GPIOD
#define  Motor2_Enable_PORT               GPIO_PORTD_BASE
#define  Motor2_Enable_PIN                GPIO_PIN_3

//3号电机使能端口设置PC4
#define  Motor3_Enable_PERIPH             SYSCTL_PERIPH_GPIOC
#define  Motor3_Enable_PORT               GPIO_PORTC_BASE
#define  Motor3_Enable_PIN                GPIO_PIN_4


//1号电机
#define  Motor_Enco_PERIPH1               SYSCTL_PERIPH_GPIOC
#define  Motor1_use_group         INT_GPIOC
#define  Motor_Enco_PORT1                 GPIO_PORTC_BASE

#define  Motor1_Enco_A                  GPIO_PIN_6
#define  Motor1_Enco_B                  GPIO_PIN_7


//2号电机
#define  Motor_Enco_PERIPH2              SYSCTL_PERIPH_GPIOA
#define  Motor2_use_group       INT_GPIOA
#define  Motor_Enco_PORT2                GPIO_PORTA_BASE


#define  Motor2_Enco_A                 GPIO_PIN_3
#define  Motor2_Enco_B                 GPIO_PIN_4


//3号电机
#define  Motor_Enco_PERIPH3              SYSCTL_PERIPH_GPIOD
#define  Motor3_use_group      INT_GPIOD
#define  Motor_Enco_PORT3                GPIO_PORTD_BASE


#define  Motor3_Enco_A                 GPIO_PIN_5
#define  Motor3_Enco_B                 GPIO_PIN_4


#define  Forward   1               //正转
#define  Reverse   0               //反转

#define  Start     0               //启动
#define  Stop      1               //停止




void Motor1_Enable_IOinit(void);
void  Motor1Direct(tBoolean bDirect);
void  Motor1_Enable(tBoolean bEnable);


void  Motor2_Enable(tBoolean bEnable);
void  Motor2Direct(tBoolean bDirect);
void Motor2_Enable_IOinit(void);

void Motor3_Enable_IOinit(void);
void  Motor3Direct(tBoolean bDirect);
void  Motor3_Enable(tBoolean bEnable);
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -