⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dsp281x_en.c

📁 附件程序是我用DSP2812开发的无刷直流电机控制程序
💻 C
字号:
/* ==================================================================================
File name:       DSP281x_EN.C
                    
Originator:	Digital Control Systems Group
			Texas Instruments

Description:  This program configures the I/O pins and enables/disables the drive on MCK2812

Target: TMS320F281x family
              
=====================================================================================
History:
-------------------------------------------------------------------------------------
 04-15-2005	Version 3.20: Using DSP281x v. 1.00 or higher 
------------------------------------------------------------------------------------*/

#include "DSP281x_Device.h"
#include "DSP281x_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
       }   
       
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -