各位大佬好,问个问题,我做的adc实验,在根据原子的lcd实验的基础上进行改进,比如图片上的那样我想显示19.32,我结果就是1932,我想显示的是小数点前面两位和小数点后面两位,就是小数点显示不出来找不出问题出在了哪里,能请教下大佬哪里出问题了吗?谢谢!

int main(void)
{
u16 adcx;
float temp;
delay_init(); //
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//
uart_init(115200); //′
LED_Init(); //LEd
LCD_Init();
Adc_Init(); //ADC
POINT_COLOR=RED;//
LCD_ShowString(60,50,200,16,16," STM32");
LCD_ShowString(60,70,200,16,16,"ADC TEST");
LCD_ShowString (60,90,200,16,16,"sjx");
LCD_ShowString(60,110,200,16,16,"2020/6/30");
//
POINT_COLOR=BLUE;//
LCD_ShowString(60,130,200,16,16,"ADC_CH0_VAL:");
LCD_ShowString(60,150,200,16,16,"ADC_CH0_VOL:0.00mm");
while(1)
{
adcx=Get_Adc_Average(ADC_Channel_1,10);
LCD_ShowxNum(156,130,adcx,4,16,0);//
temp=(float)(52.05-15*adcx*(3.3/4096));
adcx=temp;
LCD_ShowxNum(156,150,adcx,2,16,0);//
temp-=adcx;
temp*=100;
LCD_ShowxNum(172,150,temp,2,16,0X80);
LED0=!LED0;
delay_ms(250);
}
}
|