f2407qep1.c
来自「TI公司24X系列DSP控制无刷直流电机」· C语言 代码 · 共 56 行
C
56 行
/* ==================================================================================
File name: F2407QEP1.C
Originator: Digital Control Systems Group
Texas Instruments
Description:
This file contains source for the QEP Unit on the TMS320F2407
Applicability of these functions is indicated in the Table 1
=====================================================================================
History:
-------------------------------------------------------------------------------------
09-15-2000 Release Rev 1.00
04-04-2001 Release Rev 1.10 */
/*----------------------------------------------------------------------------*/
/* T A B L E 1 */
/*----------------------------------------------------------------------------*/
/* Function Name | Applicability */
/*----------------------------------------------------------------------------*/
/* | F240 | F241| F243 | LF2402 | LF2406 | LF2407 */
/* | | | | | | */
/* F2407_QEP_Init | | | | Y | Y | Y */
/*----------------------------------------------------------------------------*/
#include "..\include\regs240x.h"
#include "..\include\F2407QEP.h"
#include "..\include\override.h"
/* Note that for the changes to constants in the header file to take effect,
THIS file must be re-compiled, AND any libs updated with the new obj.
However to just change the contents of ACTR for example, it can be done
anywhere in 'c' or asm code.
For example
T2CON=NEW_VALUE;
*/
int inline F2407_EV1_QEP_Init(QEP *p)
{
CAPCONA=CAP_INIT_STATE; /* Set up capture units */
T2CON=TIMER_INIT_STATE; /* Set up capture timer */
T2PR=0xFFFF;
EVAIFRC=0xFFFF; /* Clear all IFRC flags */
EVAIMRC=0x4; /* Enable CAP3 Interrupt*/
MCRA=MCRA|0x38; /* Set up the capture pins to primary functions */
}
int inline F2407_EV1_QEP_Index_Handle(QEP *p)
{
p->QEP_cnt_idx=T2CNT;
T2CNT=0;
p->index_sync_flg=0xF;
EVAIFRC|=0x08; /* Clear IFRC flag for CAP3 INT */
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?