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

📄 f280xbldcpwm.h

📁 DSP280X芯片的编程简单例子
💻 H
字号:
/* ==================================================================================
File name:        F280XBLDCPWM.H                     
                    
Originator:	Digital Control Systems Group
			Texas Instruments
Description:  
Header file containing data type and object definitions and 
initializers. Also contains prototypes for the functions in F280XBLDCPWM.C.

Target: TMS320F280x family
              
=====================================================================================
History:
-------------------------------------------------------------------------------------
 04-15-2005	Version 3.20: Using DSP280x v. 1.10 or higher 
------------------------------------------------------------------------------------*/

#ifndef __F280X_BLDCPWM_H__
#define __F280X_BLDCPWM_H__

#include "f280xbmsk.h"

/*----------------------------------------------------------------------------
Initialization constant for the F280X Time-Base Control Registers for PWM Generation. 
Sets up the timer to run free upon emulation suspend, count up mode
prescaler 1.
----------------------------------------------------------------------------*/
#define BLDCPWM_INIT_STATE ( FREE_RUN_FLAG +         \
                            PRDLD_IMMEDIATE  +       \
                            TIMER_CNT_UP +         \
                            HSPCLKDIV_PRESCALE_X_1 + \
                            CLKDIV_PRESCALE_X_1  +   \
                            PHSDIR_CNT_UP    +       \
                            CNTLD_DISABLE )

/*----------------------------------------------------------------------------
Initialization constant for the F280X Compare Control Register. 
----------------------------------------------------------------------------*/
#define BLDCPWM_CMPCTL_INIT_STATE ( LOADAMODE_ZRO + \
                                   LOADBMODE_ZRO + \
                                   SHDWAMODE_SHADOW + \
                                   SHDWBMODE_SHADOW )

/*----------------------------------------------------------------------------
Initialization constant for the F280X Action Qualifier Output A Register. 
----------------------------------------------------------------------------*/
#define  BLDCPWM_AQCTLA_INIT_STATE  CAU_SET

/*----------------------------------------------------------------------------
Initialization constant for the F280X Dead-Band Control Generator register.
----------------------------------------------------------------------------*/
#define  BLDCPWM_DBCTL_INIT_STATE  BP_DISABLE

/*----------------------------------------------------------------------------
Initialization constant for the F280X PWM Chopper Control register for PWM Generation. 
----------------------------------------------------------------------------*/
#define  BLDCPWM_PCCTL_INIT_STATE  CHPEN_DISABLE

/*----------------------------------------------------------------------------
Initialization constant for the F280X Trip Zone Select Register 
----------------------------------------------------------------------------*/
#define  BLDCPWM_TZSEL_INIT_STATE  DISABLE_TZSEL
              
/*----------------------------------------------------------------------------
Initialization constant for the F280X Trip Zone Control Register 
----------------------------------------------------------------------------*/
#define  BLDCPWM_TZCTL_INIT_STATE ( TZA_HI_Z + TZB_HI_Z + \
                                   DCAEVT1_HI_Z + DCAEVT2_HI_Z + \
                                   DCBEVT1_HI_Z + DCBEVT2_HI_Z )

/*-----------------------------------------------------------------------------
Define the structure of the PWM Driver Object 
-----------------------------------------------------------------------------*/

typedef struct {  
     	Uint16 CmtnPointer;    	// Input: Commutation (or switching) state pointer input (Q0)
   		int16 MfuncPeriod;      // Input: Duty ratio of the PWM outputs (Q15) 
   		Uint16 PeriodMax;    	// Parameter: Maximum period (Q0)
   		int16 DutyFunc;   	    // Input: PWM period modulation input (Q15)
   		Uint16 PwmActive;     	// Parameter: 0 = PWM active low, 1 = PWM active high (0 or 1)
   		void (*init)();   	    // Pointer to the init function 
   		void (*update)();     	// Pointer to the update function
       } PWMGEN;

/*
The "PwmActive" setting depends on Power devices. 
when PwmActive = 1 (active high) implies the power device turns ON with a HIGH gate signal. 
     PwmActive = 0 (active low) implies the power device turns ON with a LOW gate signal. 
*/

/*-----------------------------------------------------------------------------
Define a PWMGEN_handle
-----------------------------------------------------------------------------*/
typedef PWMGEN *PWMGEN_handle;

/*------------------------------------------------------------------------------
Default Initializers for the F281X PWMGEN Object 
------------------------------------------------------------------------------*/
#define F280X_BLDC_PWM_GEN   {0x0000, \
                                0x7FFF, \
                                0x1D4C, \
                                0x0000, \
                                0x0001, \
                             (void (*)(Uint32))F280X_BLDC_PWM_Init,  \
                             (void (*)(Uint32))F280X_BLDC_PWM_Update \
                             }

#define PWMGEN_DEFAULTS 	F280X_BLDC_PWM_GEN
/*------------------------------------------------------------------------------
 Prototypes for the functions in F280XBLDCPWM.C
------------------------------------------------------------------------------*/
void F280X_BLDC_PWM_Init(PWMGEN_handle);
void F280X_BLDC_PWM_Update(PWMGEN_handle);

#endif  // __F280X_BLDCPWM_H__

⌨️ 快捷键说明

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