📄 bldc.h
字号:
/* ==============================================================================
System Name: BLDC3_2
File Name: BLDC.H
Description: Primary header file for the implementation of sensorless current
controller for a three phase brushless DC Motor.
Originator: Digital control systems Group - Texas Instruments
Target dependency: x240/1/2/3/07
To Select the target device see target.h file.
=====================================================================================
History:
-------------------------------------------------------------------------------------
9-15-2000 Release Rev 1.0
================================================================================= */
/*-----------------------------------------------------------------------------*/
/* Get target information. */
/*-----------------------------------------------------------------------------*/
#include <TARGET.H>
#if (TARGET==F243)
#include <regs24x.h>
#endif /* TARGET==F243 */
#if (TARGET==F2407)
#include <regs240x.h>
#endif /* TARGET==F2407 */
#if (TARGET==F243)
#define SYSTEM_INT_PERIOD 1000 /* 50 uS sampling period @50 ns CPU clock
/* #define SYSTEM_INT_PERIOD 700 /* 17.5 uS sampling period @25 ns CPU clock */
/* #define SYSTEM_INT_PERIOD 360 /* 18 uS sampling period @50 ns CPU clock */
/* #define SYSTEM_INT_PERIOD 450 /* 22.5 uS sampling period @50 ns CPU clock */
/* #define SYSTEM_INT_PERIOD 500 /* 25 uS sampling period @50 ns CPU clock */
#endif /* TARGET==F243 */
#if (TARGET==F2407)
/* #define SYSTEM_INT_PERIOD 758 */ /* 25 uS sampling period @33 ns CPU clock */
#define SYSTEM_INT_PERIOD 1000 /* 25 uS sampling period @25 ns CPU clock */
#endif /* TARGET==F2407 */
/*------------------------------------------------------------------------------
Include file containing the system vectors.
These must be set up correctly for the interrupt mechanisms to work
------------------------------------------------------------------------------*/
#include <sysvecs.h>
/*-------------------------------------------------------------------------------
Next, Include project specific include files.
-------------------------------------------------------------------------------*/
#include <EVMDAC.H> /* Get Constants etc for the EVMDAC */
#include <BLDCPWM.H> /* Get Constants etc for the PWM Generators */
#include <ADC.H> /* Get constants and defs for the ADC */
#include <WATCHDOG.H> /* Get the watchdog driver interface */
#include <bldc_ti.h> /* Include header for the BLDC object */
/*-------------------------------------------------------------------------------
Function Prototypes for the functions implemented in BLDC.C
-------------------------------------------------------------------------------*/
void RstSystem(void);
void rtmon_init(void);
void interrupt c_int03();
void interrupt phantom(void);
void time_base_init(void);
void evm_pwm_init(void);
void update_v_timer(void);
#ifndef TRUE
#define FALSE ((Bool)0)
#define TRUE ((Bool)1)
#endif
/*-------------------------------------------------------------------------------
Set to TRUE for real time mode, otherwise set to FALSE
-------------------------------------------------------------------------------*/
#define REAL_TIME TRUE
/*-------------------------------------------------------------------------------
Set to TRUE if it is required to enable PWM signals, otherwise set to FALSE
-------------------------------------------------------------------------------*/
#define PWM_ENABLE TRUE
#if (PWM_ENABLE == TRUE)
#define EVM_IOPB6 0xFFBF
#endif /* (PWM_ENABLE == TRUE)*/
#if (PWM_ENABLE == FALSE)
#define EVM_IOPB6 0x0040
#endif /* (PWM_ENABLE == FALSE)*/
/*-------------------------------------------------------------------------------
ADC channel settings
-------------------------------------------------------------------------------*/
#define CH0 0x0000
#define CH1 0x0001
#define CH2 0x0002
#define CH3 0x0003
#define CH4 0x0004
#define CH5 0x0005
#define CH6 0x0006
#define CH7 0x0007
#define CH8 0x0008
#define CH9 0x0009
#define CH10 0x000A
#define CH11 0x000B
#define CH12 0x000C
#define CH13 0x000D
#define CH14 0x000E
#define CH15 0x000F
#if (TARGET==F243)
#define MS3CHNL CH6
#define MS2CHNL CH5
#define MS1CHNL CH4
#define MS0CHNL CH3
#endif /* (TARGET==F243) */
#if (TARGET==F2407)
//for EVM2407
/*
#define MS3CHNL CH12
#define MS2CHNL CH11
#define MS1CHNL CH10
#define MS0CHNL CH5
*/
//for eZdsp2407
#define MS3CHNL CH6
#define MS2CHNL CH5
#define MS1CHNL CH4
#define MS0CHNL CH3
#endif /* (TARGET==F2407) */
#define CHANNEL_SETTINGS ((MS3CHNL <<12) | (MS2CHNL<<8) | (MS1CHNL<<4) | (MS0CHNL))
#define V_TIMER_THRESHOLD 0x7f00
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -