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

📄 f243_pwm.h

📁 TI的digital motor control lib的源代码。了解TI的编程规范
💻 H
字号:
/* ==================================================================================
File name:        F243_PWM.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 
F243_PWM.C.
=====================================================================================
 History:
-------------------------------------------------------------------------------------
 9-15-2000	Release	Rev 1.0                                                  
---------------------------------------------------------------------------------- */

#ifndef __F243_PWM_H__
#define __F243_PWM_H__
#include "F243BMSK.H"

             
/*----------------------------------------------------------------------------
Initialization constant for the F243 Timer T1CON for PWM Generation. 
Sets up the timer to run free upon emulation suspend, continuous up-down mode
prescaler 1, timer enabled.
----------------------------------------------------------------------------*/
#define PWM_INIT_STATE  (FREE_RUN_FLAG +         \
                        TIMER_CONT_UPDN +        \
                        TIMER_CLK_PRESCALE_X_1 + \
                        TIMER_ENABLE_BY_OWN    + \
                        TIMER_ENABLE)
/*----------------------------------------------------------------------------
Initialization constant for the F243 ACTR register for PWM Generation. 
Sets up PWM polarities.
----------------------------------------------------------------------------*/
#define ACTR_INIT_STATE ( COMPARE1_AH + \
                          COMPARE2_AL + \
                          COMPARE3_AH + \
                          COMPARE4_AL + \
                          COMPARE5_AH + \
                          COMPARE6_AL )

/*----------------------------------------------------------------------------
Initialization constant for the F243 DBTCON register for PWM Generation. 
Sets up the dead band for PWM 1 -6 and sets up dead band values.
----------------------------------------------------------------------------*/
#define DBTCON_INIT_STATE ( DBT_VAL_10 +  \
                            EDBT3_EN   +  \
                            EDBT2_EN   +  \
                            EDBT1_EN   +  \
                            DBTPS_X4 )
/*-----------------------------------------------------------------------------
Define the structure of the PWM Driver Object 
-----------------------------------------------------------------------------*/
typedef struct {   
                                   
        int period_max;        /* PWM Period in CPU clock cycles.  Q0-Input  */
        int mfunc_p;           /* Period scaler. Q15 - Input                 */
        int mfunc_c1;          /* PWM 1&2 Duty cycle ratio. Q15, Input       */
        int mfunc_c2;          /* PWM 3&4 Duty cycle ratio. Q15, Input       */
        int mfunc_c3;          /* PWM 5&6 Duty cycle ratio. Q15, Input       */
        int (*init)();         /* Pointer to the init function               */
        int (*update)();       /* Pointer to the update function             */
        } PWMGEN ;

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

/*-----------------------------------------------------------------------------
Default Initializer for the F243 PWMGEN Object 
-----------------------------------------------------------------------------*/
#define F243_FC_PWM_GEN {1000,   \
                         0x7fff, \
                         0x4000, \
                         0x4000, \
                         0x4000, \
                         (int (*)(int))F243_PWM_Init,  \
                         (int (*)(int))F243_PWM_Update \
                         }      
                         
#define PWMGEN_DEFAULTS  F243_FC_PWM_GEN                        
/*------------------------------------------------------------------------------
Prototypes for the functions in F243_PWM.C
------------------------------------------------------------------------------*/
int F243_PWM_Init(PWMGEN *);
int F243_PWM_Update(PWMGEN *);


#endif  /*__F243_PWM_H__*/

⌨️ 快捷键说明

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