读取ADC数值后显示在LCD1602.
51单片机 ADC0832 ADC 仿真 proteus LCD1602 显示 研究生
联系QQ 137712826
/*****************************************/
/**********主程序*************************/
void main()
{
char adc1,adc2,adc3,adc4,adc5,adc6,adc7;
unsigned long adcdata=0;
LCD1602_init();
while(1)
{
/////////////获取 adc
adcdata=(unsigned long)Get_AD_Result(0);
/////////////转换数据
adc1=adcdata/1000000 ;
adc2=adcdata00000/100000 ;
adc3=adcdata0000/10000 ;
adc4=adcdata000/1000 ;
adc5=adcdata00/100;
adc6=adcdata0/10 ;
adc7=adcdata/1;
/////////////显示数据
GotoXY(4,1);
LCD1602_Write(1,adc1+0x30);
LCD1602_Write(1,adc2+0x30);
LCD1602_Write(1,adc3+0x30);
LCD1602_Write(1,adc4+0x30);
LCD1602_Write(1,adc5+0x30);
LCD1602_Write(1,adc6+0x30);
LCD1602_Write(1,adc7+0x30);
delay(100);
}
}
1