新闻中心

EEPW首页 > 嵌入式系统 > 设计应用 > ADC0809模数转换测试程序

ADC0809模数转换测试程序

作者: 时间:2016-11-13 来源:网络 收藏
采用ADC0809采集电桥上热敏电阻的电压,根据电压变化来驱动LED

#include
#define uint unsigned int
sbit a=P1^0;
sbit st=P1^1;
sbit en=P1^2;

本文引用地址:https://www.eepw.com.cn/article/201611/316310.htm

void delay(uint z)//延时
{
uint x,y;
for(x=110;x>0;x--)
for(y=z;y>0;y--);
}
void start()//启动AD转换
{
st=0;
delay(10);
st=1;
delay(10);
st=0;
delay(10);
}
void init()//选择输入模拟通道
{
a=0;
}


void main()
{
init();
while(1)
{
start();
en=0;
delay(10);
en=1;
P2=P0;//将数字量输入到LED
delay(10);

}
}



评论


技术专区

关闭