📄 global.h
字号:
#ifndef Global_H // Begin of the file
#define Global_H
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
// 系统硬件设置关注点(只需关注项目目录下的 Drv_dsp280x_xxx.x)
//--------------------------------------------------------------------------------
//
// 1、CPU 类型选择
// 修改文件:..\Common_Include\DSP280x_Device.h 第27-33行;
// 更改项目:将 CCS 项目文件列表中所用的 F280X.cmd 换成所需的型号;
//
// 2、项目配置(外设选用)
// 请依照 Main.c 开头对各种包含文件的处理方式;
//
// 3、关掉项目不使用的外设
// 在 SwtchPeripheralClocks() 函数中关掉不使用的外设的时钟(函数定义在 Global.c );
//
// 4、外设硬件设置
// 外设总线(高速/低速)的分频值、Timer0中断周期、频率输出脚的输出频率都在:Main.h
// ADC 的相关硬件设置在:Drv_dsp280x_ADC.h
// 串口 A/B 如果是 485 需将模块头文件中的宏打开,且在 Interface.h 需为 485 分配控制端;
//
// 5、I/O 端口配置
// 宏定义在 Interface.h 中将项目中对 I/O 端口的定义与 DSP 实际 I/O 端口对应;
// 在项目中只能使用 Interface.h 中定义的名称,I/O 端口变更时修订 Interface.h 即可;
// 端口初始化放在 InitInterfaceGpio() 函数中(函数定义在 Global.c );
//
// 6、使用 CAP1~4、TZ5、TZ6 时需参考 Main.c 前部的说明修订相关位置的 GPIO 选择;
//
//--------------------------------------------------------------------------------
// 发布信息 需在每次编译、发布程序时进行更新
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
// 硬件选项
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
// 位操作定义
//--------------------------------------------------------------------------------
//---------------------------------------------------------------------------------
// 宏定义
//---------------------------------------------------------------------------------
#define RUN 0xAAAA
#define RUNNING 0xAAAA
#define STOP 0x0000
#define SWITCH_ADJ 0xAAAA
#define SWITCH_CONST 0x0000
#define SWITCH_16KHZ 16
//--------------------------------------------------------------------------------
// 全局数据类型说明
//--------------------------------------------------------------------------------
struct PID_REGS
{
volatile int32 lPidEk;
volatile int32 lPidEk1;
volatile int32 lPidEk2;
volatile int32 lKp;
volatile int32 lKi;
volatile int32 lKd;
volatile int32 lPidEk3;
volatile int32 lPidEk4;
volatile int32 lPidEk5;
};
extern volatile struct PID_REGS PidRegs; // 数据对象:系统命令
struct OUTPUT_VAR
{
volatile Uint16 uiRealVolt;
volatile Uint16 uiTargetVolt;
volatile Uint16 uiCurrVolt;
volatile Uint16 uiCurrVoltW;
volatile Uint16 uiCurrVoltV;
volatile Uint16 uiCurrVoltU;
volatile Uint16 uiCurrVoltWTemp;
volatile Uint16 uiCurrVoltVTemp;
volatile Uint16 uiCurrVoltUTemp;
volatile Uint16 uiTargetFreq;
volatile Uint16 uiCurrFreq;
volatile Uint16 uiPidOutMax;
volatile Uint16 uiPidOutMin;
};
extern volatile struct OUTPUT_VAR OutputVar; // 数据对象:PWM1 控制
struct SET_PARA
{
volatile Uint16 uiDftPara;
volatile Uint16 uiMaxFreq;
volatile Uint16 uiMinFreq;
volatile Uint16 uiUoutSet;
volatile Uint16 uiVm;
volatile Uint16 uiOprMode;
volatile Uint16 uiCarrSet;
volatile Uint16 uiPwrDwnV;
volatile Uint16 uiSoftVer;
volatile Uint16 uiIinCoeff;
volatile Uint16 uiIinCoefDir;
volatile Uint16 uiPidObj;
volatile Uint16 uiKp;
volatile Uint16 uiKi;
volatile Uint16 uiKd;
volatile Uint16 uiPidT;
volatile Uint16 uiUoutCoeff;
volatile Uint16 uiUoutCoefDir;
volatile Uint16 uiPidHi;
volatile Uint16 uiPidLo;
volatile Uint16 uiPwrRate;
volatile Uint16 uiErrGap;
volatile Uint16 uiVolSenseH;
volatile Uint16 uiVolSenseL;
volatile Uint16 uiDeltaLim;
volatile Uint16 uiAntiVibration;
volatile Uint16 uiSwitchAdj;
volatile Uint16 uiDisMode;
volatile Uint16 uiPreVolt;
volatile Uint16 uiStartStep;
};
extern volatile struct SET_PARA SetPara; // 数据对象:系统数据
struct RUN_STATE
{
volatile Uint16 uiRun;
volatile Uint16 uiRunning;
volatile Uint16 uiSwitchAdj;
volatile Uint16 uiSwitchNum;
volatile Uint16 uiSoftStart;
volatile Uint16 uiLockKey;
};
extern volatile struct RUN_STATE RunState; // 数据对象:系统状态
struct PHASE_SECTOR
{
volatile Uint32 ulPhaseSum;
volatile Uint32 ulPhaseSum1;
volatile Uint32 ulPhaseNew;
volatile Uint32 ulRegion;
volatile Uint32 ulAngle;
volatile Uint16 uiTi;
volatile Uint16 uiTiW;
volatile Uint16 uiTiU;
volatile Uint16 uiTiV;
volatile Uint16 uiTjW;
volatile Uint16 uiTjU;
volatile Uint16 uiTjV;
volatile Uint16 uiTiTj;
volatile Uint16 uiV01U;
volatile Uint16 uiV01V;
volatile Uint16 uiV01W;
volatile Uint16 uiV01;
volatile Uint16 uiTj;
volatile Uint16 uiTiBak;
volatile Uint16 uiVfCoeff;
volatile Uint16 uiVfCoeffU;
volatile Uint16 uiVfCoeffV;
volatile Uint16 uiVfCoeffW;
volatile Uint16 uiPrdHCarr;
volatile Uint16 uiCalDat;
};
extern volatile struct PHASE_SECTOR PhaseSector; // 数据对象:系统计数
//--------------------------------------------------------------------------------
// 全局变量说明
//--------------------------------------------------------------------------------
extern volatile Uint16 uiCnt25uS;
extern volatile Uint16 uiCnt25uS1;
extern volatile Uint16 uiSample;
extern volatile Uint16 uiSampleCnt;
extern volatile Uint16 ulSum;
extern volatile Uint16 uiSampleTrue;
extern volatile Uint16 uiKeyOk;
extern volatile Uint16 uiFlag;
extern volatile Uint16 uiRamValueTemp;
extern volatile Uint16 uiCntCode;
extern volatile Uint16 uiRamValue;
extern volatile Uint16 uiPage;
extern volatile Uint16 uiSampleTrue;
extern volatile Uint16 uiKeyOk;
extern volatile Uint16 uiKeyTrueValue;
extern volatile Uint16 uiTest;
extern volatile Uint16 uiFacSDCnt;
extern volatile Uint16 uiFacNBCnt;
extern volatile Uint16 uiCnt1S;
extern volatile Uint16 uiSoftStartCnt;
extern volatile Uint16 uiTime10ms;
extern volatile Uint16 uiPidCnt;
extern volatile Uint16 uiTime1ms;
extern volatile Uint16 uiVolNB_U;
extern volatile Uint16 uiVolNB_V;
extern volatile Uint16 uiVolNB_W;
extern volatile Uint16 uiVolSD_U;
extern volatile Uint16 uiVolSD_V;
extern volatile Uint16 uiVolSD_W;
extern volatile Uint16 uiAdVRef;
extern volatile Uint16 uiRmsNBAvg;
extern volatile Uint32 uiAddNBW;
extern volatile Uint32 uiAddNBU;
extern volatile Uint32 uiAddNBV;
extern volatile Uint16 uiRmsNBW;
extern volatile Uint16 uiRmsNBU;
extern volatile Uint16 uiRmsNBV;
extern volatile Uint16 uiRmsNBAvg;
extern volatile Uint16 uiAvgNBW;
extern volatile Uint16 uiAvgNBU;
extern volatile Uint16 uiAvgNBV;
extern volatile Uint16 uiPhaseOk;
extern volatile Uint16 uiRmsNBAvgSum;
extern volatile Uint16 uiNBCnt;
extern volatile Uint32 uiAddSDW;
extern volatile Uint32 uiAddSDU;
extern volatile Uint32 uiAddSDV;
extern volatile Uint16 uiRmsSDW;
extern volatile Uint16 uiRmsSDU;
extern volatile Uint16 uiRmsSDV;
extern volatile Uint16 uiAvgSDW;
extern volatile Uint16 uiAvgSDU;
extern volatile Uint16 uiAvgSDV;
extern volatile Uint16 uiRmsSDAvg;
extern volatile Uint16 uiECapTime1;
extern volatile Uint16 uiECapTime2;
extern volatile Uint16 uiECapTime;
extern volatile Uint16 uiECapFlag;
extern volatile Uint16 uiTmpC1;
extern volatile Uint16 uiPhaseOK;
extern volatile Uint16 uiPhaseCnt;
extern volatile Uint32 ulECapCnt;
extern volatile Uint32 ulECapCnt1;
//--------------------------------------------------------------------------------
// 全局函数说明
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
#endif // End of the file
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -