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

📄 speed_pr.h

📁 TI公司的DSP(LF2407A)编写的有霍尔位置传感器的无刷直流电机控制程序,内含子程序说明
💻 H
字号:
/* =================================================================================
File name:        SPEED_PR.H                      
    Header file containing the data types, constants for the period based
    speed measurement function. Also contains the prototypes for the 
    functions implemented in SPEED_PR.ASM
=====================================================================================
 History:
-------------------------------------------------------------------------------------
 5-31-2007	Release	Rev 1.00                                                   
------------------------------------------------------------------------------*/

#ifndef __SPEED_PR_H__
#define __SPEED_PR_H__

typedef struct {
       int NewTimeStamp;    // Variable : New 'Timestamp' corresponding to a capture event 
       int OldTimeStamp;  	// Variable : Old 'Timestamp' corresponding to a capture event 
       int TimeStamp; 		// Input : Current 'Timestamp' corresponding to a capture event  
       int SpeedScaler;  	// Parameter :  Scaler converting 1/N cycles to a Q15 speed  
       int EventPeriod;    	// Input/Variable :  Event Period (Q0) - independently with global Q
       int InputSelect;     // Input : Input selection between TimeStamp (InputSelect=0) and EventPeriod (InputSelect=1)
       long Speed;     	    // Output :  speed in per-unit                            
       int BaseRpm;       	// Parameter : Scaler converting Q15 speed to rpm (Q0)speed 
       int SpeedRpm;        // Output : speed in r.p.m.     
       int motorpairs;		// Input :motropairs.(Q0)                     
       void (*calc)();  	// Pointer to the calulation function                  
       } SPEED_MEAS_CAP;   	// Data type created      
/* 
Note that 
         SpeedScaler = 60*f/rmp_max 
where f = CLK_freq/(128*N), N = number of teeth in sprocket
and 128 is pre-determined prescaler of timer 2 (used by capture)*/

typedef SPEED_MEAS_CAP *SPEED_MEAS_CAP_handle;
/*-----------------------------------------------------------------------------
Default initalizer for the SPEED_MEAS_CAP object.
-----------------------------------------------------------------------------*/                     
// SpeedScaler = 260 based on f(clk) 25 MHz, f(samping)= 16.67, 25 kHz
// rmp_max = 6000 rpm                   
#define SPEED_MEAS_CAP_DEFAULTS  { 0, \
                                   0, \
                                   0, \
                                   400, \
                                   0, \
                                   0, \
                                   0, \
                                   6000, \
                                   0, \
								   0, \
                                   (void (*)(int))speed_prd_calc \
                                   }

/*------------------------------------------------------------------------------
Prototypes for the functions in SPEED_PR.C
------------------------------------------------------------------------------*/
void speed_prd_calc(SPEED_MEAS_CAP_handle); 

#endif /*  __SPEED_PR_H__ */


⌨️ 快捷键说明

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