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

📄 uifunction.c

📁 基于c的电动机保护程序
💻 C
📖 第 1 页 / 共 5 页
字号:
          

      // }
       
/************************************************************/
          
     //  else
      // {
      //      temp_pointToInt = temp_point * 10 ;
        //    Float2LedValue[0] = Numdot[ temp_int ] ;
/***************************小数部分*********************************/
          //  temp_pointToInt = temp_point * 10 ;
           // Float2LedValue[1] = LedNum[ temp_pointToInt ];
            //temp_pointToInt = temp_point * 100 - temp_pointToInt*10;
            //Float2LedValue[2] = LedNum[ temp_pointToInt ];
       // }   
    }
       
         
  /************************************************************/

Data[0] =  Float2LedValue[0];
Data[1] =  Float2LedValue[1];
Data[2] =  Float2LedValue[2];

}

  



	





//设定数值时,首先用DOWN确定小数点位置,enter确定,然后
//用DOWN确定每一位的数值,按enter到下一位,然后用up翻页,
//翻页也代表确认先前的设定


								
 
float Led2Float(void)
{
	U16 tempData[3];
	int dotFlag;
	int dotPosition = 0;// 小数点位置 0为tempDate 最左边

	int i;
	int j;
	
	    
	float resultTemp = 0;
	float result = 0;
	int temp = 1;
	enum  num {zero = 0x00FC, one = 0x0060, two = 0x00DA, three = 0x00F2, four = 0x0066, 
	five = 0x00B6,six = 0x00BE, seven = 0x00E0, eight = 0x00FE, nine = 0x00E6, ten = 0x000 }; 

	
	
	tempData[0] = LED_2;
	tempData[1] = LED_3;
	tempData[2] = LED_4;
	
	
    dotPosition = dotPosition + 3 - Bit_NeedSet ; 
	
	for( i = (3 - Bit_NeedSet ); i < Bit_NeedSet; i++)
	{
		
		if( ( ( tempData[i] >> 8 ) & dot ) != dot )
		{
			
			dotPosition ++ ;
		}
		else
		{
			break;
		}
	}


	for( i = 2; i >= ( 3 - Bit_NeedSet ); i--)
	{
		
		
		switch( ( tempData[ i ] >> 8 ) & 0xFE )
		{
			//j = tempData[ i ] >> 8
			case zero:
				resultTemp = resultTemp + (0 * temp);
				temp *= 10;
				break;

			case one:
				resultTemp = resultTemp + (1 * temp);
				temp *= 10;
				break;

			case two:
				resultTemp = resultTemp + (2 * temp);
				temp *= 10;
				break;

			case three:
				resultTemp = resultTemp + (3 * temp);
				temp *= 10;
				break;

			case four:
				resultTemp = resultTemp + (4 * temp);
				temp *= 10;
				break;

			case five:
				resultTemp = resultTemp + (5 * temp);
				temp *= 10;
				break;

			case six:
				resultTemp = resultTemp + (6 * temp);
				temp *= 10;
				break;

			case seven:
				resultTemp = resultTemp + (7 * temp);
				temp *= 10;
				break;

			case eight:
				resultTemp = resultTemp + (8 * temp);
				temp *= 10;
				break;

			case nine:
				resultTemp = resultTemp + (9 * temp);
				temp *= 10;
				break;

			case ten:
				resultTemp = resultTemp + (10 * temp);
				temp *= 10;
				break;
		}
	}


	if( resultTemp == 0 )
	{
		result = 0;
	}
	else
	{



		switch( dotPosition )
		{
			case 0:
				result = resultTemp / 100 ;
				break;

			case 1:
				result = resultTemp /10 ;
				break;

			case 2:
				result = resultTemp;
				break;

			default:
				break;
		}
	}

}


void Led2Bool(void)
{
	U16 temp;
	if( Bit_NeedSet == 3)
	{
		temp = LED_2;
		switch( temp >> 8  )
		{
			case 0x00FC: //  "0"
				(( Menu_Top_Struct * )ActiveMenuAdd)->data[0] = 0;
				break;

			case 0x0060:   // "1"
				(( Menu_Top_Struct * )ActiveMenuAdd) ->data[0] = 1;
				break;
		}
	}


	temp = LED_3;
	switch( temp >> 8  )
	{
			case 0x00FC: //  "0"
				(( Menu_Top_Struct * )ActiveMenuAdd) ->data[1] = 0;
				break;

			case 0x0060:   // "1"
				(( Menu_Top_Struct * )ActiveMenuAdd) ->data[1] = 1;
				break;
	}


	temp = LED_4;
	switch( temp >> 8  )
	{
			case 0x00FC: //  "0"
				(( Menu_Top_Struct * )ActiveMenuAdd) ->data[2] = 0;
				break;

			case 0x0060:   // "1"
				(( Menu_Top_Struct * )ActiveMenuAdd) ->data[2] = 1;
				break;
	}
}



void SetDotPosition(void)
{
	U16 tempData[3];
	int i;

	
 int dotPosition = 0;// 小数点位置 0为tempDate 最左边
	tempData[0] = LED_2;
	tempData[1] = LED_3;
	tempData[2] = LED_4;
	
	dotPosition = 3-Bit_NeedSet;
	
	
	for( i = (3 - Bit_NeedSet ); i < Bit_NeedSet ; i++)
	{
		
		if( ( ( tempData[i] >> 8 ) & dot ) != dot )
		{
			
			dotPosition ++ ;
		}
		
		
	}
	

	if( dotPosition != 2)
	{
		dotPosition++;
	}
	else
	{
		dotPosition = 3-Bit_NeedSet;
	}

	for( i = 0; i < 3; i++)
	{
		tempData[ i ] =  tempData[ i ]  & ( 0xFE << 8 ) ;
	}

	tempData[ dotPosition ] =  tempData[ dotPosition ] + (0x1 << 8 );
	LED_2 = tempData[ 0 ] ;
	LED_3 = tempData[ 1 ] ;
	LED_4 = tempData[ 2 ] ;


}



int  ChangeLED1(U16 *DataIn)
{
	U16 temp = *DataIn ;
	int result;
	
	enum  num {zero = 0x00FC, one = 0x0060, two = 0x00DA, three = 0x00F2, four = 0x0066, 
	five = 0x00B6,six = 0x00BE, seven = 0x00E0, eight = 0x00FE, nine = 0x00E6, ten = 0x000 }; 

	
	if( Menu_Level != 0 )
	{

		switch( ( temp >> 8 ) & 0xFE )
		{
			case zero:
				*DataIn = ( *DataIn & 0x1FF ) | ( ( Num[1] << 8 ) & 0xFE00 );
				result = 1;
				break;

			case one:
				*DataIn = ( *DataIn & 0x1FF ) | ( ( Num[2] << 8 ) & 0xFE00 );
				result = 2;
				break;

			case two:
				*DataIn = ( *DataIn & 0x1FF ) | ( ( Num[3] << 8 ) & 0xFE00 );
				result = 3;
				break;

			case three:
				*DataIn = ( *DataIn & 0x1FF ) | ( ( Num[4] << 8 ) & 0xFE00 );
				result = 4;
				break;

			case four:
				*DataIn = ( *DataIn & 0x1FF ) | ( ( Num[5] << 8 ) & 0xFE00 );
				result = 5;
				break;

			case five:
				*DataIn = ( *DataIn & 0x1FF ) | ( ( Num[6] << 8 ) & 0xFE00 );
				result = 6;
				break;

			case six:
				*DataIn = ( *DataIn & 0x1FF ) | ( ( Num[7] << 8 ) & 0xFE00 );
				result = 7;
				break;

			case seven:
				*DataIn = ( *DataIn & 0x1FF ) | ( ( Num[8] << 8 ) & 0xFE00 );
				result = 8;
				break;

			case eight:
				*DataIn = ( *DataIn & 0x1FF ) | ( ( Num[9] << 8 ) & 0xFE00 );
				result = 9;
				break;

			case nine:
				*DataIn = ( *DataIn & 0x1FF ) | ( ( Num[0] << 8 ) & 0xFE00 );
				result = 0;
				break;

			case ten:
				*DataIn = ( *DataIn & 0x1FF ) | ( ( Num[10] << 8 ) & 0xFE00 );
				result = 0;
				break;

			default:
				break;
		}
	}
	else
	{
		switch( ( temp >> 8 ) & 0xFE )
		{
			case zero:
				*DataIn = ( *DataIn & 0x1FF ) | ( ( Num[1] << 8 ) & 0xFE00 );
				break;

			case one:
				*DataIn = ( *DataIn & 0x1FF ) | ( ( Num[0] << 8 ) & 0xFE00 );
				break;
		}
	}
	
	return result;
	
}	







void ChangeLED(U16 DataIn[4])
{
	U16 tempData[3] ;
	U16 temp;
	enum  num {zero = 0x00FC, one = 0x0060, two = 0x00DA, three = 0x00F2, four = 0x0066, 
	five = 0x00B6,six = 0x00BE, seven = 0x00E0, eight = 0x00FE, nine = 0x00E6, ten = 0x000 }; 

	
	tempData[0] = DataIn[2];
	tempData[1] = DataIn[3];
	tempData[2] = DataIn[4];
	temp = tempData[ Cursor ];

     
	if( Menu_Level != 0 )
	{

		switch( ( temp >> 8 ) & 0xFE )
		{
			case zero:
				tempData[ Cursor ] = ( tempData[ Cursor ] & 0x1FF ) | ( ( Num[1] << 8 ) & 0xFE00 );
				break;

			case one:
				tempData[ Cursor ] = ( tempData[ Cursor ] & 0x1FF ) | ( ( Num[2] << 8 ) & 0xFE00 );
				break;

			case two:
				tempData[ Cursor ] = ( tempData[ Cursor ] & 0x1FF ) | ( ( Num[3] << 8 ) & 0xFE00 );
				break;

			case three:
				tempData[ Cursor ] = ( tempData[ Cursor ] & 0x1FF ) | ( ( Num[4] << 8 ) & 0xFE00 );
				break;

			case four:
				tempData[ Cursor ] = ( tempData[ Cursor ] & 0x1FF ) | ( ( Num[5] << 8 ) & 0xFE00 );
				break;

			case five:
				tempData[ Cursor ] = ( tempData[ Cursor ] & 0x1FF ) | ( ( Num[6] << 8 ) & 0xFE00 );
				break;

			case six:
				tempData[ Cursor ] = ( tempData[ Cursor ] & 0x1FF ) | ( ( Num[7] << 8 ) & 0xFE00 );
				break;

			case seven:
				tempData[ Cursor ] = ( tempData[ Cursor ] & 0x1FF ) | ( ( Num[8] << 8 ) & 0xFE00 );
				break;

			case eight:
				tempData[ Cursor ] = ( tempData[ Cursor ] & 0x1FF ) | ( ( Num[9] << 8 ) & 0xFE00 );
				break;

			case nine:
				tempData[ Cursor ] = ( tempData[ Cursor ] & 0x1FF ) | ( ( Num[0] << 8 ) & 0xFE00 );
				break;

			case ten:
				tempData[ Cursor ] = ( tempData[ Cursor ] & 0x1FF ) | ( ( Num[10] << 8 ) & 0xFE00 );
				break;

			default:
				break;
		}
	}
	else
	{
		switch( ( temp >> 8 ) & 0xFE )
		{
			case zero:
				tempData[ Cursor ] = ( tempData[ Cursor ] & 0x1FF ) | ( ( Num[1] << 8 ) & 0xFE00 );
				break;

			case one:
				tempData[ Cursor ] = ( tempData[ Cursor ] & 0x1FF ) | ( ( Num[0] << 8 ) & 0xFE00 );
				break;
		}
	}
	
	DataIn[2] = tempData[ 0 ];
	DataIn[3] = tempData[ 1 ];
	DataIn[4] = tempData[ 2 ];
	
}

extern int keyNum;
float calTemp =0.0;
int calSampleNum = 0;
int iii = 0;
float valueStore[100];


int  ChangeDisplayFlag = 0;
int diandu_disp = 0;
char strBuf[20];
void Display_Process(void)
{
	U16 LedValue[3];
	U8 diandutemp = 0;
	int timeTemp;
	U16 LedTemp[8];
	int datatemp;
	float temp;
	float valuetemp = 0.0;
	static int  valuetempNum = 0;
	static float caltemptemp = 0;
	static float caltemptemp2 = 0;
	int alength;
	static float caltest1 = 0;
	static float caltest2 = 0;
	static float caltest3 = 0;
	static float caltest  = 0;
	static int aa = 0;
	static float max= 0;
	static float min = 20000;
	int ii;
	int yxj;
	char solid;
	int j;
	
	  static int x = 0;
	  static int xx2 = 0;
			    static int x2 = 0;
			    static float y = 0;
			    static float xy = 0;
			    static float b = 0;
			    
	char *str=&strBuf[0]   ; 
	
		    
	int d_distemp = 0;
	
	
	/****************************设定系统参数时的显示*******************/
	if( Func_Select  == System )

⌨️ 快捷键说明

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