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

📄 menu_task_motor.c

📁 电力系统中的保护装置全部代码
💻 C
📖 第 1 页 / 共 5 页
字号:
/************************************************************************/
/*                                                                      */
/* FILE NAME                                            VERSION         */
/*                                                                      */
/*      menu_task.c                                      PLUS  1.0    	*/
/*                                                                  	*/
/* COMPONENT                                                            */
/*                                                                      */
/*                                  	                                */
/*                                                                      */
/* DESCRIPTION                                                          */
/*       This file contines MMI program.                                */
/*                                                                      */
/* AUTHOR                                                               */
/*                                                                      */
/*      chenjie    						     			        		*/
/*                                                                      */
/* DATA STRUCTURES                                                      */
/*                                                                      */
/*      None                                                            */
/*                                                                      */
/* FUNCTIONS                                                            */
/*                                                                      */
/*      None                                                            */
/*                                                                      */
/* DEPENDENCIES                                                         */
/*                                                                      */
/*      None                                                            */
/*                                                                      */
/* HISTORY                                                              */
/*                                                                      */
/*      NAME            DATE                    REMARKS                 */
/*                                                                      */
/*    QingShan.Huang   03-20-2002      Created edit version 1.1         */
/*                                                                      */
/************************************************************************/
#include 	"menu_task.h"
#include    "BaseVariable.h" 
#include 	"Lcd_Main.h"
#include 	"menu_sub.h" 
#include  	"nucleus.h"
#include  	"pro_defs.h"
#include  	"chl_defs.h"   
#include    "math.h"     
#include    "BaseVariable.h"     
/***********************************************/
/*define external variable                     */
/*                                             */
/***********************************************/
extern unsigned     *pAscii_tab;
extern unsigned     *pHzk16_tab;
extern unsigned     *pIcon7_version; 
extern unsigned     *pIcon6_set;	  
extern unsigned     *pIcon5_Comm;	  
extern unsigned     *pIcon4_Swipin;	  
extern unsigned     *pIcon3_Swipout;	
extern unsigned     *pIcon2_Report; 
extern unsigned     *pIcon1_Setting;
extern unsigned     *pIcon0_Scan;
extern unsigned     *pIcon8_set_zone;				    
extern unsigned     *pIcon9_yaban;
extern unsigned     *pIcon10_print;		

extern UNSIGNED      TMD_System_Clock; 
extern UNSIGNED		 RevertDISP_Flag; 
extern UNSIGNED		 Switchin_buf; 
extern NU_TASK	     Task_2_CB;         	
extern unsigned   		 *pRomsumAddr; 
extern void  		 *pRomstartAddr;
extern float         samp_f;
extern INT	 	     iLONC_SetZoneNum;  
extern EEP_REPORT	 *pEEP_REPORT; 
extern EEP_REPORT	 uReportEEP[EEP_REPORTNUM];
extern unsigned char CommunStatusJK1;    
extern unsigned      key_current;  
extern unsigned      PRO_Total_Protect; 	
extern unsigned      key_delaytime; 
extern PROTECT       *PRO_Created_Protect_List;  
extern unsigned 	 subAddress_backup; 
extern unsigned 	 subAddress_flag; 
extern unsigned 	 subAddress_backup;
extern unsigned 	 subAddress_flag;
extern int           din_flag;
unsigned  			 CT_backup,PT_backup;

/***********************************************/
/*define glabal  variable                      */
/*                                             */
/***********************************************/ 
unsigned  CRC_Code,Lcd_Rundata_Time;
unsigned  Lcd_Time1,Lcd_Time2,Lcd_Time3;	
unsigned  SaveAddr,Reclosing_Charge_Flag;
unsigned  out_let[13]={QDJ,GXJ ,TZJ, BY1, BY2, YTJ,
				 YHJ, HZJ, BY3, BY4, BY5, FGJ, BSJ};

char	Outlet_Char[13][14]= {{"启动继电器"},{"告警信号继电器"},{"跳闸继电器"},
				{"备用1继电器"},{"备用2继电器"},{"遥跳继电器"},{"遥合继电器"},
				{"合闸继电器"},{"备用3继电器"},{"备用4继电器"},
				{"备用5继电器"},{"复归继电器"},{"闭锁继电器"}};

/********************************************************************************/
/*  LCD画装置说明子程序                        	2001-9-13               	    */
/*  入口: ( )             						出口:无返回值              	    */
/*  说明:                                        				   				*/
/*                                                     							*/
/********************************************************************************/
void Lcd_Draw_Preface()
{
	 Lcd_Draw_Echar("WDR-821",32,12,1);  
  	 Lcd_Draw_Cchar("微机电动机保护",8,24,1);
 	 Lcd_Draw_Echar("XJ Elec.Co.Ltd",14,54,1);   
}

/********************************************************************************/
/*  LCD自动显示报告子程序                        2001-9-06                         */
/*  入口: 无                                出口:无返回值                         */
/*  说明:                       `											     */
/********************************************************************************/
void  Display_Report_Auto()
{ 
	char  *pcharr1="没有动作值!";
    char  *pchar2="No.  :";
    int   temp,data_num,Year,Month,Day;
	int   Hour,Minute,Second,Millionsecond;
	int   report_flag,*ptr,Lcd_Backup[1024],i;
    char  char_buf[20];
    REPORT  *report_prt;
	char *pchar3;
	char *pchar4;
    
    
	if(pReportIN == pReportRVT)
	{
		return;  
	}
	pReportDISP=pReportRVT; 
	NU_Suspend_Task(&Task_2_CB);
	do
	{   
	    report_flag=(pReportDISP->mmi_flag&MMIDISPLAY);
	    if(report_flag) 
	    {
			if((CtrlPortBuf&0x08)==0)
        	{
        		ptr=(int *)0x815000;      /* 开出背景光 */
    			CtrlPortBuf |= 0x08;
       			*ptr |= CtrlPortBuf;
       		}
			data_num= pReportDISP->pro_report_data_number; 
			pchar3=pReportDISP->pro_report_soe.pSOE_name;
			Year=pReportDISP->pro_report_soe.Year;
    		Month=pReportDISP->pro_report_soe.Month;
    		Day=pReportDISP->pro_report_soe.Day;
			Hour=pReportDISP->pro_report_soe.Hour;
			Minute=pReportDISP->pro_report_soe.Minute;
			Second=pReportDISP->pro_report_soe.Millionsecond/1000;
    		Millionsecond=pReportDISP->pro_report_soe.Millionsecond%1000;    
    		report_flag=pReportDISP->pro_report_flag;
		
			Lcd_Clear_Memory();
			Lcd_Draw_Cchar(pchar3,16,10,1);
			sprintf(char_buf,"20%02d-%02d-%02d",Year,Month,Day);
			Lcd_Draw_Echar(char_buf,20,36,1);
			sprintf(char_buf,"%02d-%02d-%02d.%03d",Hour,Minute,
				Second,Millionsecond);
			Lcd_Draw_Echar(char_buf,16,46,1); 
			Lcd_Display_Executive();
			NU_Sleep(1000*NU_TICKS);
	     }
	    pReportDISP++;
	    if(pReportIN <= pReportDISP)//????EFAAAAA 
	    {
	        pReportDISP=pReportRVT; 
	    }
	    if(RevertDISP_Flag)
	    {
     	     pReportRVT = pReportIN; 
     	     pReportDISP=pReportIN; 
     	     RevertDISP_Flag=0;
     	     NU_Resume_Task(&Task_2_CB);
     	     return;
     	}
	}
	while(pReportIN != pReportRVT);	
      
} 


/********************************************************************************/
/*  LCD画主接线图子程序                        	2001-9-13               	    */
/*  入口: ( )             						出口:无返回值              	    */
/*  说明:                                        				   				*/
/*                                                     							*/
/********************************************************************************/
void Lcd_Draw_Diagrame()
{
    
    UNSIGNED  i;
    
    Lcd_Clear_Memory();	
    Lcd_Draw_Preface();
	Lcd_Display_Executive();   
    i=(UNSIGNED)pRomsumAddr-(UNSIGNED)pRomstartAddr;
    CRC_Code=LONS_Get_CRC32(pRomstartAddr,i);
    
   while(1)
   { 
        Lcd_Draw_Diagrame1();
	}  
}
/***********************************************/
/*                                             */
/*                                             */
/***********************************************/
void Lcd_Draw_Diagrame1()
{
	char time_buffer1[20],time_buffer2[20];
    char value_buffer1[6];
    int current_x,current_y,value_n,flag;
    CLOCK	Clock_Buffer,*pCLOCK_BUF;
    MEASTRU	*pMeasure;

    Lcd_Time1 = TMD_System_Clock;
    while(1)
    {
   
    pMeasure = measure;
    Lcd_Clear_Memory();
		
	if((PT_backup>999)|(PT_backup<0))
	{
		PT_backup=999; 
		uSaveRequest |= SAVE_PTRATE;
	}
	if((CT_backup>999)|(CT_backup<0))
	{
		CT_backup=999; 
		uSaveRequest |= SAVE_CTRATE;
	}
	value_n=pMeasure->value*0.1*CT_backup+0.5;
	sprintf(value_buffer1,"%2d.%02d",value_n/100,value_n%100); 
	Lcd_Draw_Echar(value_buffer1,20,28,1);
    Lcd_Draw_Echar("I=",0,28,1);
    Lcd_Draw_Echar("KA",66,28,1);

	pMeasure+=3;
	value_n=pMeasure->value*0.1*PT_backup+0.5;
	sprintf(value_buffer1,"%2d.%02d",value_n/100,value_n%100);   
    Lcd_Draw_Echar(value_buffer1,20,37,1);
    Lcd_Draw_Echar("U=",0,37,1);
    Lcd_Draw_Echar("KV",66,37,1);     

	pCLOCK_BUF = &Clock_Buffer;        
    READ_DEC_TIME(&pCLOCK_BUF->year_);
    pCLOCK_BUF -> second_=pCLOCK_BUF -> second_/1000;
	sprintf(time_buffer1,"20%02d-%02d-%02d", pCLOCK_BUF ->year_,
	pCLOCK_BUF ->month_, pCLOCK_BUF ->day_);
	sprintf(time_buffer2,"%02d:%02d:%02d",pCLOCK_BUF ->hour_,
	pCLOCK_BUF ->minute_,pCLOCK_BUF ->second_);
	Lcd_Draw_Echar(time_buffer1,24,56,1);
    Lcd_Draw_Echar(time_buffer2,32,48,1);
	if(Reclosing_Charge_Flag)
	{
		Lcd_Draw_Line(6,57,6,59,1);
		Lcd_Draw_Line(7,57,7,59,1);
		Lcd_Draw_SolidRect( 8, 56, 16, 61, 1);
	}	
	Lcd_Draw_Line(2,2,2,22,1);
	Lcd_Draw_Line(1,2,1,22,1);
	Lcd_Draw_Line(2,11,19,11,1); 
	Lcd_Draw_Line(2,12,19,12,1);
	
	if(DIChn[YX1].state)  //ON  up_knife
	{
	    Lcd_Draw_Line(18,11,23,11,1);
	    Lcd_Draw_Line(18,12,23,12,1);
	    Lcd_Draw_Line(18,13,23,13,1);
	    Lcd_Draw_Line(18,10,23,10,1);	     
	}
	else                 //OFF
	{
	    Lcd_Draw_Line(19,11,23,7,1); 
	    Lcd_Draw_Line(22,11,26,7,1);
	    Lcd_Draw_Line(19,12,23,16,1);
	    Lcd_Draw_Line(22,12,26,16,1);
	}
	Lcd_Draw_Line(23,11,32,11,1);
	Lcd_Draw_Line(23,12,32,12,1);
	Lcd_Draw_BlankRect(33,6,48,17,1);
	if(DIChn[HW].state)          //HW
	{
	   	Lcd_Draw_Line(35,11,46,11,1);
	   	Lcd_Draw_Line(35,12,46,12,1);
	}
	else if(DIChn[TW].state)     //TW
	{
		Lcd_Draw_Line(40,8,40,14,1);
	   	Lcd_Draw_Line(41,8,41,14,1);
	}
	else 
	{
	 	Lcd_Draw_BlankRect(33,6,48,17,1);
	}
	Lcd_Draw_Line(49,11,59,11,1); 
	Lcd_Draw_Line(49,12,59,12,1);
	
	if(DIChn[YX3].state)     //dwon_knife
	{
	    Lcd_Draw_Line(62,11,57,11,1); 
	    Lcd_Draw_Line(62,12,57,12,1);
	    Lcd_Draw_Line(62,10,57,10,1); 
	    Lcd_Draw_Line(62,13,57,13,1);        
	}
	else
	{
	    Lcd_Draw_Line(59,11,55,7,1);  
	    Lcd_Draw_Line(59,12,55,16,1);  
	    Lcd_Draw_Line(62,11,58,7,1);  
	    Lcd_Draw_Line(62,12,58,16,1); 

	Lcd_Draw_Circle(76,3,3,1);      //draw CT
	Lcd_Draw_Circle(82,3,3,1);
	Lcd_Draw_Circle(76,18,3, 1);
	Lcd_Draw_Circle(82,18,3, 1);
	Lcd_Draw_Line(71,3,87,3,1);
	Lcd_Draw_Line(71,18,87,18,1);
	Lcd_Draw_Line(76,6,76,9,1);
	Lcd_Draw_Line(82,6,82,9,1);
	Lcd_Draw_Line(76,21,76,24,1);
	Lcd_Draw_Line(82,21,82,24,1);
	Lcd_Draw_Line(75, 8,77,8,1);
	Lcd_Draw_Line(81, 8,83,8,1);
	Lcd_Draw_Line(77, 23,75,23,1);
	Lcd_Draw_Line(81, 23,83,23,1);
    
    Lcd_Draw_Line(63,11,107,11,1); 
	Lcd_Draw_Line(63,12,107,12,1);
    
    Lcd_Draw_Circle(115,11,7,1);  //
    Lcd_Draw_Echar("M",111,7,1);
    Lcd_Draw_Point(111,16, 1);
    Lcd_Draw_Point(112,15, 1);
    Lcd_Draw_Point(113,15, 1);
    Lcd_Draw_Point(114,16, 1);
    Lcd_Draw_Point(115,17, 1);
    Lcd_Draw_Point(116,17, 1);
    Lcd_Draw_Point(117,16, 1);
    Lcd_Draw_Point(118,15, 1);
  
  //  Lcd_Draw_Line(119,11,125,11,1); 
//	Lcd_Draw_Line(119,12,125,12,1);

	Lcd_Draw_Line(92,12,92,26,1);
	Lcd_Draw_Line(93,12,93,26,1);
	Lcd_Draw_Line(92,26,102,26,1);     
	Lcd_Draw_Line(92,27,102,27,1);   
	Lcd_Draw_Circle(107,27,5,1);
	
	if(DIChn[YX4].state)     //ON  earth_knife
	{
	    Lcd_Draw_Line(105,28,110,28,1); 
	    Lcd_Draw_Line(105,27,110,27,1);
	}
	else                 //OFF
	{
	    Lcd_Draw_Line(107,24,107,30,1);
	    Lcd_Draw_Line(108,24,108,30,1);
	} 
	
	Lcd_Draw_Line(113,26,119,26,1); 
	Lcd_Draw_Line(113,27,119,27,1);	
	Lcd_Draw_Line(120,21,120,32,1);
	Lcd_Draw_Line(122,23,122,30,1);			    
    Lcd_Draw_Line(124,25,124,28,1); 
    Lcd_Display_Executive();
    Delay_Key();
	if((key_current==0x55aa)&&(flag!=0x55aa))
	{
	    if((TMD_System_Clock-Lcd_Time1)>=LCD_CHANGE_TIME)
		{
			flag=0;
			return;
		} 
	}
	if((key_current==KINC)||(key_current==KDEC))
	{
		flag=0x55aa;
		continue; 	
	} 
	if((key_current==KCR)||(key_current==KLEFT)||(key_current==KRIGHT)
	  ||(key_current==KUP)||(key_current==KDOWN))
	{
	 	Lcd_Draw_Mainmenu(); 
	}
	if(key_current==KESC)
	{
	 	flag=0;
	 	break; 	
	} 
  }	
} 


/********************************************************************************/
/*  LCD画主菜单子程序                        	2001-9-14               	  		*/
/*  入口: ( )             			出口:无返回值                 				*/
/*  说明:                                        								*/
/*                                                     							*/
/********************************************************************************/ 
unsigned password_backup;	
unsigned password_flag;

MENU	Main_Menu[MAX_MENU];	
void Lcd_Draw_Mainmenu()
{
unsigned test;


unsigned	temp;
int		counter,current_menu,old_menu;
 
MENU	*pMENU;
/*----------- MENU_0 -------------*/
	pMENU	=	(MENU *)&Main_Menu[0];
        pMENU	->      menu_index_num		=	0;
        pMENU	->      x_offset		=	ICON_X0;
        pMENU	->      y_offset		=	ICON_Y0;
        pMENU	->      icon_pointer1		=	pIcon0_Scan;
        pMENU	->      menu_text		=	"浏览";
        pMENU	->      menu_help		=	"[浏览]:查看实时参数";
        pMENU	->      menu_file		=	Display_Rundata;
/*----------- MENU_1 -------------*/
	pMENU	=	(MENU *)&Main_Menu[1];
        pMENU	->      menu_index_num		=	1;
        pMENU	->      x_offset		=	ICON_X1;
        pMENU	->      y_offset		=	ICON_Y1;
        pMENU	->      icon_pointer1		=	pIcon1_Setting;
        pMENU	->      menu_text		=	"定值";
        pMENU	->      menu_help		=	"[定值]:查看修改定值";
        pMENU	->      menu_file		=	Change_Setting;
/*----------- MENU_2 -------------*/
	pMENU	=	(MENU *)&Main_Menu[2];
        pMENU	->      menu_index_num		=	2;

⌨️ 快捷键说明

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