2019-07-18 11:04发布
a410670107 发表于 2016-5-30 19:46 把adc的数据线和地址线接入单片机的IO就可以了 注意一下时钟和基准电压。看看数据手册吧
a410670107 发表于 2016-5-30 21:26 start需要程序的配合嘛。数据传输开始的标志
最多设置5个标签!
可是光照度传感器没有给adc传输信号,
还有START的高低电平怎么实现?
传感器你不是都接到adc的IN0了吗
这个程序应该怎么写?
#include <reg51.h>
#define uchar unsigned char
#define uint unsigned int
sbit OUT=P2^0;
sbit START=P2^5;
sbit EOC=P2^6;
sbit OE=P2^7;
sbit shuchu=P2^0;
unsigned int aa=0;
void delayms(uint ms)
{
uchar i;
while(ms--)
{
for(i=0;i<144;i++);
}
}
void main()
{
uint a;
START=0;
OE=1;
START=1;
START=0;
while(!EOC)
OE=1;
a=P1;
if(a<128)
shuchu=0;
else
shuchu=1;
delayms(1000);
}
对吗?
一周热门 更多>