最新回复
//10进制显示 有符号浮点数数值 (32位数据)(mask小数位数)
extern void LCD_Display_DEC_float(uint8 address,float dat,int8 mask1,int8 mask2)
{
uint32 xx;
uint32 div=1000000000;
uint8 tmp;
LCD_Write_Command(0x80+address);
#ifdef LCD_DISPLAY_FLOAT_SIGN
if (dat>=0)
LCD_Write_Data('+');
else
{
LCD_Write_Data('-');
dat=-dat;
}
#else
if (dat=div) {
xx-=div;
tmp++;
}
if (mask1=10);
LCD_Write_Data((uint8)xx+'0');
LCD_Write_Data('.');
while (mask2>0)
{
mask2--;
dat*=10;
tmp=(int32)dat; //取小数部分
LCD_Write_Data(tmp+'0');
dat-=tmp;
}
DISPLAYEND;
}
详情
回复
发表于 2014-7-30 10:56
| |
|
|
此帖出自单片机论坛
| ||
|
||
EEWorld Datasheet 技术支持