#include "stm8s.h"
#define H1_PORT GPIOD->IDR
#define H1_PIN BIT4
#define H2_PORT GPIOD->IDR
#define H2_PIN BIT3
#define H3_PORT GPIOD->IDR
#define H3_PIN BIT2
extern unsigned char St_F;
extern unsigned char FaultF;//故障标志
extern unsigned char Run_dir;
extern unsigned int OutPwmValue;
extern unsigned char bHallStartStep;
#define BIT0 0x01
#define BIT1 0x02
#define BIT2 0x04
#define BIT3 0x08
#define BIT4 0x10
#define BIT5 0x20
#define BIT6 0x40
#define BIT7 0x80
//下桥臂开关控制端口定义
#define MCO0_PORT GPIOB
#define MCO0_PIN GPIO_PIN_0
#define MCO2_PORT GPIOB
#define MCO2_PIN GPIO_PIN_1
#define MCO4_PORT GPIOB
#define MCO4_PIN GPIO_PIN_2
#define PWM_A_ON MCO0_PORT->ODR |= (u8)MCO0_PIN;
#define PWM_B_ON MCO2_PORT->ODR |= (u8)MCO2_PIN;
#define PWM_C_ON MCO4_PORT->ODR |= (u8)MCO4_PIN;
#define PWM_A_OFF MCO0_PORT->ODR &= (u8)(~MCO0_PIN);
#define PWM_B_OFF MCO2_PORT->ODR &= (u8)(~MCO2_PIN);
#define PWM_C_OFF MCO2_PORT->ODR &= (u8)(~MCO4_PIN);
void Init_TIM2(void);
void TIM2_InitCapturePolarity(void);
void ComHandler(void);
此帖出自
小平头技术问答
一周热门 更多>