完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
#include "ADC.h"//adc模块程序 #include #include ***it ADC_start= P2^3; ***it ADC_oe= P2^2; ***it ADC_eoc =P3^6; sfr ADDR = 0xA0; //P2 = 0xA0;P2.0接A,P2.1接B,C接地 sfr ADC_data =0x90; //P1 读数据 uchar ADC_flag=0; //用来启动clock uchar ADC(uchar port) { uchar back=0; if(port<3) { ADDR=(ADDR&0xFC)|port; ADC_start=0; ADC_oe=0; delay(30); ADC_start=1; delay(30); ADC_start=0; ADC_flag=1; while(ADC_eoc==0); ADC_oe=1; back=ADC_data; ADC_flag=0; ADC_oe=0; } return(back); } #include #include #include "time0.h" #include "ADC.h" #include "LCD.h" #include "math.h" //#include "LCD1602.h" //#include "DS1302.h" #define uint unsigned int #define uchar unsigned char uchar show_count[6]; //char by[]={"askgj"}; void main() { uchar IN0,IN1,IN2; delay(100); initial_time0(); lcd_init(); EA=1; ET0=1; TR0=1; while(1) { IN0=ADC(0); IN1=ADC(1); IN2=ADC(2); show_count[0]=48;//万位 show_count[1]=48;//千位 show_count[2]=IN0/100+48;//百位 show_count[3]=(IN0%100)/10+48;//十位 show_count[4]=(IN0%10)+48;//个位 show_count[6]=' |