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

请教TI工程师,TI异步电机控制例程F281XACI33中,f281x_en.c源程序模块的作用?

请问,在中断函数中以下语句的作用?

// ——————————————————————————
// Connect inputs of the EN_DRV module and call the enable/disable PWM signal
// update function. (FOR DMC1500 ONLY)// —————————————————————————— drv1.EnableFlag = EnableFlag;
drv1.update(&drv1);

 F281X_EN.C源程序如下

#include "DSP281x_Device.h"
#include "f281x_en.h"

void F281X_EV1_DRIVE_Init(DRIVE *p){ // IOPB4: strobe_ (T1PWM_GPIOA6); IO PB6: enable_ (TDIRA_GPIOA11)
EALLOW; // Enable EALLOW
GpioMuxRegs.GPAMUX.bit.T1PWM_GPIOA6 = 0;
GpioMuxRegs.GPAMUX.bit.TDIRA_GPIOA11 = 0;
// config IOPB4 & IOPB6 as outputs and output "1" to disable drive
GpioMuxRegs.GPADIR.bit.GPIOA6 = 1;
GpioMuxRegs.GPADIR.bit.GPIOA11 = 1;
EDIS; // Disable EALLOW
}

void F281X_EV1_DRIVE_Update(DRIVE *p){ if (p->EnableFlag==1) // Enable PWM drive on DMC1500
{
GpioDataRegs.GPADAT.bit.GPIOA6 = 0; // IOPB4 low (T1PWM_GPIOA6) GpioDataRegs.GPADAT.bit.GPIOA6 = 1; // IOPB4 high (T1PWM_GPIOA6) GpioDataRegs.GPADAT.bit.GPIOA11 = 0; // IOPB6 low (T1PWM_GPIOA11)
}
else if (p->EnableFlag==0) // Disable PWM drive on DMC1500
{
GpioDataRegs.GPADAT.all |= 0x0840; // IOPB4 (T1PWM_GPIOA6) & IOPB6 (T1PWM_GPIOA11) outputs high
}}

请问,我如果将TI的例程移值到另外一块开发板上,这段程序是否要加入?还是说要做一些改动?谢谢

Johnson Chen1:

楼主你好!

这个作用只是单片机输出的PWM信号可以进入到驱动级,这一个更具体硬件电路有关,是否需要要看你的硬件电路是否和里程中用的DEMO板一样,如果你的驱动电路不一样的话,可能不需要或者要另外处理。

请问,在中断函数中以下语句的作用?

// ——————————————————————————
// Connect inputs of the EN_DRV module and call the enable/disable PWM signal
// update function. (FOR DMC1500 ONLY)// —————————————————————————— drv1.EnableFlag = EnableFlag;
drv1.update(&drv1);

 F281X_EN.C源程序如下

#include "DSP281x_Device.h"
#include "f281x_en.h"

void F281X_EV1_DRIVE_Init(DRIVE *p){ // IOPB4: strobe_ (T1PWM_GPIOA6); IO PB6: enable_ (TDIRA_GPIOA11)
EALLOW; // Enable EALLOW
GpioMuxRegs.GPAMUX.bit.T1PWM_GPIOA6 = 0;
GpioMuxRegs.GPAMUX.bit.TDIRA_GPIOA11 = 0;
// config IOPB4 & IOPB6 as outputs and output "1" to disable drive
GpioMuxRegs.GPADIR.bit.GPIOA6 = 1;
GpioMuxRegs.GPADIR.bit.GPIOA11 = 1;
EDIS; // Disable EALLOW
}

void F281X_EV1_DRIVE_Update(DRIVE *p){ if (p->EnableFlag==1) // Enable PWM drive on DMC1500
{
GpioDataRegs.GPADAT.bit.GPIOA6 = 0; // IOPB4 low (T1PWM_GPIOA6) GpioDataRegs.GPADAT.bit.GPIOA6 = 1; // IOPB4 high (T1PWM_GPIOA6) GpioDataRegs.GPADAT.bit.GPIOA11 = 0; // IOPB6 low (T1PWM_GPIOA11)
}
else if (p->EnableFlag==0) // Disable PWM drive on DMC1500
{
GpioDataRegs.GPADAT.all |= 0x0840; // IOPB4 (T1PWM_GPIOA6) & IOPB6 (T1PWM_GPIOA11) outputs high
}}

请问,我如果将TI的例程移值到另外一块开发板上,这段程序是否要加入?还是说要做一些改动?谢谢

ACIMFOC:

回复 Johnson Chen1:

johnson,您好,您的解释我还是有点疑问,例程中不是已经有程序产生6路PWM波形输入到驱动板的IGBT中吗?为何这里还要加这条语句呀–如下

drv1.EnableFlag = EnableFlag; drv1.update(&drv1);

请问,在中断函数中以下语句的作用?

// ——————————————————————————
// Connect inputs of the EN_DRV module and call the enable/disable PWM signal
// update function. (FOR DMC1500 ONLY)// —————————————————————————— drv1.EnableFlag = EnableFlag;
drv1.update(&drv1);

 F281X_EN.C源程序如下

#include "DSP281x_Device.h"
#include "f281x_en.h"

void F281X_EV1_DRIVE_Init(DRIVE *p){ // IOPB4: strobe_ (T1PWM_GPIOA6); IO PB6: enable_ (TDIRA_GPIOA11)
EALLOW; // Enable EALLOW
GpioMuxRegs.GPAMUX.bit.T1PWM_GPIOA6 = 0;
GpioMuxRegs.GPAMUX.bit.TDIRA_GPIOA11 = 0;
// config IOPB4 & IOPB6 as outputs and output "1" to disable drive
GpioMuxRegs.GPADIR.bit.GPIOA6 = 1;
GpioMuxRegs.GPADIR.bit.GPIOA11 = 1;
EDIS; // Disable EALLOW
}

void F281X_EV1_DRIVE_Update(DRIVE *p){ if (p->EnableFlag==1) // Enable PWM drive on DMC1500
{
GpioDataRegs.GPADAT.bit.GPIOA6 = 0; // IOPB4 low (T1PWM_GPIOA6) GpioDataRegs.GPADAT.bit.GPIOA6 = 1; // IOPB4 high (T1PWM_GPIOA6) GpioDataRegs.GPADAT.bit.GPIOA11 = 0; // IOPB6 low (T1PWM_GPIOA11)
}
else if (p->EnableFlag==0) // Disable PWM drive on DMC1500
{
GpioDataRegs.GPADAT.all |= 0x0840; // IOPB4 (T1PWM_GPIOA6) & IOPB6 (T1PWM_GPIOA11) outputs high
}}

请问,我如果将TI的例程移值到另外一块开发板上,这段程序是否要加入?还是说要做一些改动?谢谢

Johnson Chen1:

回复 ACIMFOC:

DMC1500的驱动电路你有的话,可以贴上来看一下。

单片机输出的PWM如果经过了驱动芯片如74XXX244之类芯片或者DRV芯片,那么这些芯片本身也要需要使能,否则PWM无法输出到下一级。

请问,在中断函数中以下语句的作用?

// ——————————————————————————
// Connect inputs of the EN_DRV module and call the enable/disable PWM signal
// update function. (FOR DMC1500 ONLY)// —————————————————————————— drv1.EnableFlag = EnableFlag;
drv1.update(&drv1);

 F281X_EN.C源程序如下

#include "DSP281x_Device.h"
#include "f281x_en.h"

void F281X_EV1_DRIVE_Init(DRIVE *p){ // IOPB4: strobe_ (T1PWM_GPIOA6); IO PB6: enable_ (TDIRA_GPIOA11)
EALLOW; // Enable EALLOW
GpioMuxRegs.GPAMUX.bit.T1PWM_GPIOA6 = 0;
GpioMuxRegs.GPAMUX.bit.TDIRA_GPIOA11 = 0;
// config IOPB4 & IOPB6 as outputs and output "1" to disable drive
GpioMuxRegs.GPADIR.bit.GPIOA6 = 1;
GpioMuxRegs.GPADIR.bit.GPIOA11 = 1;
EDIS; // Disable EALLOW
}

void F281X_EV1_DRIVE_Update(DRIVE *p){ if (p->EnableFlag==1) // Enable PWM drive on DMC1500
{
GpioDataRegs.GPADAT.bit.GPIOA6 = 0; // IOPB4 low (T1PWM_GPIOA6) GpioDataRegs.GPADAT.bit.GPIOA6 = 1; // IOPB4 high (T1PWM_GPIOA6) GpioDataRegs.GPADAT.bit.GPIOA11 = 0; // IOPB6 low (T1PWM_GPIOA11)
}
else if (p->EnableFlag==0) // Disable PWM drive on DMC1500
{
GpioDataRegs.GPADAT.all |= 0x0840; // IOPB4 (T1PWM_GPIOA6) & IOPB6 (T1PWM_GPIOA11) outputs high
}}

请问,我如果将TI的例程移值到另外一块开发板上,这段程序是否要加入?还是说要做一些改动?谢谢

ACIMFOC:

回复 Johnson Chen1:

你好,谢谢你的回答,我没有用DMC1500,PWM1~6从DSP相应的I/O输出后,经过一个电平转换芯片,转换电5V的驱动信号就直接送入到了三菱的IPM驱动板当中啦,请问这样是否需要加使能程序呀?

请问,在中断函数中以下语句的作用?

// ——————————————————————————
// Connect inputs of the EN_DRV module and call the enable/disable PWM signal
// update function. (FOR DMC1500 ONLY)// —————————————————————————— drv1.EnableFlag = EnableFlag;
drv1.update(&drv1);

 F281X_EN.C源程序如下

#include "DSP281x_Device.h"
#include "f281x_en.h"

void F281X_EV1_DRIVE_Init(DRIVE *p){ // IOPB4: strobe_ (T1PWM_GPIOA6); IO PB6: enable_ (TDIRA_GPIOA11)
EALLOW; // Enable EALLOW
GpioMuxRegs.GPAMUX.bit.T1PWM_GPIOA6 = 0;
GpioMuxRegs.GPAMUX.bit.TDIRA_GPIOA11 = 0;
// config IOPB4 & IOPB6 as outputs and output "1" to disable drive
GpioMuxRegs.GPADIR.bit.GPIOA6 = 1;
GpioMuxRegs.GPADIR.bit.GPIOA11 = 1;
EDIS; // Disable EALLOW
}

void F281X_EV1_DRIVE_Update(DRIVE *p){ if (p->EnableFlag==1) // Enable PWM drive on DMC1500
{
GpioDataRegs.GPADAT.bit.GPIOA6 = 0; // IOPB4 low (T1PWM_GPIOA6) GpioDataRegs.GPADAT.bit.GPIOA6 = 1; // IOPB4 high (T1PWM_GPIOA6) GpioDataRegs.GPADAT.bit.GPIOA11 = 0; // IOPB6 low (T1PWM_GPIOA11)
}
else if (p->EnableFlag==0) // Disable PWM drive on DMC1500
{
GpioDataRegs.GPADAT.all |= 0x0840; // IOPB4 (T1PWM_GPIOA6) & IOPB6 (T1PWM_GPIOA11) outputs high
}}

请问,我如果将TI的例程移值到另外一块开发板上,这段程序是否要加入?还是说要做一些改动?谢谢

Martin Yu:

回复 ACIMFOC:

推荐在硬件电路上增加驱动脉冲(PWM)封锁电路,即发生异常时(如过流等)可以软件禁止PWM和硬件封锁PWM输出到IPM两级保护机制,那么还是需要增加这部分代码,具体的IO口根据电路选择合适的。

赞(0)
未经允许不得转载:TI中文支持网 » 请教TI工程师,TI异步电机控制例程F281XACI33中,f281x_en.c源程序模块的作用?
分享到: 更多 (0)