#include "hall.h"
unsigned char bHallStartStep;//换相步序变量定义
//换相步序值0-5分别对应ABACBCBACACB
unsigned int OutPwmValue=0;//PWM输出值变量定义
unsigned char St_F=0;//启停标志,0时为停止,1时为启动
unsigned char FaultF=0;//故障标志
unsigned char Run_dir=0;//运转方向,0-1对立
unsigned char bHallSteps[2][8]={
{7,5,3,4,1,0,2,7},//正转
{7,2,0,1,4,3,5,7}//反转
};
const unsigned char PWM_EN1_TAB[6]={0x01,0x01,0x10,0x10,0x00,0x00};
//六步法中,CH1CH2通道极性及使能配置
const unsigned char PWM_EN2_TAB[6]={0x0,0x00,0x00,0x0,0x1,0x1};
//六步法中,CH3通道极性及使能配置
此帖出自
小平头技术问答
TIM1->CCER2=PWM_EN2_TAB[bHallStartStep];
然后 bHallStartStep是个变量,再结合PWM_EN2_TAB【】这个数组,再看看CCER1和2的寄存器,你就能看明白了
一周热门 更多>