本文共 802 字,大约阅读时间需要 2 分钟。
【资源下载】下载地址如下1419:
#include <reg51.h> #include "lcd1602.h" #include "beep.h"#define uchar unsigned char #define uint unsigned int #define out P1sbit start=P3^3;sbit oe=P3^1;sbit eoc=P3^2;sbit clock=P3^0;bit flag=0;/*--------------------------------------------------------------------------*//*功能描述:通过读取ADC0809电压值 *//*输入参数:无 *//*输出参数:电压值(V*100) *//*--------------------------------------------------------------------------*/unsigned char Read_ADC0809(void){ unsigned char temp; start=0; start=1; start=0; //启动转换 while(1){clock=!clock;if(eoc==1)break;}//等待转换结束 //clock=!clock; oe=1; //允许输出 temp = out; //暂存转换结果 oe=0; //关闭输出 return temp;}
转载地址:http://pkiwz.baihongyu.com/