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

📄 f280x_ustep_8sw.h

📁 DSP2808控制步进电机
💻 H
字号:
/* ==================================================================================
File name	:       F280X_uStep_8sw.H                     
                    
Originator	:		Department of Electrical Engineering, KMUTT

Description	:  

Header file containing data type and object definitions and 
initializers. Also contains prototypes for the functions in F281X_MicroStep.C.


    dc-bus+ --------------------------------------------------
                |                 |        |                 |   
               [1]               [3]	  [5]               [7]
                |----(Phase A)----|        |----(Phase B)----|
               [2]               [4]	  [6]               [8]
                |                 |		   |                 |
    dc-bus- --------------------------------------------------

Target: TMS320F281x family

=====================================================================================
 History:
-------------------------------------------------------------------------------------
 06-15-2006	Release	Rev 1.0  
---------------------------------------------------------------------------------- */

#ifndef __F280X_uSTEP_8SW_H__
#define __F280X_uSTEP_8SW_H__

#include "f280xbmsk.h"
#include "IQmathLib.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 uStep_TimeBase_INIT ( FREE_RUN_FLAG +         \
                            PRDLD_IMMEDIATE  +       \
                            TIMER_CNT_UPDN +         \
                            HSPCLKDIV_PRESCALE_X_1 + \
                            CLKDIV_PRESCALE_X_1  +   \
                            PHSDIR_CNT_UP    +       \
                            CNTLD_DISABLE )

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

/*----------------------------------------------------------------------------
Initialization constant for the F280X Action Qualifier Output A Register. 
	-	Clear Output to "Low" when incrementing
	-	Set Output to "High" when decrementing
----------------------------------------------------------------------------*/
#define uStep_PWM1_AQCTLA_INIT ( CAD_SET + CAU_CLEAR )
#define uStep_PWM2_AQCTLA_INIT ( CAD_SET + CAU_CLEAR )
#define uStep_PWM3_AQCTLA_INIT ( CAD_SET + CAU_CLEAR )
#define uStep_PWM4_AQCTLA_INIT ( CAD_SET + CAU_CLEAR )

/*----------------------------------------------------------------------------
Initialization constant for the F280X Dead-Band Generator registers for PWM Generation. 
Sets up the dead band for PWM and sets up dead band values.
	-	Full enable dead time on rising and falling edge
	-	Active High Complement
	-	DBFED-DBRED = 100 :  TBCLK = SYSTEMCLK/1  =>  Dead Time = 1us
----------------------------------------------------------------------------*/
#define  uStep_DBCTL_INIT  (BP_ENABLE + POLSEL_ACTIVE_HI_CMP)
#define  uStep_DBCNT_INIT   100   // 100 counts = 1 usec (delay) * 100 count/usec (for TBCLK = SYSCLK/1)

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

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

// ==================== New Class : Micro Stepping Sine/Cosine Moduration =====================

typedef struct {   
		_iq	Ramp_In;				// Input: Ramp
     	Uint16 Rotation;       		// Input: 0 = PWM1&4 enabled, 1 = PWM2&3 enabled (Q0)
		_iq VoltRef_A;				// Voltage Reference for Phase A
		_iq VoltRef_B;				// Voltage Reference for Phase B
   		int16 DutyFunc_A;        	// Input: PWM period modulation input for phase A (Q15)
		int16 DutyFunc_B;	   	    // Input: PWM period modulation input for phase B (Q15)
   		Uint16 PeriodMax;     	 	// Parameter: Maximum period (Q0)
   		Uint16 PwmActive;           // Parameter: 0 = PWM active low, 1 = PWM active high (0 or 1)
        void (*init)();             // Pointer to the init function 
        void (*SinMod_update)();    // Pointer to the update function
        }uSTEP_8S;  

// ====================== End Class ===========================================================
/*
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. 

This polarity definition is not the same as the PWM polarity(Active High/Active Low) 
defined by the ACTRA register in x281x. The setting chosen here is applicable only 
when ACTRA is configured to generate Active High PWM. 
*/

// ============ Define Object =====================

typedef uSTEP_8S  *uSTEP_8S_handle;

//=================================================

// =================== Initial Class ============================================

#define uSTEP_8S_GEN {	0,	\
						0,	\
						1,	\
						1,	\
						0x4000,	\
						0x4000,	\
						0x4000,	\
						1,		\
						(void(*)(Uint32))F280X_uStep_8s_Init,	\
						(void(*)(Uint32))F280X_uStep_8s_Update	\
                      }

#define uSTEP_8S_DEFAULTS  uSTEP_8S_GEN

// ---------------- End Default Initializer ------------------------------------

/*------------------------------------------------------------------------------
 Prototypes for the functions in F280X_BDCPWM_BIPOLAR.C
------------------------------------------------------------------------------*/
void F280X_uStep_8s_Init(uSTEP_8S_handle);
void F280X_uStep_8s_Update(uSTEP_8S_handle);

#endif



⌨️ 快捷键说明

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