TI中文支持网
TI专业的中文技术问题搜集分享网站

BLDC_Sensorless 代码是不是有问题

在这个文件 COM_TRIG.H  里面 有这样一段代码,应该是有问题吧,那个宏 NOISE_WINDOW_CNT_MACRO 的使用是不是应该加一个花括号才对啊?

/*———————————————————————————————-
NOISE_WINDOW_CNT Macro Definition
———————————————————————————————-*/

#define NOISE_WINDOW_CNT_MACRO(v) \
if (v.CmtnDelay >= v.NWDelayThres) /* noise window is fixed Value*/ \
v.NoiseWindowMax = v.NWDelayThres – v.NWDelta; \
else /* noise window adjusted dynamically*/ \
v.NoiseWindowMax = v.CmtnDelay – v.NWDelta; \
\
v.NoiseWindowCounter += 1; \
\
if (v.NoiseWindowCounter == v.NoiseWindowMax) /* zc must occur max_noise_window times*/ \
{ \
v.ZcTrig = 0x00007FFF; /* Yes! Set trigger */ \
v.NoiseWindowCounter = 0; \
}

/* Commutation State table Tasks*/ \
/* State s1: current flows to motor windings from phase A->B, de-energized phase = C*/ \
if (v.CmtnPointer == 0) \
{ \
v.DebugBemf = _IQmpy(_IQ(3),v.Vc) – v.Neutral; \
if (v.DebugBemf > 0) \
v.NoiseWindowCounter = 0; \
else /* Zero crossing Noise window processing*/ \
NOISE_WINDOW_CNT_MACRO(v); \
} /* else if-end: State s1*/

guojing xie:

附件为c code

在这个文件 COM_TRIG.H  里面 有这样一段代码,应该是有问题吧,那个宏 NOISE_WINDOW_CNT_MACRO 的使用是不是应该加一个花括号才对啊?

/*———————————————————————————————-
NOISE_WINDOW_CNT Macro Definition
———————————————————————————————-*/

#define NOISE_WINDOW_CNT_MACRO(v) \
if (v.CmtnDelay >= v.NWDelayThres) /* noise window is fixed Value*/ \
v.NoiseWindowMax = v.NWDelayThres – v.NWDelta; \
else /* noise window adjusted dynamically*/ \
v.NoiseWindowMax = v.CmtnDelay – v.NWDelta; \
\
v.NoiseWindowCounter += 1; \
\
if (v.NoiseWindowCounter == v.NoiseWindowMax) /* zc must occur max_noise_window times*/ \
{ \
v.ZcTrig = 0x00007FFF; /* Yes! Set trigger */ \
v.NoiseWindowCounter = 0; \
}

/* Commutation State table Tasks*/ \
/* State s1: current flows to motor windings from phase A->B, de-energized phase = C*/ \
if (v.CmtnPointer == 0) \
{ \
v.DebugBemf = _IQmpy(_IQ(3),v.Vc) – v.Neutral; \
if (v.DebugBemf > 0) \
v.NoiseWindowCounter = 0; \
else /* Zero crossing Noise window processing*/ \
NOISE_WINDOW_CNT_MACRO(v); \
} /* else if-end: State s1*/

Seven Han:

你好,这个不需要吧,不是都有换行续航符\

赞(0)
未经允许不得转载:TI中文支持网 » BLDC_Sensorless 代码是不是有问题
分享到: 更多 (0)