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

📄 variable.h

📁 此代码应用与f2812的通讯程序!!方便用户编程!
💻 H
字号:
//---------------全局变量声明---------------------
#ifndef  VARIABLE_H
#define  VARIABLE_H   

//-------------------硬件自检-----------
typedef struct
{ 	
	Uint16 spi_1306:1;           
	Uint16 spi_5323:1;
	Uint16 exram:1;
	Uint16 exflash:1;
	Uint16 reserved:12;
}SSELF_TEST;//1 words
extern SSELF_TEST SelfTest;  

//--------------------计时器和时钟-----------------
typedef struct
{
	Uint16 soe10ms;
	//counter
	Uint16 ms10_c:4;
	Uint16 ms100_c:4;
	//flag
	Uint16 f10ms:1;
	Uint16 f100ms:1;
	Uint16 f1s:1;
	Uint16 f1min:1;
	Uint16 f1hour:1;
	Uint16 f1day:1;
	Uint16 reserved:2;
}STimerFlag;
extern STimerFlag TimerFlag;

//-年-月-星期-日-时-分-秒-毫秒
typedef struct 
{     		
	Uint16 seconds;	
	Uint16 minutes;
	Uint16 hours;
	Uint16 dayofweek;
	
	Uint16 dates;
	Uint16 months;
	Uint16 years;
	
}STIME1306;
extern STIME1306 Time1306;

//------------------- 系统工作 ------------
typedef struct 
{	
	Uint16 enaSample:1;
	Uint16 bCal:1; 		      
	Uint16 cepinFlag:1;	
	Uint16 reserved:13;
}SWORK_STATE;
extern   SWORK_STATE   wst;   /* 工作状态 */

//--------------采样和FFT计算----------------
typedef struct
{
	int16 capnum1,capnum2;
	Uint16 pinLvNow;
	Uint16 pinLvBef;
	Uint16 capGood;	
	//Uint16 cepinNum:6;
	//Uint16 capGood:4;
	//Uint16 reserved:6;
}ScePin;
extern ScePin cePin;

#define REAL 0
#define IMAG 1

#define     N   32  
extern int sumi; /*increase one on every calculate,when it get 16, do average operation*/
extern long fri[64];//used for FFT
extern int LineComplex[32][2];
extern int  K_PQ[6]; 

extern int SamCounter; //采样点计数

#define SAMPLE_NUM 32
extern long Ach[16][SAMPLE_NUM];         // 存采样数据  

/*
#define PQk     1000 
extern int  K_PQ[6];            // 功率系数

extern  int K_Phase[];          //功率补偿
#define SIN_NUM	201
extern const int SinTab[SIN_NUM];
extern const int CosTab[SIN_NUM];
*/

//-------------遥测------------
#define YC_NUM 48
extern const int YcTab[YC_NUM];
extern int  Yc_Temp[YC_NUM];        // YC数据 临时值 
extern int  Yc_Ave[YC_NUM];         // YC数据 临时值 
extern long Yc_Sum[YC_NUM];         // YC数据 累加值

//extern int  Yc_Bak[65];         // YC数据 最终值 保存上次值
//extern int  Yc_Set[65];         // YC变化设定值

#define DDU_NUM 8
#define DD_ONE      360000L
extern long  DDu_Temp[DDU_NUM];
extern long  DDu[DDU_NUM];          

//-------------遥信------
/*
extern Uint16 YX[]; 
extern Uint16 YX_Bak[];
extern Uint16 YxSize;
extern const int YxTab[64];
extern const int YxIndex[256];
*/
//--------------- 遥控--------------
//extern Uint16 SboOpCh;
//extern volatile Uint16* SboReg  ; //define for sbo operation   

typedef struct
{
	Uint16 chanel;/*the channel of YK operation*/
	Uint16 sel_timer;/*the defined time for select */
	Uint16 exe_timer;/*the defined time for execute operation*/
	Uint16 oper_st;/*the act ; 1 for close , 0 for trip*/
}SSboOper;
//extern SSboOper SboOper;

//----------------EEPROM----------------
typedef struct
{
	int DatBuf[32];            // the data of operating
	int Len;                    // the length of operating data	
	Uint16 Add;           // the address of eeprom
	Uint16 pos:8;           // the position of sending
	
	Uint16 Busy10ms:4;    //waiting after writing cycle
	Uint16 writeEna:1; 
	Uint16 doWriteEEp5323:1;
	Uint16 writBusy:1;
}SSPIDATA;
extern SSPIDATA SpiData;
extern int EEPROM_Data[100];

//---------------SSTFLASH-----------------
typedef struct
{
	Uint16 Busy10ms:4; //写等待
	Uint16 WriteEnable:1;
	Uint16 doWriteFlash:1;
	Uint16 RES:10;
		
	Uint16 *pbuf;   //
	Uint32 WordAdd;
	Uint16 Length;
}SSTFLASH_DATA;
extern SSTFLASH_DATA SstFlashData;
extern volatile Uint16 *pExflash;

//--------------- 通信 -------------------
#define COM_NUM 2 //通讯端口数

typedef struct
{ 	
	Uint16 AddL:8;           
	Uint16 AddH:8;

	Uint16 stopbit:1;
	Uint16 parity:2; 
	Uint16 databit:1;
	Uint16 baudrate:4;   //1 bit is reserved 

	Uint16 rxouttime:8;//等待时间
	Uint16 txouttime:8;

	Uint16 rxidletime:8;
	Uint16 txidletime:8;
	Uint16 reserved:8;
}SComParm;//2 words
extern SComParm ComParm[COM_NUM];  

extern Uint16 RxLena;
extern Uint16 RxLenb;

extern Uint16 TxLena;
extern Uint16 TxLenb;

extern Uint16 TxCounta;
extern Uint16 TxCountb;

#define BUF_SIZE 260
extern Uint16 ComBufa[260];
extern Uint16 ComBufb[260];

//----------------645抄表-----------


//---------------YX变化------------
typedef struct 	
{ 
	Uint16 chanel;  
	Uint16 ms;	
	Uint16 minute:8;
	Uint16 hours:8;
	Uint16 reserved:7;
	Uint16 st:1;
	
	Uint16 dates:8;
	Uint16 months:8;
	Uint16 years:8;
}SSoeArr; //soe array, 5 words
//extern  SSoeArr SOE_Array[30];

//extern unsigned short pSOEbot;       /*poshorter of array*/
//extern int SOENum;
//extern int YXChNum;

//------------- YC变化 ----------------
typedef struct 
{ 
	Uint16 chanel;  
	Uint16 data;
	Uint16 ms;
	
	Uint16 minute:8;
	Uint16 hours:8;
	Uint16 reserved:8;
	
	Uint16 dates:8;
	Uint16 months:8;
	Uint16 years:8;
	
}SYCCHREC; //yc change array .6 words
//extern  SYCCHREC YcChRec[30];  //YC change record/
//extern  Uint16 pYCbot,YCchSendNum;  //poshorter of array


typedef struct
{  //BYTE P0Counter;
   //BYTE P1Counter;
   //BYTE P2Counter;
    
   Uint16 keyold;
   Uint16 keydown;
   
}STKEY;

extern STKEY stKey;

#endif	

//===========================================================================
// No more.
//===========================================================================

⌨️ 快捷键说明

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