📄 f280x_en.c
字号:
/* ==================================================================================
File name: F280X_EN.C
Originator: Digital Control Systems Group
Texas Instruments
Description: This program configures the I/O pins and enables/disables the drive on DMC1500
Target: TMS320F280x family
=====================================================================================
History:
-------------------------------------------------------------------------------------
04-15-2005 Version 3.20: Using DSP280x v. 1.10 or higher
------------------------------------------------------------------------------------*/
#include "DSP280x_Device.h"
#include "f280x_en.h"
void F280X_DRIVE_Init(DRIVE *p)
{
EALLOW; // Enable EALLOW
// IOPB4: strobe_ (T1PWM_GPIOA6); IOPB6: enable_ (TDIRA_GPIOA11)
GpioCtrlRegs.GPAMUX2.bit.GPIO27 = 0; // GPIO27 is T1PWM_GPIOA6
GpioCtrlRegs.GPAMUX1.bit.GPIO13 = 0; // GPIO13 is TDIRA_GPIOA11
// config IOPB27 & IOPB13 as outputs and output "1" to disable drive
GpioCtrlRegs.GPADIR.bit.GPIO27 = 1; // GPIO27 is T1PWM_GPIOA6
GpioCtrlRegs.GPADIR.bit.GPIO13 = 1; // GPIO13 is TDIRA_GPIOA11
EDIS; // Disable EALLOW
}
void F280X_DRIVE_Update(DRIVE *p)
{
if (p->EnableFlag==1) // Enable PWM drive on DMC1500
{ // IOPB4 (T1PWM_GPIOA6) & IOPB6 (T1PWM_GPIOA11)
GpioDataRegs.GPADAT.bit.GPIO27 = 0; // IOPB4 low (T1PWM_GPIOA6)
GpioDataRegs.GPADAT.bit.GPIO27 = 1; // IOPB4 high (T1PWM_GPIOA6)
GpioDataRegs.GPADAT.bit.GPIO13 = 0; // IOPB6 low (T1PWM_GPIOA11)
}
else if (p->EnableFlag==0) // Disable PWM drive on DMC1500
{ // IOPB4 (T1PWM_GPIOA6) & IOPB6 (T1PWM_GPIOA11) outputs high
GpioDataRegs.GPADAT.bit.GPIO27 = 1; // GPIO27 is T1PWM_GPIOA6
GpioDataRegs.GPADAT.bit.GPIO13 = 1; // GPIO13 is TDIRA_GPIOA11
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -