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

📄 aaa.c

📁 基于c的电动机保护程序
💻 C
字号:
#include "UItype.h"
#include "led.h"
#include "Keyboard_drv.h"

void  Float2Led1(float value,U16 Float2LedValue[3])
{
    float temp = value ;
    float temp_point = 0;
    int temp_pointToInt = 0;
    int p = 0;
    int temp_int = 0 ;
    int temp_left = 0 ;
    
    U16 i[3];
    int j;
	
	
	Float2LedValue[0] = 0;
	Float2LedValue[1] = 0 ;
	Float2LedValue[2] = 0;
    temp_int = temp ;
    temp_point = temp - temp_int ;


    if( temp_int > 999 )
    {
        Float2LedValue[0] =  9;
        Float2LedValue[1] =  9;
        Float2LedValue[2] =  9;

    }


    temp_left = temp_int;


    if( (temp_int > 99) && (temp_int <= 999) )
    {
        p = temp_int / 100;
        Float2LedValue[0] = LedNum[ p ] ;
        temp_left -= p*100;


        if( (temp_left > 9) && (temp_left <=99) )
        {
            p = temp_left / 10 ;
            Float2LedValue[1] = LedNum[ p ] ;
            
            temp_left -= p*10;
        }

        if( (temp_left >= 0) && (temp_left <10) )
        {
            Float2LedValue[2] = LedNum[ temp_left ] ;
        }
    }





    if( (temp_int > 9) && (temp_int <= 99) )
    {


            temp_pointToInt = temp_point * 100 ;
            temp_pointToInt %= 10 ;



            if( temp_pointToInt >= 5 )
            {
                p = temp_int / 10;
                Float2LedValue[0] = LedNum[p] ;
                temp_left -= p * 10 ;
                Float2LedValue[1] = Numdot[temp_left];
                temp_pointToInt = temp_point * 10;
/***************************小数部分*********************************/
                Float2LedValue[2] = LedNum[ temp_pointToInt  ];
                j++;

            }
            else
            {
                  temp_pointToInt = temp_point * 10 ;
                  temp_pointToInt %= 10 ;


                  if( temp_pointToInt == 0 )
                     {
                            p= temp_int / 10;
                         Float2LedValue[0] = LedNum[ 10 ];
                         Float2LedValue[1] = LedNum[ p ] ;
                         temp_left -= p * 10 ;
                Float2LedValue[2] = LedNum[ temp_left ];
             }
        }

    }

/************************************************************/

    if( (temp_int >= 0 ) && (temp_int <= 9) )
    {
        temp_pointToInt = temp_point * 1000 ;
        temp_pointToInt %= 100 ;


        if( temp_pointToInt >= 5 )
       
            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 ];
          

       }
/************************************************************/
        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 ];
         }
  /************************************************************/

}

  

⌨️ 快捷键说明

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