微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > PIC16F917 电压表

PIC16F917 电压表

时间:11-18 来源:互联网 点击:

LCD_CE=1 ;// 关闭LCD
}

////////////主程序/////////////////////////
void main (void)
{

Init();//初始化程序
LCD_clear(); //LCD清屏
delayms(1000);
LCD_write_english_string(0,0," AD Test " );
LCD_write_english_string(0,1,"AD4 Vref=3.3V" );

ADCON0=ADCON0|0B00000010;//开始AD转换
LCD_set_XY(0,3);
LCD_write_char(D);
LCD_write_char(x);
LCD_write_char( );
LCD_write_char(=);

LCD_set_XY(0,5);
LCD_write_char(V);
LCD_write_char(i);
LCD_write_char(n);
LCD_write_char(=);
LCD_set_XY(72,5);
LCD_write_char(V);
while(1)
{
LCD_set_XY(30,3);
LCD_write_char((temp3/1000)+16+32);
LCD_write_char( (temp3%1000)/100+16+32);
LCD_write_char( ((temp3%1000)%100)/10+16+32);
LCD_write_char( ((temp3%1000)%100)%10+16+32);

//ad_data=ad_data*10000;
temp3=(uint)ad_data;
LCD_set_XY(30,5);
LCD_write_char((temp3/10000)+16+32);
LCD_write_char(.);
LCD_write_char( (temp3%10000)/1000+16+32);
LCD_write_char( ((temp3%10000)%1000)/100+16+32);
LCD_write_char( (((temp3%10000)%1000)%100)/10+16+32);
LCD_write_char( (((temp3%10000)%1000)%100)%10+16+32);

delayms(100);
ADCON0=ADCON0|0B00000010;//开始AD转换

}

}

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top