TA的每日心情 | 难过 2024-8-22 11:08 |
---|
签到天数: 1 天 [LV.1]初来乍到
注册会员
- 积分
- 114
|
楼主 |
发表于 2024-1-1 18:44:55
|
显示全部楼层
//ADC获取batt电压并显示
void handel_adc(bit flag)
{
u16 adc_val;
u16 u16_volt;
float volt ;
Get_Adc(15); //获取ADC
adc_val= ADC_RES<<8|ADC_RESL ; //高低字节合并
LCD_ShowChar(100+24,0,"0123456789ABCDEF"[ADC_RESL&0x0f],RED,BLACK,16,0,0);
LCD_ShowChar(100+16,0,"0123456789ABCDEF"[ADC_RESL>>4],RED,BLACK,16,0,0);
LCD_ShowChar(100+8,0,"0123456789ABCDEF"[ADC_RES&0x0f],RED,BLACK,16,0,0);
LCD_ShowChar(100,0,"0123456789ABCDEF"[ADC_RES>>4],RED,BLACK,16,0,0);
Get_Adc(14); //获取ADC
adc_val= ADC_RES<<8|ADC_RESL ; //高低字节合并
LCD_ShowChar(100+24,1,"0123456789ABCDEF"[ADC_RESL&0x0f],RED,BLACK,16,0,0);
LCD_ShowChar(100+16,1,"0123456789ABCDEF"[ADC_RESL>>4],RED,BLACK,16,0,0);
LCD_ShowChar(100+8,1,"0123456789ABCDEF"[ADC_RES&0x0f],RED,BLACK,16,0,0);
LCD_ShowChar(100,1,"0123456789ABCDEF"[ADC_RES>>4],RED,BLACK,16,0,0);
}
以上运行后发现两处显示是一样的值,都 是016c
|
|