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

📄 format.c

📁 在8052下实现电平电压测试功能,自己开发的单片系统
💻 C
字号:
/*
----------------------------------------------------------
;		(c) Copyright xami All Rights Reserved              
----------------------------------------------------------
;	SOURCE_FILE:    FORMAT.H
;	APPLICATION:	80c51\80c52
;	DESCRIPTION:    格式化取得的频率值,送显存
;	AUTHOR:         xami
;	DATE:           28 Apr. 2007
----------------------------------------------------------
*/
void panduan(void)
{
		if(temp_f>= 10000000){
			digit_temp[0]= digit[0][temp_f/10000000];
			digit_temp[1]= digit[0][(temp_f/1000000)%10];
			digit_temp[2]= digit[0][(temp_f/100000)%10];			
			digit_temp[3]= digit[0][(temp_f/10000)%10];			
			digit_temp[4]= digit[1][(temp_f/1000)%10];			
			digit_temp[5]= digit[0][(temp_f/100)%10];				//最后舍去两位
		}else if(temp_f>= 1000000){
			digit_temp[0]= digit[0][temp_f/1000000];
			digit_temp[1]= digit[0][(temp_f/100000)%10];
			digit_temp[2]= digit[0][(temp_f/10000)%10];			
			digit_temp[3]= digit[1][(temp_f/1000)%10];			
			digit_temp[4]= digit[0][(temp_f/100)%10];			
			digit_temp[5]= digit[0][(temp_f/10)%10];				//最后舍去一位				
		}else if(temp_f>= 100000){
			digit_temp[0]= digit[0][temp_f/100000];
			digit_temp[1]= digit[0][(temp_f/10000)%10];
			digit_temp[2]= digit[1][(temp_f/1000)%10];			
			digit_temp[3]= digit[0][(temp_f/100)%10];			
			digit_temp[4]= digit[0][(temp_f/10)%10];			
			digit_temp[5]= digit[0][(temp_f)%10];					//无舍去				
		}else if(temp_f>= 10000){
			digit_temp[0]= 0x00;									//第一位"null"
			digit_temp[1]= digit[0][temp_f/10000];
			digit_temp[2]= digit[1][(temp_f/1000)%10];			
			digit_temp[3]= digit[0][(temp_f/100)%10];			
			digit_temp[4]= digit[0][(temp_f/10)%10];			
			digit_temp[5]= digit[0][(temp_f)%10];									
		}else if(temp_f>= 1000){
			digit_temp[0]= 0x00;									//第一位"null"
			digit_temp[1]= 0x00;									//第二位"null"
			digit_temp[2]= digit[1][temp_f/1000];			
			digit_temp[3]= digit[0][(temp_f/100)%10];			
			digit_temp[4]= digit[0][(temp_f/10)%10];			
			digit_temp[5]= digit[0][(temp_f)%10];									
		}else if(temp_f>= 100){
			digit_temp[0]= 0x00;									//第一位"null"
			digit_temp[1]= 0x00;									//第二位"null"
			digit_temp[2]= digit[1][0];								//第三位"0."
			digit_temp[3]= digit[0][temp_f/100];			
			digit_temp[4]= digit[0][(temp_f/10)%10];			
			digit_temp[5]= digit[0][(temp_f)%10];									
		}else if(temp_f>= 10){
			digit_temp[0]= 0x00;									//第一位"null"
			digit_temp[1]= 0x00;									//第二位"null"
			digit_temp[2]= digit[1][0];								//第三位"0."
			digit_temp[3]= digit[0][0];								//第四位"0"
			digit_temp[4]= digit[0][temp_f/10];			
			digit_temp[5]= digit[0][(temp_f)%10];									
		}else{
			digit_temp[0]= 0x00;									//第一位"null"
			digit_temp[1]= 0x00;									//第二位"null"
			digit_temp[2]= digit[1][0];								//第三位"0."
			digit_temp[3]= digit[0][0];								//第四位"0"
			digit_temp[4]= digit[0][0];								//第五位"0"
			digit_temp[5]= digit[0][temp_f];									
		}	
}

⌨️ 快捷键说明

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