ADC0809模数转换测试程序
#include
#define uint unsigned int
sbit a=P1^0;
sbit st=P1^1;
sbit en=P1^2;
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);
}
}
评论