#include #include \"lcd.h\" #include #define uint unsigned int #define uchar unsigned char uchar lcd[]=\"0123456789\"; sbit rd=P3^6; //IO口定义 sbit wr=P3^5; sbit cs=P3^7; read_adc0804()//控制并读取adc0804转换好的数据 { uchar a; //cs=1; wr=1; cs=0; wr=0; _nop_(); wr=1; P1=0xff; //rd=1; 写入控制命令,启动转换 读取已转换好的数据 rd=0; _nop_(); a=P1; rd=1; cs=1; return a; } void main() { uchar a,A1,A2,A3; lcd_init(); while(1) { a=read_adc0804(); A1=a/100; //分出百,十,和个位 A2=a%100/10; A3=a%10; lcd_busy(); lcd_xy(3,0); lcd_write_dat(lcd[A1]); lcd_busy(); lcd_xy(4,0); lcd_write_dat(lcd[A2]); lcd_busy(); lcd_xy(5,0); lcd_write_dat(lcd[A3]); } } 因篇幅问题不能全部显示,请点此查看更多更全内容